|
@@ -224,7 +224,18 @@ uint8_t menu_item_gcode_P(const char* str, const char* str_gcode)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-const char menu_fmt_int3[] PROGMEM = "%c%S:\x1b[%hhu;16H%3d";
|
|
|
+const char menu_20x_space[] PROGMEM = " ";
|
|
|
+const char menu_fmt_int3[] PROGMEM = "%c%.15S:%s%3d";
|
|
|
+void menu_draw_int3(char chr, const char* str, int16_t val)
|
|
|
+{
|
|
|
+ int text_len = strlen_P(str);
|
|
|
+ if (text_len > 15) text_len = 15;
|
|
|
+ char spaces[21];
|
|
|
+ strcpy_P(spaces, menu_20x_space);
|
|
|
+ spaces[15 - text_len] = 0;
|
|
|
+ lcd_printf_P(menu_fmt_int3, chr, str, spaces, val);
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
#define _menu_data (*((menu_data_edit_t*)menu_data))
|
|
|
void _menu_edit_int3(void)
|
|
@@ -234,7 +245,7 @@ void _menu_edit_int3(void)
|
|
|
if (lcd_encoder < _menu_data.minEditValue) lcd_encoder = _menu_data.minEditValue;
|
|
|
if (lcd_encoder > _menu_data.maxEditValue) lcd_encoder = _menu_data.maxEditValue;
|
|
|
lcd_set_cursor(0, 1);
|
|
|
- lcd_printf_P(menu_fmt_int3, ' ', _menu_data.editLabel, (uint8_t)1, (int)lcd_encoder);
|
|
|
+ menu_draw_int3(' ', _menu_data.editLabel, (int)lcd_encoder);
|
|
|
}
|
|
|
if (LCD_CLICKED)
|
|
|
{
|
|
@@ -250,7 +261,7 @@ uint8_t menu_item_edit_int3(const char* str, int16_t* pval, int16_t min_val, int
|
|
|
if (lcd_draw_update)
|
|
|
{
|
|
|
lcd_set_cursor(0, menu_row);
|
|
|
- lcd_printf_P(menu_fmt_int3, (lcd_encoder == menu_item)?'>':' ', str, menu_row, *pval);
|
|
|
+ menu_draw_int3((lcd_encoder == menu_item)?'>':' ', str, *pval);
|
|
|
}
|
|
|
if (menu_clicked && (lcd_encoder == menu_item))
|
|
|
{
|