From 9e5dbf67e8dc1d0d10d053c47e76a4a162105ac4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Br=C3=A1zio?= <jbrazio@gmail.com>
Date: Sat, 23 Jul 2016 02:48:21 +0100
Subject: [PATCH] Update the stats menu to include longest job and extruded
 filament

---
 Marlin/language_en.h | 21 +++++++++++++++++----
 Marlin/ultralcd.cpp  | 21 +++++++++++++++------
 2 files changed, 32 insertions(+), 10 deletions(-)

diff --git a/Marlin/language_en.h b/Marlin/language_en.h
index eba87d3df4..f599810823 100644
--- a/Marlin/language_en.h
+++ b/Marlin/language_en.h
@@ -561,22 +561,35 @@
     #define MSG_INFO_PRINT_COUNT              "Print Count"
   #endif
   #ifndef MSG_INFO_COMPLETED_PRINTS
-    #define MSG_INFO_COMPLETED_PRINTS         "Completed  "
+    #define MSG_INFO_COMPLETED_PRINTS         "Completed"
   #endif
   #ifndef MSG_INFO_PRINT_TIME
-    #define MSG_INFO_PRINT_TIME               "Total Time "
+    #define MSG_INFO_PRINT_TIME               "Total print time"
+  #endif
+  #ifndef MSG_INFO_PRINT_LONGEST
+    #define MSG_INFO_PRINT_LONGEST            "Longest job time"
+  #endif
+  #ifndef MSG_INFO_PRINT_FILAMENT
+    #define MSG_INFO_PRINT_FILAMENT           "Extruded total"
   #endif
 #else
   #ifndef MSG_INFO_PRINT_COUNT
-    #define MSG_INFO_PRINT_COUNT              "Prints   "
+    #define MSG_INFO_PRINT_COUNT              "Prints"
   #endif
   #ifndef MSG_INFO_COMPLETED_PRINTS
     #define MSG_INFO_COMPLETED_PRINTS         "Completed"
   #endif
   #ifndef MSG_INFO_PRINT_TIME
-    #define MSG_INFO_PRINT_TIME               "Duration "
+    #define MSG_INFO_PRINT_TIME               "Total"
+  #endif
+  #ifndef MSG_INFO_PRINT_LONGEST
+    #define MSG_INFO_PRINT_LONGEST            "Longest"
+  #endif
+  #ifndef MSG_INFO_PRINT_FILAMENT
+    #define MSG_INFO_PRINT_FILAMENT           "Extruded"
   #endif
 #endif
+
 #ifndef MSG_INFO_MIN_TEMP
   #define MSG_INFO_MIN_TEMP                   "Min Temp"
 #endif
diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp
index cdb75b870f..95d5c30700 100755
--- a/Marlin/ultralcd.cpp
+++ b/Marlin/ultralcd.cpp
@@ -1972,17 +1972,26 @@ void kill_screen(const char* lcd_msg) {
       static void lcd_info_stats_menu() {
         if (LCD_CLICKED) { lcd_goto_previous_menu(true); return; }
 
+        char buffer[21];
         printStatistics stats = print_job_timer.getStats();
+
+        START_SCREEN();                                                                                // 12345678901234567890
+        STATIC_ITEM(MSG_INFO_PRINT_COUNT ": ", false, false, itostr3left(stats.totalPrints));          // Print Count: 999
+        STATIC_ITEM(MSG_INFO_COMPLETED_PRINTS"  : ", false, false, itostr3left(stats.finishedPrints)); // Completed  : 666
+
         timestamp_t time(stats.printTime);
+        time.toString(buffer);
+        STATIC_ITEM(MSG_INFO_PRINT_TIME ": ", false, false);                                           // Total print Time:
+        STATIC_ITEM("", false, false, buffer);                                                         // 99y 364d 23h 59m 59s
 
-        char buffer[21];
+        time.timestamp = stats.longestPrint;
         time.toString(buffer);
+        STATIC_ITEM(MSG_INFO_PRINT_LONGEST ": ", false, false);                                        // Longest job time:
+        STATIC_ITEM("", false, false, buffer);                                                         // 99y 364d 23h 59m 59s
 
-        START_SCREEN();                                                                              // 12345678901234567890
-        STATIC_ITEM(MSG_INFO_PRINT_COUNT ": ", false, false, itostr3left(stats.totalPrints));        // Print Count: 999
-        STATIC_ITEM(MSG_INFO_COMPLETED_PRINTS": ", false, false, itostr3left(stats.finishedPrints)); // Completed  : 666
-        STATIC_ITEM(MSG_INFO_PRINT_TIME ": ", false, false);                                         // Total Time :
-        STATIC_ITEM("  ", false, false, buffer);                                                     //   12345d 12h 34m
+        sprintf_P(buffer, PSTR("%im"), stats.filamentUsed / 1000);
+        STATIC_ITEM(MSG_INFO_PRINT_FILAMENT ": ", false, false);                                       // Extruded total:
+        STATIC_ITEM("", false, false, buffer);                                                         // 125m
         END_SCREEN();
       }
     #endif // PRINTCOUNTER
-- 
GitLab