From 3f87f912c5b78a08b17dca07840333c882ceada2 Mon Sep 17 00:00:00 2001 From: proferabg Date: Mon, 10 Feb 2020 17:48:22 -0500 Subject: [PATCH] Enable hotend / bed PID separately in ExtUI (#16827) --- Marlin/src/lcd/extensible_ui/ui_api.cpp | 37 +++++++++++++++---------- Marlin/src/lcd/extensible_ui/ui_api.h | 9 ++++-- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/Marlin/src/lcd/extensible_ui/ui_api.cpp b/Marlin/src/lcd/extensible_ui/ui_api.cpp index 21c99d94a6..31d195c95d 100644 --- a/Marlin/src/lcd/extensible_ui/ui_api.cpp +++ b/Marlin/src/lcd/extensible_ui/ui_api.cpp @@ -894,25 +894,18 @@ namespace ExtUI { float getFeedrate_percent() { return feedrate_percentage; } - #if HAS_PID_HEATING + #if ENABLED(PIDTEMP) float getPIDValues_Kp(const extruder_t tool) { return PID_PARAM(Kp, tool); } + float getPIDValues_Ki(const extruder_t tool) { return unscalePID_i(PID_PARAM(Ki, tool)); } + float getPIDValues_Kd(const extruder_t tool) { return unscalePID_d(PID_PARAM(Kd, tool)); } - float getBedPIDValues_Kp() { - return thermalManager.temp_bed.pid.Kp; - } - float getBedPIDValues_Ki() { - return unscalePID_i(thermalManager.temp_bed.pid.Ki); - } - float getBedPIDValues_Kd() { - return unscalePID_d(thermalManager.temp_bed.pid.Kd); - } void setPIDValues(const float p, const float i, const float d, extruder_t tool) { thermalManager.temp_hotend[tool].pid.Kp = p; @@ -920,16 +913,32 @@ namespace ExtUI { thermalManager.temp_hotend[tool].pid.Kd = scalePID_d(d); thermalManager.updatePID(); } + + void startPIDTune(const float temp, extruder_t tool){ + thermalManager.PID_autotune(temp, (heater_ind_t)tool, 8, true); + } + #endif + + #if ENABLED(PIDTEMPBED) + float getBedPIDValues_Kp() { + return thermalManager.temp_bed.pid.Kp; + } + + float getBedPIDValues_Ki() { + return unscalePID_i(thermalManager.temp_bed.pid.Ki); + } + + float getBedPIDValues_Kd() { + return unscalePID_d(thermalManager.temp_bed.pid.Kd); + } + void setBedPIDValues(const float p, const float i, const float d) { thermalManager.temp_bed.pid.Kp = p; thermalManager.temp_bed.pid.Ki = scalePID_i(i); thermalManager.temp_bed.pid.Kd = scalePID_d(d); thermalManager.updatePID(); } - - void startPIDTune(const float temp, extruder_t tool){ - thermalManager.PID_autotune(temp, (heater_ind_t)tool, 8, true); - } + void startBedPIDTune(const float temp) { thermalManager.PID_autotune(temp, H_BED, 4, true); } diff --git a/Marlin/src/lcd/extensible_ui/ui_api.h b/Marlin/src/lcd/extensible_ui/ui_api.h index 4f88b4606e..d99cfcedb4 100644 --- a/Marlin/src/lcd/extensible_ui/ui_api.h +++ b/Marlin/src/lcd/extensible_ui/ui_api.h @@ -249,16 +249,19 @@ namespace ExtUI { #endif #endif - #if HAS_PID_HEATING + #if ENABLED(PIDTEMP) float getPIDValues_Kp(const extruder_t); float getPIDValues_Ki(const extruder_t); float getPIDValues_Kd(const extruder_t); + void setPIDValues(const float, const float, const float, extruder_t); + void startPIDTune(const float, extruder_t); + #endif + + #if ENABLED(PIDTEMPBED) float getBedPIDValues_Kp(); float getBedPIDValues_Ki(); float getBedPIDValues_Kd(); - void setPIDValues(const float, const float, const float, extruder_t); void setBedPIDValues(const float, const float, const float); - void startPIDTune(const float, extruder_t); void startBedPIDTune(const float); #endif