1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-26 21:36:21 +00:00

🐛 Fix PID edit menu for Bed, Chamber (#23987)

This commit is contained in:
Giuliano Zaro 2022-04-03 01:27:05 +02:00 committed by Scott Lahteine
parent d98c61cafb
commit e4c7c550fc
2 changed files with 36 additions and 9 deletions

View File

@ -39,7 +39,7 @@
#include "../../module/probe.h" #include "../../module/probe.h"
#endif #endif
#if ENABLED(PIDTEMP) #if ANY(PIDTEMP, PIDTEMPBED, PIDTEMPCHAMBER)
#include "../../module/temperature.h" #include "../../module/temperature.h"
#endif #endif
@ -190,7 +190,12 @@ void menu_backlash();
#if ENABLED(PIDTEMPCHAMBER) #if ENABLED(PIDTEMPCHAMBER)
case H_CHAMBER: tune_temp = autotune_temp_chamber; break; case H_CHAMBER: tune_temp = autotune_temp_chamber; break;
#endif #endif
default: tune_temp = autotune_temp[hid]; break; default:
#if ENABLED(PIDTEMP)
tune_temp = autotune_temp[hid]; break;
#else
return;
#endif
} }
sprintf_P(cmd, PSTR("M303 U1 E%i S%i"), hid, tune_temp); sprintf_P(cmd, PSTR("M303 U1 E%i S%i"), hid, tune_temp);
queue.inject(cmd); queue.inject(cmd);
@ -206,14 +211,36 @@ void menu_backlash();
// Helpers for editing PID Ki & Kd values // Helpers for editing PID Ki & Kd values
// grab the PID value out of the temp variable; scale it; then update the PID driver // grab the PID value out of the temp variable; scale it; then update the PID driver
void copy_and_scalePID_i(int16_t e) { void copy_and_scalePID_i(int16_t e) {
UNUSED(e); switch (e) {
PID_PARAM(Ki, e) = scalePID_i(raw_Ki); #if ENABLED(PIDTEMPBED)
thermalManager.updatePID(); case H_BED: thermalManager.temp_bed.pid.Ki = scalePID_i(raw_Ki); break;
#endif
#if ENABLED(PIDTEMPCHAMBER)
case H_CHAMBER: thermalManager.temp_chamber.pid.Ki = scalePID_i(raw_Ki); break;
#endif
default:
#if ENABLED(PIDTEMP)
PID_PARAM(Ki, e) = scalePID_i(raw_Ki);
thermalManager.updatePID();
#endif
break;
}
} }
void copy_and_scalePID_d(int16_t e) { void copy_and_scalePID_d(int16_t e) {
UNUSED(e); switch (e) {
PID_PARAM(Kd, e) = scalePID_d(raw_Kd); #if ENABLED(PIDTEMPBED)
thermalManager.updatePID(); case H_BED: thermalManager.temp_bed.pid.Kd = scalePID_d(raw_Kd); break;
#endif
#if ENABLED(PIDTEMPCHAMBER)
case H_CHAMBER: thermalManager.temp_chamber.pid.Kd = scalePID_d(raw_Kd); break;
#endif
default:
#if ENABLED(PIDTEMP)
PID_PARAM(Kd, e) = scalePID_d(raw_Kd);
thermalManager.updatePID();
#endif
break;
}
} }
#define _DEFINE_PIDTEMP_BASE_FUNCS(N) \ #define _DEFINE_PIDTEMP_BASE_FUNCS(N) \

View File

@ -2129,7 +2129,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
+ sq(steps_dist_mm.i), + sq(steps_dist_mm.j), + sq(steps_dist_mm.k), + sq(steps_dist_mm.i), + sq(steps_dist_mm.j), + sq(steps_dist_mm.k),
+ sq(steps_dist_mm.u), + sq(steps_dist_mm.v), + sq(steps_dist_mm.w) + sq(steps_dist_mm.u), + sq(steps_dist_mm.v), + sq(steps_dist_mm.w)
); );
#elif ENABLED(FOAMCUTTER_XYUV) #elif ENABLED(FOAMCUTTER_XYUV)
#if HAS_J_AXIS #if HAS_J_AXIS
// Special 5 axis kinematics. Return the largest distance move from either X/Y or I/J plane // Special 5 axis kinematics. Return the largest distance move from either X/Y or I/J plane
_MAX(sq(steps_dist_mm.x) + sq(steps_dist_mm.y), sq(steps_dist_mm.i) + sq(steps_dist_mm.j)) _MAX(sq(steps_dist_mm.x) + sq(steps_dist_mm.y), sq(steps_dist_mm.i) + sq(steps_dist_mm.j))