Parcourir la source

Use millis_t for progress_bar_ms and expire_status_ms

Scott Lahteine il y a 9 ans
Parent
révision
c92b59952a
2 fichiers modifiés avec 9 ajouts et 8 suppressions
  1. 4
    4
      Marlin/ultralcd.cpp
  2. 5
    4
      Marlin/ultralcd_implementation_hitachi_HD44780.h

+ 4
- 4
Marlin/ultralcd.cpp Voir le fichier

@@ -267,8 +267,8 @@ static void lcd_status_screen() {
267 267
   #ifdef LCD_PROGRESS_BAR
268 268
     millis_t ms = millis();
269 269
     #ifndef PROGRESS_MSG_ONCE
270
-      if (ms > progressBarTick + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME) {
271
-        progressBarTick = ms;
270
+      if (ms > progress_bar_ms + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME) {
271
+        progress_bar_ms = ms;
272 272
       }
273 273
     #endif
274 274
     #if PROGRESS_MSG_EXPIRE > 0
@@ -1392,9 +1392,9 @@ void lcd_ignore_click(bool b) {
1392 1392
 
1393 1393
 void lcd_finishstatus(bool persist=false) {
1394 1394
   #ifdef LCD_PROGRESS_BAR
1395
-    progressBarTick = millis();
1395
+    progress_bar_ms = millis();
1396 1396
     #if PROGRESS_MSG_EXPIRE > 0
1397
-      expire_status_ms = persist ? 0 : progressBarTick + PROGRESS_MSG_EXPIRE;
1397
+      expire_status_ms = persist ? 0 : progress_bar_ms + PROGRESS_MSG_EXPIRE;
1398 1398
     #endif
1399 1399
   #endif
1400 1400
   lcdDrawUpdate = 2;

+ 5
- 4
Marlin/ultralcd_implementation_hitachi_HD44780.h Voir le fichier

@@ -194,9 +194,9 @@
194 194
 #include "utf_mapper.h"
195 195
 
196 196
 #ifdef LCD_PROGRESS_BAR
197
-  static uint16_t progressBarTick = 0;
197
+  static millis_t progress_bar_ms = 0;
198 198
   #if PROGRESS_MSG_EXPIRE > 0
199
-    static uint16_t expire_status_ms = 0;
199
+    static millis_t expire_status_ms = 0;
200 200
   #endif
201 201
   #define LCD_STR_PROGRESS  "\x03\x04\x05"
202 202
 #endif
@@ -588,8 +588,9 @@ static void lcd_implementation_status_screen() {
588 588
   #ifdef LCD_PROGRESS_BAR
589 589
 
590 590
     if (card.isFileOpen()) {
591
-      if (millis() >= progressBarTick + PROGRESS_BAR_MSG_TIME || !lcd_status_message[0]) {
592
-        // draw the progress bar
591
+      // Draw the progress bar if the message has shown long enough
592
+      // or if there is no message set.
593
+      if (millis() >= progress_bar_ms + PROGRESS_BAR_MSG_TIME || !lcd_status_message[0]) {
593 594
         int tix = (int)(card.percentDone() * LCD_WIDTH * 3) / 100,
594 595
           cel = tix / 3, rem = tix % 3, i = LCD_WIDTH;
595 596
         char msg[LCD_WIDTH+1], b = ' ';

Chargement…
Annuler
Enregistrer