|
@@ -185,8 +185,9 @@ void* editValue;
|
185
|
185
|
int32_t minEditValue, maxEditValue;
|
186
|
186
|
menuFunc_t callbackFunc;
|
187
|
187
|
|
188
|
|
-// place-holders for Ki and Kd edits
|
|
188
|
+// place-holders for Ki and Kd edits, and the extruder # being edited
|
189
|
189
|
float raw_Ki, raw_Kd;
|
|
190
|
+int pid_current_extruder;
|
190
|
191
|
|
191
|
192
|
static void lcd_goto_menu(menuFunc_t menu, const uint32_t encoder=0, const bool feedback=true) {
|
192
|
193
|
if (currentMenu != menu) {
|
|
@@ -764,12 +765,6 @@ static void lcd_control_menu()
|
764
|
765
|
|
765
|
766
|
static void lcd_control_temperature_menu()
|
766
|
767
|
{
|
767
|
|
-#ifdef PIDTEMP
|
768
|
|
- // set up temp variables - undo the default scaling
|
769
|
|
- raw_Ki = unscalePID_i(Ki);
|
770
|
|
- raw_Kd = unscalePID_d(Kd);
|
771
|
|
-#endif
|
772
|
|
-
|
773
|
768
|
START_MENU();
|
774
|
769
|
MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
|
775
|
770
|
#if TEMP_SENSOR_0 != 0
|
|
@@ -792,13 +787,43 @@ static void lcd_control_temperature_menu()
|
792
|
787
|
MENU_ITEM_EDIT(float32, MSG_FACTOR, &autotemp_factor, 0.0, 1.0);
|
793
|
788
|
#endif
|
794
|
789
|
#ifdef PIDTEMP
|
795
|
|
- MENU_ITEM_EDIT(float52, MSG_PID_P, &Kp, 1, 9990);
|
796
|
|
- // i is typically a small value so allows values below 1
|
797
|
|
- MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I, &raw_Ki, 0.01, 9990, copy_and_scalePID_i);
|
798
|
|
- MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D, &raw_Kd, 1, 9990, copy_and_scalePID_d);
|
|
790
|
+ // set up temp variables - undo the default scaling
|
|
791
|
+ pid_current_extruder = 0;
|
|
792
|
+ raw_Ki = unscalePID_i(Ki[0]);
|
|
793
|
+ raw_Kd = unscalePID_d(Kd[0]);
|
|
794
|
+ MENU_ITEM_EDIT(float52, MSG_PID_P, &Kp[0], 1, 9990);
|
|
795
|
+ // i is typically a small value so allows values below 1
|
|
796
|
+ MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I, &raw_Ki, 0.01, 9990, copy_and_scalePID_i);
|
|
797
|
+ MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D, &raw_Kd, 1, 9990, copy_and_scalePID_d);
|
799
|
798
|
# ifdef PID_ADD_EXTRUSION_RATE
|
800
|
|
- MENU_ITEM_EDIT(float3, MSG_PID_C, &Kc, 1, 9990);
|
|
799
|
+ MENU_ITEM_EDIT(float3, MSG_PID_C, &Kc[0], 1, 9990);
|
801
|
800
|
# endif//PID_ADD_EXTRUSION_RATE
|
|
801
|
+#if EXTRUDERS > 1
|
|
802
|
+ // set up temp variables - undo the default scaling
|
|
803
|
+ pid_current_extruder = 1;
|
|
804
|
+ raw_Ki = unscalePID_i(Ki[1]);
|
|
805
|
+ raw_Kd = unscalePID_d(Kd[1]);
|
|
806
|
+ MENU_ITEM_EDIT(float52, MSG_PID_P1, &Kp[1], 1, 9990);
|
|
807
|
+ // i is typically a small value so allows values below 1
|
|
808
|
+ MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I1, &raw_Ki, 0.01, 9990, copy_and_scalePID_i);
|
|
809
|
+ MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D1, &raw_Kd, 1, 9990, copy_and_scalePID_d);
|
|
810
|
+# ifdef PID_ADD_EXTRUSION_RATE
|
|
811
|
+ MENU_ITEM_EDIT(float3, MSG_PID_C1, &Kc[1], 1, 9990);
|
|
812
|
+# endif//PID_ADD_EXTRUSION_RATE
|
|
813
|
+#endif//EXTRUDERS > 1
|
|
814
|
+#if EXTRUDERS > 2
|
|
815
|
+ // set up temp variables - undo the default scaling
|
|
816
|
+ pid_current_extruder = 2;
|
|
817
|
+ raw_Ki = unscalePID_i(Ki[2]);
|
|
818
|
+ raw_Kd = unscalePID_d(Kd[2]);
|
|
819
|
+ MENU_ITEM_EDIT(float52, MSG_PID_P2, &Kp[2], 1, 9990);
|
|
820
|
+ // i is typically a small value so allows values below 1
|
|
821
|
+ MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I2, &raw_Ki, 0.01, 9990, copy_and_scalePID_i);
|
|
822
|
+ MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D2, &raw_Kd, 1, 9990, copy_and_scalePID_d);
|
|
823
|
+# ifdef PID_ADD_EXTRUSION_RATE
|
|
824
|
+ MENU_ITEM_EDIT(float3, MSG_PID_C2, &Kc[2], 1, 9990);
|
|
825
|
+# endif//PID_ADD_EXTRUSION_RATE
|
|
826
|
+#endif//EXTRUDERS > 2
|
802
|
827
|
#endif//PIDTEMP
|
803
|
828
|
MENU_ITEM(submenu, MSG_PREHEAT_PLA_SETTINGS, lcd_control_temperature_preheat_pla_settings_menu);
|
804
|
829
|
MENU_ITEM(submenu, MSG_PREHEAT_ABS_SETTINGS, lcd_control_temperature_preheat_abs_settings_menu);
|
|
@@ -1705,7 +1730,7 @@ char *ftostr52(const float &x)
|
1705
|
1730
|
void copy_and_scalePID_i()
|
1706
|
1731
|
{
|
1707
|
1732
|
#ifdef PIDTEMP
|
1708
|
|
- Ki = scalePID_i(raw_Ki);
|
|
1733
|
+ Ki[pid_current_extruder] = scalePID_i(raw_Ki);
|
1709
|
1734
|
updatePID();
|
1710
|
1735
|
#endif
|
1711
|
1736
|
}
|
|
@@ -1715,7 +1740,7 @@ void copy_and_scalePID_i()
|
1715
|
1740
|
void copy_and_scalePID_d()
|
1716
|
1741
|
{
|
1717
|
1742
|
#ifdef PIDTEMP
|
1718
|
|
- Kd = scalePID_d(raw_Kd);
|
|
1743
|
+ Kd[pid_current_extruder] = scalePID_d(raw_Kd);
|
1719
|
1744
|
updatePID();
|
1720
|
1745
|
#endif
|
1721
|
1746
|
}
|