From ba5910ab6cc2ff16b0ec487934d1a4307148dda5 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 21 May 2017 12:35:06 -0500 Subject: [PATCH 1/3] Constrain LCD status message rendering --- Marlin/ultralcd_impl_DOGM.h | 6 ++++-- Marlin/ultralcd_impl_HD44780.h | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Marlin/ultralcd_impl_DOGM.h b/Marlin/ultralcd_impl_DOGM.h index 8664c64b8..f37c7b18b 100644 --- a/Marlin/ultralcd_impl_DOGM.h +++ b/Marlin/ultralcd_impl_DOGM.h @@ -634,7 +634,8 @@ static void lcd_implementation_status_screen() { #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) if (PENDING(millis(), previous_lcd_status_ms + 5000UL)) { //Display both Status message line and Filament display on the last line - lcd_print(lcd_status_message); + const char *str = lcd_status_message; + for (uint8_t i = 0; char c = str[i] && i < LCD_WIDTH; ++i) lcd_print(c); } else { lcd_printPGM(PSTR(LCD_STR_FILAM_DIA)); @@ -646,7 +647,8 @@ static void lcd_implementation_status_screen() { u8g.print('%'); } #else - lcd_print(lcd_status_message); + const char *str = lcd_status_message; + for (uint8_t i = 0; char c = str[i] && i < LCD_WIDTH; ++i) lcd_print(c); #endif } } diff --git a/Marlin/ultralcd_impl_HD44780.h b/Marlin/ultralcd_impl_HD44780.h index 0f8e03493..eef964e8d 100644 --- a/Marlin/ultralcd_impl_HD44780.h +++ b/Marlin/ultralcd_impl_HD44780.h @@ -795,7 +795,8 @@ static void lcd_implementation_status_screen() { #endif // FILAMENT_LCD_DISPLAY && SDSUPPORT - lcd_print(lcd_status_message); + const char *str = lcd_status_message; + for (uint8_t i = 0; char c = str[i] && i < LCD_WIDTH; ++i) lcd_print(c); } #if ENABLED(ULTIPANEL) From 76af9ac7c568187da21ae204bc987bc80d5f9452 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 21 May 2017 12:51:58 -0500 Subject: [PATCH 2/3] tweaks --- Marlin/ultralcd_impl_DOGM.h | 8 ++++++-- Marlin/ultralcd_impl_HD44780.h | 8 +++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Marlin/ultralcd_impl_DOGM.h b/Marlin/ultralcd_impl_DOGM.h index f37c7b18b..b4ee92c5f 100644 --- a/Marlin/ultralcd_impl_DOGM.h +++ b/Marlin/ultralcd_impl_DOGM.h @@ -635,7 +635,9 @@ static void lcd_implementation_status_screen() { #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) if (PENDING(millis(), previous_lcd_status_ms + 5000UL)) { //Display both Status message line and Filament display on the last line const char *str = lcd_status_message; - for (uint8_t i = 0; char c = str[i] && i < LCD_WIDTH; ++i) lcd_print(c); + uint8_t i = LCD_WIDTH; + char c; + while (i-- && (c = *str++)) lcd_print(c); } else { lcd_printPGM(PSTR(LCD_STR_FILAM_DIA)); @@ -648,7 +650,9 @@ static void lcd_implementation_status_screen() { } #else const char *str = lcd_status_message; - for (uint8_t i = 0; char c = str[i] && i < LCD_WIDTH; ++i) lcd_print(c); + uint8_t i = LCD_WIDTH; + char c; + while (i-- && (c = *str++)) lcd_print(c); #endif } } diff --git a/Marlin/ultralcd_impl_HD44780.h b/Marlin/ultralcd_impl_HD44780.h index eef964e8d..cbad9698e 100644 --- a/Marlin/ultralcd_impl_HD44780.h +++ b/Marlin/ultralcd_impl_HD44780.h @@ -386,10 +386,10 @@ void lcd_printPGM(const char *str) { } void lcd_print(const char* const str) { - for (uint8_t i = 0; char c = str[i]; ++i) charset_mapper(c); + for (uint8_t i = 0; const char c = str[i]; ++i) charset_mapper(c); } -void lcd_print(char c) { charset_mapper(c); } +void lcd_print(const char c) { charset_mapper(c); } #if ENABLED(SHOW_BOOTSCREEN) @@ -796,7 +796,9 @@ static void lcd_implementation_status_screen() { #endif // FILAMENT_LCD_DISPLAY && SDSUPPORT const char *str = lcd_status_message; - for (uint8_t i = 0; char c = str[i] && i < LCD_WIDTH; ++i) lcd_print(c); + uint8_t i = LCD_WIDTH; + char c; + while (i-- && (c = *str++)) lcd_print(c); } #if ENABLED(ULTIPANEL) From 5e8892d6b5eba32496b305418f9ba182e246e126 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 21 May 2017 12:52:44 -0500 Subject: [PATCH 3/3] Show Restore Failsafe item with EEPROM off --- Marlin/ultralcd.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 7edbdc519..7edb0fef5 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -2507,9 +2507,12 @@ void kill_screen(const char* lcd_msg) { #if ENABLED(EEPROM_SETTINGS) MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings); MENU_ITEM(function, MSG_LOAD_EEPROM, lcd_load_settings); - MENU_ITEM(function, MSG_RESTORE_FAILSAFE, lcd_factory_settings); + #endif + MENU_ITEM(function, MSG_RESTORE_FAILSAFE, lcd_factory_settings); + #if ENABLED(EEPROM_SETTINGS) MENU_ITEM(gcode, MSG_INIT_EEPROM, PSTR("M502\nM500")); // TODO: Add "Are You Sure?" step #endif + END_MENU(); }