Procházet zdrojové kódy

Merge pull request #4748 from thinkyhead/rc_sd_print_timer

Patch duration_t toDigital method
Scott Lahteine před 8 roky
rodič
revize
3b2f7ba225
1 změnil soubory, kde provedl 6 přidání a 3 odebrání
  1. 6
    3
      Marlin/duration_t.h

+ 6
- 3
Marlin/duration_t.h Zobrazit soubor

@@ -146,11 +146,14 @@ struct duration_t {
146 146
    *  11d 12:33
147 147
    */
148 148
   void toDigital(char *buffer, bool with_days=false) const {
149
-    int m = this->minute() % 60;
149
+    uint16_t h = uint16_t(this->hour()),
150
+             m = uint16_t(this->minute() % 60UL);
150 151
     if (with_days)
151
-      sprintf_P(buffer, PSTR("%id %02i:%02i"), this->day(), this->hour() % 24, m);
152
+      sprintf_P(buffer, PSTR("%ud %02u:%02u"), this->day(), h, m);
153
+    else if (h < 100)
154
+      sprintf_P(buffer, PSTR("%02u:%02u"), h % 24, m);
152 155
     else
153
-      sprintf_P(buffer, PSTR("%02i:%02i"), this->hour(), m);
156
+      sprintf_P(buffer, PSTR("%u:%02u"), h, m);
154 157
   }
155 158
 };
156 159
 

Loading…
Zrušit
Uložit