Browse Source

Add Filament menu and add Filament/Retract settings to config store.

wgm4321 9 years ago
parent
commit
edac64e7d2

+ 112
- 12
Marlin/ConfigurationStore.cpp View File

38
 // wrong data being written to the variables.
38
 // wrong data being written to the variables.
39
 // ALSO:  always make sure the variables in the Store and retrieve sections are in the same order.
39
 // ALSO:  always make sure the variables in the Store and retrieve sections are in the same order.
40
 
40
 
41
-#define EEPROM_VERSION "V10"
42
-#ifdef DELTA
43
-	#undef EEPROM_VERSION
44
-	#define EEPROM_VERSION "V11"
45
-#endif
46
-#ifdef SCARA
47
-	#undef EEPROM_VERSION
48
-	#define EEPROM_VERSION "V12"
49
-#endif
41
+#define EEPROM_VERSION "V13"
50
 
42
 
51
 #ifdef EEPROM_SETTINGS
43
 #ifdef EEPROM_SETTINGS
52
 void Config_StoreSettings() 
44
 void Config_StoreSettings() 
101
   #ifdef SCARA
93
   #ifdef SCARA
102
   EEPROM_WRITE_VAR(i,axis_scaling);        // Add scaling for SCARA
94
   EEPROM_WRITE_VAR(i,axis_scaling);        // Add scaling for SCARA
103
   #endif
95
   #endif
96
+  #ifdef FWRETRACT
97
+  EEPROM_WRITE_VAR(i,autoretract_enabled);
98
+  EEPROM_WRITE_VAR(i,retract_length);
99
+  #if EXTRUDERS > 1
100
+  EEPROM_WRITE_VAR(i,retract_length_swap);
101
+  #endif
102
+  EEPROM_WRITE_VAR(i,retract_feedrate);
103
+  EEPROM_WRITE_VAR(i,retract_zlift);
104
+  EEPROM_WRITE_VAR(i,retract_recover_length);
105
+  #if EXTRUDERS > 1
106
+  EEPROM_WRITE_VAR(i,retract_recover_length_swap);
107
+  #endif
108
+  EEPROM_WRITE_VAR(i,retract_recover_feedrate);
109
+  #endif
110
+
111
+  // Save filament sizes
112
+  EEPROM_WRITE_VAR(i, volumetric_enabled);
113
+  EEPROM_WRITE_VAR(i, filament_size[0]);
114
+  #if EXTRUDERS > 1
115
+  EEPROM_WRITE_VAR(i, filament_size[1]);
116
+  #if EXTRUDERS > 2
117
+  EEPROM_WRITE_VAR(i, filament_size[2]);
118
+  #endif
119
+  #endif
120
+  
104
   char ver2[4]=EEPROM_VERSION;
121
   char ver2[4]=EEPROM_VERSION;
105
   i=EEPROM_OFFSET;
122
   i=EEPROM_OFFSET;
106
   EEPROM_WRITE_VAR(i,ver2); // validate data
123
   EEPROM_WRITE_VAR(i,ver2); // validate data
210
     SERIAL_ECHO_START;
227
     SERIAL_ECHO_START;
211
     SERIAL_ECHOLNPGM("Recover: S=Extra length (mm) F:Speed (mm/m)");
228
     SERIAL_ECHOLNPGM("Recover: S=Extra length (mm) F:Speed (mm/m)");
212
     SERIAL_ECHO_START;
229
     SERIAL_ECHO_START;
