@ -185,8 +185,9 @@ void* editValue;
int32_t minEditValue , maxEditValue ;
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 ;
int pid_current_extruder ;
static void lcd_goto_menu ( menuFunc_t menu , const uint32_t encoder = 0 , const bool feedback = true ) {
if ( currentMenu ! = menu ) {
@ -764,12 +765,6 @@ static void lcd_control_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 ( ) ;
MENU_ITEM ( back , MSG_CONTROL , lcd_control_menu ) ;
# 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 ) ;
# endif
# ifdef PIDTEMP
MENU_ITEM_EDIT ( float52 , MSG_PID_P , & Kp , 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 ) ;
// set up temp variables - undo the default scaling
pid_current_extruder = 0 ;
raw_Ki = unscalePID_i ( Ki [ 0 ] ) ;
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
MENU_ITEM_EDIT ( float3 , MSG_PID_C , & Kc [ 0 ] , 1 , 9990 ) ;
# 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_C , & Kc , 1 , 9990 ) ;
MENU_ITEM_EDIT ( float3 , MSG_PID_C 2 , & Kc [ 2 ] , 1 , 9990 ) ;
# endif //PID_ADD_EXTRUSION_RATE
# endif //EXTRUDERS > 2
# endif //PIDTEMP
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 ) ;
@ -1705,7 +1730,7 @@ char *ftostr52(const float &x)
void copy_and_scalePID_i ( )
{
# ifdef PIDTEMP
Ki = scalePID_i ( raw_Ki ) ;
Ki [ pid_current_extruder ] = scalePID_i ( raw_Ki ) ;
updatePID ( ) ;
# endif
}
@ -1715,7 +1740,7 @@ void copy_and_scalePID_i()
void copy_and_scalePID_d ( )
{
# ifdef PIDTEMP
Kd = scalePID_d ( raw_Kd ) ;
Kd [ pid_current_extruder ] = scalePID_d ( raw_Kd ) ;
updatePID ( ) ;
# endif
}