Bläddra i källkod

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

daid303 12 år sedan
förälder
incheckning
f4a89ec776
1 ändrade filer med 28 tillägg och 45 borttagningar
  1. 28
    45
      Marlin/ultralcd.cpp

+ 28
- 45
Marlin/ultralcd.cpp Visa fil

2295
 //         if(force_lcd_update)
2295
 //         if(force_lcd_update)
2296
 //         {
2296
 //         {
2297
 //           lcd.setCursor(0,line);
2297
 //           lcd.setCursor(0,line);
2298
-//            #ifdef CARDINSERTED
2299
 //           if(CARDINSERTED)
2298
 //           if(CARDINSERTED)
2300
-//           #else
2301
-//           if(true)
2302
-//           #endif
2303
 //           {
2299
 //           {
2304
 //             LCD_PRINT_PGM(" \004Refresh");
2300
 //             LCD_PRINT_PGM(" \004Refresh");
2305
 //           }
2301
 //           }
2455
         if(force_lcd_update) 
2451
         if(force_lcd_update) 
2456
         {
2452
         {
2457
           lcd.setCursor(0,line);
2453
           lcd.setCursor(0,line);
2458
-          #ifdef CARDINSERTED
2459
-            if(CARDINSERTED)
2460
-          #else
2461
-            if(true)
2462
-          #endif
2454
+          if(CARDINSERTED)
2463
           {
2455
           {
2464
             if(card.sdprinting)
2456
             if(card.sdprinting)
2465
               LCD_PRINT_PGM(MSG_STOP_PRINT);
2457
               LCD_PRINT_PGM(MSG_STOP_PRINT);
2471
            LCD_PRINT_PGM(MSG_NO_CARD); 
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
           card.printingHasFinished();
2468
           card.printingHasFinished();
2480
           BLOCK;
2469
           BLOCK;
2487
             if(force_lcd_update)
2476
             if(force_lcd_update)
2488
             {
2477
             {
2489
                 lcd.setCursor(0,line);
2478
                 lcd.setCursor(0,line);
2490
-#ifdef CARDINSERTED
2491
                 if(CARDINSERTED)
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
                     if(card.sdprinting)
2481
                     if(card.sdprinting)
2512
-                    {
2513
-                        card.pauseSDPrint();
2514
-                        beepshort();
2515
-                        status = Main_Status;
2516
-                    }
2482
+                        LCD_PRINT_PGM(MSG_PAUSE_PRINT);
2517
                     else
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
         }break;
2507
         }break;
2526
       #else
2508
       #else
2527
       case ItemM_file:
2509
       case ItemM_file:
2550
 {
2532
 {
2551
   static MainStatus oldstatus=Main_Menu;  //init automatically causes foce_lcd_update=true
2533
   static MainStatus oldstatus=Main_Menu;  //init automatically causes foce_lcd_update=true
2552
   static unsigned long timeoutToStatus=0;
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
     if((CARDINSERTED != oldcardstatus))
2538
     if((CARDINSERTED != oldcardstatus))
2556
     {
2539
     {
2557
       force_lcd_update=true;
2540
       force_lcd_update=true;

Laddar…
Avbryt
Spara