213
-    SERIAL_ECHOPAIR("   M208 S",retract_recover_length); 
214
-    SERIAL_ECHOPAIR(" F" ,retract_recover_feedrate*60); 
215
-    SERIAL_ECHOLN(""); 
230
+    SERIAL_ECHOPAIR("   M208 S",retract_recover_length);
231
+    SERIAL_ECHOPAIR(" F", retract_recover_feedrate*60);
232
+	SERIAL_ECHOLN("");
233
+    SERIAL_ECHO_START;
234
+    SERIAL_ECHOLNPGM("Auto-Retract: S=0 to disable, 1 to interpret extrude-only moves as retracts or recoveries");
235
+    SERIAL_ECHO_START;
236
+    SERIAL_ECHOPAIR("   M209 S", (unsigned long)(autoretract_enabled ? 1 : 0));
237
+    SERIAL_ECHOLN("");
238
+#if EXTRUDERS > 1
239
+    SERIAL_ECHO_START;
240
+    SERIAL_ECHOLNPGM("Multi-extruder settings:");
241
+    SERIAL_ECHO_START;
242
+    SERIAL_ECHOPAIR("   Swap retract length (mm):    ", retract_length_swap);
243
+    SERIAL_ECHOLN("");
244
+    SERIAL_ECHO_START;
245
+    SERIAL_ECHOPAIR("   Swap rec. addl. length (mm): ", retract_recover_length_swap);
246
+    SERIAL_ECHOLN("");
216
 #endif
247
 #endif
248
+    SERIAL_ECHO_START;
249
+    if (volumetric_enabled) {
250
+        SERIAL_ECHOLNPGM("Filament settings:");
251
+        SERIAL_ECHO_START;
252
+        SERIAL_ECHOPAIR("   M200 D", filament_size[0]);
253
+        SERIAL_ECHOLN(""); 
254
+#if EXTRUDERS > 1
255
+		SERIAL_ECHO_START;
256
+        SERIAL_ECHOPAIR("   M200 T1 D", filament_size[1]);
257
+        SERIAL_ECHOLN(""); 
258
+#if EXTRUDERS > 2
259
+		SERIAL_ECHO_START;
260
+        SERIAL_ECHOPAIR("   M200 T2 D", filament_size[2]);
261
+		SERIAL_ECHOLN("");
262
+#endif
263
+#endif
264
+    } else {
265
+        SERIAL_ECHOLNPGM("Filament settings: Disabled");
266
+    }
217
 } 
267
 } 
218
 #endif
268
 #endif
269
+#endif
219
 
270
 
220
 
271
 
221
 #ifdef EEPROM_SETTINGS
272
 #ifdef EEPROM_SETTINGS
277
 		EEPROM_READ_VAR(i,axis_scaling);
328
 		EEPROM_READ_VAR(i,axis_scaling);
278
 		#endif
329
 		#endif
279
 
330
 
331
+		#ifdef FWRETRACT
332
+		EEPROM_READ_VAR(i,autoretract_enabled);
333
+		EEPROM_READ_VAR(i,retract_length);
334
+		#if EXTRUDERS > 1
335
+		EEPROM_READ_VAR(i,retract_length_swap);
336
+		#endif
337
+		EEPROM_READ_VAR(i,retract_feedrate);
338
+		EEPROM_READ_VAR(i,retract_zlift);
339
+		EEPROM_READ_VAR(i,retract_recover_length);
340
+		#if EXTRUDERS > 1
341
+		EEPROM_READ_VAR(i,retract_recover_length_swap);
342
+		#endif
343
+		EEPROM_READ_VAR(i,retract_recover_feedrate);
344
+		#endif
345
+
346
+		EEPROM_READ_VAR(i, volumetric_enabled);
347
+		EEPROM_READ_VAR(i, filament_size[0]);
348
+#if EXTRUDERS > 1
349
+		EEPROM_READ_VAR(i, filament_size[1]);
350
+#if EXTRUDERS > 2
351
+		EEPROM_READ_VAR(i, filament_size[2]);
352
+#endif
353
+#endif
354
+		calculate_volumetric_multipliers();
280
 		// Call updatePID (similar to when we have processed M301)
355
 		// Call updatePID (similar to when we have processed M301)
281
 		updatePID();
356
 		updatePID();
282
         SERIAL_ECHO_START;
357
         SERIAL_ECHO_START;
353
 #endif//PID_ADD_EXTRUSION_RATE
428
 #endif//PID_ADD_EXTRUSION_RATE
354
 #endif//PIDTEMP
429
 #endif//PIDTEMP
355
 
430
 
