Static menu items take an optional string, LJ by default

2.0.x
Scott Lahteine 8 years ago
parent fa9b2a925d
commit 439e78147d

@ -473,9 +473,11 @@ 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));
} }
static void lcd_implementation_drawmenu_static(uint8_t row, const char* pstr, bool center=true) { #if ENABLED(LCD_INFO_MENU)
static void lcd_implementation_drawmenu_static(uint8_t row, const char* pstr, const char* valstr=NULL, bool center=false) {
char c; char c;
uint8_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) {
@ -486,8 +488,14 @@ static void lcd_implementation_drawmenu_static(uint8_t row, const char* pstr, bo
n -= lcd_print(c); n -= lcd_print(c);
pstr++; pstr++;
} }
while (n--) lcd_print(' '); if (valstr) {
} lcd_print(valstr);
n -= lcd_strlen(valstr);
}
while (n-- > 0) lcd_print(' ');
}
#endif // LCD_INFO_MENU
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(pstr);

@ -815,9 +815,11 @@ static void lcd_implementation_status_screen() {
lcd_print(lcd_status_message); lcd_print(lcd_status_message);
} }
static void lcd_implementation_drawmenu_static(uint8_t row, const char* pstr, bool center=true) { #if ENABLED(LCD_INFO_MENU)
static void lcd_implementation_drawmenu_static(uint8_t row, const char* pstr, const char *valstr=NULL, bool center=true) {
char c; char c;
uint8_t n = LCD_WIDTH; int8_t n = LCD_WIDTH;
lcd.setCursor(0, row); lcd.setCursor(0, row);
if (center) { if (center) {
int8_t pad = (LCD_WIDTH - lcd_strlen_P(pstr)) / 2; int8_t pad = (LCD_WIDTH - lcd_strlen_P(pstr)) / 2;
@ -827,8 +829,14 @@ static void lcd_implementation_drawmenu_static(uint8_t row, const char* pstr, bo
n -= lcd_print(c); n -= lcd_print(c);
pstr++; pstr++;
} }
while (n--) lcd.print(' '); if (valstr) {
} lcd_print(valstr);
n -= lcd_strlen(valstr);
}
while (n-- > 0) lcd.print(' ');
}
#endif // LCD_INFO_MENU
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