From d2c547c407f72f55a855bc82d30721549d27d42f Mon Sep 17 00:00:00 2001 From: mfeherpataky Date: Mon, 11 Feb 2013 23:25:24 +0100 Subject: [PATCH 1/2] Update Marlin/ultralcd_implementation_hitachi_HD44780.h Fix to a minor bug with hardcoded LCD_WIDTH that draws edited values outside of the 16 characters width LCDs. --- Marlin/ultralcd_implementation_hitachi_HD44780.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/ultralcd_implementation_hitachi_HD44780.h b/Marlin/ultralcd_implementation_hitachi_HD44780.h index 58d75bd39..dc25e2018 100644 --- a/Marlin/ultralcd_implementation_hitachi_HD44780.h +++ b/Marlin/ultralcd_implementation_hitachi_HD44780.h @@ -366,7 +366,7 @@ void lcd_implementation_drawedit(const char* pstr, char* value) lcd.setCursor(1, 1); lcd_printPGM(pstr); lcd.print(':'); - lcd.setCursor(19 - strlen(value), 1); + lcd.setCursor(LCD_WIDTH -1 - strlen(value), 1); lcd.print(value); } static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char* pstr, const char* filename, char* longFilename) From 71ddb8dc60ca48008772ef130c97b5d1aba1055e Mon Sep 17 00:00:00 2001 From: mfeherpataky Date: Tue, 12 Feb 2013 00:03:40 +0100 Subject: [PATCH 2/2] Update Marlin/ultralcd_implementation_hitachi_HD44780.h Use all available characters in narrow LCDs < 20 characters. --- .../ultralcd_implementation_hitachi_HD44780.h | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/Marlin/ultralcd_implementation_hitachi_HD44780.h b/Marlin/ultralcd_implementation_hitachi_HD44780.h index dc25e2018..428d449a1 100644 --- a/Marlin/ultralcd_implementation_hitachi_HD44780.h +++ b/Marlin/ultralcd_implementation_hitachi_HD44780.h @@ -297,7 +297,12 @@ static void lcd_implementation_status_screen() static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, char pre_char, char post_char) { char c; - uint8_t n = LCD_WIDTH - 1 - 2; + //Use all characters in narrow LCDs + #if LCD_WIDTH < 20 + uint8_t n = LCD_WIDTH - 1 - 1; + #else + uint8_t n = LCD_WIDTH - 1 - 2; + #endif lcd.setCursor(0, row); lcd.print(pre_char); while((c = pgm_read_byte(pstr)) != '\0') @@ -314,7 +319,12 @@ static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, c static void lcd_implementation_drawmenu_setting_edit_generic(uint8_t row, const char* pstr, char pre_char, char* data) { char c; - uint8_t n = LCD_WIDTH - 1 - 2 - strlen(data); + //Use all characters in narrow LCDs + #if LCD_WIDTH < 20 + uint8_t n = LCD_WIDTH - 1 - 1; + #else + uint8_t n = LCD_WIDTH - 1 - 2; + #endif lcd.setCursor(0, row); lcd.print(pre_char); while((c = pgm_read_byte(pstr)) != '\0') @@ -331,7 +341,12 @@ static void lcd_implementation_drawmenu_setting_edit_generic(uint8_t row, const static void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, const char* pstr, char pre_char, const char* data) { char c; - uint8_t n = LCD_WIDTH - 1 - 2 - strlen_P(data); + //Use all characters in narrow LCDs + #if LCD_WIDTH < 20 + uint8_t n = LCD_WIDTH - 1 - 1; + #else + uint8_t n = LCD_WIDTH - 1 - 2; + #endif lcd.setCursor(0, row); lcd.print(pre_char); while((c = pgm_read_byte(pstr)) != '\0') @@ -366,7 +381,11 @@ void lcd_implementation_drawedit(const char* pstr, char* value) lcd.setCursor(1, 1); lcd_printPGM(pstr); lcd.print(':'); - lcd.setCursor(LCD_WIDTH -1 - strlen(value), 1); + #if LCD_WIDTH < 20 + lcd.setCursor(LCD_WIDTH - strlen(value), 1); + #else + lcd.setCursor(LCD_WIDTH -1 - strlen(value), 1); + #endif lcd.print(value); } static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char* pstr, const char* filename, char* longFilename)