431
+#ifdef FWRETRACT
432
+	autoretract_enabled = false;
433
+	retract_length = RETRACT_LENGTH;
434
+#if EXTRUDERS > 1
435
+	retract_length_swap = RETRACT_LENGTH_SWAP;
436
+#endif
437
+	retract_feedrate = RETRACT_FEEDRATE;
438
+	retract_zlift = RETRACT_ZLIFT;
439
+	retract_recover_length = RETRACT_RECOVER_LENGTH;
440
+#if EXTRUDERS > 1
441
+	retract_recover_length_swap = RETRACT_RECOVER_LENGTH_SWAP;
442
+#endif
443
+	retract_recover_feedrate = RETRACT_RECOVER_FEEDRATE;
444
+#endif
445
+
446
+	volumetric_enabled = false;
447
+	filament_size[0] = DEFAULT_NOMINAL_FILAMENT_DIA;
448
+#if EXTRUDERS > 1
449
+	filament_size[1] = DEFAULT_NOMINAL_FILAMENT_DIA;
450
+#if EXTRUDERS > 2
451
+	filament_size[2] = DEFAULT_NOMINAL_FILAMENT_DIA;
452
+#endif
453
+#endif
454
+	calculate_volumetric_multipliers();
455
+
356
 SERIAL_ECHO_START;
456
 SERIAL_ECHO_START;
357
 SERIAL_ECHOLNPGM("Hardcoded Default Settings Loaded");
457
 SERIAL_ECHOLNPGM("Hardcoded Default Settings Loaded");
358
 
458
 

+ 4
- 0
Marlin/Marlin.h View File

209
 extern bool axis_relative_modes[];
209
 extern bool axis_relative_modes[];
210
 extern int feedmultiply;
210
 extern int feedmultiply;
211
 extern int extrudemultiply; // Sets extrude multiply factor (in percent) for all extruders
211
 extern int extrudemultiply; // Sets extrude multiply factor (in percent) for all extruders
212
+extern bool volumetric_enabled;
212
 extern int extruder_multiply[EXTRUDERS]; // sets extrude multiply factor (in percent) for each extruder individually
213
 extern int extruder_multiply[EXTRUDERS]; // sets extrude multiply factor (in percent) for each extruder individually
214
+extern float filament_size[EXTRUDERS]; // cross-sectional area of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder.
213
 extern float volumetric_multiplier[EXTRUDERS]; // reciprocal of cross-sectional area of filament (in square millimeters), stored this way to reduce computational burden in planner
215
 extern float volumetric_multiplier[EXTRUDERS]; // reciprocal of cross-sectional area of filament (in square millimeters), stored this way to reduce computational burden in planner
214
 extern float current_position[NUM_AXIS] ;
216
 extern float current_position[NUM_AXIS] ;
215
 extern float add_homing[3];
217
 extern float add_homing[3];
266
 #endif
268
 #endif
267
 
269
 
268
 #endif
270
 #endif
271
+
272
+extern void calculate_volumetric_multipliers();

+ 62
- 16
Marlin/Marlin_main.cpp View File

215
     #endif
215
     #endif
216
   #endif
216
   #endif
217
 };
217
 };
