From a988f9304d0ddc7d90dfe73613e7d23b131d1be6 Mon Sep 17 00:00:00 2001
From: Tanguy Pruvot <tanguy.pruvot@gmail.com>
Date: Mon, 14 Oct 2019 20:11:59 +0200
Subject: [PATCH] reduce the required size with uint16_t modifiers

---
 Marlin/src/lcd/dogm/status_screen_DOGM.cpp | 2 +-
 Marlin/src/libs/duration_t.h               | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp
index 3a8f9c296e..e5ff034132 100644
--- a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp
+++ b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp
@@ -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[22];
+    static char elapsed_string[16];
     #if ENABLED(SHOW_REMAINING_TIME)
       #define SHOW_REMAINING_TIME_PREFIX 'E'
       static uint8_t estimation_x_pos = 0;
diff --git a/Marlin/src/libs/duration_t.h b/Marlin/src/libs/duration_t.h
index 2015c17436..0df3659b1b 100644
--- a/Marlin/src/libs/duration_t.h
+++ b/Marlin/src/libs/duration_t.h
@@ -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;
     }
   }
-- 
GitLab