Fix SD percent for Lite Status Screen
Co-Authored-By: Lê Hoàng <icy.lord.love.angel@gmail.com>
This commit is contained in:
parent
cf1b2af71a
commit
4f0737cd2c
@ -876,24 +876,32 @@ 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 ENABLED(LCD_SET_PROGRESS_MANUALLY) || ENABLED(SDSUPPORT)
|
||||||
uint8_t progress_bar_percent = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Set current percentage from SD when actively printing
|
#if DISABLED(LCD_SET_PROGRESS_MANUALLY)
|
||||||
#if ENABLED(LCD_SET_PROGRESS_MANUALLY) && ENABLED(SDSUPPORT) && (ENABLED(LCD_PROGRESS_BAR) || ENABLED(DOGLCD))
|
uint8_t progress_bar_percent; //=0
|
||||||
if (IS_SD_PRINTING) progress_bar_percent = card.percentDone();
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
// Since the progress bar involves writing
|
#if ENABLED(SDSUPPORT)
|
||||||
// quite a few bytes to GDRAM, only do this
|
// Progress bar % comes from SD when actively printing
|
||||||
// when an update is actually necessary.
|
if (IS_SD_PRINTING) progress_bar_percent = card.percentDone();
|
||||||
|
#endif
|
||||||
|
|
||||||
static uint8_t last_progress = 0;
|
// Since the progress bar involves writing
|
||||||
if (!forceUpdate && last_progress == progress_bar_percent) return;
|
// quite a few bytes to GDRAM, only do this
|
||||||
last_progress = progress_bar_percent;
|
// when an update is actually necessary.
|
||||||
|
|
||||||
draw_progress_bar(progress_bar_percent);
|
static uint8_t last_progress = 0;
|
||||||
|
if (!forceUpdate && last_progress == progress_bar_percent) return;
|
||||||
|
last_progress = progress_bar_percent;
|
||||||
|
|
||||||
|
draw_progress_bar(progress_bar_percent);
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
UNUSED(forceUpdate);
|
||||||
|
|
||||||
|
#endif // LCD_SET_PROGRESS_MANUALLY || SDSUPPORT
|
||||||
}
|
}
|
||||||
|
|
||||||
void ST7920_Lite_Status_Screen::update(const bool forceUpdate) {
|
void ST7920_Lite_Status_Screen::update(const bool forceUpdate) {
|
||||||
|
Loading…
Reference in New Issue
Block a user