Skip to content

Commit e4c7c55

Browse files
GMagicianthinkyhead
authored andcommitted
🐛 Fix PID edit menu for Bed, Chamber (MarlinFirmware#23987)
1 parent d98c61c commit e4c7c55

File tree

2 files changed

+36
-9
lines changed

2 files changed

+36
-9
lines changed

Marlin/src/lcd/menu/menu_advanced.cpp

+35-8
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#include "../../module/probe.h"
4040
#endif
4141

42-
#if ENABLED(PIDTEMP)
42+
#if ANY(PIDTEMP, PIDTEMPBED, PIDTEMPCHAMBER)
4343
#include "../../module/temperature.h"
4444
#endif
4545

@@ -190,7 +190,12 @@ void menu_backlash();
190190
#if ENABLED(PIDTEMPCHAMBER)
191191
case H_CHAMBER: tune_temp = autotune_temp_chamber; break;
192192
#endif
193-
default: tune_temp = autotune_temp[hid]; break;
193+
default:
194+
#if ENABLED(PIDTEMP)
195+
tune_temp = autotune_temp[hid]; break;
196+
#else
197+
return;
198+
#endif
194199
}
195200
sprintf_P(cmd, PSTR("M303 U1 E%i S%i"), hid, tune_temp);
196201
queue.inject(cmd);
@@ -206,14 +211,36 @@ void menu_backlash();
206211
// Helpers for editing PID Ki & Kd values
207212
// grab the PID value out of the temp variable; scale it; then update the PID driver
208213
void copy_and_scalePID_i(int16_t e) {
209-
UNUSED(e);
210-
PID_PARAM(Ki, e) = scalePID_i(raw_Ki);
211-
thermalManager.updatePID();
214+
switch (e) {
215+
#if ENABLED(PIDTEMPBED)
216+
case H_BED: thermalManager.temp_bed.pid.Ki = scalePID_i(raw_Ki); break;
217+
#endif
218+
#if ENABLED(PIDTEMPCHAMBER)
219+
case H_CHAMBER: thermalManager.temp_chamber.pid.Ki = scalePID_i(raw_Ki); break;
220+
#endif
221+
default:
222+
#if ENABLED(PIDTEMP)
223+
PID_PARAM(Ki, e) = scalePID_i(raw_Ki);
224+
thermalManager.updatePID();
225+
#endif
226+
break;
227+
}
212228
}
213229
void copy_and_scalePID_d(int16_t e) {
214-
UNUSED(e);
215-
PID_PARAM(Kd, e) = scalePID_d(raw_Kd);
216-
thermalManager.updatePID();
230+
switch (e) {
231+
#if ENABLED(PIDTEMPBED)
232+
case H_BED: thermalManager.temp_bed.pid.Kd = scalePID_d(raw_Kd); break;
233+
#endif
234+
#if ENABLED(PIDTEMPCHAMBER)
235+
case H_CHAMBER: thermalManager.temp_chamber.pid.Kd = scalePID_d(raw_Kd); break;
236+
#endif
237+
default:
238+
#if ENABLED(PIDTEMP)
239+
PID_PARAM(Kd, e) = scalePID_d(raw_Kd);
240+
thermalManager.updatePID();
241+
#endif
242+
break;
243+
}
217244
}
218245

219246
#define _DEFINE_PIDTEMP_BASE_FUNCS(N) \

Marlin/src/module/planner.cpp

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

0 commit comments

Comments
 (0)