Remaining Time for LIGHTWEIGHT_UI (#18875)

This commit is contained in:
ftk 2020-08-10 01:19:35 +03:00 committed by GitHub
parent 81f5973afc
commit b15c207d08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 9 deletions

View File

@ -591,16 +591,17 @@ void ST7920_Lite_Status_Screen::draw_fan_speed(const uint8_t value) {
write_byte('%'); write_byte('%');
} }
void ST7920_Lite_Status_Screen::draw_print_time(const duration_t &elapsed) { void ST7920_Lite_Status_Screen::draw_print_time(const duration_t &elapsed, char suffix) {
#if HOTENDS == 1 #if HOTENDS == 1
set_ddram_address(DDRAM_LINE_3); set_ddram_address(DDRAM_LINE_3);
#else #else
set_ddram_address(DDRAM_LINE_3 + 5); set_ddram_address(DDRAM_LINE_3 + 5);
#endif #endif
char str[7]; char str[7];
str[elapsed.toDigital(str)] = ' '; int str_length = elapsed.toDigital(str);
str[str_length++] = suffix;
begin_data(); begin_data();
write_str(str, 6); write_str(str, str_length);
} }
void ST7920_Lite_Status_Screen::draw_feedrate_percentage(const uint16_t percentage) { void ST7920_Lite_Status_Screen::draw_feedrate_percentage(const uint16_t percentage) {
@ -714,6 +715,7 @@ void ST7920_Lite_Status_Screen::update_indicators(const bool forceUpdate) {
if (forceUpdate || indicators_changed()) { if (forceUpdate || indicators_changed()) {
const bool blink = ui.get_blink(); const bool blink = ui.get_blink();
const duration_t elapsed = print_job_timer.duration(); const duration_t elapsed = print_job_timer.duration();
duration_t remaining = TERN0(USE_M73_REMAINING_TIME, ui.get_remaining_time());
const uint16_t feedrate_perc = feedrate_percentage; const uint16_t feedrate_perc = feedrate_percentage;
const int16_t extruder_1_temp = thermalManager.degHotend(0), const int16_t extruder_1_temp = thermalManager.degHotend(0),
extruder_1_target = thermalManager.degTargetHotend(0); extruder_1_target = thermalManager.degTargetHotend(0);
@ -738,7 +740,19 @@ void ST7920_Lite_Status_Screen::update_indicators(const bool forceUpdate) {
#endif #endif
draw_fan_speed(thermalManager.fanPercent(spd)); draw_fan_speed(thermalManager.fanPercent(spd));
// Draw elapsed/remaining time
const bool show_remaining = ENABLED(SHOW_REMAINING_TIME) && (DISABLED(ROTATE_PROGRESS_DISPLAY) || blink);
if (show_remaining && !remaining.second()) {
const auto progress = ui.get_progress_percent();
if (progress)
remaining = elapsed.second() * (100 - progress) / progress;
}
if (show_remaining && remaining.second())
draw_print_time(remaining, 'R');
else
draw_print_time(elapsed); draw_print_time(elapsed);
draw_feedrate_percentage(feedrate_perc); draw_feedrate_percentage(feedrate_perc);
// Update the fan and bed animations // Update the fan and bed animations

View File

@ -84,7 +84,7 @@ class ST7920_Lite_Status_Screen {
static void draw_extruder_2_temp(const int16_t temp, const int16_t target, bool forceUpdate=false); static void draw_extruder_2_temp(const int16_t temp, const int16_t target, bool forceUpdate=false);
static void draw_bed_temp(const int16_t temp, const int16_t target, bool forceUpdate=false); static void draw_bed_temp(const int16_t temp, const int16_t target, bool forceUpdate=false);
static void draw_fan_speed(const uint8_t value); static void draw_fan_speed(const uint8_t value);
static void draw_print_time(const duration_t &elapsed); static void draw_print_time(const duration_t &elapsed, char suffix=' ');
static void draw_feedrate_percentage(const uint16_t percentage); static void draw_feedrate_percentage(const uint16_t percentage);
static void draw_status_message(); static void draw_status_message();
static void draw_position(const xyze_pos_t &pos, bool position_known=true); static void draw_position(const xyze_pos_t &pos, bool position_known=true);