M73 R : Set Remaining Time (#15549)

This commit is contained in:
Roman Moravčík
2019-11-13 02:36:54 +01:00
committed by Scott Lahteine
parent ac71cdc265
commit e110f5abce
109 changed files with 471 additions and 133 deletions

View File

@ -455,19 +455,25 @@ void MarlinUI::draw_status_screen() {
#if ENABLED(SHOW_REMAINING_TIME)
if (!(ev & 0x3)) {
duration_t estimation = elapsed.value * (100 * (PROGRESS_SCALE) - progress) / progress;
if (estimation.value == 0) {
uint32_t timeval = (0
#if ENABLED(USE_M73_REMAINING_TIME)
+ get_remaining_time()
#endif
);
if (!timeval) timeval = elapsed.value * (100 * (PROGRESS_SCALE) - progress) / progress;
if (!timeval) {
estimation_string[0] = '\0';
estimation_x_pos = _SD_INFO_X(0);
}
else {
duration_t estimation = timeval;
const bool has_days = (estimation.value >= 60*60*24L);
const uint8_t len = estimation.toDigital(estimation_string, has_days);
#if BOTH(DOGM_SD_PERCENT, ROTATE_PROGRESS_DISPLAY)
estimation_x_pos = _SD_INFO_X(len);
#else
estimation_x_pos = _SD_INFO_X(len + 1);
#endif
estimation_x_pos = _SD_INFO_X(len
#if !BOTH(DOGM_SD_PERCENT, ROTATE_PROGRESS_DISPLAY)
+ 1
#endif
);
}
}
#endif