Browse Source

Multiple PID parameter edit for ultralcd

* Depending on extruder count, will add menu items for ultralcd to edit
individual PID parameters for each extruder
* Added menu items to each language_xx.h
* Builds OK, but recommend testing with typical LCD
grob6000 9 years ago
parent
commit
7d32c7f36d

+ 8
- 0
Marlin/language_ca.h View File

@@ -67,6 +67,14 @@
67 67
 #define MSG_PID_I                           "PID-I"
68 68
 #define MSG_PID_D                           "PID-D"
69 69
 #define MSG_PID_C                           "PID-C"
70
+#define MSG_PID_P1                          "PID-P E2"
71
+#define MSG_PID_I1                          "PID-I E2"
72
+#define MSG_PID_D1                          "PID-D E2"
73
+#define MSG_PID_C1                          "PID-C E2"
74
+#define MSG_PID_P2                          "PID-P E3"
75
+#define MSG_PID_I2                          "PID-I E3"
76
+#define MSG_PID_D2                          "PID-D E3"
77
+#define MSG_PID_C2                          "PID-C E3"
70 78
 #define MSG_ACC                             "Accel"
71 79
 #define MSG_VXY_JERK                        "Vxy-jerk"
72 80
 #define MSG_VZ_JERK                         "Vz-jerk"

+ 8
- 0
Marlin/language_de.h View File

@@ -67,6 +67,14 @@
67 67
 #define MSG_PID_I                           "PID-I"
68 68
 #define MSG_PID_D                           "PID-D"
69 69
 #define MSG_PID_C                           "PID-C"
70
+#define MSG_PID_P1                          "PID-P E2"
71
+#define MSG_PID_I1                          "PID-I E2"
72
+#define MSG_PID_D1                          "PID-D E2"
73
+#define MSG_PID_C1                          "PID-C E2"
74
+#define MSG_PID_P2                          "PID-P E3"
75
+#define MSG_PID_I2                          "PID-I E3"
76
+#define MSG_PID_D2                          "PID-D E3"
77
+#define MSG_PID_C2                          "PID-C E3"
70 78
 #define MSG_ACC                             "Acc"
71 79
 #define MSG_VXY_JERK                        "Vxy-jerk"
72 80
 #define MSG_VZ_JERK                         "Vz-jerk"

+ 8
- 0
Marlin/language_en.h View File

@@ -67,6 +67,14 @@
67 67
 #define MSG_PID_I                           "PID-I"
68 68
 #define MSG_PID_D                           "PID-D"
69 69
 #define MSG_PID_C                           "PID-C"
70
+#define MSG_PID_P1                          "PID-P E2"
71
+#define MSG_PID_I1                          "PID-I E2"
72
+#define MSG_PID_D1                          "PID-D E2"
73
+#define MSG_PID_C1                          "PID-C E2"
74
+#define MSG_PID_P2                          "PID-P E3"
75
+#define MSG_PID_I2                          "PID-I E3"
76
+#define MSG_PID_D2                          "PID-D E3"
77
+#define MSG_PID_C2                          "PID-C E3"
70 78
 #define MSG_ACC                             "Accel"
71 79
 #define MSG_VXY_JERK                        "Vxy-jerk"
72 80
 #define MSG_VZ_JERK                         "Vz-jerk"

+ 8
- 0
Marlin/language_es.h View File

@@ -67,6 +67,14 @@
67 67
 #define MSG_PID_I                           "PID-I"
68 68
 #define MSG_PID_D                           "PID-D"
69 69
 #define MSG_PID_C                           "PID-C"
70
+#define MSG_PID_P1                          "PID-P E2"
71
+#define MSG_PID_I1                          "PID-I E2"
72
+#define MSG_PID_D1                          "PID-D E2"
73
+#define MSG_PID_C1                          "PID-C E2"
74
+#define MSG_PID_P2                          "PID-P E3"
75
+#define MSG_PID_I2                          "PID-I E3"
76
+#define MSG_PID_D2                          "PID-D E3"
77
+#define MSG_PID_C2                          "PID-C E3"
70 78
 #define MSG_ACC                             "Acel"
