From fae96a6a13c669681e233a7a0c2e1ca7e02498bb Mon Sep 17 00:00:00 2001 From: Marcio Teixeira Date: Fri, 3 Aug 2018 16:16:14 -0600 Subject: [PATCH] Fix jumping progress bar. (#11438) - When `LCD_SET_PROGRESS_MANUALLY` was disabled and an SD print was not active (i.e. the printer was idle), progress_bar_percent would read uninitialized memory from stack and cause progress bar to jump wildly. - Also updated conditions in `#ifdef` to match `ultralcd.cpp` --- Marlin/status_screen_lite_ST7920.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/status_screen_lite_ST7920.h b/Marlin/status_screen_lite_ST7920.h index 17cb44a66..e3a9822f2 100644 --- a/Marlin/status_screen_lite_ST7920.h +++ b/Marlin/status_screen_lite_ST7920.h @@ -877,11 +877,11 @@ void ST7920_Lite_Status_Screen::update_status_or_position(bool forceUpdate) { void ST7920_Lite_Status_Screen::update_progress(const bool forceUpdate) { #if DISABLED(LCD_SET_PROGRESS_MANUALLY) - uint8_t progress_bar_percent; + uint8_t progress_bar_percent = 0; #endif // Set current percentage from SD when actively printing - #if ENABLED(SDSUPPORT) + #if ENABLED(LCD_SET_PROGRESS_MANUALLY) && ENABLED(SDSUPPORT) && (ENABLED(LCD_PROGRESS_BAR) || ENABLED(DOGLCD)) if (IS_SD_PRINTING) progress_bar_percent = card.percentDone(); #endif