Browse Source

reduce the required size with uint16_t modifiers

Tanguy Pruvot 5 years ago
parent
commit
a988f9304d
2 changed files with 4 additions and 4 deletions
  1. 1
    1
      Marlin/src/lcd/dogm/status_screen_DOGM.cpp
  2. 3
    3
      Marlin/src/libs/duration_t.h

+ 1
- 1
Marlin/src/lcd/dogm/status_screen_DOGM.cpp View File

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

+ 3
- 3
Marlin/src/libs/duration_t.h View File

@@ -151,15 +151,15 @@ struct duration_t {
151 151
              m = uint16_t(this->minute() % 60UL);
152 152
     if (with_days) {
153 153
       uint16_t d = this->day();
154
-      sprintf_P(buffer, PSTR("%ud %02u:%02u"), d, h % 24, m);
154
+      sprintf_P(buffer, PSTR("%hud %02hu:%02hu"), d, h % 24, m);
155 155
       return d >= 10 ? 9 : 8;
156 156
     }
157 157
     else if (h < 100) {
158
-      sprintf_P(buffer, PSTR("%02u:%02u"), h, m);
158
+      sprintf_P(buffer, PSTR("%02hu:%02hu"), h, m);
159 159
       return 5;
160 160
     }
161 161
     else {
162
-      sprintf_P(buffer, PSTR("%u:%02u"), h, m);
162
+      sprintf_P(buffer, PSTR("%hu:%02hu"), h, m);
163 163
       return 6;
164 164
     }
165 165
   }

Loading…
Cancel
Save