Skip to content

Commit 3f87f91

Browse files
authored
Enable hotend / bed PID separately in ExtUI (#16827)
1 parent fa4a6cd commit 3f87f91

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

Marlin/src/lcd/extensible_ui/ui_api.cpp

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -894,42 +894,51 @@ namespace ExtUI {
894894

895895
float getFeedrate_percent() { return feedrate_percentage; }
896896

897-
#if HAS_PID_HEATING
897+
#if ENABLED(PIDTEMP)
898898
float getPIDValues_Kp(const extruder_t tool) {
899899
return PID_PARAM(Kp, tool);
900900
}
901+
901902
float getPIDValues_Ki(const extruder_t tool) {
902903
return unscalePID_i(PID_PARAM(Ki, tool));
903904
}
905+
904906
float getPIDValues_Kd(const extruder_t tool) {
905907
return unscalePID_d(PID_PARAM(Kd, tool));
906908
}
909+
910+
void setPIDValues(const float p, const float i, const float d, extruder_t tool) {
911+
thermalManager.temp_hotend[tool].pid.Kp = p;
912+
thermalManager.temp_hotend[tool].pid.Ki = scalePID_i(i);
913+
thermalManager.temp_hotend[tool].pid.Kd = scalePID_d(d);
914+
thermalManager.updatePID();
915+
}
916+
917+
void startPIDTune(const float temp, extruder_t tool){
918+
thermalManager.PID_autotune(temp, (heater_ind_t)tool, 8, true);
919+
}
920+
#endif
921+
922+
#if ENABLED(PIDTEMPBED)
907923
float getBedPIDValues_Kp() {
908924
return thermalManager.temp_bed.pid.Kp;
909925
}
926+
910927
float getBedPIDValues_Ki() {
911928
return unscalePID_i(thermalManager.temp_bed.pid.Ki);
912929
}
930+
913931
float getBedPIDValues_Kd() {
914932
return unscalePID_d(thermalManager.temp_bed.pid.Kd);
915933
}
916-
917-
void setPIDValues(const float p, const float i, const float d, extruder_t tool) {
918-
thermalManager.temp_hotend[tool].pid.Kp = p;
919-
thermalManager.temp_hotend[tool].pid.Ki = scalePID_i(i);
920-
thermalManager.temp_hotend[tool].pid.Kd = scalePID_d(d);
921-
thermalManager.updatePID();
922-
}
934+
923935
void setBedPIDValues(const float p, const float i, const float d) {
924936
thermalManager.temp_bed.pid.Kp = p;
925937
thermalManager.temp_bed.pid.Ki = scalePID_i(i);
926938
thermalManager.temp_bed.pid.Kd = scalePID_d(d);
927939
thermalManager.updatePID();
928940
}
929-
930-
void startPIDTune(const float temp, extruder_t tool){
931-
thermalManager.PID_autotune(temp, (heater_ind_t)tool, 8, true);
932-
}
941+
933942
void startBedPIDTune(const float temp) {
934943
thermalManager.PID_autotune(temp, H_BED, 4, true);
935944
}

Marlin/src/lcd/extensible_ui/ui_api.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,16 +249,19 @@ namespace ExtUI {
249249
#endif
250250
#endif
251251

252-
#if HAS_PID_HEATING
252+
#if ENABLED(PIDTEMP)
253253
float getPIDValues_Kp(const extruder_t);
254254
float getPIDValues_Ki(const extruder_t);
255255
float getPIDValues_Kd(const extruder_t);
256+
void setPIDValues(const float, const float, const float, extruder_t);
257+
void startPIDTune(const float, extruder_t);
258+
#endif
259+
260+
#if ENABLED(PIDTEMPBED)
256261
float getBedPIDValues_Kp();
257262
float getBedPIDValues_Ki();
258263
float getBedPIDValues_Kd();
259-
void setPIDValues(const float, const float, const float, extruder_t);
260264
void setBedPIDValues(const float, const float, const float);
261-
void startPIDTune(const float, extruder_t);
262265
void startBedPIDTune(const float);
263266
#endif
264267

0 commit comments

Comments
 (0)