Skip to content

Commit

Permalink
Enable hotend / bed PID separately in ExtUI (#16827)
Browse files Browse the repository at this point in the history
  • Loading branch information
proferabg authored Feb 10, 2020
1 parent fa4a6cd commit 3f87f91
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 15 deletions.
33 changes: 21 additions & 12 deletions Marlin/src/lcd/extensible_ui/ui_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -894,42 +894,51 @@ 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));
}

void setPIDValues(const float p, const float i, const float d, extruder_t tool) {
thermalManager.temp_hotend[tool].pid.Kp = p;
thermalManager.temp_hotend[tool].pid.Ki = scalePID_i(i);
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 setPIDValues(const float p, const float i, const float d, extruder_t tool) {
thermalManager.temp_hotend[tool].pid.Kp = p;
thermalManager.temp_hotend[tool].pid.Ki = scalePID_i(i);
thermalManager.temp_hotend[tool].pid.Kd = scalePID_d(d);
thermalManager.updatePID();
}

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);
}
Expand Down
9 changes: 6 additions & 3 deletions Marlin/src/lcd/extensible_ui/ui_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 3f87f91

Please sign in to comment.