Skip to content

Commit

Permalink
Remove dead code in get_pid_output, consolidate
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Mar 3, 2019
1 parent c935a67 commit 06d58c9
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions Marlin/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,25 +613,20 @@ float Temperature::get_pid_output(const int8_t e) {
pid_error[HOTEND_INDEX] = target_temperature[HOTEND_INDEX] - current_temperature[HOTEND_INDEX];
dTerm[HOTEND_INDEX] = PID_K2 * PID_PARAM(Kd, HOTEND_INDEX) * (current_temperature[HOTEND_INDEX] - temp_dState[HOTEND_INDEX]) + float(PID_K1) * dTerm[HOTEND_INDEX];
temp_dState[HOTEND_INDEX] = current_temperature[HOTEND_INDEX];
#if HEATER_IDLE_HANDLER
if (heater_idle_timeout_exceeded[HOTEND_INDEX]) {
pid_output = 0;
pid_reset[HOTEND_INDEX] = true;
}
else
#endif
if (pid_error[HOTEND_INDEX] > PID_FUNCTIONAL_RANGE) {
pid_output = BANG_MAX;
pid_reset[HOTEND_INDEX] = true;
}
else if (pid_error[HOTEND_INDEX] < -(PID_FUNCTIONAL_RANGE) || target_temperature[HOTEND_INDEX] == 0

if (target_temperature[HOTEND_INDEX] == 0
|| pid_error[HOTEND_INDEX] < -(PID_FUNCTIONAL_RANGE)
#if HEATER_IDLE_HANDLER
|| heater_idle_timeout_exceeded[HOTEND_INDEX]
#endif
) {
) {
pid_output = 0;
pid_reset[HOTEND_INDEX] = true;
}
else if (pid_error[HOTEND_INDEX] > PID_FUNCTIONAL_RANGE) {
pid_output = BANG_MAX;
pid_reset[HOTEND_INDEX] = true;
}
else {
if (pid_reset[HOTEND_INDEX]) {
temp_iState[HOTEND_INDEX] = 0.0;
Expand Down

0 comments on commit 06d58c9

Please sign in to comment.