Merge pull request #496 from MStohn/fix-16x2-lcd
Fix: Long menu entries (>14 or >18 chars) caused overrun in hitachi display implementation
This commit is contained in:
commit
34fb4831a2
@ -101,11 +101,11 @@ static void lcd_implementation_init()
|
|||||||
u8g.setRot90(); // Rotate screen by 90°
|
u8g.setRot90(); // Rotate screen by 90°
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef LCD_SCREEN_ROT_180;
|
#ifdef LCD_SCREEN_ROT_180
|
||||||
u8g.setRot180(); // Rotate screen by 180°
|
u8g.setRot180(); // Rotate screen by 180°
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef LCD_SCREEN_ROT_270;
|
#ifdef LCD_SCREEN_ROT_270
|
||||||
u8g.setRot270(); // Rotate screen by 270°
|
u8g.setRot270(); // Rotate screen by 270°
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -503,7 +503,7 @@ static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, c
|
|||||||
#endif
|
#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') && (n>0) )
|
||||||
{
|
{
|
||||||
lcd.print(c);
|
lcd.print(c);
|
||||||
pstr++;
|
pstr++;
|
||||||
@ -525,7 +525,7 @@ static void lcd_implementation_drawmenu_setting_edit_generic(uint8_t row, const
|
|||||||
#endif
|
#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') && (n>0) )
|
||||||
{
|
{
|
||||||
lcd.print(c);
|
lcd.print(c);
|
||||||
pstr++;
|
pstr++;
|
||||||
@ -547,7 +547,7 @@ static void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, cons
|
|||||||
#endif
|
#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') && (n>0) )
|
||||||
{
|
{
|
||||||
lcd.print(c);
|
lcd.print(c);
|
||||||
pstr++;
|
pstr++;
|
||||||
@ -617,7 +617,7 @@ static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char*
|
|||||||
filename = longFilename;
|
filename = longFilename;
|
||||||
longFilename[LCD_WIDTH-1] = '\0';
|
longFilename[LCD_WIDTH-1] = '\0';
|
||||||
}
|
}
|
||||||
while((c = *filename) != '\0')
|
while( ((c = *filename) != '\0') && (n>0) )
|
||||||
{
|
{
|
||||||
lcd.print(c);
|
lcd.print(c);
|
||||||
filename++;
|
filename++;
|
||||||
@ -637,7 +637,7 @@ static void lcd_implementation_drawmenu_sdfile(uint8_t row, const char* pstr, co
|
|||||||
filename = longFilename;
|
filename = longFilename;
|
||||||
longFilename[LCD_WIDTH-1] = '\0';
|
longFilename[LCD_WIDTH-1] = '\0';
|
||||||
}
|
}
|
||||||
while((c = *filename) != '\0')
|
while( ((c = *filename) != '\0') && (n>0) )
|
||||||
{
|
{
|
||||||
lcd.print(c);
|
lcd.print(c);
|
||||||
filename++;
|
filename++;
|
||||||
@ -658,7 +658,7 @@ static void lcd_implementation_drawmenu_sddirectory_selected(uint8_t row, const
|
|||||||
filename = longFilename;
|
filename = longFilename;
|
||||||
longFilename[LCD_WIDTH-2] = '\0';
|
longFilename[LCD_WIDTH-2] = '\0';
|
||||||
}
|
}
|
||||||
while((c = *filename) != '\0')
|
while( ((c = *filename) != '\0') && (n>0) )
|
||||||
{
|
{
|
||||||
lcd.print(c);
|
lcd.print(c);
|
||||||
filename++;
|
filename++;
|
||||||
@ -679,7 +679,7 @@ static void lcd_implementation_drawmenu_sddirectory(uint8_t row, const char* pst
|
|||||||
filename = longFilename;
|
filename = longFilename;
|
||||||
longFilename[LCD_WIDTH-2] = '\0';
|
longFilename[LCD_WIDTH-2] = '\0';
|
||||||
}
|
}
|
||||||
while((c = *filename) != '\0')
|
while( ((c = *filename) != '\0') && (n>0) )
|
||||||
{
|
{
|
||||||
lcd.print(c);
|
lcd.print(c);
|
||||||
filename++;
|
filename++;
|
||||||
|
Loading…
Reference in New Issue
Block a user