forked from Mirrors/Marlin
🚸 Show estimated remaining time
This commit is contained in:
@@ -693,7 +693,7 @@ bool ST7920_Lite_Status_Screen::indicators_changed() {
|
||||
#if ENABLED(SHOW_REMAINING_TIME)
|
||||
void MarlinUI::drawRemain() { lightUI.drawRemain(); }
|
||||
void ST7920_Lite_Status_Screen::drawRemain() {
|
||||
const duration_t remaint = TERN0(SET_REMAINING_TIME, ui.get_remaining_time());
|
||||
const duration_t remaint = ui.get_remaining_time();
|
||||
if (marlin.printJobOngoing() && remaint.value) {
|
||||
draw_progress_string(PPOS, prepare_time_string(remaint, 'R'));
|
||||
}
|
||||
|
||||
@@ -685,7 +685,7 @@ void JyersDWIN::drawPrintScreen() {
|
||||
updateStatusBar(true);
|
||||
drawPrintProgressBar();
|
||||
drawPrintProgressElapsed();
|
||||
TERN_(SET_REMAINING_TIME, drawPrintProgressRemain());
|
||||
TERN_(SHOW_REMAINING_TIME, drawPrintProgressRemain());
|
||||
drawPrintFilename(true);
|
||||
}
|
||||
|
||||
@@ -711,10 +711,10 @@ void JyersDWIN::drawPrintProgressBar() {
|
||||
dwinDrawString(false, DWIN_FONT_MENU, getColor(eeprom_settings.progress_percent, COLOR_PERCENT), COLOR_BG_BLACK, 133, 133, F("%"));
|
||||
}
|
||||
|
||||
#if ENABLED(SET_REMAINING_TIME)
|
||||
#if ENABLED(SHOW_REMAINING_TIME)
|
||||
|
||||
void JyersDWIN::drawPrintProgressRemain() {
|
||||
uint16_t remainingtime = ui.get_remaining_time();
|
||||
const uint16_t remainingtime = ui.get_remaining_time();
|
||||
dwinDrawIntValue(true, true, 1, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, COLOR_WHITE), COLOR_BG_BLACK, 2, 176, 187, remainingtime / 3600);
|
||||
dwinDrawIntValue(true, true, 1, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, COLOR_WHITE), COLOR_BG_BLACK, 2, 200, 187, (remainingtime % 3600) / 60);
|
||||
if (eeprom_settings.time_format_textual) {
|
||||
@@ -4890,7 +4890,7 @@ void JyersDWIN::startPrint(const bool sd) {
|
||||
else
|
||||
strcpy_P(filename, PSTR("Host Print"));
|
||||
TERN_(SET_PROGRESS_PERCENT, ui.set_progress(0));
|
||||
TERN_(SET_REMAINING_TIME, ui.set_remaining_time(0));
|
||||
TERN_(SET_REMAINING_TIME, ui.reset_remaining_time());
|
||||
drawPrintScreen();
|
||||
}
|
||||
}
|
||||
@@ -4900,7 +4900,7 @@ void JyersDWIN::stopPrint() {
|
||||
sdprint = false;
|
||||
thermalManager.cooldown();
|
||||
TERN_(SET_PROGRESS_PERCENT, ui.set_progress(100 * (PROGRESS_SCALE)));
|
||||
TERN_(SET_REMAINING_TIME, ui.set_remaining_time(0));
|
||||
TERN_(SET_REMAINING_TIME, ui.reset_remaining_time());
|
||||
drawPrintConfirm();
|
||||
}
|
||||
|
||||
@@ -4977,7 +4977,7 @@ void JyersDWIN::screenUpdate() {
|
||||
if (process == Proc_Print) {
|
||||
drawPrintProgressBar();
|
||||
drawPrintProgressElapsed();
|
||||
TERN_(SET_REMAINING_TIME, drawPrintProgressRemain());
|
||||
TERN_(SHOW_REMAINING_TIME, drawPrintProgressRemain());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -192,7 +192,7 @@ public:
|
||||
static void drawPrintScreen();
|
||||
static void drawPrintFilename(const bool reset=false);
|
||||
static void drawPrintProgressBar();
|
||||
#if ENABLED(SET_REMAINING_TIME)
|
||||
#if ENABLED(SHOW_REMAINING_TIME)
|
||||
static void drawPrintProgressRemain();
|
||||
#endif
|
||||
static void drawPrintProgressElapsed();
|
||||
|
||||
@@ -573,7 +573,7 @@ void drawPrintProgressBar() {
|
||||
|
||||
void drawPrintProgressElapsed() {
|
||||
MString<12> buf;
|
||||
duration_t elapsed = print_job_timer.duration(); // Print timer
|
||||
const duration_t elapsed = print_job_timer.duration(); // Print timer
|
||||
buf.setf(F("%02i:%02i "), uint16_t(elapsed.value / 3600), (uint16_t(elapsed.value) % 3600) / 60);
|
||||
DWINUI::drawString(hmiData.colorText, hmiData.colorBackground, 47, 192, buf);
|
||||
}
|
||||
@@ -1355,39 +1355,42 @@ void eachMomentUpdate() {
|
||||
if (ELAPSED(ms, next_rts_update_ms)) {
|
||||
next_rts_update_ms = ms + DWIN_UPDATE_INTERVAL;
|
||||
|
||||
if ((isPrinting() != hmiFlag.printing_flag) && !hmiFlag.home_flag) {
|
||||
hmiFlag.printing_flag = isPrinting();
|
||||
if (hmiFlag.printing_flag)
|
||||
dwinPrintStarted();
|
||||
else if (hmiFlag.abort_flag)
|
||||
dwinPrintAborted();
|
||||
else
|
||||
dwinPrintFinished();
|
||||
}
|
||||
|
||||
if ((hmiFlag.pause_flag != marlin.printingIsPaused()) && !hmiFlag.home_flag) {
|
||||
hmiFlag.pause_flag = marlin.printingIsPaused();
|
||||
if (hmiFlag.pause_flag)
|
||||
dwinPrintPause();
|
||||
else if (hmiFlag.abort_flag)
|
||||
dwinPrintAborted();
|
||||
else
|
||||
dwinPrintResume();
|
||||
if (!hmiFlag.home_flag) {
|
||||
if (hmiFlag.printing_flag != isPrinting()) {
|
||||
hmiFlag.printing_flag = isPrinting();
|
||||
if (hmiFlag.printing_flag)
|
||||
dwinPrintStarted();
|
||||
else if (hmiFlag.abort_flag)
|
||||
dwinPrintAborted();
|
||||
else
|
||||
dwinPrintFinished();
|
||||
}
|
||||
if (hmiFlag.pause_flag != marlin.printingIsPaused()) {
|
||||
hmiFlag.pause_flag = marlin.printingIsPaused();
|
||||
if (hmiFlag.pause_flag)
|
||||
dwinPrintPause();
|
||||
else if (hmiFlag.abort_flag)
|
||||
dwinPrintAborted();
|
||||
else
|
||||
dwinPrintResume();
|
||||
}
|
||||
}
|
||||
|
||||
if (checkkey == ID_PrintProcess) { // Print process
|
||||
|
||||
// Progress percent
|
||||
static uint8_t _percent_done = 255;
|
||||
if (_percent_done != ui.get_progress_percent()) {
|
||||
_percent_done = ui.get_progress_percent();
|
||||
const uint8_t pp = ui.get_progress_percent();
|
||||
if (_percent_done != pp) {
|
||||
_percent_done = pp;
|
||||
drawPrintProgressBar();
|
||||
}
|
||||
|
||||
// Remaining time
|
||||
#if ENABLED(SHOW_REMAINING_TIME)
|
||||
if (_remain_time != ui.get_remaining_time()) {
|
||||
_remain_time = ui.get_remaining_time();
|
||||
const uint32_t rt = ui.get_remaining_time();
|
||||
if (_remain_time != rt) {
|
||||
_remain_time = rt;
|
||||
drawPrintProgressRemain();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -244,7 +244,7 @@ void disp_fan_speed() {
|
||||
}
|
||||
|
||||
void disp_print_time() {
|
||||
#if ENABLED(SET_REMAINING_TIME)
|
||||
#if ENABLED(SHOW_REMAINING_TIME)
|
||||
const uint32_t r = ui.get_remaining_time();
|
||||
sprintf_P(public_buf_l, PSTR("%02d:%02d R"), r / 3600, (r % 3600) / 60);
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user