Merge pull request #1463 from thinkyhead/cleanup_recent_merge

Apply some cleanup for recent merge
This commit is contained in:
Scott Lahteine 2015-02-03 12:06:47 -08:00
commit b6ca50a2cc

View File

@ -379,7 +379,7 @@ void lcd_implementation_drawedit(const char* pstr, char* value) {
uint8_t lcd_width = LCD_WIDTH; uint8_t lcd_width = LCD_WIDTH;
uint8_t char_width = DOG_CHAR_WIDTH; uint8_t char_width = DOG_CHAR_WIDTH;
#ifdef USE_BIG_EDIT_FONT #ifdef USE_BIG_EDIT_FONT
if (strlen_P(pstr) <= LCD_WIDTH_EDIT - 1) { if (strlen_P(pstr) <= LCD_WIDTH_EDIT - 1) {
u8g.setFont(FONT_MENU_EDIT); u8g.setFont(FONT_MENU_EDIT);
lcd_width = LCD_WIDTH_EDIT + 1; lcd_width = LCD_WIDTH_EDIT + 1;
@ -389,14 +389,17 @@ void lcd_implementation_drawedit(const char* pstr, char* value) {
else { else {
u8g.setFont(FONT_MENU); u8g.setFont(FONT_MENU);
} }
#endif #endif
if ( strlen_P(pstr) > LCD_WIDTH - 2 - strlen(value) ) rows = 2; if (strlen_P(pstr) > LCD_WIDTH - 2 - strlen(value)) rows = 2;
u8g.setPrintPos( 0, u8g.getHeight() * 1/(1+rows) + DOG_CHAR_HEIGHT_EDIT/2); //1/(1+rows) = 1/2 or 1/3 const float kHalfChar = DOG_CHAR_HEIGHT_EDIT / 2;
float rowHeight = u8g.getHeight() / (rows + 1); // 1/(rows+1) = 1/2 or 1/3
u8g.setPrintPos(0, rowHeight + kHalfChar);
lcd_printPGM(pstr); lcd_printPGM(pstr);
u8g.print(':'); u8g.print(':');
u8g.setPrintPos((lcd_width-1-strlen(value))*char_width, u8g.getHeight()*rows/(1+rows) + DOG_CHAR_HEIGHT_EDIT/2); //rows/(1+rows) = 1/2 or 2/3 u8g.setPrintPos((lcd_width-1-strlen(value)) * char_width, rows * rowHeight + kHalfChar);
u8g.print(value); u8g.print(value);
} }