浏览代码

Rework stats menu to use timestamp_t

João Brázio 9 年前
父节点
当前提交
b4aad85c9a
共有 1 个文件被更改,包括 6 次插入11 次删除
  1. 6
    11
      Marlin/ultralcd.cpp

+ 6
- 11
Marlin/ultralcd.cpp 查看文件

31
 
31
 
32
 #if ENABLED(PRINTCOUNTER)
32
 #if ENABLED(PRINTCOUNTER)
33
   #include "printcounter.h"
33
   #include "printcounter.h"
34
+  #include "timestamp_t.h"
34
 #endif
35
 #endif
35
 
36
 
36
 int preheatHotendTemp1, preheatBedTemp1, preheatFanSpeed1,
37
 int preheatHotendTemp1, preheatBedTemp1, preheatFanSpeed1,
1971
       static void lcd_info_stats_menu() {
1972
       static void lcd_info_stats_menu() {
1972
         if (LCD_CLICKED) { lcd_goto_previous_menu(true); return; }
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
         START_SCREEN();                                                                              // 12345678901234567890
1981
         START_SCREEN();                                                                              // 12345678901234567890
1987
         STATIC_ITEM(MSG_INFO_PRINT_COUNT ": ", false, false, itostr3left(stats.totalPrints));        // Print Count: 999
1982
         STATIC_ITEM(MSG_INFO_PRINT_COUNT ": ", false, false, itostr3left(stats.totalPrints));        // Print Count: 999
1988
         STATIC_ITEM(MSG_INFO_COMPLETED_PRINTS": ", false, false, itostr3left(stats.finishedPrints)); // Completed  : 666
1983
         STATIC_ITEM(MSG_INFO_COMPLETED_PRINTS": ", false, false, itostr3left(stats.finishedPrints)); // Completed  : 666
1989
         STATIC_ITEM(MSG_INFO_PRINT_TIME ": ", false, false);                                         // Total Time :
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
         END_SCREEN();
1986
         END_SCREEN();
1992
       }
1987
       }
1993
     #endif // PRINTCOUNTER
1988
     #endif // PRINTCOUNTER

正在加载...
取消
保存