|
@@ -44,11 +44,6 @@ char lcd_status_message[LCD_WIDTH+1] = WELCOME_MSG;
|
44
|
44
|
#include "ultralcd_implementation_hitachi_HD44780.h"
|
45
|
45
|
#endif
|
46
|
46
|
|
47
|
|
-/** forward declarations **/
|
48
|
|
-
|
49
|
|
-void copy_and_scalePID_i();
|
50
|
|
-void copy_and_scalePID_d();
|
51
|
|
-
|
52
|
47
|
/* Different menus */
|
53
|
48
|
static void lcd_status_screen();
|
54
|
49
|
#ifdef ULTIPANEL
|
|
@@ -219,9 +214,8 @@ void* editValue;
|
219
|
214
|
int32_t minEditValue, maxEditValue;
|
220
|
215
|
menuFunc_t callbackFunc;
|
221
|
216
|
|
222
|
|
-// place-holders for Ki and Kd edits, and the extruder # being edited
|
|
217
|
+// place-holders for Ki and Kd edits
|
223
|
218
|
float raw_Ki, raw_Kd;
|
224
|
|
-int pid_current_extruder;
|
225
|
219
|
|
226
|
220
|
static void lcd_goto_menu(menuFunc_t menu, const uint32_t encoder=0, const bool feedback=true) {
|
227
|
221
|
if (currentMenu != menu) {
|
|
@@ -846,76 +840,125 @@ static void lcd_control_menu()
|
846
|
840
|
END_MENU();
|
847
|
841
|
}
|
848
|
842
|
|
|
843
|
+#ifdef PIDTEMP
|
|
844
|
+
|
|
845
|
+ // Helpers for editing PID Ki & Kd values
|
|
846
|
+ // grab the PID value out of the temp variable; scale it; then update the PID driver
|
|
847
|
+ void copy_and_scalePID_i(int e) {
|
|
848
|
+ PID_PARAM(Ki, e) = scalePID_i(raw_Ki);
|
|
849
|
+ updatePID();
|
|
850
|
+ }
|
|
851
|
+ void copy_and_scalePID_d(int e) {
|
|
852
|
+ PID_PARAM(Kd, e) = scalePID_d(raw_Kd);
|
|
853
|
+ updatePID();
|
|
854
|
+ }
|
|
855
|
+ void copy_and_scalePID_i_E1() { copy_and_scalePID_i(0); }
|
|
856
|
+ void copy_and_scalePID_d_E1() { copy_and_scalePID_d(0); }
|
|
857
|
+ #ifdef PID_PARAMS_PER_EXTRUDER
|
|
858
|
+ #if EXTRUDERS > 1
|
|
859
|
+ void copy_and_scalePID_i_E2() { copy_and_scalePID_i(1); }
|
|
860
|
+ void copy_and_scalePID_d_E2() { copy_and_scalePID_d(1); }
|
|
861
|
+ #if EXTRUDERS > 2
|
|
862
|
+ void copy_and_scalePID_i_E3() { copy_and_scalePID_i(2); }
|
|
863
|
+ void copy_and_scalePID_d_E3() { copy_and_scalePID_d(2); }
|
|
864
|
+ #if EXTRUDERS > 3
|
|
865
|
+ void copy_and_scalePID_i_E4() { copy_and_scalePID_i(3); }
|
|
866
|
+ void copy_and_scalePID_d_E5() { copy_and_scalePID_d(3); }
|
|
867
|
+ #endif //EXTRUDERS > 3
|
|
868
|
+ #endif //EXTRUDERS > 2
|
|
869
|
+ #endif //EXTRUDERS > 1
|
|
870
|
+ #endif //PID_PARAMS_PER_EXTRUDER
|
|
871
|
+
|
|
872
|
+#endif //PIDTEMP
|
|
873
|
+
|
849
|
874
|
static void lcd_control_temperature_menu()
|
850
|
875
|
{
|
851
|
876
|
START_MENU();
|
852
|
877
|
MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
|
853
|
|
-#if TEMP_SENSOR_0 != 0
|
854
|
|
- MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15);
|
855
|
|
-#endif
|
856
|
|
-#if TEMP_SENSOR_1 != 0 && EXTRUDERS > 1
|
857
|
|
- MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 2", &target_temperature[1], 0, HEATER_1_MAXTEMP - 15);
|
858
|
|
-#endif
|
859
|
|
-#if TEMP_SENSOR_2 != 0 && EXTRUDERS > 2
|
860
|
|
- MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 3", &target_temperature[2], 0, HEATER_2_MAXTEMP - 15);
|
861
|
|
-#endif
|
862
|
|
-#if TEMP_SENSOR_3 != 0 && EXTRUDERS > 3
|
863
|
|
- MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 4", &target_temperature[3], 0, HEATER_3_MAXTEMP - 15);
|
864
|
|
-#endif
|
865
|
|
-#if TEMP_SENSOR_BED != 0
|
866
|
|
- MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15);
|
867
|
|
-#endif
|
|
878
|
+ #if TEMP_SENSOR_0 != 0
|
|
879
|
+ MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15);
|
|
880
|
+ #endif
|
|
881
|
+ #if EXTRUDERS > 1
|
|
882
|
+ #if TEMP_SENSOR_1 != 0
|
|
883
|
+ MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 2", &target_temperature[1], 0, HEATER_1_MAXTEMP - 15);
|
|
884
|
+ #endif
|
|
885
|
+ #if EXTRUDERS > 2
|
|
886
|
+ #if TEMP_SENSOR_2 != 0
|
|
887
|
+ MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 3", &target_temperature[2], 0, HEATER_2_MAXTEMP - 15);
|
|
888
|
+ #endif
|
|
889
|
+ #if EXTRUDERS > 3
|
|
890
|
+ #if TEMP_SENSOR_3 != 0
|
|
891
|
+ MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 4", &target_temperature[3], 0, HEATER_3_MAXTEMP - 15);
|
|
892
|
+ #endif
|
|
893
|
+ #endif
|
|
894
|
+ #endif
|
|
895
|
+ #endif
|
|
896
|
+ #if TEMP_SENSOR_BED != 0
|
|
897
|
+ MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15);
|
|
898
|
+ #endif
|
868
|
899
|
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255);
|
869
|
|
-#if defined AUTOTEMP && (TEMP_SENSOR_0 != 0)
|
870
|
|
- MENU_ITEM_EDIT(bool, MSG_AUTOTEMP, &autotemp_enabled);
|
871
|
|
- MENU_ITEM_EDIT(float3, MSG_MIN, &autotemp_min, 0, HEATER_0_MAXTEMP - 15);
|
872
|
|
- MENU_ITEM_EDIT(float3, MSG_MAX, &autotemp_max, 0, HEATER_0_MAXTEMP - 15);
|
873
|
|
- MENU_ITEM_EDIT(float32, MSG_FACTOR, &autotemp_factor, 0.0, 1.0);
|
874
|
|
-#endif
|
875
|
|
-#ifdef PIDTEMP
|
876
|
|
- // set up temp variables - undo the default scaling
|
877
|
|
- pid_current_extruder = 0;
|
878
|
|
- raw_Ki = unscalePID_i(PID_PARAM(Ki,0));
|
879
|
|
- raw_Kd = unscalePID_d(PID_PARAM(Kd,0));
|
880
|
|
- MENU_ITEM_EDIT(float52, MSG_PID_P, &PID_PARAM(Kp,0), 1, 9990);
|
881
|
|
- // i is typically a small value so allows values below 1
|
882
|
|
- MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I, &raw_Ki, 0.01, 9990, copy_and_scalePID_i);
|
883
|
|
- MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D, &raw_Kd, 1, 9990, copy_and_scalePID_d);
|
|
900
|
+ #if defined(AUTOTEMP) && (TEMP_SENSOR_0 != 0)
|
|
901
|
+ MENU_ITEM_EDIT(bool, MSG_AUTOTEMP, &autotemp_enabled);
|
|
902
|
+ MENU_ITEM_EDIT(float3, MSG_MIN, &autotemp_min, 0, HEATER_0_MAXTEMP - 15);
|
|
903
|
+ MENU_ITEM_EDIT(float3, MSG_MAX, &autotemp_max, 0, HEATER_0_MAXTEMP - 15);
|
|
904
|
+ MENU_ITEM_EDIT(float32, MSG_FACTOR, &autotemp_factor, 0.0, 1.0);
|
|
905
|
+ #endif
|
|
906
|
+ #ifdef PIDTEMP
|
|
907
|
+ // set up temp variables - undo the default scaling
|
|
908
|
+ pid_current_extruder = 0;
|
|
909
|
+ raw_Ki = unscalePID_i(PID_PARAM(Ki,0));
|
|
910
|
+ raw_Kd = unscalePID_d(PID_PARAM(Kd,0));
|
|
911
|
+ MENU_ITEM_EDIT(float52, MSG_PID_P, &PID_PARAM(Kp,0), 1, 9990);
|
|
912
|
+ // i is typically a small value so allows values below 1
|
|
913
|
+ MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I, &raw_Ki, 0.01, 9990, copy_and_scalePID_i);
|
|
914
|
+ MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D, &raw_Kd, 1, 9990, copy_and_scalePID_d);
|
884
|
915
|
#ifdef PID_ADD_EXTRUSION_RATE
|
885
|
|
- MENU_ITEM_EDIT(float3, MSG_PID_C, &PID_PARAM(Kc,0), 1, 9990);
|
|
916
|
+ MENU_ITEM_EDIT(float3, MSG_PID_C, &PID_PARAM(Kc,0), 1, 9990);
|
886
|
917
|
#endif//PID_ADD_EXTRUSION_RATE
|
887
|
|
-#ifdef PID_PARAMS_PER_EXTRUDER
|
888
|
|
- #if EXTRUDERS > 1
|
889
|
|
- // set up temp variables - undo the default scaling
|
890
|
|
- pid_current_extruder = 0;
|
891
|
|
- raw_Ki = unscalePID_i(PID_PARAM(Ki,1));
|
892
|
|
- raw_Kd = unscalePID_d(PID_PARAM(Kd,1));
|
893
|
|
- MENU_ITEM_EDIT(float52, MSG_PID_P " E2", &PID_PARAM(Kp,1), 1, 9990);
|
894
|
|
- // i is typically a small value so allows values below 1
|
895
|
|
- MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I " E2", &raw_Ki, 0.01, 9990, copy_and_scalePID_i);
|
896
|
|
- MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D " E2", &raw_Kd, 1, 9990, copy_and_scalePID_d);
|
897
|
|
- #ifdef PID_ADD_EXTRUSION_RATE
|
898
|
|
- MENU_ITEM_EDIT(float3, MSG_PID_C " E2", &PID_PARAM(Kc,1), 1, 9990);
|
899
|
|
- #endif//PID_ADD_EXTRUSION_RATE
|
900
|
|
- #endif//EXTRUDERS > 1
|
901
|
|
- #if EXTRUDERS > 2
|
902
|
|
- // set up temp variables - undo the default scaling
|
903
|
|
- pid_current_extruder = 0;
|
904
|
|
- raw_Ki = unscalePID_i(PID_PARAM(Ki,2));
|
905
|
|
- raw_Kd = unscalePID_d(PID_PARAM(Kd,2));
|
906
|
|
- MENU_ITEM_EDIT(float52, MSG_PID_P " E3", &PID_PARAM(Kp,2), 1, 9990);
|
907
|
|
- // i is typically a small value so allows values below 1
|
908
|
|
- MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I " E3", &raw_Ki, 0.01, 9990, copy_and_scalePID_i);
|
909
|
|
- MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D " E3", &raw_Kd, 1, 9990, copy_and_scalePID_d);
|
|
918
|
+ #ifdef PID_PARAMS_PER_EXTRUDER
|
|
919
|
+ #if EXTRUDERS > 1
|
|
920
|
+ // set up temp variables - undo the default scaling
|
|
921
|
+ raw_Ki = unscalePID_i(PID_PARAM(Ki,1));
|
|
922
|
+ raw_Kd = unscalePID_d(PID_PARAM(Kd,1));
|
|
923
|
+ MENU_ITEM_EDIT(float52, MSG_PID_P " E2", &PID_PARAM(Kp,1), 1, 9990);
|
|
924
|
+ // i is typically a small value so allows values below 1
|
|
925
|
+ MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I " E2", &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E2);
|
|
926
|
+ MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D " E2", &raw_Kd, 1, 9990, copy_and_scalePID_d_E2);
|
910
|
927
|
#ifdef PID_ADD_EXTRUSION_RATE
|
911
|
|
- MENU_ITEM_EDIT(float3, MSG_PID_C " E3", &PID_PARAM(Kc,2), 1, 9990);
|
|
928
|
+ MENU_ITEM_EDIT(float3, MSG_PID_C " E2", &PID_PARAM(Kc,1), 1, 9990);
|
912
|
929
|
#endif//PID_ADD_EXTRUSION_RATE
|
913
|
|
- #endif//EXTRUDERS > 2
|
914
|
|
-#endif // PID_PARAMS_PER_EXTRUDER
|
915
|
|
-#endif//PIDTEMP
|
916
|
|
- MENU_ITEM(submenu, MSG_PREHEAT_PLA_SETTINGS, lcd_control_temperature_preheat_pla_settings_menu);
|
917
|
|
- MENU_ITEM(submenu, MSG_PREHEAT_ABS_SETTINGS, lcd_control_temperature_preheat_abs_settings_menu);
|
918
|
|
- END_MENU();
|
|
930
|
+
|
|
931
|
+ #if EXTRUDERS > 2
|
|
932
|
+ // set up temp variables - undo the default scaling
|
|
933
|
+ raw_Ki = unscalePID_i(PID_PARAM(Ki,2));
|
|
934
|
+ raw_Kd = unscalePID_d(PID_PARAM(Kd,2));
|
|
935
|
+ MENU_ITEM_EDIT(float52, MSG_PID_P " E3", &PID_PARAM(Kp,2), 1, 9990);
|
|
936
|
+ // i is typically a small value so allows values below 1
|
|
937
|
+ MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I " E3", &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E3);
|
|
938
|
+ MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D " E3", &raw_Kd, 1, 9990, copy_and_scalePID_d_E3);
|
|
939
|
+ #ifdef PID_ADD_EXTRUSION_RATE
|
|
940
|
+ MENU_ITEM_EDIT(float3, MSG_PID_C " E3", &PID_PARAM(Kc,2), 1, 9990);
|
|
941
|
+ #endif//PID_ADD_EXTRUSION_RATE
|
|
942
|
+
|
|
943
|
+ #if EXTRUDERS > 3
|
|
944
|
+ // set up temp variables - undo the default scaling
|
|
945
|
+ raw_Ki = unscalePID_i(PID_PARAM(Ki,3));
|
|
946
|
+ raw_Kd = unscalePID_d(PID_PARAM(Kd,3));
|
|
947
|
+ MENU_ITEM_EDIT(float52, MSG_PID_P " E4", &PID_PARAM(Kp,3), 1, 9990);
|
|
948
|
+ // i is typically a small value so allows values below 1
|
|
949
|
+ MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I " E4", &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E4);
|
|
950
|
+ MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D " E4", &raw_Kd, 1, 9990, copy_and_scalePID_d_E4);
|
|
951
|
+ #ifdef PID_ADD_EXTRUSION_RATE
|
|
952
|
+ MENU_ITEM_EDIT(float3, MSG_PID_C " E4", &PID_PARAM(Kc,3), 1, 9990);
|
|
953
|
+ #endif//PID_ADD_EXTRUSION_RATE
|
|
954
|
+ #endif//EXTRUDERS > 3
|
|
955
|
+ #endif//EXTRUDERS > 2
|
|
956
|
+ #endif//EXTRUDERS > 1
|
|
957
|
+ #endif //PID_PARAMS_PER_EXTRUDER
|
|
958
|
+ #endif//PIDTEMP
|
|
959
|
+ MENU_ITEM(submenu, MSG_PREHEAT_PLA_SETTINGS, lcd_control_temperature_preheat_pla_settings_menu);
|
|
960
|
+ MENU_ITEM(submenu, MSG_PREHEAT_ABS_SETTINGS, lcd_control_temperature_preheat_abs_settings_menu);
|
|
961
|
+ END_MENU();
|
919
|
962
|
}
|
920
|
963
|
|
921
|
964
|
static void lcd_control_temperature_preheat_pla_settings_menu()
|
|
@@ -1295,6 +1338,26 @@ void lcd_init()
|
1295
|
1338
|
#endif
|
1296
|
1339
|
}
|
1297
|
1340
|
|
|
1341
|
+int lcd_strlen(char *s) {
|
|
1342
|
+ int i = 0, j = 0;
|
|
1343
|
+ while (s[i]) {
|
|
1344
|
+ if ((s[i] & 0xc0) != 0x80) j++;
|
|
1345
|
+ i++;
|
|
1346
|
+ }
|
|
1347
|
+ return j;
|
|
1348
|
+}
|
|
1349
|
+
|
|
1350
|
+int lcd_strlen_P(const char *s) {
|
|
1351
|
+ int j = 0;
|
|
1352
|
+ while (pgm_read_byte(s)) {
|
|
1353
|
+ if ((pgm_read_byte(s) & 0xc0) != 0x80) j++;
|
|
1354
|
+ s++;
|
|
1355
|
+ }
|
|
1356
|
+ return j;
|
|
1357
|
+}
|
|
1358
|
+
|
|
1359
|
+
|
|
1360
|
+
|
1298
|
1361
|
void lcd_update()
|
1299
|
1362
|
{
|
1300
|
1363
|
static unsigned long timeoutToStatus = 0;
|
|
@@ -1446,7 +1509,7 @@ void lcd_ignore_click(bool b)
|
1446
|
1509
|
}
|
1447
|
1510
|
|
1448
|
1511
|
void lcd_finishstatus() {
|
1449
|
|
- int len = strlen(lcd_status_message);
|
|
1512
|
+ int len = lcd_strlen(lcd_status_message);
|
1450
|
1513
|
if (len > 0) {
|
1451
|
1514
|
while (len < LCD_WIDTH) {
|
1452
|
1515
|
lcd_status_message[len++] = ' ';
|
|
@@ -1859,24 +1922,4 @@ char *ftostr52(const float &x)
|
1859
|
1922
|
return conv;
|
1860
|
1923
|
}
|
1861
|
1924
|
|
1862
|
|
-// Callback for after editing PID i value
|
1863
|
|
-// grab the PID i value out of the temp variable; scale it; then update the PID driver
|
1864
|
|
-void copy_and_scalePID_i()
|
1865
|
|
-{
|
1866
|
|
-#ifdef PIDTEMP
|
1867
|
|
- PID_PARAM(Ki, pid_current_extruder) = scalePID_i(raw_Ki);
|
1868
|
|
- updatePID();
|
1869
|
|
-#endif
|
1870
|
|
-}
|
1871
|
|
-
|
1872
|
|
-// Callback for after editing PID d value
|
1873
|
|
-// grab the PID d value out of the temp variable; scale it; then update the PID driver
|
1874
|
|
-void copy_and_scalePID_d()
|
1875
|
|
-{
|
1876
|
|
-#ifdef PIDTEMP
|
1877
|
|
- PID_PARAM(Kd, pid_current_extruder) = scalePID_d(raw_Kd);
|
1878
|
|
- updatePID();
|
1879
|
|
-#endif
|
1880
|
|
-}
|
1881
|
|
-
|
1882
|
1925
|
#endif //ULTRA_LCD
|