浏览代码

Give lcd_sd_status an UNKNOWN state (PR#180)

Scott Lahteine 9 年前
父节点
当前提交
5d65a36dee
共有 1 个文件被更改,包括 7 次插入6 次删除
  1. 7
    6
      Marlin/ultralcd.cpp

+ 7
- 6
Marlin/ultralcd.cpp 查看文件

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

正在加载...
取消
保存