Browse Source

Use STATIC_ITEM for LCD message display

Scott Lahteine 8 years ago
parent
commit
982f10e6a0

+ 4
- 5
Marlin/dogm_lcd_implementation.h View File

473
   u8g.setPrintPos((START_ROW) * (DOG_CHAR_WIDTH), (row + 1) * (DOG_CHAR_HEIGHT));
473
   u8g.setPrintPos((START_ROW) * (DOG_CHAR_WIDTH), (row + 1) * (DOG_CHAR_HEIGHT));
474
 }
474
 }
475
 
475
 
476
-#if ENABLED(LCD_INFO_MENU)
476
+#if ENABLED(LCD_INFO_MENU) || ENABLED(FILAMENT_CHANGE_FEATURE)
477
 
477
 
478
-  static void lcd_implementation_drawmenu_static(uint8_t row, const char* pstr, const char* valstr=NULL, bool center=false) {
478
+  static void lcd_implementation_drawmenu_static(uint8_t row, const char* pstr, const char* valstr=NULL, bool center=true) {
479
     char c;
479
     char c;
480
     int8_t n = LCD_WIDTH;
480
     int8_t n = LCD_WIDTH;
481
     u8g.setPrintPos(0, (row + 1) * (DOG_CHAR_HEIGHT));
481
     u8g.setPrintPos(0, (row + 1) * (DOG_CHAR_HEIGHT));
482
     u8g.setColorIndex(1); // normal text
482
     u8g.setColorIndex(1); // normal text
483
-    if (center) {
483
+    if (center && !valstr) {
484
       int8_t pad = (LCD_WIDTH - lcd_strlen_P(pstr)) / 2;
484
       int8_t pad = (LCD_WIDTH - lcd_strlen_P(pstr)) / 2;
485
       while (--pad >= 0) { lcd_print(' '); n--; }
485
       while (--pad >= 0) { lcd_print(' '); n--; }
486
     }
486
     }
495
     while (n-- > 0) lcd_print(' ');
495
     while (n-- > 0) lcd_print(' ');
496
   }
496
   }
497
 
497
 
498
-#endif // LCD_INFO_MENU
498
+#endif // LCD_INFO_MENU || FILAMENT_CHANGE_FEATURE
499
 
499
 
