Browse Source

Add LCD_SET_PROGRESS_MANUALLY

Scott Lahteine 6 years ago
parent
commit
5f708d47ce
31 changed files with 161 additions and 31 deletions
  1. 3
    0
      Marlin/Configuration_adv.h
  2. 24
    1
      Marlin/Marlin_main.cpp
  3. 3
    0
      Marlin/example_configurations/AlephObjects/TAZ4/Configuration_adv.h
  4. 3
    0
      Marlin/example_configurations/Anet/A6/Configuration_adv.h
  5. 3
    0
      Marlin/example_configurations/Anet/A8/Configuration_adv.h
  6. 3
    0
      Marlin/example_configurations/BQ/Hephestos/Configuration_adv.h
  7. 3
    0
      Marlin/example_configurations/BQ/WITBOX/Configuration_adv.h
  8. 3
    0
      Marlin/example_configurations/Cartesio/Configuration_adv.h
  9. 3
    0
      Marlin/example_configurations/Creality/CR-10/Configuration_adv.h
  10. 3
    0
      Marlin/example_configurations/Felix/Configuration_adv.h
  11. 3
    0
      Marlin/example_configurations/Folger Tech/i3-2020/Configuration_adv.h
  12. 3
    0
      Marlin/example_configurations/Infitary/i3-M508/Configuration_adv.h
  13. 3
    0
      Marlin/example_configurations/RigidBot/Configuration_adv.h
  14. 3
    0
      Marlin/example_configurations/SCARA/Configuration_adv.h
  15. 3
    0
      Marlin/example_configurations/Sanguinololu/Configuration_adv.h
  16. 3
    0
      Marlin/example_configurations/TinyBoy2/Configuration_adv.h
  17. 3
    0
      Marlin/example_configurations/Velleman/K8400/Configuration_adv.h
  18. 3
    0
      Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h
  19. 3
    0
      Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h
  20. 3
    0
      Marlin/example_configurations/delta/generic/Configuration_adv.h
  21. 3
    0
      Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h
  22. 3
    0
      Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h
  23. 3
    0
      Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h
  24. 3
    0
      Marlin/example_configurations/gCreate/gMax1.5+/Configuration_adv.h
  25. 3
    0
      Marlin/example_configurations/makibox/Configuration_adv.h
  26. 3
    0
      Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h
  27. 3
    0
      Marlin/example_configurations/wt150/Configuration_adv.h
  28. 40
    20
      Marlin/ultralcd.cpp
  29. 4
    0
      Marlin/ultralcd.h
  30. 8
    4
      Marlin/ultralcd_impl_DOGM.h
  31. 7
    6
      Marlin/ultralcd_impl_HD44780.h

+ 3
- 0
Marlin/Configuration_adv.h View File

@@ -535,6 +535,9 @@
535 535
     //#define LCD_PROGRESS_BAR_TEST
536 536
   #endif
537 537
 
538
+  // Add an 'M73' G-code to set the current percentage
539
+  //#define LCD_SET_PROGRESS_MANUALLY
540
+
538 541
   // This allows hosts to request long names for files and folders with M33
539 542
   //#define LONG_FILENAME_HOST_SUPPORT
540 543
 

+ 24
- 1
Marlin/Marlin_main.cpp View File