218
+bool volumetric_enabled = false;
219
+float filament_size[EXTRUDERS] = { DEFAULT_NOMINAL_FILAMENT_DIA
220
+  #if EXTRUDERS > 1
221
+      , DEFAULT_NOMINAL_FILAMENT_DIA
222
+    #if EXTRUDERS > 2
223
+       , DEFAULT_NOMINAL_FILAMENT_DIA
224
+    #endif
225
+  #endif
226
+};
218
 float volumetric_multiplier[EXTRUDERS] = {1.0
227
 float volumetric_multiplier[EXTRUDERS] = {1.0
219
   #if EXTRUDERS > 1
228
   #if EXTRUDERS > 1
220
     , 1.0
229
     , 1.0
2823
     #endif //BLINKM
2832
     #endif //BLINKM
2824
     case 200: // M200 D<millimeters> set filament diameter and set E axis units to cubic millimeters (use S0 to set back to millimeters).
2833
     case 200: // M200 D<millimeters> set filament diameter and set E axis units to cubic millimeters (use S0 to set back to millimeters).
2825
       {
2834
       {
2826
-        float area = .0;
2827
-        float radius = .0;
2828
-        if(code_seen('D')) {
2829
-          radius = (float)code_value() * .5;
2830
-          if(radius == 0) {
2831
-            area = 1;
2832
-          } else {
2833
-            area = M_PI * pow(radius, 2);
2834
-          }
2835
-        } else {
2836
-          //reserved for setting filament diameter via UFID or filament measuring device
2837
-          break;
2838
-        
2839
-          
2840
-        }
2835
+
2841
         tmp_extruder = active_extruder;
2836
         tmp_extruder = active_extruder;
2842
         if(code_seen('T')) {
2837
         if(code_seen('T')) {
2843
           tmp_extruder = code_value();
2838
           tmp_extruder = code_value();
2847
             break;
2842
             break;
2848
           }
2843
           }
2849
         }
2844
         }
2850
-        volumetric_multiplier[tmp_extruder] = 1 / area;
2845
+
2846
+        float area = .0;
2847
+        if(code_seen('D')) {
2848
+		  float diameter = (float)code_value();
2849
+		  if (diameter == 0.0) {
2850
+			// setting any extruder filament size disables volumetric on the assumption that
2851
+			// slicers either generate in extruder values as cubic mm or as as filament feeds
2852
+			// for all extruders
2853
+		    volumetric_enabled = false;
2854
+		  } else {
2855
+            filament_size[tmp_extruder] = (float)code_value();
2856
+			// make sure all extruders have some sane value for the filament size
2857
+			filament_size[0] = (filament_size[0] == 0.0 ? DEFAULT_NOMINAL_FILAMENT_DIA : filament_size[0]);
2858
+            #if EXTRUDERS > 1
2859
+			filament_size[1] = (filament_size[1] == 0.0 ? DEFAULT_NOMINAL_FILAMENT_DIA : filament_size[1]);
2860
+            #if EXTRUDERS > 2
2861
+			filament_size[2] = (filament_size[2] == 0.0 ? DEFAULT_NOMINAL_FILAMENT_DIA : filament_size[2]);
2862
+            #endif
2863
+            #endif
2864
+			volumetric_enabled = true;
2865
+		  }
2866
+        } else {
2867
+          //reserved for setting filament diameter via UFID or filament measuring device
2868
+          break;
2869
+        }
2870
+		calculate_volumetric_multipliers();
2851
       }
2871
       }
2852
       break;
2872
       break;
2853
     case 201: // M201
2873
     case 201: // M201
4580
   return false;
4600
   return false;
4581
 }
4601
 }
4582
 
4602
 
4603
+
4604
+float calculate_volumetric_multiplier(float diameter) {
4605
+	float area = .0;
4606
+	float radius = .0;
4607
+
4608
+	radius = diameter * .5;
4609
+	if (! volumetric_enabled || radius == 0) {
4610
+		area = 1;
4611
+	}
4612
+	else {
4613
+		area = M_PI * pow(radius, 2);
4614
+	}
4615
+
4616
+	return 1.0 / area;
4617
+}
4618
+
4619
+void calculate_volumetric_multipliers() {
4620
+	volumetric_multiplier[0] = calculate_volumetric_multiplier(filament_size[0]);
4621
+#if EXTRUDERS > 1
4622
+	volumetric_multiplier[1] = calculate_volumetric_multiplier(filament_size[1]);
4623
+#if EXTRUDERS > 2
4624
+	volumetric_multiplier[2] = calculate_volumetric_multiplier(filament_size[2]);
4625
+#endif
4626
+#endif
4627
+}
4628
+

+ 5
- 0
Marlin/language_en.h View File

86
 #define MSG_ESTEPS                          "Esteps/mm"
86
 #define MSG_ESTEPS                          "Esteps/mm"
87
 #define MSG_TEMPERATURE                     "Temperature"
87
 #define MSG_TEMPERATURE                     "Temperature"
88
 #define MSG_MOTION                          "Motion"
