瀏覽代碼

SHOW_REMAINING_TIME for HD44780 character LCD (#19416)

deram 4 年之前
父節點
當前提交
24d8daa01b
No account linked to committer's email address
共有 3 個文件被更改,包括 44 次插入22 次删除
  1. 17
    14
      Marlin/Configuration_adv.h
  2. 2
    4
      Marlin/src/inc/SanityCheck.h
  3. 25
    4
      Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp

+ 17
- 14
Marlin/Configuration_adv.h 查看文件

@@ -1105,23 +1105,26 @@
1105 1105
   #define BOOTSCREEN_TIMEOUT 4000        // (ms) Total Duration to display the boot screen(s)
1106 1106
 #endif
1107 1107
 
1108
-#if HAS_GRAPHICAL_LCD && EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY)
1109
-  //#define PRINT_PROGRESS_SHOW_DECIMALS // Show progress with decimal digits
1110
-  //#define SHOW_REMAINING_TIME          // Display estimated time to completion
1108
+#if EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY) && (HAS_GRAPHICAL_LCD || HAS_CHARACTER_LCD)
1109
+  //#define SHOW_REMAINING_TIME       // Display estimated time to completion
1111 1110
   #if ENABLED(SHOW_REMAINING_TIME)
1112
-    //#define USE_M73_REMAINING_TIME     // Use remaining time from M73 command instead of estimation
1113
-    //#define ROTATE_PROGRESS_DISPLAY    // Display (P)rogress, (E)lapsed, and (R)emaining time
1111
+    //#define USE_M73_REMAINING_TIME  // Use remaining time from M73 command instead of estimation
1112
+    //#define ROTATE_PROGRESS_DISPLAY // Display (P)rogress, (E)lapsed, and (R)emaining time
1113
+  #endif
1114
+
1115
+  #if HAS_GRAPHICAL_LCD
1116
+    //#define PRINT_PROGRESS_SHOW_DECIMALS // Show progress with decimal digits
1114 1117
   #endif
1115
-#endif
1116 1118
 
1117
-#if HAS_CHARACTER_LCD && EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY)
1118
-  //#define LCD_PROGRESS_BAR              // Show a progress bar on HD44780 LCDs for SD printing
1119
-  #if ENABLED(LCD_PROGRESS_BAR)
1120
-    #define PROGRESS_BAR_BAR_TIME 2000    // (ms) Amount of time to show the bar
1121
-    #define PROGRESS_BAR_MSG_TIME 3000    // (ms) Amount of time to show the status message
1122
-    #define PROGRESS_MSG_EXPIRE   0       // (ms) Amount of time to retain the status message (0=forever)
1123
-    //#define PROGRESS_MSG_ONCE           // Show the message for MSG_TIME then clear it
1124
-    //#define LCD_PROGRESS_BAR_TEST       // Add a menu item to test the progress bar
1119
+  #if HAS_CHARACTER_LCD
1120
+    //#define LCD_PROGRESS_BAR            // Show a progress bar on HD44780 LCDs for SD printing
1121
+    #if ENABLED(LCD_PROGRESS_BAR)
1122
+      #define PROGRESS_BAR_BAR_TIME 2000  // (ms) Amount of time to show the bar
1123
+      #define PROGRESS_BAR_MSG_TIME 3000  // (ms) Amount of time to show the status message
1124
+      #define PROGRESS_MSG_EXPIRE   0     // (ms) Amount of time to retain the status message (0=forever)
1125
+      //#define PROGRESS_MSG_ONCE         // Show the message for MSG_TIME then clear it
1126
+      //#define LCD_PROGRESS_BAR_TEST     // Add a menu item to test the progress bar
1127
+    #endif
1125 1128
   #endif
1126 1129
 #endif
1127 1130
 

+ 2
- 4
Marlin/src/inc/SanityCheck.h 查看文件

@@ -692,8 +692,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
692 692
   #elif PROGRESS_MSG_EXPIRE < 0
693 693
     #error "PROGRESS_MSG_EXPIRE must be greater than or equal to 0."
694 694
   #endif
695
-#elif ENABLED(LCD_SET_PROGRESS_MANUALLY) && NONE(HAS_GRAPHICAL_LCD, HAS_GRAPHICAL_TFT, EXTENSIBLE_UI)
696
-  #error "LCD_SET_PROGRESS_MANUALLY requires LCD_PROGRESS_BAR, Graphical LCD, TFT, or EXTENSIBLE_UI."
695
+#elif ENABLED(LCD_SET_PROGRESS_MANUALLY) && NONE(HAS_GRAPHICAL_LCD, HAS_GRAPHICAL_TFT, HAS_CHARACTER_LCD, EXTENSIBLE_UI)
696
+  #error "LCD_SET_PROGRESS_MANUALLY requires LCD_PROGRESS_BAR, Character LCD, Graphical LCD, TFT, or EXTENSIBLE_UI."
697 697
 #endif
698 698
 
699 699
 #if !HAS_LCD_MENU && ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
@@ -3055,8 +3055,6 @@ static_assert(   _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
3055 3055
 #if !HAS_GRAPHICAL_LCD
3056 3056
   #if ENABLED(PRINT_PROGRESS_SHOW_DECIMALS)
3057 3057
     #error "PRINT_PROGRESS_SHOW_DECIMALS currently requires a Graphical LCD."
3058
-  #elif ENABLED(SHOW_REMAINING_TIME)
3059
-    #error "SHOW_REMAINING_TIME currently requires a Graphical LCD."
3060 3058
   #endif
3061 3059
 #endif
3062 3060
 

+ 25
- 4
Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp 查看文件

@@ -845,10 +845,31 @@ void MarlinUI::draw_status_screen() {
845 845
       lcd_put_wchar('%');
846 846
 
847 847
       char buffer[14];
848
-      duration_t elapsed = print_job_timer.duration();
849
-      const uint8_t len = elapsed.toDigital(buffer),
850
-                    timepos = LCD_WIDTH - len - 1;
851
-      lcd_put_wchar(timepos, 2, LCD_STR_CLOCK[0]);
848
+      uint8_t timepos = 0;
849
+      #if ENABLED(SHOW_REMAINING_TIME)
850
+        const bool show_remain = TERN1(ROTATE_PROGRESS_DISPLAY, blink) && (printingIsActive() || marlin_state == MF_SD_COMPLETE);
851
+        if (show_remain) {
852
+          #if ENABLED(USE_M73_REMAINING_TIME)
853
+            duration_t remaining = get_remaining_time();
854
+          #else
855
+            uint8_t progress = get_progress_percent();
856
+            uint32_t elapsed = print_job_timer.duration();
857
+            duration_t remaining = (progress > 0) ? ((elapsed * 25600 / progress) >> 8) - elapsed : 0;
858
+          #endif
859
+          const uint8_t len = remaining.toDigital(buffer);
860
+          timepos = LCD_WIDTH - 1 - len;
861
+          lcd_put_wchar(timepos, 2, 'R');
862
+        }
863
+      #else
864
+        constexpr bool show_remain = false;
865
+      #endif
866
+
867
+      if (!show_remain) {
868
+        duration_t elapsed = print_job_timer.duration();
869
+        const uint8_t len = elapsed.toDigital(buffer);
870
+        timepos = LCD_WIDTH - 1 - len;
871
+        lcd_put_wchar(timepos, 2, LCD_STR_CLOCK[0]);
872
+      }
852 873
       lcd_put_u8str(buffer);
853 874
 
854 875
       #if LCD_WIDTH >= 20

Loading…
取消
儲存