Browse Source

SDCARDINSERTED is always defined, and thus we do not need the #ifdefs.

daid303 12 years ago
parent
commit
f4a89ec776
1 changed files with 28 additions and 45 deletions
  1. 28
    45
      Marlin/ultralcd.cpp

+ 28
- 45
Marlin/ultralcd.cpp View File

@@ -2295,11 +2295,7 @@ void MainMenu::showSD()
2295 2295
 //         if(force_lcd_update)
2296 2296
 //         {
2297 2297
 //           lcd.setCursor(0,line);
2298
-//            #ifdef CARDINSERTED
2299 2298
 //           if(CARDINSERTED)
2300
-//           #else
2301
-//           if(true)
2302
-//           #endif
2303 2299
 //           {
2304 2300
 //             LCD_PRINT_PGM(" \004Refresh");
2305 2301
 //           }
@@ -2455,11 +2451,7 @@ void MainMenu::showMainMenu()
2455 2451
         if(force_lcd_update) 
2456 2452
         {
2457 2453
           lcd.setCursor(0,line);
2458
-          #ifdef CARDINSERTED
2459
-            if(CARDINSERTED)
2460
-          #else
2461
-            if(true)
2462
-          #endif
2454
+          if(CARDINSERTED)
2463 2455
           {
2464 2456
             if(card.sdprinting)
2465 2457
               LCD_PRINT_PGM(MSG_STOP_PRINT);
@@ -2471,10 +2463,7 @@ void MainMenu::showMainMenu()
2471 2463
            LCD_PRINT_PGM(MSG_NO_CARD); 
2472 2464
           }
2473 2465
         }
2474
-        #ifdef CARDINSERTED
2475
-          if(CARDINSERTED)
2476
-        #endif
2477
-        if((activeline==line)&&CLICKED)
2466
+        if(CARDINSERTED&&(activeline==line)&&CLICKED)
2478 2467
         {
2479 2468
           card.printingHasFinished();
2480 2469
           BLOCK;
@@ -2487,41 +2476,34 @@ void MainMenu::showMainMenu()
2487 2476
             if(force_lcd_update)
2488 2477
             {
2489 2478
                 lcd.setCursor(0,line);
2490
-#ifdef CARDINSERTED
2491 2479
                 if(CARDINSERTED)
2492
-#else
2493
-                    if(true)
2494
-#endif
2495
-                    {
2496
-                        if(card.sdprinting)
2497
-                            LCD_PRINT_PGM(MSG_PAUSE_PRINT);
2498
-                        else
2499
-                            LCD_PRINT_PGM(MSG_RESUME_PRINT);
2500
-                    }
2501
-                    else
2502
-                    {
2503
-                        //LCD_PRINT_PGM(MSG_NO_CARD);
2504
-                    }
2505
-            }
2506
-#ifdef CARDINSERTED
2507
-            if(CARDINSERTED)
2508
-#endif
2509
-                if((activeline==line) && CLICKED)
2510 2480
                 {
2511 2481
                     if(card.sdprinting)
2512
-                    {
2513
-                        card.pauseSDPrint();
2514
-                        beepshort();
2515
-                        status = Main_Status;
2516
-                    }
2482
+                        LCD_PRINT_PGM(MSG_PAUSE_PRINT);
2517 2483
                     else
2518
-                    {
2519
-                        card.startFileprint();
2520
-                        starttime=millis();
2521
-                        beepshort();
2522
-                        status = Main_Status;
2523
-                    }
2484
+                        LCD_PRINT_PGM(MSG_RESUME_PRINT);
2485
+                }
2486
+                else
2487
+                {
2488
+                    //LCD_PRINT_PGM(MSG_NO_CARD);
2489
+                }
2490
+            }
2491
+            if(CARDINSERTED && (activeline==line) && CLICKED)
2492
+            {
2493
+                if(card.sdprinting)
2494
+                {
2495
+                    card.pauseSDPrint();
2496
+                    beepshort();
2497
+                    status = Main_Status;
2524 2498
                 }
2499
+                else
2500
+                {
2501
+                    card.startFileprint();
2502
+                    starttime=millis();
2503
+                    beepshort();
2504
+                    status = Main_Status;
2505
+                }
2506
+            }
2525 2507
         }break;
2526 2508
       #else
2527 2509
       case ItemM_file:
@@ -2550,8 +2532,9 @@ void MainMenu::update()
2550 2532
 {
2551 2533
   static MainStatus oldstatus=Main_Menu;  //init automatically causes foce_lcd_update=true
2552 2534
   static unsigned long timeoutToStatus=0;
2553
-  static bool oldcardstatus=false;
2554
-  #ifdef CARDINSERTED
2535
+  #if (SDCARDDETECT > -1)
2536
+    //This code is only relivant if you have an SDcard detect pin.
2537
+    static bool oldcardstatus=false;
2555 2538
     if((CARDINSERTED != oldcardstatus))
2556 2539
     {
2557 2540
       force_lcd_update=true;

Loading…
Cancel
Save