Ver código fonte

Rework stats menu to use timestamp_t

João Brázio 9 anos atrás
pai
commit
b4aad85c9a
1 arquivos alterados com 6 adições e 11 exclusões
  1. 6
    11
      Marlin/ultralcd.cpp

+ 6
- 11
Marlin/ultralcd.cpp Ver arquivo

@@ -31,6 +31,7 @@
31 31
 
32 32
 #if ENABLED(PRINTCOUNTER)
33 33
   #include "printcounter.h"
34
+  #include "timestamp_t.h"
34 35
 #endif
35 36
 
36 37
 int preheatHotendTemp1, preheatBedTemp1, preheatFanSpeed1,
@@ -1971,23 +1972,17 @@ void kill_screen(const char* lcd_msg) {
1971 1972
       static void lcd_info_stats_menu() {
1972 1973
         if (LCD_CLICKED) { lcd_goto_previous_menu(true); return; }
1973 1974
 
1974
-        PrintCounter print_job_counter = PrintCounter();
1975
-        print_job_counter.loadStats();
1976
-        printStatistics stats = print_job_counter.getStats();
1975
+        printStatistics stats = print_job_timer.getStats();
1976
+        timestamp_t time(stats.printTime);
1977 1977
 
1978
-        char timeString[14];
1979
-        sprintf_P(timeString,
1980
-        PSTR("%i" MSG_SHORT_DAY " %i" MSG_SHORT_HOUR " %i" MSG_SHORT_MINUTE),
1981
-          int(stats.printTime / 60 / 60 / 24),
1982
-          int((stats.printTime / 60 / 60) % 24),
1983
-          int((stats.printTime / 60) % 60)
1984
-        );
1978
+        char buffer[21];
1979
+        time.toString(buffer);
1985 1980
 
1986 1981
         START_SCREEN();                                                                              // 12345678901234567890
1987 1982
         STATIC_ITEM(MSG_INFO_PRINT_COUNT ": ", false, false, itostr3left(stats.totalPrints));        // Print Count: 999
1988 1983
         STATIC_ITEM(MSG_INFO_COMPLETED_PRINTS": ", false, false, itostr3left(stats.finishedPrints)); // Completed  : 666
1989 1984
         STATIC_ITEM(MSG_INFO_PRINT_TIME ": ", false, false);                                         // Total Time :
1990
-        STATIC_ITEM("  ", false, false, timeString);                                                 //   12345d 12h 34m
1985
+        STATIC_ITEM("  ", false, false, buffer);                                                     //   12345d 12h 34m
1991 1986
         END_SCREEN();
1992 1987
       }
1993 1988
     #endif // PRINTCOUNTER

Carregando…
Cancelar
Salvar