88
 #define MSG_MOTION                          "Motion"
89
+#define MSG_VOLUMETRIC                      "Filament"
90
+#define MSG_VOLUMETRIC_ENABLED		        "E in mm3"
91
+#define MSG_FILAMENT_SIZE_EXTRUDER_0        "Fil. Dia. 1"
92
+#define MSG_FILAMENT_SIZE_EXTRUDER_1        "Fil. Dia. 2"
93
+#define MSG_FILAMENT_SIZE_EXTRUDER_2        "Fil. Dia. 3"
89
 #define MSG_CONTRAST                        "LCD contrast"
94
 #define MSG_CONTRAST                        "LCD contrast"
90
 #define MSG_STORE_EPROM                     "Store memory"
95
 #define MSG_STORE_EPROM                     "Store memory"
91
 #define MSG_LOAD_EPROM                      "Load memory"
96
 #define MSG_LOAD_EPROM                      "Load memory"

+ 44
- 1
Marlin/ultralcd.cpp View File

59
 static void lcd_control_temperature_preheat_pla_settings_menu();
59
 static void lcd_control_temperature_preheat_pla_settings_menu();
60
 static void lcd_control_temperature_preheat_abs_settings_menu();
60
 static void lcd_control_temperature_preheat_abs_settings_menu();
61
 static void lcd_control_motion_menu();
61
 static void lcd_control_motion_menu();
62
+static void lcd_control_volumetric_menu();
62
 #ifdef DOGLCD
63
 #ifdef DOGLCD
63
 static void lcd_set_contrast();
64
 static void lcd_set_contrast();
64
 #endif
65
 #endif
82
 static void menu_action_setting_edit_int3(const char* pstr, int* ptr, int minValue, int maxValue);
83
 static void menu_action_setting_edit_int3(const char* pstr, int* ptr, int minValue, int maxValue);
83
 static void menu_action_setting_edit_float3(const char* pstr, float* ptr, float minValue, float maxValue);
84
 static void menu_action_setting_edit_float3(const char* pstr, float* ptr, float minValue, float maxValue);
84
 static void menu_action_setting_edit_float32(const char* pstr, float* ptr, float minValue, float maxValue);
85
 static void menu_action_setting_edit_float32(const char* pstr, float* ptr, float minValue, float maxValue);
86
+static void menu_action_setting_edit_float43(const char* pstr, float* ptr, float minValue, float maxValue);
85
 static void menu_action_setting_edit_float5(const char* pstr, float* ptr, float minValue, float maxValue);
87
 static void menu_action_setting_edit_float5(const char* pstr, float* ptr, float minValue, float maxValue);
86
 static void menu_action_setting_edit_float51(const char* pstr, float* ptr, float minValue, float maxValue);
88
 static void menu_action_setting_edit_float51(const char* pstr, float* ptr, float minValue, float maxValue);
87
 static void menu_action_setting_edit_float52(const char* pstr, float* ptr, float minValue, float maxValue);
89
 static void menu_action_setting_edit_float52(const char* pstr, float* ptr, float minValue, float maxValue);
90
 static void menu_action_setting_edit_callback_int3(const char* pstr, int* ptr, int minValue, int maxValue, menuFunc_t callbackFunc);
92
 static void menu_action_setting_edit_callback_int3(const char* pstr, int* ptr, int minValue, int maxValue, menuFunc_t callbackFunc);
