Browse Source

Fix Progress at the end of print.

Robby Candra 5 years ago
parent
commit
6241bcf0c8
1 changed files with 20 additions and 13 deletions
  1. 20
    13
      Marlin/src/lcd/dogm/status_screen_DOGM.cpp

+ 20
- 13
Marlin/src/lcd/dogm/status_screen_DOGM.cpp View File

340
       #define _SD_DURATION_X(len) (LCD_PIXEL_WIDTH - (len) * (MENU_FONT_WIDTH))
340
       #define _SD_DURATION_X(len) (LCD_PIXEL_WIDTH - (len) * (MENU_FONT_WIDTH))
341
     #endif
341
     #endif
342
 
342
 
343
-    static uint8_t progress_bar_solid_width = 0, lastProgress = 0;
344
     #if ENABLED(DOGM_SD_PERCENT)
343
     #if ENABLED(DOGM_SD_PERCENT)
345
       static char progress_string[5];
344
       static char progress_string[5];
346
     #endif
345
     #endif
347
-    static uint8_t lastElapsed = 0, elapsed_x_pos = 0;
346
+    static uint8_t lastElapsed = 0, lastProgress = 0;
347
+    static u8g_uint_t elapsed_x_pos = 0, progress_bar_solid_width = 0;
348
     static char elapsed_string[16];
348
     static char elapsed_string[16];
349
     #if ENABLED(SHOW_REMAINING_TIME)
349
     #if ENABLED(SHOW_REMAINING_TIME)
350
-      static uint8_t estimation_x_pos = 0;
350
+      static u8g_uint_t estimation_x_pos = 0;
351
       static char estimation_string[10];
351
       static char estimation_string[10];
352
       #if ENABLED(DOGM_SD_PERCENT) && ENABLED(ROTATE_PROGRESS_DISPLAY)
352
       #if ENABLED(DOGM_SD_PERCENT) && ENABLED(ROTATE_PROGRESS_DISPLAY)
353
         #define PROGRESS_TIME_PREFIX "PROG"
353
         #define PROGRESS_TIME_PREFIX "PROG"
354
         #define ELAPSED_TIME_PREFIX "ELAP"
354
         #define ELAPSED_TIME_PREFIX "ELAP"
355
         #define SHOW_REMAINING_TIME_PREFIX "REM"
355
         #define SHOW_REMAINING_TIME_PREFIX "REM"
356
-        static uint8_t progress_x_pos = 0;
356
+        static u8g_uint_t progress_x_pos = 0;
357
         static uint8_t progress_state = 0;
357
         static uint8_t progress_state = 0;
358
         static bool prev_blink = 0;
358
         static bool prev_blink = 0;
359
       #else
359
       #else
397
       ;
397
       ;
398
       duration_t elapsed = print_job_timer.duration();
398
       duration_t elapsed = print_job_timer.duration();
399
       const uint8_t p = progress & 0xFF, ev = elapsed.value & 0xFF;
399
       const uint8_t p = progress & 0xFF, ev = elapsed.value & 0xFF;
400
-      if (progress > 1 && p != lastProgress) {
400
+      if (progress > 1 || p != lastProgress) {
401
         lastProgress = p;
401
         lastProgress = p;
402
 
402
 
403
-        progress_bar_solid_width = uint8_t((PROGRESS_BAR_WIDTH - 2) * progress / (PROGRESS_SCALE) * 0.01f);
403
+        progress_bar_solid_width = u8g_uint_t((PROGRESS_BAR_WIDTH - 2) * progress / (PROGRESS_SCALE) * 0.01f);
404
 
404
 
405
         #if ENABLED(DOGM_SD_PERCENT)
405
         #if ENABLED(DOGM_SD_PERCENT)
406
-          strcpy(progress_string, (
407
-            #if ENABLED(PRINT_PROGRESS_SHOW_DECIMALS)
408
-              permyriadtostr4(progress)
409
-            #else
410
-              ui8tostr3(progress / (PROGRESS_SCALE))
411
-            #endif
412
-          ));
406
+          if (progress == 0) {
407
+            progress_string[0] = '\0';
408
+            estimation_string[0] = '\0';
409
+            estimation_x_pos = _PROGRESS_CENTER_X(0);
410
+          }
411
+          else {
412
+            strcpy(progress_string, (
413
+              #if ENABLED(PRINT_PROGRESS_SHOW_DECIMALS)
414
+                permyriadtostr4(progress)
415
+              #else
416
+                ui8tostr3(progress / (PROGRESS_SCALE))
417
+              #endif
418
+            ));
419
+          }
413
           #if ENABLED(SHOW_REMAINING_TIME)  && ENABLED(ROTATE_PROGRESS_DISPLAY) // Tristate progress display mode
420
           #if ENABLED(SHOW_REMAINING_TIME)  && ENABLED(ROTATE_PROGRESS_DISPLAY) // Tristate progress display mode
414
             progress_x_pos = _SD_DURATION_X(strlen(progress_string)+1);
421
             progress_x_pos = _SD_DURATION_X(strlen(progress_string)+1);
415
           #endif
422
           #endif

Loading…
Cancel
Save