瀏覽代碼

Fix Progress Display

Robby Candra 5 年之前
父節點
當前提交
bf850827f7
共有 1 個文件被更改,包括 63 次插入24 次删除
  1. 63
    24
      Marlin/src/lcd/dogm/status_screen_DOGM.cpp

+ 63
- 24
Marlin/src/lcd/dogm/status_screen_DOGM.cpp 查看文件

@@ -347,9 +347,16 @@ void MarlinUI::draw_status_screen() {
347 347
     static uint8_t lastElapsed = 0, elapsed_x_pos = 0;
348 348
     static char elapsed_string[16];
349 349
     #if ENABLED(SHOW_REMAINING_TIME)
350
-      #define SHOW_REMAINING_TIME_PREFIX 'E'
350
+      #define SHOW_REMAINING_TIME_PREFIX 'R'
351 351
       static uint8_t estimation_x_pos = 0;
352 352
       static char estimation_string[10];
353
+      #if ENABLED(DOGM_SD_PERCENT)
354
+        #define PROGRESS_TIME_PREFIX 'P'
355
+        #define ELAPSED_TIME_PREFIX 'E'
356
+        static uint8_t progress_x_pos = 0;
357
+        static uint8_t progress_state = 0;
358
+        static bool prev_blink = 0;
359
+      #endif
353 360
     #endif
354 361
   #endif
355 362
 
@@ -401,6 +408,9 @@ void MarlinUI::draw_status_screen() {
401 408
               ui8tostr3(progress / (PROGRESS_SCALE))
402 409
             #endif
403 410
           ));
411
+          #if ENABLED(SHOW_REMAINING_TIME) // Tristate progress display mode
412
+            progress_x_pos = _SD_DURATION_X(strlen(progress_string)+1);
413
+          #endif
404 414
         #endif
405 415
       }
406 416
 
@@ -415,7 +425,11 @@ void MarlinUI::draw_status_screen() {
415 425
             duration_t estimation = elapsed.value * (100 * (PROGRESS_SCALE) - progress) / progress;
416 426
             const bool has_days = (estimation.value >= 60*60*24L);
417 427
             const uint8_t len = estimation.toDigital(estimation_string, has_days);
418
-            estimation_x_pos = _SD_DURATION_X(len + 1);
428
+            #if ENABLED(DOGM_SD_PERCENT)
429
+              estimation_x_pos = _SD_DURATION_X(len);
430
+            #else
431
+              estimation_x_pos = _SD_DURATION_X(len + 2);
432
+            #endif
419 433
           }
420 434
         #endif
421 435
       }
@@ -563,35 +577,60 @@ void MarlinUI::draw_status_screen() {
563 577
     if (PAGE_CONTAINS(50, 51))     // 50-51 (or just 50)
564 578
       u8g.drawBox(PROGRESS_BAR_X + 1, 50, progress_bar_solid_width, 2);
565 579
 
566
-    //
567
-    // SD Percent Complete
568
-    //
580
+    if (PAGE_CONTAINS(EXTRAS_BASELINE - INFO_FONT_ASCENT, EXTRAS_BASELINE - 1)) {
569 581
 
570
-    #if ENABLED(DOGM_SD_PERCENT)
571
-      if (progress_string[0] != '\0')
572
-        if (PAGE_CONTAINS(41, 48)) {
573
-          // Percent complete
574
-          lcd_put_u8str(55, 48, progress_string);
575
-          lcd_put_wchar('%');
582
+      #if ENABLED(DOGM_SD_PERCENT) && ENABLED(SHOW_REMAINING_TIME)
583
+        if (prev_blink != blink) {
584
+          prev_blink = blink;
585
+          progress_state++;
586
+          if (progress_state >=3) progress_state = 0;
576 587
         }
577
-    #endif
578 588
 
579
-    //
580
-    // Elapsed Time
581
-    //
589
+        if (progress_state == 0) {
590
+          if (progress_string[0] != '\0') {
591
+            lcd_put_wchar(PROGRESS_BAR_X, EXTRAS_BASELINE, PROGRESS_TIME_PREFIX);
592
+            lcd_put_u8str(progress_x_pos, EXTRAS_BASELINE, progress_string);
593
+            lcd_put_wchar('%');
594
+          }
595
+        }
596
+        else if (progress_state == 2  && estimation_string[0] != '\0') {
597
+          lcd_put_wchar(PROGRESS_BAR_X, EXTRAS_BASELINE, SHOW_REMAINING_TIME_PREFIX);
598
+          lcd_put_u8str(estimation_x_pos, EXTRAS_BASELINE, estimation_string);
599
+        }
600
+        else {
601
+          lcd_put_wchar(PROGRESS_BAR_X, EXTRAS_BASELINE, ELAPSED_TIME_PREFIX);
602
+          lcd_put_u8str(elapsed_x_pos, EXTRAS_BASELINE, elapsed_string);
603
+        }
604
+      #else
582 605
 
583
-    if (PAGE_CONTAINS(EXTRAS_BASELINE - INFO_FONT_ASCENT, EXTRAS_BASELINE - 1)) {
606
+        //
607
+        // SD Percent Complete
608
+        //
609
+
610
+        #if ENABLED(DOGM_SD_PERCENT)
611
+          if (progress_string[0] != '\0') {
612
+            // Percent complete
613
+            lcd_put_u8str(55, 48, progress_string);
614
+            lcd_put_wchar('%');
615
+          }
616
+        #endif
617
+
618
+        //
619
+        // Elapsed Time
620
+        //
621
+
622
+        #if ENABLED(SHOW_REMAINING_TIME)
623
+          if (blink && (estimation_string[0] != '\0')) {
624
+            lcd_put_wchar(estimation_x_pos, EXTRAS_BASELINE, SHOW_REMAINING_TIME_PREFIX);
625
+            lcd_put_wchar(" ");
626
+            lcd_put_u8str(estimation_string);
627
+          }
628
+          else
629
+        #endif
630
+            lcd_put_u8str(elapsed_x_pos, EXTRAS_BASELINE, elapsed_string);
584 631
 
585
-      #if ENABLED(SHOW_REMAINING_TIME)
586
-        if (blink && (estimation_string[0] != '\0')) {
587
-          lcd_put_wchar(estimation_x_pos, EXTRAS_BASELINE, SHOW_REMAINING_TIME_PREFIX);
588
-          lcd_put_u8str(estimation_string);
589
-        }
590
-        else
591 632
       #endif
592
-          lcd_put_u8str(elapsed_x_pos, EXTRAS_BASELINE, elapsed_string);
593 633
     }
594
-
595 634
   #endif // HAS_PRINT_PROGRESS
596 635
 
597 636
   //

Loading…
取消
儲存