From c92b59952a9eb517d92df58f428df8dbb03a1f05 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 24 Apr 2015 22:16:09 -0700 Subject: [PATCH] Use millis_t for progress_bar_ms and expire_status_ms --- Marlin/ultralcd.cpp | 8 ++++---- Marlin/ultralcd_implementation_hitachi_HD44780.h | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index a310db6143..1d4e167287 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -267,8 +267,8 @@ static void lcd_status_screen() { #ifdef LCD_PROGRESS_BAR millis_t ms = millis(); #ifndef PROGRESS_MSG_ONCE - if (ms > progressBarTick + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME) { - progressBarTick = ms; + if (ms > progress_bar_ms + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME) { + progress_bar_ms = ms; } #endif #if PROGRESS_MSG_EXPIRE > 0 @@ -1392,9 +1392,9 @@ void lcd_ignore_click(bool b) { void lcd_finishstatus(bool persist=false) { #ifdef LCD_PROGRESS_BAR - progressBarTick = millis(); + progress_bar_ms = millis(); #if PROGRESS_MSG_EXPIRE > 0 - expire_status_ms = persist ? 0 : progressBarTick + PROGRESS_MSG_EXPIRE; + expire_status_ms = persist ? 0 : progress_bar_ms + PROGRESS_MSG_EXPIRE; #endif #endif lcdDrawUpdate = 2; diff --git a/Marlin/ultralcd_implementation_hitachi_HD44780.h b/Marlin/ultralcd_implementation_hitachi_HD44780.h index 50c6deb5e4..eb1f525cc2 100644 --- a/Marlin/ultralcd_implementation_hitachi_HD44780.h +++ b/Marlin/ultralcd_implementation_hitachi_HD44780.h @@ -194,9 +194,9 @@ #include "utf_mapper.h" #ifdef LCD_PROGRESS_BAR - static uint16_t progressBarTick = 0; + static millis_t progress_bar_ms = 0; #if PROGRESS_MSG_EXPIRE > 0 - static uint16_t expire_status_ms = 0; + static millis_t expire_status_ms = 0; #endif #define LCD_STR_PROGRESS "\x03\x04\x05" #endif @@ -588,8 +588,9 @@ static void lcd_implementation_status_screen() { #ifdef LCD_PROGRESS_BAR if (card.isFileOpen()) { - if (millis() >= progressBarTick + PROGRESS_BAR_MSG_TIME || !lcd_status_message[0]) { - // draw the progress bar + // Draw the progress bar if the message has shown long enough + // or if there is no message set. + if (millis() >= progress_bar_ms + PROGRESS_BAR_MSG_TIME || !lcd_status_message[0]) { int tix = (int)(card.percentDone() * LCD_WIDTH * 3) / 100, cel = tix / 3, rem = tix % 3, i = LCD_WIDTH; char msg[LCD_WIDTH+1], b = ' ';