浏览代码

Fix. menu texts and formatting - issues PFW-877 and PFW-879

DRracer 5 年之前
父节点
当前提交
da98977de3
共有 2 个文件被更改,包括 11 次插入17 次删除
  1. 7 13
      Firmware/menu.cpp
  2. 4 4
      Firmware/ultralcd.cpp

+ 7 - 13
Firmware/menu.cpp

@@ -308,9 +308,9 @@ const char menu_fmt_int3[] PROGMEM = "%c%.15S:%s%3d";
 
 const char menu_fmt_float31[] PROGMEM = "%-12.12S%+8.1f";
 
-const char menu_fmt_float13[] PROGMEM = "%-15.15S%+5.3f";
+const char menu_fmt_float13[] PROGMEM = "%c%-13.13S%+5.3f";
 
-const char menu_fmt_float13off[] PROGMEM = "%c%.12S:%s%";
+const char menu_fmt_float13off[] PROGMEM = "%c%-13.13S%6.6s";
 
 template<typename T>
 static void menu_draw_P(char chr, const char* str, int16_t val);
@@ -331,20 +331,14 @@ template<>
 void menu_draw_P<uint8_t*>(char chr, const char* str, int16_t val)
 {
     menu_data_edit_t* _md = (menu_data_edit_t*)&(menu_data[0]);
-    int text_len = strlen_P(str);
-    if (text_len > 15) text_len = 15;
-    char spaces[21];
-    strcpy_P(spaces, menu_20x_space);
-    spaces[12 - text_len] = 0;
-    float factor = 1.0 + static_cast<float>(val) / 1000.0;
+    float factor = 1.0f + static_cast<float>(val) / 1000.0f;
     if (val <= _md->minEditValue)
     {
-        lcd_printf_P(menu_fmt_float13off, chr, str, spaces);
-        lcd_puts_P(_i(" [off]"));
+        lcd_printf_P(menu_fmt_float13off, chr, str, " [off]");
     }
     else
     {
-        lcd_printf_P(menu_fmt_float13, chr, str, spaces, factor);
+        lcd_printf_P(menu_fmt_float13, chr, str, factor);
     }
 }
 
@@ -363,7 +357,7 @@ void menu_draw_float31(const char* str, float val)
 	lcd_printf_P(menu_fmt_float31, str, val);	
 }
 
-//! @brief Draw up to 12 chars of text and a float number in format +1.234
+//! @brief Draw up to 14 chars of text and a float number in format +1.234
 //! 
 //! @param str string label to print
 //! @param val value to print aligned to the right side of the display  
@@ -375,7 +369,7 @@ void menu_draw_float31(const char* str, float val)
 //! Moreover, this function gets inlined in the final code, so removing it doesn't really help ;)
 void menu_draw_float13(const char* str, float val)
 {
-	lcd_printf_P(menu_fmt_float13, str, val);
+	lcd_printf_P(menu_fmt_float13, ' ', str, val);
 }
 
 template <typename T>

+ 4 - 4
Firmware/ultralcd.cpp

@@ -5191,11 +5191,11 @@ void lcd_settings_linearity_correction_menu(void)
 #ifdef TMC2130_LINEARITY_CORRECTION_XYZ
 	//tmc2130_wave_fac[X_AXIS]
 
-	MENU_ITEM_EDIT_int3_P(_i("X-correct"),  &tmc2130_wave_fac[X_AXIS],  TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9
-	MENU_ITEM_EDIT_int3_P(_i("Y-correct"),  &tmc2130_wave_fac[Y_AXIS],  TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9
-	MENU_ITEM_EDIT_int3_P(_i("Z-correct"),  &tmc2130_wave_fac[Z_AXIS],  TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9
+	MENU_ITEM_EDIT_int3_P(_i("X-correct:"),  &tmc2130_wave_fac[X_AXIS],  TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9
+	MENU_ITEM_EDIT_int3_P(_i("Y-correct:"),  &tmc2130_wave_fac[Y_AXIS],  TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9
+	MENU_ITEM_EDIT_int3_P(_i("Z-correct:"),  &tmc2130_wave_fac[Z_AXIS],  TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9
 #endif //TMC2130_LINEARITY_CORRECTION_XYZ
-	MENU_ITEM_EDIT_int3_P(_i("E-correct"),  &tmc2130_wave_fac[E_AXIS],  TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9
+	MENU_ITEM_EDIT_int3_P(_i("E-correct:"),  &tmc2130_wave_fac[E_AXIS],  TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9
 	MENU_END();
 }
 #endif // TMC2130