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
This commit is contained in:
grob6000 2015-01-11 01:14:02 +11:00
parent 3e2af67ce3
commit 7d32c7f36d
13 changed files with 135 additions and 14 deletions

View file

@ -67,6 +67,14 @@
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C" #define MSG_PID_C "PID-C"
#define MSG_PID_P1 "PID-P E2"
#define MSG_PID_I1 "PID-I E2"
#define MSG_PID_D1 "PID-D E2"
#define MSG_PID_C1 "PID-C E2"
#define MSG_PID_P2 "PID-P E3"
#define MSG_PID_I2 "PID-I E3"
#define MSG_PID_D2 "PID-D E3"
#define MSG_PID_C2 "PID-C E3"
#define MSG_ACC "Accel" #define MSG_ACC "Accel"
#define MSG_VXY_JERK "Vxy-jerk" #define MSG_VXY_JERK "Vxy-jerk"
#define MSG_VZ_JERK "Vz-jerk" #define MSG_VZ_JERK "Vz-jerk"

View file

@ -67,6 +67,14 @@
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C" #define MSG_PID_C "PID-C"
#define MSG_PID_P1 "PID-P E2"
#define MSG_PID_I1 "PID-I E2"
#define MSG_PID_D1 "PID-D E2"
#define MSG_PID_C1 "PID-C E2"
#define MSG_PID_P2 "PID-P E3"
#define MSG_PID_I2 "PID-I E3"
#define MSG_PID_D2 "PID-D E3"
#define MSG_PID_C2 "PID-C E3"
#define MSG_ACC "Acc" #define MSG_ACC "Acc"
#define MSG_VXY_JERK "Vxy-jerk" #define MSG_VXY_JERK "Vxy-jerk"
#define MSG_VZ_JERK "Vz-jerk" #define MSG_VZ_JERK "Vz-jerk"

View file

@ -67,6 +67,14 @@
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C" #define MSG_PID_C "PID-C"
#define MSG_PID_P1 "PID-P E2"
#define MSG_PID_I1 "PID-I E2"
#define MSG_PID_D1 "PID-D E2"
#define MSG_PID_C1 "PID-C E2"
#define MSG_PID_P2 "PID-P E3"
#define MSG_PID_I2 "PID-I E3"
#define MSG_PID_D2 "PID-D E3"
#define MSG_PID_C2 "PID-C E3"
#define MSG_ACC "Accel" #define MSG_ACC "Accel"
#define MSG_VXY_JERK "Vxy-jerk" #define MSG_VXY_JERK "Vxy-jerk"
#define MSG_VZ_JERK "Vz-jerk" #define MSG_VZ_JERK "Vz-jerk"

View file

@ -67,6 +67,14 @@
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C" #define MSG_PID_C "PID-C"
#define MSG_PID_P1 "PID-P E2"
#define MSG_PID_I1 "PID-I E2"
#define MSG_PID_D1 "PID-D E2"
#define MSG_PID_C1 "PID-C E2"
#define MSG_PID_P2 "PID-P E3"
#define MSG_PID_I2 "PID-I E3"
#define MSG_PID_D2 "PID-D E3"
#define MSG_PID_C2 "PID-C E3"
#define MSG_ACC "Acel" #define MSG_ACC "Acel"
#define MSG_VXY_JERK "Vxy-jerk" #define MSG_VXY_JERK "Vxy-jerk"
#define MSG_VZ_JERK "Vz-jerk" #define MSG_VZ_JERK "Vz-jerk"

View file

@ -67,6 +67,14 @@
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C" #define MSG_PID_C "PID-C"
#define MSG_PID_P1 "PID-P E2"
#define MSG_PID_I1 "PID-I E2"
#define MSG_PID_D1 "PID-D E2"
#define MSG_PID_C1 "PID-C E2"
#define MSG_PID_P2 "PID-P E3"
#define MSG_PID_I2 "PID-I E3"
#define MSG_PID_D2 "PID-D E3"
#define MSG_PID_C2 "PID-C E3"
#define MSG_ACC "Azelerazioa" #define MSG_ACC "Azelerazioa"
#define MSG_VXY_JERK "Vxy-astindua" #define MSG_VXY_JERK "Vxy-astindua"
#define MSG_VZ_JERK "Vz-astindua" #define MSG_VZ_JERK "Vz-astindua"