71 79
 #define MSG_VXY_JERK                        "Vxy-jerk"
72 80
 #define MSG_VZ_JERK                         "Vz-jerk"

+ 8
- 0
Marlin/language_eu.h View File

@@ -67,6 +67,14 @@
67 67
 #define MSG_PID_I                           "PID-I"
68 68
 #define MSG_PID_D                           "PID-D"
69 69
 #define MSG_PID_C                           "PID-C"
70
+#define MSG_PID_P1                          "PID-P E2"
71
+#define MSG_PID_I1                          "PID-I E2"
72
+#define MSG_PID_D1                          "PID-D E2"
73
+#define MSG_PID_C1                          "PID-C E2"
74
+#define MSG_PID_P2                          "PID-P E3"
75
+#define MSG_PID_I2                          "PID-I E3"
76
+#define MSG_PID_D2                          "PID-D E3"
77
+#define MSG_PID_C2                          "PID-C E3"
70 78
 #define MSG_ACC                             "Azelerazioa"
71 79
 #define MSG_VXY_JERK                        "Vxy-astindua"
72 80
 #define MSG_VZ_JERK                         "Vz-astindua"

+ 8
- 0
Marlin/language_fi.h View File

@@ -67,6 +67,14 @@
67 67
 #define MSG_PID_I                           "PID-I"
68 68
 #define MSG_PID_D                           "PID-D"
69 69
 #define MSG_PID_C                           "PID-C"
70
+#define MSG_PID_P1                          "PID-P E2"
71
+#define MSG_PID_I1                          "PID-I E2"
72
+#define MSG_PID_D1                          "PID-D E2"
73
+#define MSG_PID_C1                          "PID-C E2"
74
+#define MSG_PID_P2                          "PID-P E3"
75
+#define MSG_PID_I2                          "PID-I E3"
76
+#define MSG_PID_D2                          "PID-D E3"
77
+#define MSG_PID_C2                          "PID-C E3"
70 78
 #define MSG_ACC                             "Kiihtyv"
71 79
 #define MSG_VXY_JERK                        "Vxy-jerk"
72 80
 #define MSG_VZ_JERK                         "Vz-jerk"

+ 8
- 0
Marlin/language_fr.h View File

@@ -67,6 +67,14 @@
67 67
 #define MSG_PID_I                           "PID-I"
68 68
 #define MSG_PID_D                           "PID-D"
69 69
 #define MSG_PID_C                           "PID-C"
70
+#define MSG_PID_P1                          "PID-P E2"
71
+#define MSG_PID_I1                          "PID-I E2"
72
+#define MSG_PID_D1                          "PID-D E2"
73
+#define MSG_PID_C1                          "PID-C E2"
74
+#define MSG_PID_P2                          "PID-P E3"
75
+#define MSG_PID_I2                          "PID-I E3"
76
+#define MSG_PID_D2                          "PID-D E3"
77
+#define MSG_PID_C2                          "PID-C E3"
70 78
 #define MSG_ACC                             "Accel"
71 79
 #define MSG_VXY_JERK                        "Vxy-jerk"
72 80
 #define MSG_VZ_JERK                         "Vz-jerk"

+ 8
- 0
Marlin/language_it.h View File

@@ -67,6 +67,14 @@
67 67
 #define MSG_PID_I                           "PID-I"
68 68
 #define MSG_PID_D                           "PID-D"
69 69
 #define MSG_PID_C                           "PID-C"
70
+#define MSG_PID_P1                          "PID-P E2"
71
+#define MSG_PID_I1                          "PID-I E2"
72
+#define MSG_PID_D1                          "PID-D E2"
73
+#define MSG_PID_C1                          "PID-C E2"
74
+#define MSG_PID_P2                          "PID-P E3"
75
+#define MSG_PID_I2                          "PID-I E3"
76
+#define MSG_PID_D2                          "PID-D E3"
77
+#define MSG_PID_C2                          "PID-C E3"
70 78
 #define MSG_ACC                             "Accel."
71 79
 #define MSG_VXY_JERK                        "Vxy-jerk"
72 80
 #define MSG_VZ_JERK                         "Vz-jerk"

