|
@@ -707,6 +707,35 @@ void MarlinUI::draw_status_message(const bool blink) {
|
707
|
707
|
* |01234567890123456789|
|
708
|
708
|
*/
|
709
|
709
|
|
|
710
|
+inline uint8_t draw_elapsed_or_remaining_time(uint8_t timepos) {
|
|
711
|
+ char buffer[14];
|
|
712
|
+
|
|
713
|
+ #if ENABLED(SHOW_REMAINING_TIME)
|
|
714
|
+ const bool show_remain = TERN1(ROTATE_PROGRESS_DISPLAY, blink) && (printingIsActive() || marlin_state == MF_SD_COMPLETE);
|
|
715
|
+ if (show_remain) {
|
|
716
|
+ #if ENABLED(USE_M73_REMAINING_TIME)
|
|
717
|
+ duration_t remaining = get_remaining_time();
|
|
718
|
+ #else
|
|
719
|
+ uint8_t progress = get_progress_percent();
|
|
720
|
+ uint32_t elapsed = print_job_timer.duration();
|
|
721
|
+ duration_t remaining = (progress > 0) ? ((elapsed * 25600 / progress) >> 8) - elapsed : 0;
|
|
722
|
+ #endif
|
|
723
|
+ timepos -= remaining.toDigital(buffer);
|
|
724
|
+ lcd_put_wchar(timepos, 2, 'R');
|
|
725
|
+ }
|
|
726
|
+ #else
|
|
727
|
+ constexpr bool show_remain = false;
|
|
728
|
+ #endif
|
|
729
|
+
|
|
730
|
+ if (!show_remain) {
|
|
731
|
+ duration_t elapsed = print_job_timer.duration();
|
|
732
|
+ timepos -= elapsed.toDigital(buffer);
|
|
733
|
+ lcd_put_wchar(timepos, 2, LCD_STR_CLOCK[0]);
|
|
734
|
+ }
|
|
735
|
+ lcd_put_u8str(buffer);
|
|
736
|
+ return timepos;
|
|
737
|
+}
|
|
738
|
+
|
710
|
739
|
void MarlinUI::draw_status_screen() {
|
711
|
740
|
|
712
|
741
|
const bool blink = get_blink();
|
|
@@ -845,33 +874,7 @@ void MarlinUI::draw_status_screen() {
|
845
|
874
|
lcd_put_u8str(i16tostr3rj(feedrate_percentage));
|
846
|
875
|
lcd_put_wchar('%');
|
847
|
876
|
|
848
|
|
- char buffer[14];
|
849
|
|
- uint8_t timepos = 0;
|
850
|
|
- #if ENABLED(SHOW_REMAINING_TIME)
|
851
|
|
- const bool show_remain = TERN1(ROTATE_PROGRESS_DISPLAY, blink) && (printingIsActive() || marlin_state == MF_SD_COMPLETE);
|
852
|
|
- if (show_remain) {
|
853
|
|
- #if ENABLED(USE_M73_REMAINING_TIME)
|
854
|
|
- duration_t remaining = get_remaining_time();
|
855
|
|
- #else
|
856
|
|
- uint8_t progress = get_progress_percent();
|
857
|
|
- uint32_t elapsed = print_job_timer.duration();
|
858
|
|
- duration_t remaining = (progress > 0) ? ((elapsed * 25600 / progress) >> 8) - elapsed : 0;
|
859
|
|
- #endif
|
860
|
|
- const uint8_t len = remaining.toDigital(buffer);
|
861
|
|
- timepos = LCD_WIDTH - 1 - len;
|
862
|
|
- lcd_put_wchar(timepos, 2, 'R');
|
863
|
|
- }
|
864
|
|
- #else
|
865
|
|
- constexpr bool show_remain = false;
|
866
|
|
- #endif
|
867
|
|
-
|
868
|
|
- if (!show_remain) {
|
869
|
|
- duration_t elapsed = print_job_timer.duration();
|
870
|
|
- const uint8_t len = elapsed.toDigital(buffer);
|
871
|
|
- timepos = LCD_WIDTH - 1 - len;
|
872
|
|
- lcd_put_wchar(timepos, 2, LCD_STR_CLOCK[0]);
|
873
|
|
- }
|
874
|
|
- lcd_put_u8str(buffer);
|
|
877
|
+ const uint8_t timepos = draw_elapsed_or_remaining_time(LCD_WIDTH - 1);
|
875
|
878
|
|
876
|
879
|
#if LCD_WIDTH >= 20
|
877
|
880
|
lcd_moveto(timepos - 7, 2);
|
|
@@ -955,7 +958,7 @@ void MarlinUI::draw_status_screen() {
|
955
|
958
|
#elif HAS_MULTI_HOTEND && HAS_HEATED_BED
|
956
|
959
|
_draw_bed_status(blink);
|
957
|
960
|
#elif HAS_PRINT_PROGRESS
|
958
|
|
- #define DREW_PRINT_PROGRESS
|
|
961
|
+ #define DREW_PRINT_PROGRESS 1
|
959
|
962
|
_draw_print_progress();
|
960
|
963
|
#endif
|
961
|
964
|
|
|
@@ -963,14 +966,15 @@ void MarlinUI::draw_status_screen() {
|
963
|
966
|
// Elapsed Time or SD Percent
|
964
|
967
|
//
|
965
|
968
|
lcd_moveto(LCD_WIDTH - 9, 2);
|
966
|
|
- #if HAS_PRINT_PROGRESS && !defined(DREW_PRINT_PROGRESS)
|
|
969
|
+
|
|
970
|
+ #if HAS_PRINT_PROGRESS && !DREW_PRINT_PROGRESS
|
|
971
|
+
|
967
|
972
|
_draw_print_progress();
|
|
973
|
+
|
968
|
974
|
#else
|
969
|
|
- duration_t elapsed = print_job_timer.duration();
|
970
|
|
- char buffer[14];
|
971
|
|
- (void)elapsed.toDigital(buffer);
|
972
|
|
- lcd_put_wchar(LCD_STR_CLOCK[0]);
|
973
|
|
- lcd_put_u8str(buffer);
|
|
975
|
+
|
|
976
|
+ (void)draw_elapsed_or_remaining_time(LCD_WIDTH - 4);
|
|
977
|
+
|
974
|
978
|
#endif
|
975
|
979
|
|
976
|
980
|
#endif // LCD_INFO_SCREEN_STYLE 1
|