|
@@ -379,24 +379,27 @@ void lcd_implementation_drawedit(const char* pstr, char* value) {
|
379
|
379
|
uint8_t lcd_width = LCD_WIDTH;
|
380
|
380
|
uint8_t char_width = DOG_CHAR_WIDTH;
|
381
|
381
|
|
382
|
|
-#ifdef USE_BIG_EDIT_FONT
|
383
|
|
- if (strlen_P(pstr) <= LCD_WIDTH_EDIT - 1) {
|
384
|
|
- u8g.setFont(FONT_MENU_EDIT);
|
385
|
|
- lcd_width = LCD_WIDTH_EDIT + 1;
|
386
|
|
- char_width = DOG_CHAR_WIDTH_EDIT;
|
387
|
|
- if (strlen_P(pstr) >= LCD_WIDTH_EDIT - strlen(value)) rows = 2;
|
388
|
|
- }
|
389
|
|
- else {
|
390
|
|
- u8g.setFont(FONT_MENU);
|
391
|
|
- }
|
392
|
|
-#endif
|
|
382
|
+ #ifdef USE_BIG_EDIT_FONT
|
|
383
|
+ if (strlen_P(pstr) <= LCD_WIDTH_EDIT - 1) {
|
|
384
|
+ u8g.setFont(FONT_MENU_EDIT);
|
|
385
|
+ lcd_width = LCD_WIDTH_EDIT + 1;
|
|
386
|
+ char_width = DOG_CHAR_WIDTH_EDIT;
|
|
387
|
+ if (strlen_P(pstr) >= LCD_WIDTH_EDIT - strlen(value)) rows = 2;
|
|
388
|
+ }
|
|
389
|
+ else {
|
|
390
|
+ u8g.setFont(FONT_MENU);
|
|
391
|
+ }
|
|
392
|
+ #endif
|
|
393
|
+
|
|
394
|
+ if (strlen_P(pstr) > LCD_WIDTH - 2 - strlen(value)) rows = 2;
|
393
|
395
|
|
394
|
|
- if ( strlen_P(pstr) > LCD_WIDTH - 2 - strlen(value) ) rows = 2;
|
|
396
|
+ const float kHalfChar = DOG_CHAR_HEIGHT_EDIT / 2;
|
|
397
|
+ float rowHeight = u8g.getHeight() / (rows + 1); // 1/(rows+1) = 1/2 or 1/3
|
395
|
398
|
|
396
|
|
- u8g.setPrintPos( 0, u8g.getHeight() * 1/(1+rows) + DOG_CHAR_HEIGHT_EDIT/2); //1/(1+rows) = 1/2 or 1/3
|
|
399
|
+ u8g.setPrintPos(0, rowHeight + kHalfChar);
|
397
|
400
|
lcd_printPGM(pstr);
|
398
|
401
|
u8g.print(':');
|
399
|
|
- 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
|
|
402
|
+ u8g.setPrintPos((lcd_width-1-strlen(value)) * char_width, rows * rowHeight + kHalfChar);
|
400
|
403
|
u8g.print(value);
|
401
|
404
|
}
|
402
|
405
|
|