Browse Source

Introduce a +1234.56 format for over 999 steps/mm

esenapaj 8 years ago
parent
commit
7b836a4000
5 changed files with 29 additions and 8 deletions
  1. 7
    8
      Marlin/ultralcd.cpp
  2. 2
    0
      Marlin/ultralcd_impl_DOGM.h
  3. 2
    0
      Marlin/ultralcd_impl_HD44780.h
  4. 15
    0
      Marlin/utility.cpp
  5. 3
    0
      Marlin/utility.h

+ 7
- 8
Marlin/ultralcd.cpp View File

@@ -181,6 +181,7 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
181 181
   static void menu_action_setting_edit_float5(const char* pstr, float* ptr, float minValue, float maxValue);
182 182
   static void menu_action_setting_edit_float51(const char* pstr, float* ptr, float minValue, float maxValue);
183 183
   static void menu_action_setting_edit_float52(const char* pstr, float* ptr, float minValue, float maxValue);
184
+  static void menu_action_setting_edit_float62(const char* pstr, float* ptr, float minValue, float maxValue);
184 185
   static void menu_action_setting_edit_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue);
185 186
   static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, screenFunc_t callbackFunc);
186 187
   static void menu_action_setting_edit_callback_int3(const char* pstr, int* ptr, int minValue, int maxValue, screenFunc_t callbackFunc);
