Live adjust Z format fix
This commit is contained in:
parent
4b6b2a657d
commit
fa30353646
3 changed files with 18 additions and 1 deletions
|
@ -224,12 +224,16 @@ uint8_t menu_item_gcode_P(const char* str, const char* str_gcode)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
const char menu_20x_space[] PROGMEM = " ";
|
||||
|
||||
const char menu_fmt_int3[] PROGMEM = "%c%.15S:%s%3d";
|
||||
|
||||
const char menu_fmt_float31[] PROGMEM = "%c%.12S:%s%+06.1f";
|
||||
|
||||
const char menu_fmt_float13[] PROGMEM = "%c%.12S:%s%+06.3f";
|
||||
|
||||
|
||||
void menu_draw_int3(char chr, const char* str, int16_t val)
|
||||
{
|
||||
int text_len = strlen_P(str);
|
||||
|
@ -251,6 +255,17 @@ void menu_draw_float31(char chr, const char* str, float val)
|
|||
lcd_printf_P(menu_fmt_float31, chr, str, spaces, val);
|
||||
}
|
||||
|
||||
//draw up to 12 chars of text, ':' and float number in format +1.234
|
||||
void menu_draw_float13(char chr, const char* str, float val)
|
||||
{
|
||||
int text_len = strlen_P(str);
|
||||
if (text_len > 12) text_len = 12;
|
||||
char spaces[21];
|
||||
strcpy_P(spaces, menu_20x_space);
|
||||
spaces[12 - text_len] = 0;
|
||||
lcd_printf_P(menu_fmt_float13, chr, str, spaces, val);
|
||||
}
|
||||
|
||||
#define _menu_data (*((menu_data_edit_t*)menu_data))
|
||||
void _menu_edit_int3(void)
|
||||
{
|
||||
|
|
|
@ -96,6 +96,8 @@ extern void menu_draw_int3(char chr, const char* str, int16_t val);
|
|||
|
||||
extern void menu_draw_float31(char chr, const char* str, float val);
|
||||
|
||||
extern void menu_draw_float13(char chr, const char* str, float val);
|
||||
|
||||
extern void _menu_edit_int3(void);
|
||||
|
||||
#define MENU_ITEM_EDIT_int3_P(str, pval, minval, maxval) do { if (menu_item_edit_int3(str, pval, minval, maxval)) return; } while (0)
|
||||
|
|
|
@ -2921,7 +2921,7 @@ static void _lcd_babystep(int axis, const char *msg)
|
|||
if (lcd_draw_update)
|
||||
{
|
||||
lcd_set_cursor(0, 1);
|
||||
menu_draw_float31(' ', msg, menuData.babyStep.babystepMemMM[axis]);
|
||||
menu_draw_float13(' ', msg, menuData.babyStep.babystepMemMM[axis]);
|
||||
}
|
||||
if (LCD_CLICKED || menuExiting)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue