parent
35ae5daf2d
commit
599cdc3f0f
|
@ -725,18 +725,9 @@ float Temperature::get_pid_output(const int8_t e) {
|
|||
float pid_error = target_temperature[HOTEND_INDEX] - current_temperature[HOTEND_INDEX];
|
||||
work_pid[HOTEND_INDEX].Kd = PID_K2 * PID_PARAM(Kd, HOTEND_INDEX) * (current_temperature[HOTEND_INDEX] - temp_dState[HOTEND_INDEX]) + float(PID_K1) * work_pid[HOTEND_INDEX].Kd;
|
||||
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 > PID_FUNCTIONAL_RANGE) {
|
||||
pid_output = BANG_MAX;
|
||||
pid_reset[HOTEND_INDEX] = true;
|
||||
}
|
||||
else if (pid_error < -(PID_FUNCTIONAL_RANGE) || target_temperature[HOTEND_INDEX] == 0
|
||||
|
||||
if (target_temperature[HOTEND_INDEX] == 0
|
||||
|| pid_error < -(PID_FUNCTIONAL_RANGE)
|
||||
#if HEATER_IDLE_HANDLER
|
||||
|| heater_idle_timeout_exceeded[HOTEND_INDEX]
|
||||
#endif
|
||||
|
@ -744,6 +735,10 @@ float Temperature::get_pid_output(const int8_t e) {
|
|||
pid_output = 0;
|
||||
pid_reset[HOTEND_INDEX] = true;
|
||||
}
|
||||
else if (pid_error > PID_FUNCTIONAL_RANGE) {
|
||||
pid_output = BANG_MAX;
|
||||
pid_reset[HOTEND_INDEX] = true;
|
||||
}
|
||||
else {
|
||||
if (pid_reset[HOTEND_INDEX]) {
|
||||
temp_iState[HOTEND_INDEX] = 0.0;
|
||||
|
@ -806,11 +801,12 @@ float Temperature::get_pid_output(const int8_t e) {
|
|||
|
||||
#else /* PID off */
|
||||
#if HEATER_IDLE_HANDLER
|
||||
if (heater_idle_timeout_exceeded[HOTEND_INDEX])
|
||||
pid_output = 0;
|
||||
else
|
||||
#define _TIMED_OUT_TEST heater_idle_timeout_exceeded[HOTEND_INDEX]
|
||||
#else
|
||||
#define _TIMED_OUT_TEST false
|
||||
#endif
|
||||
pid_output = (current_temperature[HOTEND_INDEX] < target_temperature[HOTEND_INDEX]) ? BANG_MAX : 0;
|
||||
pid_output = (!_TIMED_OUT_TEST && current_temperature[HOTEND_INDEX] < target_temperature[HOTEND_INDEX]) ? BANG_MAX : 0;
|
||||
#undef _TIMED_OUT_TEST
|
||||
#endif
|
||||
|
||||
return pid_output;
|
||||
|
|
Loading…
Reference in a new issue