Sfoglia il codice sorgente

Rework LCD implementation to use timestamp_t

João Brázio 9 anni fa
parent
commit
86d9311495
2 ha cambiato i file con 15 aggiunte e 15 eliminazioni
  1. 8
    6
      Marlin/ultralcd_impl_DOGM.h
  2. 7
    9
      Marlin/ultralcd_impl_HD44780.h

+ 8
- 6
Marlin/ultralcd_impl_DOGM.h Vedi File

@@ -58,6 +58,8 @@
58 58
 #include "ultralcd_st7920_u8glib_rrd.h"
59 59
 #include "Configuration.h"
60 60
 
61
+#include "timestamp_t.h"
62
+
61 63
 #if DISABLED(MAPPER_C2C3) && DISABLED(MAPPER_NON) && ENABLED(USE_BIG_EDIT_FONT)
62 64
   #undef USE_BIG_EDIT_FONT
63 65
 #endif
@@ -387,12 +389,12 @@ static void lcd_implementation_status_screen() {
387 389
     }
388 390
 
389 391
     u8g.setPrintPos(80,48);
390
-    millis_t time = print_job_timer.duration() / 60;
391
-    if (time != 0) {
392
-      lcd_print(itostr2(time/60));
393
-      lcd_print(':');
394
-      lcd_print(itostr2(time%60));
395
-    }
392
+
393
+    char buffer[10];
394
+    timestamp_t time(print_job_timer.duration());
395
+    time.toString(buffer, true);
396
+    if (time.timestamp != 0) lcd_print(buffer);
397
+    else lcd_printPGM(PSTR("--:--"));
396 398
   #endif
397 399
 
398 400
   // Extruders

+ 7
- 9
Marlin/ultralcd_impl_HD44780.h Vedi File

@@ -27,6 +27,8 @@
27 27
 * Implementation of the LCD display routines for a Hitachi HD44780 display. These are common LCD character displays.
28 28
 **/
29 29
 
30
+#include "timestamp_t.h"
31
+
30 32
 extern volatile uint8_t buttons;  //an extended version of the last checked buttons in a bit array.
31 33
 
32 34
 ////////////////////////////////////
@@ -760,15 +762,11 @@ static void lcd_implementation_status_screen() {
760 762
     lcd.setCursor(LCD_WIDTH - 6, 2);
761 763
     lcd.print(LCD_STR_CLOCK[0]);
762 764
 
763
-    uint16_t time = print_job_timer.duration() / 60;
764
-    if (time != 0) {
765
-      lcd.print(itostr2(time / 60));
766
-      lcd.print(':');
767
-      lcd.print(itostr2(time % 60));
768
-    }
769
-    else {
770
-      lcd_printPGM(PSTR("--:--"));
771
-    }
765
+    char buffer[10];
766
+    timestamp_t time(print_job_timer.duration());
767
+    time.toString(buffer, true);
768
+    if (time.timestamp != 0) lcd_print(buffer);
769
+    else lcd_printPGM(PSTR("--:--"));
772 770
 
773 771
   #endif // LCD_HEIGHT > 3
774 772
 

Loading…
Annulla
Salva