mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-12-01 23:58:33 +00:00
parent
c935a6706a
commit
06d58c939c
@ -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];
|
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];
|
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];
|
temp_dState[HOTEND_INDEX] = current_temperature[HOTEND_INDEX];
|
||||||
#if HEATER_IDLE_HANDLER
|
|
||||||
if (heater_idle_timeout_exceeded[HOTEND_INDEX]) {
|
if (target_temperature[HOTEND_INDEX] == 0
|
||||||
pid_output = 0;
|
|| pid_error[HOTEND_INDEX] < -(PID_FUNCTIONAL_RANGE)
|
||||||
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 HEATER_IDLE_HANDLER
|
#if HEATER_IDLE_HANDLER
|
||||||
|| heater_idle_timeout_exceeded[HOTEND_INDEX]
|
|| heater_idle_timeout_exceeded[HOTEND_INDEX]
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
pid_output = 0;
|
pid_output = 0;
|
||||||
pid_reset[HOTEND_INDEX] = true;
|
pid_reset[HOTEND_INDEX] = true;
|
||||||
}
|
}
|
||||||
|
else if (pid_error[HOTEND_INDEX] > PID_FUNCTIONAL_RANGE) {
|
||||||
|
pid_output = BANG_MAX;
|
||||||
|
pid_reset[HOTEND_INDEX] = true;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
if (pid_reset[HOTEND_INDEX]) {
|
if (pid_reset[HOTEND_INDEX]) {
|
||||||
temp_iState[HOTEND_INDEX] = 0.0;
|
temp_iState[HOTEND_INDEX] = 0.0;
|
||||||
|
Loading…
Reference in New Issue
Block a user