Browse Source

Patch up About Printer sub-menus

Scott Lahteine 8 years ago
parent
commit
51b7820686
2 changed files with 32 additions and 35 deletions
  1. 3
    0
      Marlin/language_en.h
  2. 29
    35
      Marlin/ultralcd.cpp

+ 3
- 0
Marlin/language_en.h View File

523
 #ifndef MSG_INFO_MENU
523
 #ifndef MSG_INFO_MENU
524
   #define MSG_INFO_MENU                       "About Printer"
524
   #define MSG_INFO_MENU                       "About Printer"
525
 #endif
525
 #endif
526
+#ifndef MSG_INFO_PRINTER_MENU
527
+  #define MSG_INFO_PRINTER_MENU               "Printer Info"
528
+#endif
526
 #ifndef MSG_INFO_STATS_MENU
529
 #ifndef MSG_INFO_STATS_MENU
527
   #define MSG_INFO_STATS_MENU                 "Printer Stats"
530
   #define MSG_INFO_STATS_MENU                 "Printer Stats"
528
 #endif
531
 #endif

+ 29
- 35
Marlin/ultralcd.cpp View File

271
     } \
271
     } \
272
     _menuItemNr++
272
     _menuItemNr++
273
 
273
 
274
-  // Same as STATIC_ITEM, but can display variables. Do not use for text strings.
275
-  #define STATIC_ITEM_VAR(label, args...) \
276
-    if (_menuItemNr == _lineNr) { \
277
-      if (encoderLine == _menuItemNr && _menuItemNr < LCD_HEIGHT - 1) \
278
-        encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; \
279
-      if (lcdDrawUpdate) \
280
-        lcd_implementation_drawmenu_static(_drawLineNr, label, ## args); \
281
-    } \
282
-    _menuItemNr++
283
-
284
   #if ENABLED(ENCODER_RATE_MULTIPLIER)
274
   #if ENABLED(ENCODER_RATE_MULTIPLIER)
285
 
275
 
286
     //#define ENCODER_RATE_MULTIPLIER_DEBUG  // If defined, output the encoder steps per second value
276
     //#define ENCODER_RATE_MULTIPLIER_DEBUG  // If defined, output the encoder steps per second value
1914
   #endif //SDSUPPORT
1904
   #endif //SDSUPPORT
1915
 
1905
 
1916
   #if ENABLED(LCD_INFO_MENU)
1906
   #if ENABLED(LCD_INFO_MENU)
1907
+
1917
     #if ENABLED(PRINTCOUNTER)
1908
     #if ENABLED(PRINTCOUNTER)
1918
       /**
1909
       /**
1919
        *
1910
        *
1920
-       * Printer Info > Stastics submenu
1911
+       * About Printer > Stastics submenu
1921
        *
1912
        *
1922
        */
1913
        */
1923
       static void lcd_info_stats_menu() {
1914
       static void lcd_info_stats_menu() {
1925
         print_job_counter.loadStats();
1916
         print_job_counter.loadStats();
1926
         printStatistics stats = print_job_counter.getStats();
1917
         printStatistics stats = print_job_counter.getStats();
1927
 
1918
 
1928
-        char totalPrints[18];
1929
-        itoa(stats.totalPrints, totalPrints, 10);
1930
-        char finishedPrints[18];
1931
-        itoa(stats.finishedPrints, finishedPrints, 10);
1932
-        char printTime[18];
1933
-        itoa(stats.printTime, printTime, 10);
1919
+        char printTime[6];
1920
+        sprintf(printTime, "%02d:%02d", stats.printTime / 60, stats.printTime % 60);
1934
 
1921
 
1935
         if (LCD_CLICKED) lcd_goto_previous_menu(true);
1922
         if (LCD_CLICKED) lcd_goto_previous_menu(true);
1936
         START_MENU();
1923
         START_MENU();
1937
-        STATIC_ITEM(MSG_INFO_TOTAL_PRINTS ": ");    // Total Prints:
1938
-        STATIC_ITEM_VAR(totalPrints);               // 999
1939
-        STATIC_ITEM(MSG_INFO_FINISHED_PRINTS ": "); // Finished Prints:
1940
-        STATIC_ITEM_VAR(finishedPrints);            // 666
1941
-        STATIC_ITEM(MSG_INFO_PRINT_TIME ": ");      // Total Print Time:
1942
-        STATIC_ITEM_VAR(printTime);                 // 123456
1924
+        STATIC_ITEM(MSG_INFO_TOTAL_PRINTS ": ", itostr3left(stats.totalPrints));       // Total Prints: 999
1925
+        STATIC_ITEM(MSG_INFO_FINISHED_PRINTS ": ", itostr3left(stats.finishedPrints)); // Finished Prints: 666
1926
+        STATIC_ITEM(MSG_INFO_PRINT_TIME ": ", printTime);                              // Total Print Time: 123456
1943
         END_MENU();
1927
         END_MENU();
1944
       }
1928
       }
1945
-    #endif
1946
-  
1929
+    #endif // PRINTCOUNTER
1930
+
1947
     /**
1931
     /**
1948
      *
1932
      *
1949
-     * Printer Info > Thermistors
1933
+     * About Printer > Thermistors
1950
      *
1934
      *
1951
      */
1935
      */
1952
     static void lcd_info_thermistors_menu() {
1936
     static void lcd_info_thermistors_menu() {
1984
         STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_3_MINTEMP));
1968
         STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_3_MINTEMP));
