Browse Source

Rework LCD implementation to use timestamp_t

João Brázio 9 years ago
parent
commit
86d9311495
2 changed files with 15 additions and 15 deletions
  1. 8
    6
      Marlin/ultralcd_impl_DOGM.h
  2. 7
    9
      Marlin/ultralcd_impl_HD44780.h

+ 8
- 6
Marlin/ultralcd_impl_DOGM.h View File

58
 #include "ultralcd_st7920_u8glib_rrd.h"
58
 #include "ultralcd_st7920_u8glib_rrd.h"
59
 #include "Configuration.h"
59
 #include "Configuration.h"
60
 
60
 
61
+#include "timestamp_t.h"
62
+
61
 #if DISABLED(MAPPER_C2C3) && DISABLED(MAPPER_NON) && ENABLED(USE_BIG_EDIT_FONT)
63
 #if DISABLED(MAPPER_C2C3) && DISABLED(MAPPER_NON) && ENABLED(USE_BIG_EDIT_FONT)
62
   #undef USE_BIG_EDIT_FONT
64
   #undef USE_BIG_EDIT_FONT
63
 #endif
65
 #endif
387
     }
389
     }
388
 
390
 
389
     u8g.setPrintPos(80,48);
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
   #endif
398
   #endif
397
 
399
 
398
   // Extruders
400
   // Extruders

+ 7
- 9
Marlin/ultralcd_impl_HD44780.h View File

27
 * Implementation of the LCD display routines for a Hitachi HD44780 display. These are common LCD character displays.
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
 extern volatile uint8_t buttons;  //an extended version of the last checked buttons in a bit array.
32
 extern volatile uint8_t buttons;  //an extended version of the last checked buttons in a bit array.
31
 
33
 
32
 ////////////////////////////////////
34
 ////////////////////////////////////
760
     lcd.setCursor(LCD_WIDTH - 6, 2);
762
     lcd.setCursor(LCD_WIDTH - 6, 2);
761
     lcd.print(LCD_STR_CLOCK[0]);
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
   #endif // LCD_HEIGHT > 3
771
   #endif // LCD_HEIGHT > 3
774
 
772
 

Loading…
Cancel
Save