Use STATIC_ITEM for LCD message display

master
Scott Lahteine 9 years ago
parent 43ff0ce35f
commit 982f10e6a0

@ -473,14 +473,14 @@ static void lcd_implementation_mark_as_selected(uint8_t row, bool isSelected) {
u8g.setPrintPos((START_ROW) * (DOG_CHAR_WIDTH), (row + 1) * (DOG_CHAR_HEIGHT)); u8g.setPrintPos((START_ROW) * (DOG_CHAR_WIDTH), (row + 1) * (DOG_CHAR_HEIGHT));
} }
#if ENABLED(LCD_INFO_MENU) #if ENABLED(LCD_INFO_MENU) || ENABLED(FILAMENT_CHANGE_FEATURE)
static void lcd_implementation_drawmenu_static(uint8_t row, const char* pstr, const char* valstr=NULL, bool center=false) { static void lcd_implementation_drawmenu_static(uint8_t row, const char* pstr, const char* valstr=NULL, bool center=true) {
char c; char c;
int8_t n = LCD_WIDTH; int8_t n = LCD_WIDTH;
u8g.setPrintPos(0, (row + 1) * (DOG_CHAR_HEIGHT)); u8g.setPrintPos(0, (row + 1) * (DOG_CHAR_HEIGHT));
u8g.setColorIndex(1); // normal text u8g.setColorIndex(1); // normal text
if (center) { if (center && !valstr) {
int8_t pad = (LCD_WIDTH - lcd_strlen_P(pstr)) / 2; int8_t pad = (LCD_WIDTH - lcd_strlen_P(pstr)) / 2;
while (--pad >= 0) { lcd_print(' '); n--; } while (--pad >= 0) { lcd_print(' '); n--; }
} }
@ -495,10 +495,9 @@ static void lcd_implementation_mark_as_selected(uint8_t row, bool isSelected) {
while (n-- > 0) lcd_print(' '); while (n-- > 0) lcd_print(' ');
} }
#endif // LCD_INFO_MENU #endif // LCD_INFO_MENU || FILAMENT_CHANGE_FEATURE
static void lcd_implementation_drawmenu_generic(bool isSelected, uint8_t row, const char* pstr, char pre_char, char post_char) { static void lcd_implementation_drawmenu_generic(bool isSelected, uint8_t row, const char* pstr, char pre_char, char post_char) {
UNUSED(pstr);
UNUSED(pre_char); UNUSED(pre_char);
char c; char c;

@ -2048,9 +2048,6 @@ static void lcd_status_screen() {
#if ENABLED(FILAMENT_CHANGE_FEATURE) #if ENABLED(FILAMENT_CHANGE_FEATURE)
static void lcd_filament_change_nothing() {
}
static void lcd_filament_change_resume_print() { static void lcd_filament_change_resume_print() {
filament_change_menu_response = FILAMENT_CHANGE_RESPONSE_RESUME_PRINT; filament_change_menu_response = FILAMENT_CHANGE_RESPONSE_RESUME_PRINT;
lcdDrawUpdate = 2; lcdDrawUpdate = 2;
@ -2063,7 +2060,9 @@ static void lcd_status_screen() {
static void lcd_filament_change_option_menu() { static void lcd_filament_change_option_menu() {
START_MENU(); START_MENU();
MENU_ITEM(function, MSG_FILAMENT_CHANGE_OPTION_HEADER, lcd_filament_change_nothing); #if LCD_HEIGHT > 2
STATIC_ITEM(MSG_FILAMENT_CHANGE_OPTION_HEADER);
#endif
MENU_ITEM(function, MSG_FILAMENT_CHANGE_OPTION_RESUME, lcd_filament_change_resume_print); MENU_ITEM(function, MSG_FILAMENT_CHANGE_OPTION_RESUME, lcd_filament_change_resume_print);
MENU_ITEM(function, MSG_FILAMENT_CHANGE_OPTION_EXTRUDE, lcd_filament_change_extrude_more); MENU_ITEM(function, MSG_FILAMENT_CHANGE_OPTION_EXTRUDE, lcd_filament_change_extrude_more);
END_MENU(); END_MENU();
@ -2071,55 +2070,79 @@ static void lcd_status_screen() {
static void lcd_filament_change_init_message() { static void lcd_filament_change_init_message() {
START_MENU(); START_MENU();
MENU_ITEM(function, MSG_FILAMENT_CHANGE_HEADER, lcd_filament_change_nothing); STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER);
MENU_ITEM(function, MSG_FILAMENT_CHANGE_INIT_1, lcd_filament_change_nothing); STATIC_ITEM(MSG_FILAMENT_CHANGE_INIT_1);
MENU_ITEM(function, MSG_FILAMENT_CHANGE_INIT_2, lcd_filament_change_nothing); #ifdef MSG_FILAMENT_CHANGE_INIT_2
MENU_ITEM(function, MSG_FILAMENT_CHANGE_INIT_3, lcd_filament_change_nothing); STATIC_ITEM(MSG_FILAMENT_CHANGE_INIT_2);
#endif
#ifdef MSG_FILAMENT_CHANGE_INIT_3
STATIC_ITEM(MSG_FILAMENT_CHANGE_INIT_3);
#endif
END_MENU(); END_MENU();
} }
static void lcd_filament_change_unload_message() { static void lcd_filament_change_unload_message() {
START_MENU(); START_MENU();
MENU_ITEM(function, MSG_FILAMENT_CHANGE_HEADER, lcd_filament_change_nothing); STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER);
MENU_ITEM(function, MSG_FILAMENT_CHANGE_UNLOAD_1, lcd_filament_change_nothing); STATIC_ITEM(MSG_FILAMENT_CHANGE_UNLOAD_1);
MENU_ITEM(function, MSG_FILAMENT_CHANGE_UNLOAD_2, lcd_filament_change_nothing); #ifdef MSG_FILAMENT_CHANGE_UNLOAD_2
MENU_ITEM(function, MSG_FILAMENT_CHANGE_UNLOAD_3, lcd_filament_change_nothing); STATIC_ITEM(MSG_FILAMENT_CHANGE_UNLOAD_2);
#endif
#ifdef MSG_FILAMENT_CHANGE_UNLOAD_3
STATIC_ITEM(MSG_FILAMENT_CHANGE_UNLOAD_3);
#endif
END_MENU(); END_MENU();
} }
static void lcd_filament_change_insert_message() { static void lcd_filament_change_insert_message() {
START_MENU(); START_MENU();
MENU_ITEM(function, MSG_FILAMENT_CHANGE_HEADER, lcd_filament_change_nothing); STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER);
MENU_ITEM(function, MSG_FILAMENT_CHANGE_INSERT_1, lcd_filament_change_nothing); STATIC_ITEM(MSG_FILAMENT_CHANGE_INSERT_1);
MENU_ITEM(function, MSG_FILAMENT_CHANGE_INSERT_2, lcd_filament_change_nothing); #ifdef MSG_FILAMENT_CHANGE_INSERT_2
MENU_ITEM(function, MSG_FILAMENT_CHANGE_INSERT_3, lcd_filament_change_nothing); STATIC_ITEM(MSG_FILAMENT_CHANGE_INSERT_2);
#endif
#ifdef MSG_FILAMENT_CHANGE_INSERT_3
STATIC_ITEM(MSG_FILAMENT_CHANGE_INSERT_3);
#endif
END_MENU(); END_MENU();
} }
static void lcd_filament_change_load_message() { static void lcd_filament_change_load_message() {
START_MENU(); START_MENU();
MENU_ITEM(function, MSG_FILAMENT_CHANGE_HEADER, lcd_filament_change_nothing); STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER);
MENU_ITEM(function, MSG_FILAMENT_CHANGE_LOAD_1, lcd_filament_change_nothing); STATIC_ITEM(MSG_FILAMENT_CHANGE_LOAD_1);
MENU_ITEM(function, MSG_FILAMENT_CHANGE_LOAD_2, lcd_filament_change_nothing); #ifdef MSG_FILAMENT_CHANGE_LOAD_2
MENU_ITEM(function, MSG_FILAMENT_CHANGE_LOAD_3, lcd_filament_change_nothing); STATIC_ITEM(MSG_FILAMENT_CHANGE_LOAD_2);
#endif
#ifdef MSG_FILAMENT_CHANGE_LOAD_3
STATIC_ITEM(MSG_FILAMENT_CHANGE_LOAD_3);
#endif
END_MENU(); END_MENU();
} }
static void lcd_filament_change_extrude_message() { static void lcd_filament_change_extrude_message() {
START_MENU(); START_MENU();
MENU_ITEM(function, MSG_FILAMENT_CHANGE_HEADER, lcd_filament_change_nothing); STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER);
MENU_ITEM(function, MSG_FILAMENT_CHANGE_EXTRUDE_1, lcd_filament_change_nothing); STATIC_ITEM(MSG_FILAMENT_CHANGE_EXTRUDE_1);
MENU_ITEM(function, MSG_FILAMENT_CHANGE_EXTRUDE_2, lcd_filament_change_nothing); #ifdef MSG_FILAMENT_CHANGE_EXTRUDE_2
MENU_ITEM(function, MSG_FILAMENT_CHANGE_EXTRUDE_3, lcd_filament_change_nothing); STATIC_ITEM(MSG_FILAMENT_CHANGE_EXTRUDE_2);
#endif
#ifdef MSG_FILAMENT_CHANGE_EXTRUDE_3
STATIC_ITEM(MSG_FILAMENT_CHANGE_EXTRUDE_3);
#endif
END_MENU(); END_MENU();
} }
static void lcd_filament_change_resume_message() { static void lcd_filament_change_resume_message() {
START_MENU(); START_MENU();
MENU_ITEM(function, MSG_FILAMENT_CHANGE_HEADER, lcd_filament_change_nothing); STATIC_ITEM(MSG_FILAMENT_CHANGE_HEADER);
MENU_ITEM(function, MSG_FILAMENT_CHANGE_RESUME_1, lcd_filament_change_nothing); STATIC_ITEM(MSG_FILAMENT_CHANGE_RESUME_1);
MENU_ITEM(function, MSG_FILAMENT_CHANGE_RESUME_2, lcd_filament_change_nothing); #ifdef MSG_FILAMENT_CHANGE_RESUME_2
MENU_ITEM(function, MSG_FILAMENT_CHANGE_RESUME_3, lcd_filament_change_nothing); STATIC_ITEM(MSG_FILAMENT_CHANGE_RESUME_2);
#endif
#ifdef MSG_FILAMENT_CHANGE_RESUME_3
STATIC_ITEM(MSG_FILAMENT_CHANGE_RESUME_3);
#endif
END_MENU(); END_MENU();
} }

@ -815,13 +815,13 @@ static void lcd_implementation_status_screen() {
lcd_print(lcd_status_message); lcd_print(lcd_status_message);
} }
#if ENABLED(LCD_INFO_MENU) #if ENABLED(LCD_INFO_MENU) || ENABLED(FILAMENT_CHANGE_FEATURE)
static void lcd_implementation_drawmenu_static(uint8_t row, const char* pstr, const char *valstr=NULL, bool center=true) { static void lcd_implementation_drawmenu_static(uint8_t row, const char* pstr, const char *valstr=NULL, bool center=true) {
char c; char c;
int8_t n = LCD_WIDTH; int8_t n = LCD_WIDTH;
lcd.setCursor(0, row); lcd.setCursor(0, row);
if (center) { if (center && !valstr) {
int8_t pad = (LCD_WIDTH - lcd_strlen_P(pstr)) / 2; int8_t pad = (LCD_WIDTH - lcd_strlen_P(pstr)) / 2;
while (--pad >= 0) { lcd.print(' '); n--; } while (--pad >= 0) { lcd.print(' '); n--; }
} }
@ -836,7 +836,7 @@ static void lcd_implementation_status_screen() {
while (n-- > 0) lcd.print(' '); while (n-- > 0) lcd.print(' ');
} }
#endif // LCD_INFO_MENU #endif // LCD_INFO_MENU || FILAMENT_CHANGE_FEATURE
static void lcd_implementation_drawmenu_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char post_char) { static void lcd_implementation_drawmenu_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char post_char) {
char c; char c;

Loading…
Cancel
Save