@@ -190,6 +191,7 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
190 191
   static void menu_action_setting_edit_callback_float5(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
191 192
   static void menu_action_setting_edit_callback_float51(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
192 193
   static void menu_action_setting_edit_callback_float52(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
194
+  static void menu_action_setting_edit_callback_float62(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
193 195
   static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue, screenFunc_t callbackFunc);
194 196
 
195 197
   #if ENABLED(SDSUPPORT)
@@ -1841,14 +1843,10 @@ void kill_screen(const char* lcd_msg) {
1841 1843
     MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E, &planner.max_acceleration_mm_per_s2[E_AXIS], 100, 99000, _reset_acceleration_rates);
1842 1844
     MENU_ITEM_EDIT(float5, MSG_A_RETRACT, &planner.retract_acceleration, 100, 99000);
1843 1845
     MENU_ITEM_EDIT(float5, MSG_A_TRAVEL, &planner.travel_acceleration, 100, 99000);
1844
-    MENU_ITEM_EDIT_CALLBACK(float52, MSG_XSTEPS, &planner.axis_steps_per_mm[X_AXIS], 5, 9999, _planner_refresh_positioning);
1845
-    MENU_ITEM_EDIT_CALLBACK(float52, MSG_YSTEPS, &planner.axis_steps_per_mm[Y_AXIS], 5, 9999, _planner_refresh_positioning);
1846
-    #if ENABLED(DELTA)
1847
-      MENU_ITEM_EDIT_CALLBACK(float52, MSG_ZSTEPS, &planner.axis_steps_per_mm[Z_AXIS], 5, 9999, _planner_refresh_positioning);
1848
-    #else
1849
-      MENU_ITEM_EDIT_CALLBACK(float51, MSG_ZSTEPS, &planner.axis_steps_per_mm[Z_AXIS], 5, 9999, _planner_refresh_positioning);
1850
-    #endif
1851
-    MENU_ITEM_EDIT_CALLBACK(float51, MSG_ESTEPS, &planner.axis_steps_per_mm[E_AXIS], 5, 9999, _planner_refresh_positioning);
1846
+    MENU_ITEM_EDIT_CALLBACK(float62, MSG_XSTEPS, &planner.axis_steps_per_mm[X_AXIS], 5, 9999, _planner_refresh_positioning);
1847
+    MENU_ITEM_EDIT_CALLBACK(float62, MSG_YSTEPS, &planner.axis_steps_per_mm[Y_AXIS], 5, 9999, _planner_refresh_positioning);
1848
+    MENU_ITEM_EDIT_CALLBACK(float62, MSG_ZSTEPS, &planner.axis_steps_per_mm[Z_AXIS], 5, 9999, _planner_refresh_positioning);
1849
+    MENU_ITEM_EDIT_CALLBACK(float62, MSG_ESTEPS, &planner.axis_steps_per_mm[E_AXIS], 5, 9999, _planner_refresh_positioning);
1852 1850
     #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
1853 1851
       MENU_ITEM_EDIT(bool, MSG_ENDSTOP_ABORT, &stepper.abort_on_endstop_hit);
1854 1852
     #endif
@@ -2341,6 +2339,7 @@ void kill_screen(const char* lcd_msg) {
2341 2339
   menu_edit_type(float, float5, ftostr5rj, 0.01)
2342 2340
   menu_edit_type(float, float51, ftostr51sign, 10)
2343 2341
   menu_edit_type(float, float52, ftostr52sign, 100)
2342
+  menu_edit_type(float, float62, ftostr62sign, 100)
2344 2343
   menu_edit_type(unsigned long, long5, ftostr5rj, 0.01)
2345 2344
 
2346 2345
   /**

+ 2
- 0
Marlin/ultralcd_impl_DOGM.h View File

@@ -587,6 +587,7 @@ static void lcd_implementation_status_screen() {
587 587
   #define lcd_implementation_drawmenu_setting_edit_float5(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr5rj(*(data)))
588 588
   #define lcd_implementation_drawmenu_setting_edit_float52(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr52sign(*(data)))
589 589
   #define lcd_implementation_drawmenu_setting_edit_float51(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr51sign(*(data)))
590
+  #define lcd_implementation_drawmenu_setting_edit_float62(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr62sign(*(data)))
590 591
   #define lcd_implementation_drawmenu_setting_edit_long5(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr5rj(*(data)))
591 592
   #define lcd_implementation_drawmenu_setting_edit_bool(sel, row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
592 593
 
@@ -597,6 +598,7 @@ static void lcd_implementation_status_screen() {
597 598
   #define lcd_implementation_drawmenu_setting_edit_callback_float5(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr5rj(*(data)))
598 599
   #define lcd_implementation_drawmenu_setting_edit_callback_float52(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr52sign(*(data)))
599 600
   #define lcd_implementation_drawmenu_setting_edit_callback_float51(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr51sign(*(data)))
601
+  #define lcd_implementation_drawmenu_setting_edit_callback_float62(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr62sign(*(data)))
600 602
   #define lcd_implementation_drawmenu_setting_edit_callback_long5(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr5rj(*(data)))
601 603
   #define lcd_implementation_drawmenu_setting_edit_callback_bool(sel, row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
602 604
 

+ 2
- 0
Marlin/ultralcd_impl_HD44780.h View File

@@ -863,6 +863,7 @@ static void lcd_implementation_status_screen() {
863 863
   #define lcd_implementation_drawmenu_setting_edit_float5(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr5rj(*(data)))
864 864
   #define lcd_implementation_drawmenu_setting_edit_float52(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr52sign(*(data)))
865 865
   #define lcd_implementation_drawmenu_setting_edit_float51(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr51sign(*(data)))
866
+  #define lcd_implementation_drawmenu_setting_edit_float62(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr62sign(*(data)))
866 867
   #define lcd_implementation_drawmenu_setting_edit_long5(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr5rj(*(data)))
867 868
   #define lcd_implementation_drawmenu_setting_edit_bool(sel, row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
868 869
 
@@ -874,6 +875,7 @@ static void lcd_implementation_status_screen() {
874 875
   #define lcd_implementation_drawmenu_setting_edit_callback_float5(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr5rj(*(data)))
875 876
   #define lcd_implementation_drawmenu_setting_edit_callback_float52(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr52sign(*(data)))
876 877
   #define lcd_implementation_drawmenu_setting_edit_callback_float51(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr51sign(*(data)))
878
+  #define lcd_implementation_drawmenu_setting_edit_callback_float62(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr62sign(*(data)))
877 879
   #define lcd_implementation_drawmenu_setting_edit_callback_long5(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr5rj(*(data)))
878 880
   #define lcd_implementation_drawmenu_setting_edit_callback_bool(sel, row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
879 881
 

+ 15
- 0
Marlin/utility.cpp View File

@@ -188,6 +188,21 @@ void safe_delay(millis_t ms) {
188 188
     return conv;
189 189
   }
190 190
 
191
+  // Convert signed float to string with +1234.56 format
192
+  char* ftostr62sign(const float& x) {
193
+    long xx = abs(x * 100);
194
+    conv[0] = MINUSOR(xx, '+');
195
+    conv[1] = DIGIMOD(xx, 100000);
196
+    conv[2] = DIGIMOD(xx, 10000);
197
+    conv[3] = DIGIMOD(xx, 1000);
198
+    conv[4] = DIGIMOD(xx, 100);
199
+    conv[5] = '.';
200
+    conv[6] = DIGIMOD(xx, 10);
201
+    conv[7] = DIGIMOD(xx, 1);
202
+    conv[8] = '\0';
203
+    return conv;
204
+  }
205
+
191 206
   // Convert signed float to space-padded string with -_23.4_ format
192 207
   char* ftostr52sp(const float& x) {
193 208
     long xx = x * 100;

+ 3
- 0
Marlin/utility.h View File

@@ -63,6 +63,9 @@ void safe_delay(millis_t ms);
63 63
   // Convert signed float to string with +123.45 format
64 64
   char* ftostr52sign(const float& x);
65 65
 
66
+  // Convert signed float to string with +1234.56 format
67
+  char* ftostr62sign(const float& x);
68
+
66 69
   // Convert float to rj string with 123 or -12 format
67 70
   FORCE_INLINE char *ftostr3(const float& x) { return itostr3((int)x); }
68 71
 

Loading…
Cancel
Save