Explorar el Código

Include days in Graphical LCD print timer

Scott Lahteine hace 8 años
padre
commit
880cdb553b
Se han modificado 2 ficheros con 13 adiciones y 10 borrados
  1. 9
    7
      Marlin/duration_t.h
  2. 4
    3
      Marlin/ultralcd_impl_DOGM.h

+ 9
- 7
Marlin/duration_t.h Ver fichero

@@ -141,14 +141,16 @@ struct duration_t {
141 141
    * @param buffer The array pointed to must be able to accommodate 10 bytes
142 142
    *
143 143
    * Output examples:
144
-   *  1234567890 (strlen)
145
-   *  1193046:59
144
+   *  123456789 (strlen)
145
+   *  99:59
146
+   *  11d 12:33
146 147
    */
147
-  void toDigital(char *buffer) const {
148
-    int h = this->hour(),
149
-        m = this->minute() % 60;
150
-
151
-    sprintf_P(buffer, PSTR("%02i:%02i"), h, m);
148
+  void toDigital(char *buffer, bool with_days=false) const {
149
+    int m = this->minute() % 60;
150
+    if (with_days)
151
+      sprintf_P(buffer, PSTR("%id %02i:%02i"), this->day(), this->hour() % 24, m);
152
+    else
153
+      sprintf_P(buffer, PSTR("%02i:%02i"), this->hour(), m);
152 154
   }
153 155
 };
154 156
 

+ 4
- 3
Marlin/ultralcd_impl_DOGM.h Ver fichero

@@ -382,11 +382,12 @@ static void lcd_implementation_status_screen() {
382 382
       u8g.drawBox(55, 50, (unsigned int)(71 * card.percentDone() * 0.01), 2 - (TALL_FONT_CORRECTION));
383 383
     }
384 384
 
385
-    u8g.setPrintPos(80,48);
386
-
387 385
     char buffer[10];
388 386
     duration_t elapsed = print_job_timer.duration();
389
-    elapsed.toDigital(buffer);
387
+    bool has_days = (elapsed.value > 60*60*24);
388
+    elapsed.toDigital(buffer, has_days);
389
+
390
+    u8g.setPrintPos(has_days ? 71 : 80, 48);
390 391
     lcd_print(buffer);
391 392
 
392 393
   #endif

Loading…
Cancelar
Guardar