Update Marlin/ultralcd_implementation_hitachi_HD44780.h

Use all available characters in narrow LCDs < 20 characters.
This commit is contained in:
mfeherpataky 2013-02-12 00:03:40 +01:00
parent d2c547c407
commit 71ddb8dc60

View File

@ -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) static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, char pre_char, char post_char)
{ {
char c; char c;
//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; uint8_t n = LCD_WIDTH - 1 - 2;
#endif
lcd.setCursor(0, row); lcd.setCursor(0, row);
lcd.print(pre_char); lcd.print(pre_char);
while((c = pgm_read_byte(pstr)) != '\0') 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) static void lcd_implementation_drawmenu_setting_edit_generic(uint8_t row, const char* pstr, char pre_char, char* data)
{ {
char c; 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.setCursor(0, row);
lcd.print(pre_char); lcd.print(pre_char);
while((c = pgm_read_byte(pstr)) != '\0') 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) static void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, const char* pstr, char pre_char, const char* data)
{ {
char c; 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.setCursor(0, row);
lcd.print(pre_char); lcd.print(pre_char);
while((c = pgm_read_byte(pstr)) != '\0') 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.setCursor(1, 1);
lcd_printPGM(pstr); lcd_printPGM(pstr);
lcd.print(':'); lcd.print(':');
#if LCD_WIDTH < 20
lcd.setCursor(LCD_WIDTH - strlen(value), 1);
#else
lcd.setCursor(LCD_WIDTH -1 - strlen(value), 1); lcd.setCursor(LCD_WIDTH -1 - strlen(value), 1);
#endif
lcd.print(value); lcd.print(value);
} }
static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char* pstr, const char* filename, char* longFilename) static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char* pstr, const char* filename, char* longFilename)