1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-27 22:08:02 +00:00

Prevent lcd_update stack overflow on SD Card change

This commit is contained in:
Scott Lahteine 2018-03-18 18:57:54 -05:00
parent c0d694d5d3
commit fbdc5ad962

View File

@ -5035,17 +5035,19 @@ void lcd_update() {
const bool sd_status = IS_SD_INSERTED;
if (sd_status != lcd_sd_status && lcd_detected()) {
bool old_sd_status = lcd_sd_status; // prevent re-entry to this block!
lcd_sd_status = sd_status;
if (sd_status) {
safe_delay(1000); // some boards need a delay or the LCD won't show the new status
card.initsd();
if (lcd_sd_status != 2) LCD_MESSAGEPGM(MSG_SD_INSERTED);
if (old_sd_status != 2) LCD_MESSAGEPGM(MSG_SD_INSERTED);
}
else {
card.release();
if (lcd_sd_status != 2) LCD_MESSAGEPGM(MSG_SD_REMOVED);
if (old_sd_status != 2) LCD_MESSAGEPGM(MSG_SD_REMOVED);
}
lcd_sd_status = sd_status;
lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
#if ENABLED(LCD_PROGRESS_BAR)