View file

@ -67,6 +67,14 @@
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C" #define MSG_PID_C "PID-C"
#define MSG_PID_P1 "PID-P E2"
#define MSG_PID_I1 "PID-I E2"
#define MSG_PID_D1 "PID-D E2"
#define MSG_PID_C1 "PID-C E2"
#define MSG_PID_P2 "PID-P E3"
#define MSG_PID_I2 "PID-I E3"
#define MSG_PID_D2 "PID-D E3"
#define MSG_PID_C2 "PID-C E3"
#define MSG_ACC "Kiihtyv" #define MSG_ACC "Kiihtyv"
#define MSG_VXY_JERK "Vxy-jerk" #define MSG_VXY_JERK "Vxy-jerk"
#define MSG_VZ_JERK "Vz-jerk" #define MSG_VZ_JERK "Vz-jerk"

View file

@ -67,6 +67,14 @@
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C" #define MSG_PID_C "PID-C"
#define MSG_PID_P1 "PID-P E2"
#define MSG_PID_I1 "PID-I E2"
#define MSG_PID_D1 "PID-D E2"
#define MSG_PID_C1 "PID-C E2"
#define MSG_PID_P2 "PID-P E3"
#define MSG_PID_I2 "PID-I E3"
#define MSG_PID_D2 "PID-D E3"
#define MSG_PID_C2 "PID-C E3"
#define MSG_ACC "Accel" #define MSG_ACC "Accel"
#define MSG_VXY_JERK "Vxy-jerk" #define MSG_VXY_JERK "Vxy-jerk"
#define MSG_VZ_JERK "Vz-jerk" #define MSG_VZ_JERK "Vz-jerk"

View file

@ -67,6 +67,14 @@
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C" #define MSG_PID_C "PID-C"
#define MSG_PID_P1 "PID-P E2"
#define MSG_PID_I1 "PID-I E2"
#define MSG_PID_D1 "PID-D E2"
#define MSG_PID_C1 "PID-C E2"
#define MSG_PID_P2 "PID-P E3"
#define MSG_PID_I2 "PID-I E3"
#define MSG_PID_D2 "PID-D E3"
#define MSG_PID_C2 "PID-C E3"
#define MSG_ACC "Accel." #define MSG_ACC "Accel."
#define MSG_VXY_JERK "Vxy-jerk" #define MSG_VXY_JERK "Vxy-jerk"
#define MSG_VZ_JERK "Vz-jerk" #define MSG_VZ_JERK "Vz-jerk"

View file

@ -67,6 +67,14 @@
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C" #define MSG_PID_C "PID-C"
#define MSG_PID_P1 "PID-P E2"
#define MSG_PID_I1 "PID-I E2"
#define MSG_PID_D1 "PID-D E2"
#define MSG_PID_C1 "PID-C E2"
#define MSG_PID_P2 "PID-P E3"
#define MSG_PID_I2 "PID-I E3"
#define MSG_PID_D2 "PID-D E3"
#define MSG_PID_C2 "PID-C E3"
#define MSG_ACC "Versn" #define MSG_ACC "Versn"
#define MSG_VXY_JERK "Vxy-jerk" #define MSG_VXY_JERK "Vxy-jerk"
#define MSG_VZ_JERK "Vz-jerk" #define MSG_VZ_JERK "Vz-jerk"

View file

@ -67,6 +67,14 @@
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C" #define MSG_PID_C "PID-C"
#define MSG_PID_P1 "PID-P E2"
#define MSG_PID_I1 "PID-I E2"
#define MSG_PID_D1 "PID-D E2"
#define MSG_PID_C1 "PID-C E2"
#define MSG_PID_P2 "PID-P E3"
#define MSG_PID_I2 "PID-I E3"
#define MSG_PID_D2 "PID-D E3"
#define MSG_PID_C2 "PID-C E3"
#define MSG_ACC "Przyspieszenie" #define MSG_ACC "Przyspieszenie"
#define MSG_VXY_JERK "Zryw Vxy" #define MSG_VXY_JERK "Zryw Vxy"
#define MSG_VZ_JERK "Zryw Vz" #define MSG_VZ_JERK "Zryw Vz"

