1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-26 21:36:21 +00:00

Fix elapsed time overflow warning

This commit is contained in:
Scott Lahteine 2019-10-15 11:47:24 -05:00 committed by GitHub
commit 7622973a31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -345,7 +345,7 @@ void MarlinUI::draw_status_screen() {
static char progress_string[5];
#endif
static uint8_t lastElapsed = 0, elapsed_x_pos = 0;
static char elapsed_string[10];
static char elapsed_string[16];
#if ENABLED(SHOW_REMAINING_TIME)
#define SHOW_REMAINING_TIME_PREFIX 'E'
static uint8_t estimation_x_pos = 0;

View File

@ -151,15 +151,15 @@ struct duration_t {
m = uint16_t(this->minute() % 60UL);
if (with_days) {
uint16_t d = this->day();
sprintf_P(buffer, PSTR("%ud %02u:%02u"), d, h % 24, m);
sprintf_P(buffer, PSTR("%hud %02hu:%02hu"), d, h % 24, m);
return d >= 10 ? 9 : 8;
}
else if (h < 100) {
sprintf_P(buffer, PSTR("%02u:%02u"), h, m);
sprintf_P(buffer, PSTR("%02hu:%02hu"), h, m);
return 5;
}
else {
sprintf_P(buffer, PSTR("%u:%02u"), h, m);
sprintf_P(buffer, PSTR("%hu:%02hu"), h, m);
return 6;
}
}