SHOW_REMAINING_TIME for HD44780 character LCD (#19416)
This commit is contained in:
parent
073b7f1e3a
commit
24d8daa01b
@ -1105,16 +1105,18 @@
|
||||
#define BOOTSCREEN_TIMEOUT 4000 // (ms) Total Duration to display the boot screen(s)
|
||||
#endif
|
||||
|
||||
#if HAS_GRAPHICAL_LCD && EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY)
|
||||
//#define PRINT_PROGRESS_SHOW_DECIMALS // Show progress with decimal digits
|
||||
#if EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY) && (HAS_GRAPHICAL_LCD || HAS_CHARACTER_LCD)
|
||||
//#define SHOW_REMAINING_TIME // Display estimated time to completion
|
||||
#if ENABLED(SHOW_REMAINING_TIME)
|
||||
//#define USE_M73_REMAINING_TIME // Use remaining time from M73 command instead of estimation
|
||||
//#define ROTATE_PROGRESS_DISPLAY // Display (P)rogress, (E)lapsed, and (R)emaining time
|
||||
#endif
|
||||
|
||||
#if HAS_GRAPHICAL_LCD
|
||||
//#define PRINT_PROGRESS_SHOW_DECIMALS // Show progress with decimal digits
|
||||
#endif
|
||||
|
||||
#if HAS_CHARACTER_LCD && EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY)
|
||||
#if HAS_CHARACTER_LCD
|
||||
//#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing
|
||||
#if ENABLED(LCD_PROGRESS_BAR)
|
||||
#define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar
|
||||
@ -1124,6 +1126,7 @@
|
||||
//#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
|
@ -692,8 +692,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
#elif PROGRESS_MSG_EXPIRE < 0
|
||||
#error "PROGRESS_MSG_EXPIRE must be greater than or equal to 0."
|
||||
#endif
|
||||
#elif ENABLED(LCD_SET_PROGRESS_MANUALLY) && NONE(HAS_GRAPHICAL_LCD, HAS_GRAPHICAL_TFT, EXTENSIBLE_UI)
|
||||
#error "LCD_SET_PROGRESS_MANUALLY requires LCD_PROGRESS_BAR, Graphical LCD, TFT, or EXTENSIBLE_UI."
|
||||
#elif ENABLED(LCD_SET_PROGRESS_MANUALLY) && NONE(HAS_GRAPHICAL_LCD, HAS_GRAPHICAL_TFT, HAS_CHARACTER_LCD, EXTENSIBLE_UI)
|
||||
#error "LCD_SET_PROGRESS_MANUALLY requires LCD_PROGRESS_BAR, Character LCD, Graphical LCD, TFT, or EXTENSIBLE_UI."
|
||||
#endif
|
||||
|
||||
#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)
|
||||
#if !HAS_GRAPHICAL_LCD
|
||||
#if ENABLED(PRINT_PROGRESS_SHOW_DECIMALS)
|
||||
#error "PRINT_PROGRESS_SHOW_DECIMALS currently requires a Graphical LCD."
|
||||
#elif ENABLED(SHOW_REMAINING_TIME)
|
||||
#error "SHOW_REMAINING_TIME currently requires a Graphical LCD."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -845,10 +845,31 @@ void MarlinUI::draw_status_screen() {
|
||||
lcd_put_wchar('%');
|
||||
|
||||
char buffer[14];
|
||||
uint8_t timepos = 0;
|
||||
#if ENABLED(SHOW_REMAINING_TIME)
|
||||
const bool show_remain = TERN1(ROTATE_PROGRESS_DISPLAY, blink) && (printingIsActive() || marlin_state == MF_SD_COMPLETE);
|
||||
if (show_remain) {
|
||||
#if ENABLED(USE_M73_REMAINING_TIME)
|
||||
duration_t remaining = get_remaining_time();
|
||||
#else
|
||||
uint8_t progress = get_progress_percent();
|
||||
uint32_t elapsed = print_job_timer.duration();
|
||||
duration_t remaining = (progress > 0) ? ((elapsed * 25600 / progress) >> 8) - elapsed : 0;
|
||||
#endif
|
||||
const uint8_t len = remaining.toDigital(buffer);
|
||||
timepos = LCD_WIDTH - 1 - len;
|
||||
lcd_put_wchar(timepos, 2, 'R');
|
||||
}
|
||||
#else
|
||||
constexpr bool show_remain = false;
|
||||
#endif
|
||||
|
||||
if (!show_remain) {
|
||||
duration_t elapsed = print_job_timer.duration();
|
||||
const uint8_t len = elapsed.toDigital(buffer),
|
||||
timepos = LCD_WIDTH - len - 1;
|
||||
const uint8_t len = elapsed.toDigital(buffer);
|
||||
timepos = LCD_WIDTH - 1 - len;
|
||||
lcd_put_wchar(timepos, 2, LCD_STR_CLOCK[0]);
|
||||
}
|
||||
lcd_put_u8str(buffer);
|
||||
|
||||
#if LCD_WIDTH >= 20
|
||||
|
Loading…
Reference in New Issue
Block a user