SHOW_REMAINING_TIME for HD44780 character LCD (#19416)
This commit is contained in:
parent
7e56e6c4ea
commit
9cdb8ca244
|
@ -1105,23 +1105,26 @@
|
|||
#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
|
||||
//#define SHOW_REMAINING_TIME // Display estimated time to completion
|
||||
#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
|
||||
//#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
|
||||
#endif
|
||||
|
||||
#if HAS_CHARACTER_LCD && EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY)
|
||||
//#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
|
||||
#define PROGRESS_BAR_MSG_TIME 3000 // (ms) Amount of time to show the status message
|
||||
#define PROGRESS_MSG_EXPIRE 0 // (ms) Amount of time to retain the status message (0=forever)
|
||||
//#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it
|
||||
//#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar
|
||||
#if HAS_GRAPHICAL_LCD
|
||||
//#define PRINT_PROGRESS_SHOW_DECIMALS // Show progress with decimal digits
|
||||
#endif
|
||||
|
||||
#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
|
||||
#define PROGRESS_BAR_MSG_TIME 3000 // (ms) Amount of time to show the status message
|
||||
#define PROGRESS_MSG_EXPIRE 0 // (ms) Amount of time to retain the status message (0=forever)
|
||||
//#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it
|
||||
//#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -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];
|
||||
duration_t elapsed = print_job_timer.duration();
|
||||
const uint8_t len = elapsed.toDigital(buffer),
|
||||
timepos = LCD_WIDTH - len - 1;
|
||||
lcd_put_wchar(timepos, 2, LCD_STR_CLOCK[0]);
|
||||
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 - 1 - len;
|
||||
lcd_put_wchar(timepos, 2, LCD_STR_CLOCK[0]);
|
||||
}
|
||||
lcd_put_u8str(buffer);
|
||||
|
||||
#if LCD_WIDTH >= 20
|
||||
|
|
Loading…
Reference in a new issue