500
 static void lcd_implementation_drawmenu_generic(bool isSelected, uint8_t row, const char* pstr, char pre_char, char post_char) {
500
 static void lcd_implementation_drawmenu_generic(bool isSelected, uint8_t row, const char* pstr, char pre_char, char post_char) {
501
-  UNUSED(pstr);
502
   UNUSED(pre_char);
501
   UNUSED(pre_char);
503
 
502
 
504
   char c;
503
   char c;

+ 51
- 28
Marlin/ultralcd.cpp View File

2048
 
2048
 
2049
   #if ENABLED(FILAMENT_CHANGE_FEATURE)
2049
   #if ENABLED(FILAMENT_CHANGE_FEATURE)
2050
 
2050
 
2051
-    static void lcd_filament_change_nothing() {
2052
-    }
2053
-    
2054
     static void lcd_filament_change_resume_print() {
2051
     static void lcd_filament_change_resume_print() {
2055
       filament_change_menu_response = FILAMENT_CHANGE_RESPONSE_RESUME_PRINT;
2052
       filament_change_menu_response = FILAMENT_CHANGE_RESPONSE_RESUME_PRINT;
2056
       lcdDrawUpdate = 2;
2053
       lcdDrawUpdate = 2;
2063
 
2060
 
2064
     static void lcd_filament_change_option_menu() {
2061
     static void lcd_filament_change_option_menu() {
2065
       START_MENU();
2062
       START_MENU();
2066
-      MENU_ITEM(function, MSG_FILAMENT_CHANGE_OPTION_HEADER, lcd_filament_change_nothing);
2063
+      #if LCD_HEIGHT > 2
2064
+        STATIC_ITEM(MSG_FILAMENT_CHANGE_OPTION_HEADER);
2065
+      #endif
2067
       MENU_ITEM(function, MSG_FILAMENT_CHANGE_OPTION_RESUME, lcd_filament_change_resume_print);
2066
       MENU_ITEM(function, MSG_FILAMENT_CHANGE_OPTION_RESUME, lcd_filament_change_resume_print);
2068
       MENU_ITEM(function, MSG_FILAMENT_CHANGE_OPTION_EXTRUDE, lcd_filament_change_extrude_more);
2067
       MENU_ITEM(function, MSG_FILAMENT_CHANGE_OPTION_EXTRUDE, lcd_filament_change_extrude_more);
2069
       END_MENU();
2068
       END_MENU();
2071
 
2070
 
2072
     static void lcd_filament_change_init_message() {
2071
     static void lcd_filament_change_init_message() {
2073
       START_MENU();
2072
       START_MENU();
2074
-      MENU_ITEM(function, MSG_FILAMENT_CHANGE_HEADER, lcd_filament_change_nothing);
2075
-      MENU_ITEM(function, MSG_FILAMENT_CHANGE_INIT_1, lcd_filament_change_nothing);
2076
-      MENU_ITEM(function, MSG_FILAMENT_CHANGE_INIT_2, lcd_filament_change_nothing);
2077
-      MENU_ITEM(function, MSG_FILAMENT_CHANGE_INIT_3, lcd_filament_change_nothing);
2073
+      STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER);
2074
+      STATIC_ITEM(MSG_FILAMENT_CHANGE_INIT_1);
2075
+      #ifdef MSG_FILAMENT_CHANGE_INIT_2
2076
+        STATIC_ITEM(MSG_FILAMENT_CHANGE_INIT_2);
2077
+      #endif
2078
+      #ifdef MSG_FILAMENT_CHANGE_INIT_3
2079
+        STATIC_ITEM(MSG_FILAMENT_CHANGE_INIT_3);
2080
+      #endif
2078
       END_MENU();
2081
       END_MENU();
2079
     }
2082
     }
2080
 
2083
 
2081
     static void lcd_filament_change_unload_message() {
2084
     static void lcd_filament_change_unload_message() {
2082
       START_MENU();
2085
       START_MENU();
2083
-      MENU_ITEM(function, MSG_FILAMENT_CHANGE_HEADER, lcd_filament_change_nothing);
2084
-      MENU_ITEM(function, MSG_FILAMENT_CHANGE_UNLOAD_1, lcd_filament_change_nothing);
2085
-      MENU_ITEM(function, MSG_FILAMENT_CHANGE_UNLOAD_2, lcd_filament_change_nothing);
2086
-      MENU_ITEM(function, MSG_FILAMENT_CHANGE_UNLOAD_3, lcd_filament_change_nothing);
2086
+      STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER);
2087
+      STATIC_ITEM(MSG_FILAMENT_CHANGE_UNLOAD_1);
2088
+      #ifdef MSG_FILAMENT_CHANGE_UNLOAD_2
2089
+        STATIC_ITEM(MSG_FILAMENT_CHANGE_UNLOAD_2);
2090
+      #endif
2091
+      #ifdef MSG_FILAMENT_CHANGE_UNLOAD_3
2092
+        STATIC_ITEM(MSG_FILAMENT_CHANGE_UNLOAD_3);
2093
+      #endif
2087
       END_MENU();
2094
       END_MENU();
2088
     }
2095
     }
2089
 
2096
 
2090
     static void lcd_filament_change_insert_message() {
2097
     static void lcd_filament_change_insert_message() {
2091
       START_MENU();
2098
       START_MENU();
2092
-      MENU_ITEM(function, MSG_FILAMENT_CHANGE_HEADER, lcd_filament_change_nothing);
2093
-      MENU_ITEM(function, MSG_FILAMENT_CHANGE_INSERT_1, lcd_filament_change_nothing);
2094
-      MENU_ITEM(function, MSG_FILAMENT_CHANGE_INSERT_2, lcd_filament_change_nothing);
2095
-      MENU_ITEM(function, MSG_FILAMENT_CHANGE_INSERT_3, lcd_filament_change_nothing);
2099
+      STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER);
2100
+      STATIC_ITEM(MSG_FILAMENT_CHANGE_INSERT_1);
2101
+      #ifdef MSG_FILAMENT_CHANGE_INSERT_2
2102
+        STATIC_ITEM(MSG_FILAMENT_CHANGE_INSERT_2);
2103
+      #endif
2104
+      #ifdef MSG_FILAMENT_CHANGE_INSERT_3
2105
+        STATIC_ITEM(MSG_FILAMENT_CHANGE_INSERT_3);
2106
+      #endif
2096
       END_MENU();
2107
       END_MENU();
2097
     }
2108
     }
2098
 
2109
 
2099
     static void lcd_filament_change_load_message() {
2110
     static void lcd_filament_change_load_message() {
2100
       START_MENU();
2111
       START_MENU();
2101
-      MENU_ITEM(function, MSG_FILAMENT_CHANGE_HEADER, lcd_filament_change_nothing);
2102
-      MENU_ITEM(function, MSG_FILAMENT_CHANGE_LOAD_1, lcd_filament_change_nothing);
2103
-      MENU_ITEM(function, MSG_FILAMENT_CHANGE_LOAD_2, lcd_filament_change_nothing);
2104
-      MENU_ITEM(function, MSG_FILAMENT_CHANGE_LOAD_3, lcd_filament_change_nothing);
2112
+      STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER);
2113
+      STATIC_ITEM(MSG_FILAMENT_CHANGE_LOAD_1);
2114
+      #ifdef MSG_FILAMENT_CHANGE_LOAD_2
2115
+        STATIC_ITEM(MSG_FILAMENT_CHANGE_LOAD_2);
2116
+      #endif
2117
+      #ifdef MSG_FILAMENT_CHANGE_LOAD_3
2118
+        STATIC_ITEM(MSG_FILAMENT_CHANGE_LOAD_3);
2119
+      #endif
2105
       END_MENU();
2120
       END_MENU();
2106
     }
2121
     }
2107
 
2122
 
2108
     static void lcd_filament_change_extrude_message() {
2123
     static void lcd_filament_change_extrude_message() {
2109
       START_MENU();
2124
       START_MENU();
2110
-      MENU_ITEM(function, MSG_FILAMENT_CHANGE_HEADER, lcd_filament_change_nothing);
2111
-      MENU_ITEM(function, MSG_FILAMENT_CHANGE_EXTRUDE_1, lcd_filament_change_nothing);
2112
-      MENU_ITEM(function, MSG_FILAMENT_CHANGE_EXTRUDE_2, lcd_filament_change_nothing);
2113
-      MENU_ITEM(function, MSG_FILAMENT_CHANGE_EXTRUDE_3, lcd_filament_change_nothing);
2125
+      STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER);
2126
+      STATIC_ITEM(MSG_FILAMENT_CHANGE_EXTRUDE_1);
2127
+      #ifdef MSG_FILAMENT_CHANGE_EXTRUDE_2
2128
+        STATIC_ITEM(MSG_FILAMENT_CHANGE_EXTRUDE_2);
2129
+      #endif
2130
+      #ifdef MSG_FILAMENT_CHANGE_EXTRUDE_3
2131
+        STATIC_ITEM(MSG_FILAMENT_CHANGE_EXTRUDE_3);
2132
+      #endif
2114
       END_MENU();
2133
       END_MENU();
2115
     }
2134
     }
2116
 
2135
 
2117
     static void lcd_filament_change_resume_message() {
2136
     static void lcd_filament_change_resume_message() {
2118
       START_MENU();
2137
       START_MENU();
2119
-      MENU_ITEM(function, MSG_FILAMENT_CHANGE_HEADER, lcd_filament_change_nothing);
2120
-      MENU_ITEM(function, MSG_FILAMENT_CHANGE_RESUME_1, lcd_filament_change_nothing);
2121
-      MENU_ITEM(function, MSG_FILAMENT_CHANGE_RESUME_2, lcd_filament_change_nothing);
2122
-      MENU_ITEM(function, MSG_FILAMENT_CHANGE_RESUME_3, lcd_filament_change_nothing);
2138
+      STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER);
2139
+      STATIC_ITEM(MSG_FILAMENT_CHANGE_RESUME_1);
2140
+      #ifdef MSG_FILAMENT_CHANGE_RESUME_2
2141
+        STATIC_ITEM(MSG_FILAMENT_CHANGE_RESUME_2);
2142
+      #endif
2143
+      #ifdef MSG_FILAMENT_CHANGE_RESUME_3
2144
+        STATIC_ITEM(MSG_FILAMENT_CHANGE_RESUME_3);
2145
+      #endif
2123
       END_MENU();
2146
       END_MENU();
2124
     }
2147
     }