91
 static void menu_action_setting_edit_callback_float3(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
93
 static void menu_action_setting_edit_callback_float3(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
92
 static void menu_action_setting_edit_callback_float32(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
94
 static void menu_action_setting_edit_callback_float32(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
95
+static void menu_action_setting_edit_callback_float43(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
93
 static void menu_action_setting_edit_callback_float5(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
96
 static void menu_action_setting_edit_callback_float5(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
94
 static void menu_action_setting_edit_callback_float51(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
97
 static void menu_action_setting_edit_callback_float51(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
95
 static void menu_action_setting_edit_callback_float52(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
98
 static void menu_action_setting_edit_callback_float52(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
742
     MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
745
     MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
743
     MENU_ITEM(submenu, MSG_TEMPERATURE, lcd_control_temperature_menu);
746
     MENU_ITEM(submenu, MSG_TEMPERATURE, lcd_control_temperature_menu);
744
     MENU_ITEM(submenu, MSG_MOTION, lcd_control_motion_menu);
747
     MENU_ITEM(submenu, MSG_MOTION, lcd_control_motion_menu);
748
+	MENU_ITEM(submenu, MSG_VOLUMETRIC, lcd_control_volumetric_menu);
749
+
745
 #ifdef DOGLCD
750
 #ifdef DOGLCD
746
 //    MENU_ITEM_EDIT(int3, MSG_CONTRAST, &lcd_contrast, 0, 63);
751
 //    MENU_ITEM_EDIT(int3, MSG_CONTRAST, &lcd_contrast, 0, 63);
747
     MENU_ITEM(submenu, MSG_CONTRAST, lcd_set_contrast);
752
     MENU_ITEM(submenu, MSG_CONTRAST, lcd_set_contrast);
870
     END_MENU();
875
     END_MENU();
871
 }
876
 }
872
 
877
 
878
+static void lcd_control_volumetric_menu()
879
+{
880
+	START_MENU();
881
+	MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
882
+
883
+	MENU_ITEM_EDIT(bool, MSG_VOLUMETRIC_ENABLED, &volumetric_enabled);
884
+
885
+	if (volumetric_enabled) {
886
+		MENU_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_SIZE_EXTRUDER_0, &filament_size[0], DEFAULT_NOMINAL_FILAMENT_DIA - .5, DEFAULT_NOMINAL_FILAMENT_DIA + .5, calculate_volumetric_multipliers);
887
+#if EXTRUDERS > 1
888
+		MENU_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_SIZE_EXTRUDER_1, &filament_size[1], DEFAULT_NOMINAL_FILAMENT_DIA - .5, DEFAULT_NOMINAL_FILAMENT_DIA + .5, calculate_volumetric_multipliers);
889
+#if EXTRUDERS > 2
890
+		MENU_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_SIZE_EXTRUDER_2, &filament_size[2], DEFAULT_NOMINAL_FILAMENT_DIA - .5, DEFAULT_NOMINAL_FILAMENT_DIA + .5, calculate_volumetric_multipliers);
891
+#endif
892
+#endif
893
+	}
894
+
895
+	END_MENU();
896
+}
897
+
873
 #ifdef DOGLCD
898
 #ifdef DOGLCD
874
 static void lcd_set_contrast()
899
 static void lcd_set_contrast()
875
 {
900
 {
1013
 menu_edit_type(int, int3, itostr3, 1)
1038
 menu_edit_type(int, int3, itostr3, 1)
1014
 menu_edit_type(float, float3, ftostr3, 1)
1039
 menu_edit_type(float, float3, ftostr3, 1)
1015
 menu_edit_type(float, float32, ftostr32, 100)
1040
 menu_edit_type(float, float32, ftostr32, 100)
1041
+menu_edit_type(float, float43, ftostr43, 1000)
1016
 menu_edit_type(float, float5, ftostr5, 0.01)
1042
 menu_edit_type(float, float5, ftostr5, 0.01)
1017
 menu_edit_type(float, float51, ftostr51, 10)
1043
 menu_edit_type(float, float51, ftostr51, 10)
1018
 menu_edit_type(float, float52, ftostr52, 100)
1044
 menu_edit_type(float, float52, ftostr52, 100)
1482
   return conv;
1508
   return conv;
1483
 }
1509
 }
1484
 
1510
 
1485
-// Convert float to string with 1.23 format
1511
+// Convert float to string with 1.234 format
1512
+char *ftostr43(const float &x)
1513
+{
1514
+	long xx = x * 1000;
1515
+    if (xx >= 0)
1516
+		conv[0] = (xx / 1000) % 10 + '0';
1517
+	else
1518
+		conv[0] = '-';
1519
+	xx = abs(xx);
1520
+	conv[1] = '.';
1521
+	conv[2] = (xx / 100) % 10 + '0';
1522
+	conv[3] = (xx / 10) % 10 + '0';
1523
+	conv[4] = (xx) % 10 + '0';
1524
+	conv[5] = 0;
1525
+	return conv;
1526
+}
1527
+
1528
+//Float to string with 1.23 format
1486
 char *ftostr12ns(const float &x)
1529
 char *ftostr12ns(const float &x)
1487
 {
1530
 {
1488
   long xx=x*100;
1531
   long xx=x*100;

+ 1
- 0
Marlin/ultralcd.h View File

118
 char *ftostr31ns(const float &x); // float to string without sign character
118
 char *ftostr31ns(const float &x); // float to string without sign character
119
 char *ftostr31(const float &x);
119
 char *ftostr31(const float &x);
120
 char *ftostr32(const float &x);
120
 char *ftostr32(const float &x);
121
+char *ftostr43(const float &x);
121
 char *ftostr12ns(const float &x); 
122
 char *ftostr12ns(const float &x); 
122
 char *ftostr32sp(const float &x); // remove zero-padding from ftostr32
123
 char *ftostr32sp(const float &x); // remove zero-padding from ftostr32
123
 char *ftostr5(const float &x);
124
 char *ftostr5(const float &x);

+ 4
- 0
Marlin/ultralcd_implementation_hitachi_HD44780.h View File

693
 #define lcd_implementation_drawmenu_setting_edit_float3(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr3(*(data)))
693
 #define lcd_implementation_drawmenu_setting_edit_float3(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr3(*(data)))
694
 #define lcd_implementation_drawmenu_setting_edit_float32_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr32(*(data)))
694
 #define lcd_implementation_drawmenu_setting_edit_float32_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr32(*(data)))
695
 #define lcd_implementation_drawmenu_setting_edit_float32(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr32(*(data)))
695
 #define lcd_implementation_drawmenu_setting_edit_float32(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr32(*(data)))
696
+#define lcd_implementation_drawmenu_setting_edit_float43_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr43(*(data)))
697
+#define lcd_implementation_drawmenu_setting_edit_float43(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr43(*(data)))
696
 #define lcd_implementation_drawmenu_setting_edit_float5_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data)))
698
 #define lcd_implementation_drawmenu_setting_edit_float5_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data)))
697
 #define lcd_implementation_drawmenu_setting_edit_float5(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data)))
699
 #define lcd_implementation_drawmenu_setting_edit_float5(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data)))
698
 #define lcd_implementation_drawmenu_setting_edit_float52_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr52(*(data)))
700
 #define lcd_implementation_drawmenu_setting_edit_float52_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr52(*(data)))
711
 #define lcd_implementation_drawmenu_setting_edit_callback_float3(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr3(*(data)))
713
 #define lcd_implementation_drawmenu_setting_edit_callback_float3(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr3(*(data)))
712
 #define lcd_implementation_drawmenu_setting_edit_callback_float32_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr32(*(data)))
714
 #define lcd_implementation_drawmenu_setting_edit_callback_float32_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr32(*(data)))
713
 #define lcd_implementation_drawmenu_setting_edit_callback_float32(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr32(*(data)))
715
 #define lcd_implementation_drawmenu_setting_edit_callback_float32(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr32(*(data)))
716
+#define lcd_implementation_drawmenu_setting_edit_callback_float43_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr43(*(data)))
717
+#define lcd_implementation_drawmenu_setting_edit_callback_float43(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr43(*(data)))
714
 #define lcd_implementation_drawmenu_setting_edit_callback_float5_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data)))
718
 #define lcd_implementation_drawmenu_setting_edit_callback_float5_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data)))
715
 #define lcd_implementation_drawmenu_setting_edit_callback_float5(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data)))
719
 #define lcd_implementation_drawmenu_setting_edit_callback_float5(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data)))
716
 #define lcd_implementation_drawmenu_setting_edit_callback_float52_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr52(*(data)))
720
 #define lcd_implementation_drawmenu_setting_edit_callback_float52_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr52(*(data)))

Loading…
Cancel
Save