View file

@ -67,6 +67,14 @@
#define MSG_PID_I "PID-I: " #define MSG_PID_I "PID-I: "
#define MSG_PID_D "PID-D: " #define MSG_PID_D "PID-D: "
#define MSG_PID_C "PID-C: " #define MSG_PID_C "PID-C: "
#define MSG_PID_P1 "PID-P E2: "
#define MSG_PID_I1 "PID-I E2: "
#define MSG_PID_D1 "PID-D E2: "
#define MSG_PID_C1 "PID-C E2: "
#define MSG_PID_P2 "PID-P E3: "
#define MSG_PID_I2 "PID-I E3: "
#define MSG_PID_D2 "PID-D E3: "
#define MSG_PID_C2 "PID-C E3: "
#define MSG_ACC "Acc:" #define MSG_ACC "Acc:"
#define MSG_VXY_JERK "Vxy-jerk: " #define MSG_VXY_JERK "Vxy-jerk: "
#define MSG_VZ_JERK "Vz-jerk" #define MSG_VZ_JERK "Vz-jerk"

View file

@ -69,6 +69,14 @@
#define MSG_PID_I "PID-I: " #define MSG_PID_I "PID-I: "
#define MSG_PID_D "PID-D: " #define MSG_PID_D "PID-D: "
#define MSG_PID_C "PID-C: " #define MSG_PID_C "PID-C: "
#define MSG_PID_P1 "PID-P E2: "
#define MSG_PID_I1 "PID-I E2: "
#define MSG_PID_D1 "PID-D E2: "
#define MSG_PID_C1 "PID-C E2: "
#define MSG_PID_P2 "PID-P E3: "
#define MSG_PID_I2 "PID-I E3: "
#define MSG_PID_D2 "PID-D E3: "
#define MSG_PID_C2 "PID-C E3: "
#define MSG_ACC "Acc:" #define MSG_ACC "Acc:"
#define MSG_VXY_JERK "Vxy-jerk: " #define MSG_VXY_JERK "Vxy-jerk: "
#define MSG_VZ_JERK "Vz-jerk" #define MSG_VZ_JERK "Vz-jerk"

View file

