Pārlūkot izejas kodu

Give lcd_sd_status an UNKNOWN state (PR#180)

Scott Lahteine 9 gadus atpakaļ
vecāks
revīzija
5d65a36dee
1 mainītis faili ar 7 papildinājumiem un 6 dzēšanām
  1. 7
    6
      Marlin/ultralcd.cpp

+ 7
- 6
Marlin/ultralcd.cpp Parādīt failu

@@ -227,7 +227,7 @@ static void lcd_status_screen();
227 227
   uint8_t lastEncoderBits;
228 228
   uint32_t encoderPosition;
229 229
   #if PIN_EXISTS(SD_DETECT)
230
-    bool lcd_sd_status;
230
+    uint8_t lcd_sd_status;
231 231
   #endif
232 232
 
233 233
 #endif // ULTIPANEL
@@ -1534,7 +1534,7 @@ void lcd_init() {
1534 1534
   #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
1535 1535
     pinMode(SD_DETECT_PIN, INPUT);
1536 1536
     WRITE(SD_DETECT_PIN, HIGH);
1537
-    lcd_sd_status = false;
1537
+    lcd_sd_status = 2; // UNKNOWN
1538 1538
   #endif
1539 1539
 
1540 1540
   #if ENABLED(LCD_HAS_SLOW_BUTTONS)
@@ -1595,21 +1595,22 @@ void lcd_update() {
1595 1595
     bool sd_status = IS_SD_INSERTED;
1596 1596
     if (sd_status != lcd_sd_status && lcd_detected()) {
1597 1597
       lcdDrawUpdate = 2;
1598
-      lcd_sd_status = sd_status;
1599 1598
       lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
1600 1599
         #if ENABLED(LCD_PROGRESS_BAR)
1601 1600
           currentMenu == lcd_status_screen
1602 1601
         #endif
1603 1602
       );
1604 1603
 
1605
-      if (lcd_sd_status) {
1604
+      if (sd_status) {
1606 1605
         card.initsd();
1607
-        LCD_MESSAGEPGM(MSG_SD_INSERTED);
1606
+        if (lcd_sd_status != 2) LCD_MESSAGEPGM(MSG_SD_INSERTED);
1608 1607
       }
1609 1608
       else {
1610 1609
         card.release();
1611
-        LCD_MESSAGEPGM(MSG_SD_REMOVED);
1610
+        if (lcd_sd_status != 2) LCD_MESSAGEPGM(MSG_SD_REMOVED);
1612 1611
       }
1612
+
1613
+      lcd_sd_status = sd_status;
1613 1614
     }
1614 1615
 
1615 1616
   #endif //SDSUPPORT && SD_DETECT_PIN

Notiek ielāde…
Atcelt
Saglabāt