2125
   
2148
   

+ 3
- 3
Marlin/ultralcd_implementation_hitachi_HD44780.h View File

815
   lcd_print(lcd_status_message);
815
   lcd_print(lcd_status_message);
816
 }
816
 }
817
 
817
 
818
-#if ENABLED(LCD_INFO_MENU)
818
+#if ENABLED(LCD_INFO_MENU) || ENABLED(FILAMENT_CHANGE_FEATURE)
819
 
819
 
820
   static void lcd_implementation_drawmenu_static(uint8_t row, const char* pstr, const char *valstr=NULL, bool center=true) {
820
   static void lcd_implementation_drawmenu_static(uint8_t row, const char* pstr, const char *valstr=NULL, bool center=true) {
821
     char c;
821
     char c;
822
     int8_t n = LCD_WIDTH;
822
     int8_t n = LCD_WIDTH;
823
     lcd.setCursor(0, row);
823
     lcd.setCursor(0, row);
824
-    if (center) {
824
+    if (center && !valstr) {
825
       int8_t pad = (LCD_WIDTH - lcd_strlen_P(pstr)) / 2;
825
       int8_t pad = (LCD_WIDTH - lcd_strlen_P(pstr)) / 2;
826
       while (--pad >= 0) { lcd.print(' '); n--; }
826
       while (--pad >= 0) { lcd.print(' '); n--; }
827
     }
827
     }
836
     while (n-- > 0) lcd.print(' ');
836
     while (n-- > 0) lcd.print(' ');
837
   }
837
   }
838
 
838
 
839
-#endif // LCD_INFO_MENU
839
+#endif // LCD_INFO_MENU || FILAMENT_CHANGE_FEATURE
840
 
840
 
841
 static void lcd_implementation_drawmenu_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char post_char) {
841
 static void lcd_implementation_drawmenu_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char post_char) {
842
   char c;
842
   char c;

Loading…
Cancel
Save