Browse Source

Merge pull request #1967 from thinkyhead/g4_dwell_message

Use millis_t for progress_bar_ms and expire_status_ms
Scott Lahteine 9 years ago
parent
commit
a640cad139
2 changed files with 9 additions and 8 deletions
  1. 4
    4
      Marlin/ultralcd.cpp
  2. 5
    4
      Marlin/ultralcd_implementation_hitachi_HD44780.h

+ 4
- 4
Marlin/ultralcd.cpp View File

267
   #ifdef LCD_PROGRESS_BAR
267
   #ifdef LCD_PROGRESS_BAR
268
     millis_t ms = millis();
268
     millis_t ms = millis();
269
     #ifndef PROGRESS_MSG_ONCE
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
     #endif
273
     #endif
274
     #if PROGRESS_MSG_EXPIRE > 0
274
     #if PROGRESS_MSG_EXPIRE > 0
1392
 
1392
 
1393
 void lcd_finishstatus(bool persist=false) {
1393
 void lcd_finishstatus(bool persist=false) {
1394
   #ifdef LCD_PROGRESS_BAR
1394
   #ifdef LCD_PROGRESS_BAR
1395
-    progressBarTick = millis();
1395
+    progress_bar_ms = millis();
1396
     #if PROGRESS_MSG_EXPIRE > 0
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
     #endif
1398
     #endif
1399
   #endif
1399
   #endif
1400
   lcdDrawUpdate = 2;
1400
   lcdDrawUpdate = 2;

+ 5
- 4
Marlin/ultralcd_implementation_hitachi_HD44780.h View File

194
 #include "utf_mapper.h"
194
 #include "utf_mapper.h"
195
 
195
 
196
 #ifdef LCD_PROGRESS_BAR
196
 #ifdef LCD_PROGRESS_BAR
197
-  static uint16_t progressBarTick = 0;
197
+  static millis_t progress_bar_ms = 0;
198
   #if PROGRESS_MSG_EXPIRE > 0
198
   #if PROGRESS_MSG_EXPIRE > 0
199
-    static uint16_t expire_status_ms = 0;
199
+    static millis_t expire_status_ms = 0;
200
   #endif
200
   #endif
201
   #define LCD_STR_PROGRESS  "\x03\x04\x05"
201
   #define LCD_STR_PROGRESS  "\x03\x04\x05"
202
 #endif
202
 #endif
588
   #ifdef LCD_PROGRESS_BAR
588
   #ifdef LCD_PROGRESS_BAR
589
 
589
 
590
     if (card.isFileOpen()) {
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
         int tix = (int)(card.percentDone() * LCD_WIDTH * 3) / 100,
594
         int tix = (int)(card.percentDone() * LCD_WIDTH * 3) / 100,
594
           cel = tix / 3, rem = tix % 3, i = LCD_WIDTH;
595
           cel = tix / 3, rem = tix % 3, i = LCD_WIDTH;
595
         char msg[LCD_WIDTH+1], b = ' ';
596
         char msg[LCD_WIDTH+1], b = ' ';

Loading…
Cancel
Save