Pārlūkot izejas kodu

Live adjust Z format fix

Robert Pelnar 6 gadi atpakaļ
vecāks
revīzija
fa30353646
3 mainītis faili ar 18 papildinājumiem un 1 dzēšanām
  1. 15 0
      Firmware/menu.cpp
  2. 2 0
      Firmware/menu.h
  3. 1 1
      Firmware/ultralcd.cpp

+ 15 - 0
Firmware/menu.cpp

@@ -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)
 {

+ 2 - 0
Firmware/menu.h

@@ -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)

+ 1 - 1
Firmware/ultralcd.cpp

@@ -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)
 	{