Fix jumping progress bar. (#11439)
- 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`
This commit is contained in:
parent
aae02827c0
commit
f2224755ad
|
@ -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) {
|
void ST7920_Lite_Status_Screen::update_progress(const bool forceUpdate) {
|
||||||
#if DISABLED(LCD_SET_PROGRESS_MANUALLY)
|
#if DISABLED(LCD_SET_PROGRESS_MANUALLY)
|
||||||
uint8_t progress_bar_percent;
|
uint8_t progress_bar_percent = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Set current percentage from SD when actively printing
|
#if ENABLED(LCD_SET_PROGRESS_MANUALLY) && ENABLED(SDSUPPORT) && (ENABLED(LCD_PROGRESS_BAR) || ENABLED(DOGLCD))
|
||||||
#if ENABLED(SDSUPPORT)
|
// Progress bar % comes from SD when actively printing
|
||||||
if (IS_SD_PRINTING) progress_bar_percent = card.percentDone();
|
if (IS_SD_PRINTING) progress_bar_percent = card.percentDone();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue