Browse Source

Fix Progress Display

pull/1/head
Robby Candra 5 years ago
parent
commit
bf850827f7
  1. 53
      Marlin/src/lcd/dogm/status_screen_DOGM.cpp

53
Marlin/src/lcd/dogm/status_screen_DOGM.cpp

@ -347,9 +347,16 @@ void MarlinUI::draw_status_screen() {
static uint8_t lastElapsed = 0, elapsed_x_pos = 0;
static char elapsed_string[16];
#if ENABLED(SHOW_REMAINING_TIME)
#define SHOW_REMAINING_TIME_PREFIX 'E'
#define SHOW_REMAINING_TIME_PREFIX 'R'
static uint8_t estimation_x_pos = 0;
static char estimation_string[10];
#if ENABLED(DOGM_SD_PERCENT)
#define PROGRESS_TIME_PREFIX 'P'
#define ELAPSED_TIME_PREFIX 'E'
static uint8_t progress_x_pos = 0;
static uint8_t progress_state = 0;
static bool prev_blink = 0;
#endif
#endif
#endif
@ -401,6 +408,9 @@ void MarlinUI::draw_status_screen() {
ui8tostr3(progress / (PROGRESS_SCALE))
#endif
));
#if ENABLED(SHOW_REMAINING_TIME) // Tristate progress display mode
progress_x_pos = _SD_DURATION_X(strlen(progress_string)+1);
#endif
#endif
}
@ -415,7 +425,11 @@ void MarlinUI::draw_status_screen() {
duration_t estimation = elapsed.value * (100 * (PROGRESS_SCALE) - progress) / progress;
const bool has_days = (estimation.value >= 60*60*24L);
const uint8_t len = estimation.toDigital(estimation_string, has_days);
estimation_x_pos = _SD_DURATION_X(len + 1);
#if ENABLED(DOGM_SD_PERCENT)
estimation_x_pos = _SD_DURATION_X(len);
#else
estimation_x_pos = _SD_DURATION_X(len + 2);
#endif
}
#endif
}
@ -563,13 +577,38 @@ void MarlinUI::draw_status_screen() {
if (PAGE_CONTAINS(50, 51)) // 50-51 (or just 50)
u8g.drawBox(PROGRESS_BAR_X + 1, 50, progress_bar_solid_width, 2);
if (PAGE_CONTAINS(EXTRAS_BASELINE - INFO_FONT_ASCENT, EXTRAS_BASELINE - 1)) {
#if ENABLED(DOGM_SD_PERCENT) && ENABLED(SHOW_REMAINING_TIME)
if (prev_blink != blink) {
prev_blink = blink;
progress_state++;
if (progress_state >=3) progress_state = 0;
}
if (progress_state == 0) {
if (progress_string[0] != '\0') {
lcd_put_wchar(PROGRESS_BAR_X, EXTRAS_BASELINE, PROGRESS_TIME_PREFIX);
lcd_put_u8str(progress_x_pos, EXTRAS_BASELINE, progress_string);
lcd_put_wchar('%');
}
}
else if (progress_state == 2 && estimation_string[0] != '\0') {
lcd_put_wchar(PROGRESS_BAR_X, EXTRAS_BASELINE, SHOW_REMAINING_TIME_PREFIX);
lcd_put_u8str(estimation_x_pos, EXTRAS_BASELINE, estimation_string);
}
else {
lcd_put_wchar(PROGRESS_BAR_X, EXTRAS_BASELINE, ELAPSED_TIME_PREFIX);
lcd_put_u8str(elapsed_x_pos, EXTRAS_BASELINE, elapsed_string);
}
#else
//
// SD Percent Complete
//
#if ENABLED(DOGM_SD_PERCENT)
if (progress_string[0] != '\0')
if (PAGE_CONTAINS(41, 48)) {
if (progress_string[0] != '\0') {
// Percent complete
lcd_put_u8str(55, 48, progress_string);
lcd_put_wchar('%');
@ -580,18 +619,18 @@ void MarlinUI::draw_status_screen() {
// Elapsed Time
//
if (PAGE_CONTAINS(EXTRAS_BASELINE - INFO_FONT_ASCENT, EXTRAS_BASELINE - 1)) {
#if ENABLED(SHOW_REMAINING_TIME)
if (blink && (estimation_string[0] != '\0')) {
lcd_put_wchar(estimation_x_pos, EXTRAS_BASELINE, SHOW_REMAINING_TIME_PREFIX);
lcd_put_wchar(" ");
lcd_put_u8str(estimation_string);
}
else
#endif
lcd_put_u8str(elapsed_x_pos, EXTRAS_BASELINE, elapsed_string);
}
#endif
}
#endif // HAS_PRINT_PROGRESS
//

Loading…
Cancel
Save