ソースを参照

Remaining Time for LIGHTWEIGHT_UI (#18875)

ftk 3年前
コミット
b15c207d08
コミッターのメールアドレスに関連付けられたアカウントが存在しません

+ 18
- 4
Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp ファイルの表示

@@ -591,16 +591,17 @@ void ST7920_Lite_Status_Screen::draw_fan_speed(const uint8_t value) {
591 591
   write_byte('%');
592 592
 }
593 593
 
594
-void ST7920_Lite_Status_Screen::draw_print_time(const duration_t &elapsed) {
594
+void ST7920_Lite_Status_Screen::draw_print_time(const duration_t &elapsed, char suffix) {
595 595
   #if HOTENDS == 1
596 596
     set_ddram_address(DDRAM_LINE_3);
597 597
   #else
598 598
     set_ddram_address(DDRAM_LINE_3 + 5);
599 599
   #endif
600 600
   char str[7];
601
-  str[elapsed.toDigital(str)] = ' ';
601
+  int str_length = elapsed.toDigital(str);
602
+  str[str_length++] = suffix;
602 603
   begin_data();
603
-  write_str(str, 6);
604
+  write_str(str, str_length);
604 605
 }
605 606
 
606 607
 void ST7920_Lite_Status_Screen::draw_feedrate_percentage(const uint16_t percentage) {
@@ -714,6 +715,7 @@ void ST7920_Lite_Status_Screen::update_indicators(const bool forceUpdate) {
714 715
   if (forceUpdate || indicators_changed()) {
715 716
     const bool       blink             = ui.get_blink();
716 717
     const duration_t elapsed           = print_job_timer.duration();
718
+    duration_t       remaining         = TERN0(USE_M73_REMAINING_TIME, ui.get_remaining_time());
717 719
     const uint16_t   feedrate_perc     = feedrate_percentage;
718 720
     const int16_t    extruder_1_temp   = thermalManager.degHotend(0),
719 721
                      extruder_1_target = thermalManager.degTargetHotend(0);
@@ -738,7 +740,19 @@ void ST7920_Lite_Status_Screen::update_indicators(const bool forceUpdate) {
738 740
     #endif
739 741
 
740 742
     draw_fan_speed(thermalManager.fanPercent(spd));
741
-    draw_print_time(elapsed);
743
+
744
+    // Draw elapsed/remaining time
745
+    const bool show_remaining = ENABLED(SHOW_REMAINING_TIME) && (DISABLED(ROTATE_PROGRESS_DISPLAY) || blink);
746
+    if (show_remaining && !remaining.second()) {
747
+      const auto progress = ui.get_progress_percent();
748
+      if (progress)
749
+        remaining = elapsed.second() * (100 - progress) / progress;
750
+    }
751
+    if (show_remaining && remaining.second())
752
+      draw_print_time(remaining, 'R');
753
+    else
754
+      draw_print_time(elapsed);
755
+
742 756
     draw_feedrate_percentage(feedrate_perc);
743 757
 
744 758
     // Update the fan and bed animations

+ 5
- 5
Marlin/src/lcd/dogm/status_screen_lite_ST7920.h ファイルの表示

@@ -80,14 +80,14 @@ class ST7920_Lite_Status_Screen {
80 80
     static void draw_fan_icon(const bool whichIcon);
81 81
     static void draw_heat_icon(const bool whichIcon, const bool heating);
82 82
     static void draw_temps(uint8_t line, const int16_t temp, const int16_t target, bool showTarget, bool targetStateChange);
83
-    static void draw_extruder_1_temp(const int16_t temp, const int16_t target, bool forceUpdate = false);
84
-    static void draw_extruder_2_temp(const int16_t temp, const int16_t target, bool forceUpdate = false);
85
-    static void draw_bed_temp(const int16_t temp, const int16_t target, bool forceUpdate = false);
83
+    static void draw_extruder_1_temp(const int16_t temp, const int16_t target, bool forceUpdate=false);
84
+    static void draw_extruder_2_temp(const int16_t temp, const int16_t target, bool forceUpdate=false);
85
+    static void draw_bed_temp(const int16_t temp, const int16_t target, bool forceUpdate=false);
86 86
     static void draw_fan_speed(const uint8_t value);
87
-    static void draw_print_time(const duration_t &elapsed);
87
+    static void draw_print_time(const duration_t &elapsed, char suffix=' ');
88 88
     static void draw_feedrate_percentage(const uint16_t percentage);
89 89
     static void draw_status_message();
90
-    static void draw_position(const xyze_pos_t &pos, bool position_known = true);
90
+    static void draw_position(const xyze_pos_t &pos, bool position_known=true);
91 91
 
92 92
     static bool indicators_changed();
93 93
     static bool position_changed();

読み込み中…
キャンセル
保存