@ -185,8 +185,9 @@ void* editValue;
int32_t minEditValue, maxEditValue; int32_t minEditValue, maxEditValue;
menuFunc_t callbackFunc; menuFunc_t callbackFunc;
// place-holders for Ki and Kd edits // place-holders for Ki and Kd edits, and the extruder # being edited
float raw_Ki, raw_Kd; float raw_Ki, raw_Kd;
int pid_current_extruder;
static void lcd_goto_menu(menuFunc_t menu, const uint32_t encoder=0, const bool feedback=true) { static void lcd_goto_menu(menuFunc_t menu, const uint32_t encoder=0, const bool feedback=true) {
if (currentMenu != menu) { if (currentMenu != menu) {
@ -764,12 +765,6 @@ static void lcd_control_menu()
static void lcd_control_temperature_menu() static void lcd_control_temperature_menu()
{ {
#ifdef PIDTEMP
// set up temp variables - undo the default scaling
raw_Ki = unscalePID_i(Ki);
raw_Kd = unscalePID_d(Kd);
#endif
START_MENU(); START_MENU();
MENU_ITEM(back, MSG_CONTROL, lcd_control_menu); MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
#if TEMP_SENSOR_0 != 0 #if TEMP_SENSOR_0 != 0
@ -792,13 +787,43 @@ static void lcd_control_temperature_menu()
MENU_ITEM_EDIT(float32, MSG_FACTOR, &autotemp_factor, 0.0, 1.0); MENU_ITEM_EDIT(float32, MSG_FACTOR, &autotemp_factor, 0.0, 1.0);
#endif #endif
#ifdef PIDTEMP #ifdef PIDTEMP
MENU_ITEM_EDIT(float52, MSG_PID_P, &Kp, 1, 9990); // set up temp variables - undo the default scaling
// i is typically a small value so allows values below 1 pid_current_extruder = 0;
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I, &raw_Ki, 0.01, 9990, copy_and_scalePID_i); raw_Ki = unscalePID_i(Ki[0]);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D, &raw_Kd, 1, 9990, copy_and_scalePID_d); raw_Kd = unscalePID_d(Kd[0]);
MENU_ITEM_EDIT(float52, MSG_PID_P, &Kp[0], 1, 9990);
// i is typically a small value so allows values below 1
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I, &raw_Ki, 0.01, 9990, copy_and_scalePID_i);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D, &raw_Kd, 1, 9990, copy_and_scalePID_d);
# ifdef PID_ADD_EXTRUSION_RATE # ifdef PID_ADD_EXTRUSION_RATE
MENU_ITEM_EDIT(float3, MSG_PID_C, &Kc, 1, 9990); MENU_ITEM_EDIT(float3, MSG_PID_C, &Kc[0], 1, 9990);
# endif//PID_ADD_EXTRUSION_RATE # endif//PID_ADD_EXTRUSION_RATE
#if EXTRUDERS > 1
// set up temp variables - undo the default scaling
pid_current_extruder = 1;
raw_Ki = unscalePID_i(Ki[1]);
raw_Kd = unscalePID_d(Kd[1]);
MENU_ITEM_EDIT(float52, MSG_PID_P1, &Kp[1], 1, 9990);
// i is typically a small value so allows values below 1
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I1, &raw_Ki, 0.01, 9990, copy_and_scalePID_i);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D1, &raw_Kd, 1, 9990, copy_and_scalePID_d);
# ifdef PID_ADD_EXTRUSION_RATE
MENU_ITEM_EDIT(float3, MSG_PID_C1, &Kc[1], 1, 9990);
# endif//PID_ADD_EXTRUSION_RATE
#endif//EXTRUDERS > 1
#if EXTRUDERS > 2
// set up temp variables - undo the default scaling
pid_current_extruder = 2;
raw_Ki = unscalePID_i(Ki[2]);
raw_Kd = unscalePID_d(Kd[2]);
MENU_ITEM_EDIT(float52, MSG_PID_P2, &Kp[2], 1, 9990);
// i is typically a small value so allows values below 1
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I2, &raw_Ki, 0.01, 9990, copy_and_scalePID_i);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D2, &raw_Kd, 1, 9990, copy_and_scalePID_d);
# ifdef PID_ADD_EXTRUSION_RATE
MENU_ITEM_EDIT(float3, MSG_PID_C2, &Kc[2], 1, 9990);
# endif//PID_ADD_EXTRUSION_RATE
#endif//EXTRUDERS > 2
#endif//PIDTEMP #endif//PIDTEMP
MENU_ITEM(submenu, MSG_PREHEAT_PLA_SETTINGS, lcd_control_temperature_preheat_pla_settings_menu); MENU_ITEM(submenu, MSG_PREHEAT_PLA_SETTINGS, lcd_control_temperature_preheat_pla_settings_menu);
MENU_ITEM(submenu, MSG_PREHEAT_ABS_SETTINGS, lcd_control_temperature_preheat_abs_settings_menu); MENU_ITEM(submenu, MSG_PREHEAT_ABS_SETTINGS, lcd_control_temperature_preheat_abs_settings_menu);
@ -1705,7 +1730,7 @@ char *ftostr52(const float &x)
void copy_and_scalePID_i() void copy_and_scalePID_i()
{ {
#ifdef PIDTEMP #ifdef PIDTEMP
Ki = scalePID_i(raw_Ki); Ki[pid_current_extruder] = scalePID_i(raw_Ki);
updatePID(); updatePID();
#endif #endif
} }
@ -1715,7 +1740,7 @@ void copy_and_scalePID_i()
void copy_and_scalePID_d() void copy_and_scalePID_d()
{ {
#ifdef PIDTEMP #ifdef PIDTEMP
Kd = scalePID_d(raw_Kd); Kd[pid_current_extruder] = scalePID_d(raw_Kd);
updatePID(); updatePID();
#endif #endif
} }