From fc882c34a343908678acfbf4b3ddb29f3d472fe6 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 11 Sep 2015 21:53:07 -0700 Subject: [PATCH] Init lcd_sd_status as false to force lcd_update test Replaces #145 which is way out of date --- Marlin/ultralcd.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 0795fc623a..1af2072f37 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -227,7 +227,7 @@ static void lcd_status_screen(); uint8_t lastEncoderBits; uint32_t encoderPosition; #if PIN_EXISTS(SD_DETECT) - bool lcd_oldcardstatus; + bool lcd_sd_status; #endif #endif // ULTIPANEL @@ -1516,7 +1516,7 @@ void lcd_init() { #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT) pinMode(SD_DETECT_PIN, INPUT); WRITE(SD_DETECT_PIN, HIGH); - lcd_oldcardstatus = IS_SD_INSERTED; + lcd_sd_status = false; #endif #if ENABLED(LCD_HAS_SLOW_BUTTONS) @@ -1574,16 +1574,17 @@ void lcd_update() { #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT) - if (IS_SD_INSERTED != lcd_oldcardstatus && lcd_detected()) { + bool sd_status = IS_SD_INSERTED; + if (sd_status != lcd_sd_status && lcd_detected()) { lcdDrawUpdate = 2; - lcd_oldcardstatus = IS_SD_INSERTED; + lcd_sd_status = sd_status; lcd_implementation_init( // to maybe revive the LCD if static electricity killed it. #if ENABLED(LCD_PROGRESS_BAR) currentMenu == lcd_status_screen #endif ); - if (lcd_oldcardstatus) { + if (lcd_sd_status) { card.initsd(); LCD_MESSAGEPGM(MSG_SD_INSERTED); }