1985
         STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_3_MAXTEMP));
1969
         STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_3_MAXTEMP));
1986
       #endif
1970
       #endif
1987
-    
1971
+
1988
       #if TEMP_SENSOR_BED != 0
1972
       #if TEMP_SENSOR_BED != 0
1989
         #undef THERMISTOR_ID
1973
         #undef THERMISTOR_ID
1990
         #define THERMISTOR_ID TEMP_SENSOR_BED
1974
         #define THERMISTOR_ID TEMP_SENSOR_BED
1998
 
1982
 
1999
     /**
1983
     /**
2000
      *
1984
      *
2001
-     * Printer Info > Board Info
1985
+     * About Printer > Board Info
2002
      *
1986
      *
2003
      */
1987
      */
2004
     static void lcd_info_board_menu() {
1988
     static void lcd_info_board_menu() {
2019
 
2003
 
2020
     /**
2004
     /**
2021
      *
2005
      *
2022
-     * "Printer Info" submenu
2006
+     * About Printer > Printer Info
2023
      *
2007
      *
2024
      */
2008
      */
2025
-    static void lcd_info_menu() {
2009
+    static void lcd_info_printer_menu() {
2010
+      if (LCD_CLICKED) lcd_goto_previous_menu(true);
2026
       START_MENU();
2011
       START_MENU();
2027
-      MENU_ITEM(back, MSG_INFO_MENU);
2028
       STATIC_ITEM(MSG_MARLIN);                                   // Marlin
2012
       STATIC_ITEM(MSG_MARLIN);                                   // Marlin
2029
       STATIC_ITEM(SHORT_BUILD_VERSION);                          // x.x.x-Branch
2013
       STATIC_ITEM(SHORT_BUILD_VERSION);                          // x.x.x-Branch
2030
       STATIC_ITEM(STRING_DISTRIBUTION_DATE);                     // YYYY-MM-DD HH:MM
2014
       STATIC_ITEM(STRING_DISTRIBUTION_DATE);                     // YYYY-MM-DD HH:MM
2031
       STATIC_ITEM(MACHINE_NAME);                                 // My3DPrinter
2015
       STATIC_ITEM(MACHINE_NAME);                                 // My3DPrinter
2032
       STATIC_ITEM(WEBSITE_URL);                                  // www.my3dprinter.com
2016
       STATIC_ITEM(WEBSITE_URL);                                  // www.my3dprinter.com
2033
       STATIC_ITEM(MSG_INFO_EXTRUDERS ": " STRINGIFY(EXTRUDERS)); // Extruders: 2
2017
       STATIC_ITEM(MSG_INFO_EXTRUDERS ": " STRINGIFY(EXTRUDERS)); // Extruders: 2
2018
+      END_MENU();
2019
+    }
2034
 
2020
 
2035
-      MENU_ITEM(submenu, MSG_INFO_BOARD_MENU, lcd_info_board_menu);            // Board Info ->
2036
-      MENU_ITEM(submenu, MSG_INFO_THERMISTOR_MENU, lcd_info_thermistors_menu); // Thermistors ->
2021
+    /**
2022
+     *
2023
+     * "About Printer" submenu
2024
+     *
2025
+     */
2026
+    static void lcd_info_menu() {
2027
+      START_MENU();
2028
+      MENU_ITEM(back, MSG_MAIN);
2029
+      MENU_ITEM(submenu, MSG_INFO_PRINTER_MENU, lcd_info_printer_menu);        // Printer Info >
2030
+      MENU_ITEM(submenu, MSG_INFO_BOARD_MENU, lcd_info_board_menu);            // Board Info >
2031
+      MENU_ITEM(submenu, MSG_INFO_THERMISTOR_MENU, lcd_info_thermistors_menu); // Thermistors >
2037
       #if ENABLED(PRINTCOUNTER)
2032
       #if ENABLED(PRINTCOUNTER)
2038
-        MENU_ITEM(submenu, MSG_INFO_STATS_MENU, lcd_info_stats_menu);          // Printer Statistics ->
2033
+        MENU_ITEM(submenu, MSG_INFO_STATS_MENU, lcd_info_stats_menu);          // Printer Statistics >
2039
       #endif
2034
       #endif
2040
       END_MENU();
2035
       END_MENU();
2041
     }
2036
     }
2744
 
2739
 
2745
 // Convert unsigned int to string with 12 format
2740
 // Convert unsigned int to string with 12 format
2746
 char* itostr2(const uint8_t& x) {
2741
 char* itostr2(const uint8_t& x) {
2747
-  //sprintf(conv,"%5.1f",x);
2748
   int xx = x;
2742
   int xx = x;
2749
   conv[0] = DIGIMOD(xx / 10);
2743
   conv[0] = DIGIMOD(xx / 10);
2750
   conv[1] = DIGIMOD(xx);
2744
   conv[1] = DIGIMOD(xx);

Loading…
Cancel
Save