@@ -6022,7 +6022,7 @@ inline void gcode_G92() {
6022 6022
       #if ENABLED(ULTIPANEL)
6023 6023
         if (lcd_detected()) {
6024 6024
           while (wait_for_user) idle();
6025
-          IS_SD_PRINTING ? LCD_MESSAGEPGM(MSG_RESUMING) : LCD_MESSAGEPGM(WELCOME_MSG);
6025
+          print_job_timer.isPaused() ? LCD_MESSAGEPGM(WELCOME_MSG) : LCD_MESSAGEPGM(MSG_RESUMING);
6026 6026
         }
6027 6027
       #else
6028 6028
         while (wait_for_user) idle();
@@ -7241,6 +7241,24 @@ inline void gcode_M42() {
7241 7241
 
7242 7242
 #endif // AUTO_BED_LEVELING_UBL && UBL_G26_MESH_VALIDATION
7243 7243
 
7244
+#if ENABLED(ULTRA_LCD) && ENABLED(LCD_SET_PROGRESS_MANUALLY)
7245
+  /**
7246
+   * M73: Set percentage complete (for display on LCD)
7247
+   *
7248
+   * Example:
7249
+   *   M73 P25 ; Set progress to 25%
7250
+   *
7251
+   * Notes:
7252
+   *   This has no effect during an SD print job
7253
+   */
7254
+  inline void gcode_M73() {
7255
+    if (!IS_SD_PRINTING && parser.seen('P')) {
7256
+      progress_bar_percent = parser.value_byte();
7257
+      NOMORE(progress_bar_percent, 100);
7258
+    }
7259
+  }
7260
+#endif // ULTRA_LCD && LCD_SET_PROGRESS_MANUALLY
7261
+
7244 7262
 /**
7245 7263
  * M75: Start print timer
7246 7264
  */
@@ -11090,6 +11108,11 @@ void process_next_command() {
11090 11108
           break;
11091 11109
       #endif // AUTO_BED_LEVELING_UBL && UBL_G26_MESH_VALIDATION
11092 11110
 
11111
+      #if ENABLED(ULTRA_LCD) && ENABLED(LCD_SET_PROGRESS_MANUALLY)
11112
+        case 73: // M73: Set print progress percentage
11113
+          gcode_M73(); break;
11114
+      #endif
11115
+
11093 11116
       case 75: // M75: Start print timer
11094 11117
         gcode_M75(); break;
11095 11118
       case 76: // M76: Pause print timer

+ 3
- 0
Marlin/example_configurations/AlephObjects/TAZ4/Configuration_adv.h View File

@@ -535,6 +535,9 @@
535 535
     //#define LCD_PROGRESS_BAR_TEST
536 536
   #endif
537 537
 
538
+  // Add an 'M73' G-code to set the current percentage
539
+  //#define LCD_SET_PROGRESS_MANUALLY
540
+
538 541
   // This allows hosts to request long names for files and folders with M33
539 542
   //#define LONG_FILENAME_HOST_SUPPORT
540 543
 

+ 3
- 0
Marlin/example_configurations/Anet/A6/Configuration_adv.h View File

@@ -535,6 +535,9 @@
535 535
     //#define LCD_PROGRESS_BAR_TEST
536 536
   #endif
537 537
 
538
+  // Add an 'M73' G-code to set the current percentage
539
+  //#define LCD_SET_PROGRESS_MANUALLY
540
+
538 541
   // This allows hosts to request long names for files and folders with M33
539 542
   //#define LONG_FILENAME_HOST_SUPPORT
540 543
 

+ 3
- 0
Marlin/example_configurations/Anet/A8/Configuration_adv.h View File

@@ -535,6 +535,9 @@
535 535
     //#define LCD_PROGRESS_BAR_TEST
536 536
   #endif
537 537
 
538
+  // Add an 'M73' G-code to set the current percentage
539
+  //#define LCD_SET_PROGRESS_MANUALLY
540
+
538 541
   // This allows hosts to request long names for files and folders with M33
539 542
   //#define LONG_FILENAME_HOST_SUPPORT
540 543
 

+ 3
- 0
Marlin/example_configurations/BQ/Hephestos/Configuration_adv.h View File

@@ -535,6 +535,9 @@
535 535
     //#define LCD_PROGRESS_BAR_TEST
536 536
   #endif
537 537
 
538
+  // Add an 'M73' G-code to set the current percentage
539
+  //#define LCD_SET_PROGRESS_MANUALLY
540
+
538 541
   // This allows hosts to request long names for files and folders with M33
539 542
   //#define LONG_FILENAME_HOST_SUPPORT
540 543
 

+ 3
- 0
Marlin/example_configurations/BQ/WITBOX/Configuration_adv.h View File

@@ -535,6 +535,9 @@
535 535
     //#define LCD_PROGRESS_BAR_TEST
536 536
   #endif
537 537
 
538
+  // Add an 'M73' G-code to set the current percentage
539
+  //#define LCD_SET_PROGRESS_MANUALLY
540
+
538 541
   // This allows hosts to request long names for files and folders with M33
539 542
   //#define LONG_FILENAME_HOST_SUPPORT
540 543
 

+ 3
- 0
Marlin/example_configurations/Cartesio/Configuration_adv.h View File

@@ -535,6 +535,9 @@
535 535
     //#define LCD_PROGRESS_BAR_TEST
536 536
   #endif
537 537
 
538
+  // Add an 'M73' G-code to set the current percentage
539
+  //#define LCD_SET_PROGRESS_MANUALLY
540
+
538 541
   // This allows hosts to request long names for files and folders with M33
539 542
   //#define LONG_FILENAME_HOST_SUPPORT
540 543
 

+ 3
- 0
Marlin/example_configurations/Creality/CR-10/Configuration_adv.h View File

@@ -535,6 +535,9 @@
535 535
     //#define LCD_PROGRESS_BAR_TEST
536 536
   #endif
537 537
 
538
+  // Add an 'M73' G-code to set the current percentage
539
+  //#define LCD_SET_PROGRESS_MANUALLY
540
+
538 541
   // This allows hosts to request long names for files and folders with M33
539 542
   //#define LONG_FILENAME_HOST_SUPPORT
540 543
 

+ 3
- 0
Marlin/example_configurations/Felix/Configuration_adv.h View File

@@ -535,6 +535,9 @@
535 535
     //#define LCD_PROGRESS_BAR_TEST
536 536
   #endif
537 537
 
538
+  // Add an 'M73' G-code to set the current percentage
539
+  //#define LCD_SET_PROGRESS_MANUALLY
540
+
538 541
   // This allows hosts to request long names for files and folders with M33
539 542
   //#define LONG_FILENAME_HOST_SUPPORT
540 543
 

+ 3
- 0
Marlin/example_configurations/Folger Tech/i3-2020/Configuration_adv.h View File

@@ -535,6 +535,9 @@
535 535
     //#define LCD_PROGRESS_BAR_TEST
536 536
   #endif
537 537
 
538
+  // Add an 'M73' G-code to set the current percentage
539
+  //#define LCD_SET_PROGRESS_MANUALLY
540
+
538 541
   // This allows hosts to request long names for files and folders with M33
539 542
   //#define LONG_FILENAME_HOST_SUPPORT
540 543
 

+ 3
- 0
Marlin/example_configurations/Infitary/i3-M508/Configuration_adv.h View File

@@ -535,6 +535,9 @@
535 535
     //#define LCD_PROGRESS_BAR_TEST
536 536
   #endif
537 537
 
538
+  // Add an 'M73' G-code to set the current percentage
539
+  //#define LCD_SET_PROGRESS_MANUALLY
540
+
538 541
   // This allows hosts to request long names for files and folders with M33
539 542
   //#define LONG_FILENAME_HOST_SUPPORT
540 543
 

+ 3
- 0
Marlin/example_configurations/RigidBot/Configuration_adv.h View File

@@ -535,6 +535,9 @@
535 535
     //#define LCD_PROGRESS_BAR_TEST
536 536
   #endif
537 537
 
538
+  // Add an 'M73' G-code to set the current percentage
539
+  //#define LCD_SET_PROGRESS_MANUALLY
540
+
538 541
   // This allows hosts to request long names for files and folders with M33
539 542
   //#define LONG_FILENAME_HOST_SUPPORT
540 543
 

+ 3
- 0
Marlin/example_configurations/SCARA/Configuration_adv.h View File

@@ -535,6 +535,9 @@
535 535
     //#define LCD_PROGRESS_BAR_TEST
536 536
   #endif
537 537
 
538
+  // Add an 'M73' G-code to set the current percentage
539
+  //#define LCD_SET_PROGRESS_MANUALLY
540
+
538 541
   // This allows hosts to request long names for files and folders with M33
539 542
   //#define LONG_FILENAME_HOST_SUPPORT
540 543
 

+ 3
- 0
Marlin/example_configurations/Sanguinololu/Configuration_adv.h View File

@@ -524,6 +524,9 @@
524 524
     //#define LCD_PROGRESS_BAR_TEST
525 525
   #endif
526 526
 
527
+  // Add an 'M73' G-code to set the current percentage
528
+  //#define LCD_SET_PROGRESS_MANUALLY
529
+
527 530
   // This allows hosts to request long names for files and folders with M33
528 531
   //#define LONG_FILENAME_HOST_SUPPORT
529 532
 

+ 3
- 0
Marlin/example_configurations/TinyBoy2/Configuration_adv.h View File

@@ -535,6 +535,9 @@
535 535
     //#define LCD_PROGRESS_BAR_TEST
536 536
   #endif
537 537
 
538
+  // Add an 'M73' G-code to set the current percentage
539
+  //#define LCD_SET_PROGRESS_MANUALLY
540
+
538 541
   // This allows hosts to request long names for files and folders with M33
539 542
   //#define LONG_FILENAME_HOST_SUPPORT
540 543
 

+ 3
- 0
Marlin/example_configurations/Velleman/K8400/Configuration_adv.h View File

@@ -535,6 +535,9 @@
535 535
     //#define LCD_PROGRESS_BAR_TEST
536 536
   #endif
537 537
 
538
+  // Add an 'M73' G-code to set the current percentage
539
+  //#define LCD_SET_PROGRESS_MANUALLY
540
+
538 541
   // This allows hosts to request long names for files and folders with M33
539 542
   //#define LONG_FILENAME_HOST_SUPPORT
540 543
 

+ 3
- 0
Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h View File

@@ -537,6 +537,9 @@
537 537
     //#define LCD_PROGRESS_BAR_TEST
538 538
   #endif
539 539
 
540
+  // Add an 'M73' G-code to set the current percentage
541
+  //#define LCD_SET_PROGRESS_MANUALLY
542
+
540 543
   // This allows hosts to request long names for files and folders with M33
541 544
   //#define LONG_FILENAME_HOST_SUPPORT
542 545
 

+ 3
- 0
Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h View File

@@ -537,6 +537,9 @@
537 537
     //#define LCD_PROGRESS_BAR_TEST
538 538
   #endif
539 539
 
540
+  // Add an 'M73' G-code to set the current percentage
541
+  //#define LCD_SET_PROGRESS_MANUALLY
542
+
540 543
   // This allows hosts to request long names for files and folders with M33
541 544
   //#define LONG_FILENAME_HOST_SUPPORT
542 545
 

+ 3
- 0
Marlin/example_configurations/delta/generic/Configuration_adv.h View File

@@ -537,6 +537,9 @@
537 537
     //#define LCD_PROGRESS_BAR_TEST
538 538
   #endif
539 539
 
540
+  // Add an 'M73' G-code to set the current percentage
541
+  //#define LCD_SET_PROGRESS_MANUALLY
542
+
540 543
   // This allows hosts to request long names for files and folders with M33
541 544
   //#define LONG_FILENAME_HOST_SUPPORT
542 545
 

+ 3
- 0
Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h View File

@@ -537,6 +537,9 @@
537 537
     //#define LCD_PROGRESS_BAR_TEST
538 538
   #endif
539 539
 
540
+  // Add an 'M73' G-code to set the current percentage
541
+  //#define LCD_SET_PROGRESS_MANUALLY
542
+
540 543
   // This allows hosts to request long names for files and folders with M33
541 544
   //#define LONG_FILENAME_HOST_SUPPORT
542 545
 

+ 3
- 0
Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h View File

@@ -542,6 +542,9 @@
542 542
     //#define LCD_PROGRESS_BAR_TEST
543 543
   #endif
544 544
 
545
+  // Add an 'M73' G-code to set the current percentage
546
+  //#define LCD_SET_PROGRESS_MANUALLY
547
+
545 548
   // This allows hosts to request long names for files and folders with M33
546 549
   //#define LONG_FILENAME_HOST_SUPPORT
547 550
 

+ 3
- 0
Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h View File

@@ -537,6 +537,9 @@
537 537
     //#define LCD_PROGRESS_BAR_TEST
538 538
   #endif
539 539
 
540
+  // Add an 'M73' G-code to set the current percentage
541
+  //#define LCD_SET_PROGRESS_MANUALLY
542
+
540 543
   // This allows hosts to request long names for files and folders with M33
541 544
   //#define LONG_FILENAME_HOST_SUPPORT
542 545
 

+ 3
- 0
Marlin/example_configurations/gCreate/gMax1.5+/Configuration_adv.h View File

@@ -535,6 +535,9 @@
535 535
     //#define LCD_PROGRESS_BAR_TEST
536 536
   #endif
537 537
 
538
+  // Add an 'M73' G-code to set the current percentage
539
+  //#define LCD_SET_PROGRESS_MANUALLY
540
+
538 541
   // This allows hosts to request long names for files and folders with M33
539 542
   //#define LONG_FILENAME_HOST_SUPPORT
540 543
 

+ 3
- 0
Marlin/example_configurations/makibox/Configuration_adv.h View File

@@ -535,6 +535,9 @@
535 535
     //#define LCD_PROGRESS_BAR_TEST
536 536
   #endif
537 537
 
538
+  // Add an 'M73' G-code to set the current percentage
539
+  //#define LCD_SET_PROGRESS_MANUALLY
540
+
538 541
   // This allows hosts to request long names for files and folders with M33
539 542
   //#define LONG_FILENAME_HOST_SUPPORT
540 543
 

+ 3
- 0
Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h View File

@@ -535,6 +535,9 @@
535 535
     //#define LCD_PROGRESS_BAR_TEST
536 536
   #endif
537 537
 
538
+  // Add an 'M73' G-code to set the current percentage
539
+  //#define LCD_SET_PROGRESS_MANUALLY
540
+
538 541
   // This allows hosts to request long names for files and folders with M33
539 542
   //#define LONG_FILENAME_HOST_SUPPORT
540 543
 

+ 3
- 0
Marlin/example_configurations/wt150/Configuration_adv.h View File

@@ -535,6 +535,9 @@
535 535
     //#define LCD_PROGRESS_BAR_TEST
536 536
   #endif
537 537
 
538
+  // Add an 'M73' G-code to set the current percentage
539
+  //#define LCD_SET_PROGRESS_MANUALLY
540
+
538 541
   // This allows hosts to request long names for files and folders with M33
539 542
   //#define LONG_FILENAME_HOST_SUPPORT
540 543
 

+ 40
- 20
Marlin/ultralcd.cpp View File

@@ -60,6 +60,10 @@
60 60
 // Initialized by settings.load()
61 61
 int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2];
62 62
 
63
+#if ENABLED(LCD_SET_PROGRESS_MANUALLY) && (ENABLED(LCD_PROGRESS_BAR) || ENABLED(DOGLCD))
64
+  uint8_t progress_bar_percent;
65
+#endif
66
+
63 67
 #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
64 68
   millis_t previous_lcd_status_ms = 0;
65 69
 #endif
@@ -603,36 +607,52 @@ void lcd_status_screen() {
603 607
   #endif
604 608
 
605 609
   #if ENABLED(LCD_PROGRESS_BAR)
610
+
611
+    //
612
+    // HD44780 implements the following message blinking and
613
+    // message expiration because Status Line and Progress Bar
614
+    // share the same line on the display.
615
+    //
616
+
617
+    // Set current percentage from SD when actively printing
618
+    #if ENABLED(LCD_SET_PROGRESS_MANUALLY)
619
+      if (IS_SD_PRINTING)
620
+        progress_bar_percent = card.percentDone();
621
+    #endif
622
+
606 623
     millis_t ms = millis();
624
+
625
+    // If the message will blink rather than expire...
607 626
     #if DISABLED(PROGRESS_MSG_ONCE)
608
-      if (ELAPSED(ms, progress_bar_ms + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME)) {
627
+      if (ELAPSED(ms, progress_bar_ms + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME))
609 628
         progress_bar_ms = ms;
610
-      }
611 629
     #endif
630
+
612 631
     #if PROGRESS_MSG_EXPIRE > 0
632
+
613 633
       // Handle message expire
614 634
       if (expire_status_ms > 0) {
615
-        #if ENABLED(SDSUPPORT)
616
-          if (card.isFileOpen()) {
617
-            // Expire the message when printing is active
618
-            if (IS_SD_PRINTING) {
619
-              if (ELAPSED(ms, expire_status_ms)) {
620
-                lcd_status_message[0] = '\0';
621
-                expire_status_ms = 0;
622
-              }
623
-            }
624
-            else {
625
-              expire_status_ms += LCD_UPDATE_INTERVAL;
626
-            }
627
-          }
628
-          else {
635
+
636
+        #if DISABLED(LCD_SET_PROGRESS_MANUALLY)
637
+          const uint8_t progress_bar_percent = card.percentDone();
638
+        #endif
639
+
640
+        // Expire the message if a job is active and the bar has ticks
641
+        if (progress_bar_percent > 2 && !print_job_timer.isPaused()) {
642
+          if (ELAPSED(ms, expire_status_ms)) {
643
+            lcd_status_message[0] = '\0';
629 644
             expire_status_ms = 0;
630 645
           }
631
-        #else
632
-          expire_status_ms = 0;
633
-        #endif // SDSUPPORT
646
+        }
647
+        else {
648
+          // Defer message expiration before bar appears
649
+          // and during any pause (not just SD)
650
+          expire_status_ms += LCD_UPDATE_INTERVAL;
651
+        }
634 652
       }
635
-    #endif
653
+
654
+    #endif // PROGRESS_MSG_EXPIRE
655
+
636 656
   #endif // LCD_PROGRESS_BAR
637 657
 
638 658
   #if ENABLED(ULTIPANEL)

+ 4
- 0
Marlin/ultralcd.h View File

@@ -168,6 +168,10 @@
168 168
     #define LCD_CLICKED false
169 169
   #endif
170 170
 
171
+  #if ENABLED(LCD_SET_PROGRESS_MANUALLY) && (ENABLED(LCD_PROGRESS_BAR) || ENABLED(DOGLCD))
172
+    extern uint8_t progress_bar_percent;
173
+  #endif
174
+
171 175
 #else // no LCD
172 176
 
173 177
   inline void lcd_update() {}

+ 8
- 4
Marlin/ultralcd_impl_DOGM.h View File

@@ -535,7 +535,7 @@ static void lcd_implementation_status_screen() {
535 535
     // SD Card Symbol
536 536
     //
537 537
 
538
-    if (PAGE_CONTAINS(42 - (TALL_FONT_CORRECTION), 51 - (TALL_FONT_CORRECTION))) {
538
+    if (card.isFileOpen() && PAGE_CONTAINS(42 - (TALL_FONT_CORRECTION), 51 - (TALL_FONT_CORRECTION))) {
539 539
       // Upper box
540 540
       u8g.drawBox(42, 42 - (TALL_FONT_CORRECTION), 8, 7);     // 42-48 (or 41-47)
541 541
       // Right edge
@@ -559,7 +559,11 @@ static void lcd_implementation_status_screen() {
559 559
         PROGRESS_BAR_WIDTH, 4 - (TALL_FONT_CORRECTION)
560 560
       );
561 561
 
562
-    if (IS_SD_PRINTING) {
562
+    #if DISABLED(LCD_SET_PROGRESS_MANUALLY)
563
+      const uint8_t progress_bar_percent = card.percentDone();
564
+    #endif
565
+
566
+    if (progress_bar_percent > 1) {
563 567
 
564 568
       //
565 569
       // Progress bar solid part
@@ -568,7 +572,7 @@ static void lcd_implementation_status_screen() {
568 572
       if (PAGE_CONTAINS(50, 51 - (TALL_FONT_CORRECTION)))     // 50-51 (or just 50)
569 573
         u8g.drawBox(
570 574
           PROGRESS_BAR_X + 1, 50,
571
-          (uint16_t)((PROGRESS_BAR_WIDTH - 2) * card.percentDone() * 0.01), 2 - (TALL_FONT_CORRECTION)
575
+          (uint16_t)((PROGRESS_BAR_WIDTH - 2) * progress_bar_percent * 0.01), 2 - (TALL_FONT_CORRECTION)
572 576
         );
573 577
 
574 578
       //
@@ -579,7 +583,7 @@ static void lcd_implementation_status_screen() {
579 583
         if (PAGE_CONTAINS(41, 48)) {
580 584
           // Percent complete
581 585
           u8g.setPrintPos(55, 48);
582
-          u8g.print(itostr3(card.percentDone()));
586
+          u8g.print(itostr3(progress_bar_percent));
583 587
           u8g.print('%');
584 588
         }
585 589
       #endif

+ 7
- 6
Marlin/ultralcd_impl_HD44780.h View File

@@ -200,9 +200,9 @@ extern volatile uint8_t buttons;  //an extended version of the last checked butt
200 200
 #include "utf_mapper.h"
201 201
 
202 202
 #if ENABLED(LCD_PROGRESS_BAR)
203
-  static millis_t progress_bar_ms = 0;
203
+  static millis_t progress_bar_ms = 0;     // Start millis of the current progress bar cycle
204 204
   #if PROGRESS_MSG_EXPIRE > 0
205
-    static millis_t expire_status_ms = 0;
205
+    static millis_t expire_status_ms = 0;  // millis at which to expire the status message
206 206
   #endif
207 207
   #define LCD_STR_PROGRESS  "\x03\x04\x05"
208 208
 #endif
@@ -841,10 +841,11 @@ static void lcd_implementation_status_screen() {
841 841
 
842 842
     // Draw the progress bar if the message has shown long enough
843 843
     // or if there is no message set.
844
-    if (card.isFileOpen() && (ELAPSED(millis(), progress_bar_ms + PROGRESS_BAR_MSG_TIME) || !lcd_status_message[0])) {
845
-      const uint8_t percent = card.percentDone();
846
-      if (percent) return lcd_draw_progress_bar(percent);
847
-    }
844
+    #if DISABLED(LCD_SET_PROGRESS_MANUALLY)
845
+      const uint8_t progress_bar_percent = card.percentDone();
846
+    #endif
847
+    if (progress_bar_percent > 2 && (ELAPSED(millis(), progress_bar_ms + PROGRESS_BAR_MSG_TIME) || !lcd_status_message[0]))
848
+      return lcd_draw_progress_bar(progress_bar_percent);
848 849
 
849 850
   #elif ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
850 851
 

Loading…
Cancel
Save