+ 8
- 0
Marlin/language_nl.h View File

@@ -67,6 +67,14 @@
67 67
 #define MSG_PID_I                           "PID-I"
68 68
 #define MSG_PID_D                           "PID-D"
69 69
 #define MSG_PID_C                           "PID-C"
70
+#define MSG_PID_P1                          "PID-P E2"
71
+#define MSG_PID_I1                          "PID-I E2"
72
+#define MSG_PID_D1                          "PID-D E2"
73
+#define MSG_PID_C1                          "PID-C E2"
74
+#define MSG_PID_P2                          "PID-P E3"
75
+#define MSG_PID_I2                          "PID-I E3"
76
+#define MSG_PID_D2                          "PID-D E3"
77
+#define MSG_PID_C2                          "PID-C E3"
70 78
 #define MSG_ACC                             "Versn"
71 79
 #define MSG_VXY_JERK                        "Vxy-jerk"
72 80
 #define MSG_VZ_JERK                         "Vz-jerk"

+ 8
- 0
Marlin/language_pl.h View File

@@ -67,6 +67,14 @@
67 67
 #define MSG_PID_I                           "PID-I"
68 68
 #define MSG_PID_D                           "PID-D"
69 69
 #define MSG_PID_C                           "PID-C"
70
+#define MSG_PID_P1                          "PID-P E2"
71
+#define MSG_PID_I1                          "PID-I E2"
72
+#define MSG_PID_D1                          "PID-D E2"
73
+#define MSG_PID_C1                          "PID-C E2"
74
+#define MSG_PID_P2                          "PID-P E3"
75
+#define MSG_PID_I2                          "PID-I E3"
76
+#define MSG_PID_D2                          "PID-D E3"
77
+#define MSG_PID_C2                          "PID-C E3"
70 78
 #define MSG_ACC                             "Przyspieszenie"
71 79
 #define MSG_VXY_JERK                        "Zryw Vxy"
72 80
 #define MSG_VZ_JERK                         "Zryw Vz"

+ 8
- 0
Marlin/language_pt.h View File

@@ -67,6 +67,14 @@
67 67
 #define MSG_PID_I                           "PID-I: "
68 68
 #define MSG_PID_D                           "PID-D: "
69 69
 #define MSG_PID_C                           "PID-C: "
70
+#define MSG_PID_P1                          "PID-P E2: "
71
+#define MSG_PID_I1                          "PID-I E2: "
72
+#define MSG_PID_D1                          "PID-D E2: "
73
+#define MSG_PID_C1                          "PID-C E2: "
74
+#define MSG_PID_P2                          "PID-P E3: "
75
+#define MSG_PID_I2                          "PID-I E3: "
76
+#define MSG_PID_D2                          "PID-D E3: "
77
+#define MSG_PID_C2                          "PID-C E3: "
70 78
 #define MSG_ACC                             "Acc:"
71 79
 #define MSG_VXY_JERK                        "Vxy-jerk: "
72 80
 #define MSG_VZ_JERK                         "Vz-jerk"

+ 8
- 0
Marlin/language_ru.h View File

@@ -69,6 +69,14 @@
69 69
 #define MSG_PID_I                           "PID-I: "
70 70
 #define MSG_PID_D                           "PID-D: "
71 71
 #define MSG_PID_C                           "PID-C: "
72
+#define MSG_PID_P1                          "PID-P E2: "
73
+#define MSG_PID_I1                          "PID-I E2: "
74
+#define MSG_PID_D1                          "PID-D E2: "
75
+#define MSG_PID_C1                          "PID-C E2: "
76
+#define MSG_PID_P2                          "PID-P E3: "
77
+#define MSG_PID_I2                          "PID-I E3: "
78
+#define MSG_PID_D2                          "PID-D E3: "
79
+#define MSG_PID_C2                          "PID-C E3: "
72 80
 #define MSG_ACC                             "Acc:"
73 81
 #define MSG_VXY_JERK                        "Vxy-jerk: "
74 82
 #define MSG_VZ_JERK                         "Vz-jerk"

+ 39
- 14
Marlin/ultralcd.cpp View File

@@ -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
 }

Loading…
Cancel
Save