Separate PID_MAX from BANG_MAX

This allows PID_FUNCTIONAL_RANGE to use a maximum duty cycle higher
than PID_MAX. This is useful for powerful heaters to heat quickly in
bang-bang mode, but use a lower duty cycle that is easier to stabilize
in PID mode.
This commit is contained in:
whosawhatsis
2013-03-22 18:16:26 -07:00
parent 590225be25
commit fd5b7e0cec
2 changed files with 4 additions and 3 deletions

View File

@ -325,10 +325,10 @@ void manage_heater()
#ifndef PID_OPENLOOP
pid_error[e] = target_temperature[e] - pid_input;
if(pid_error[e] > PID_FUNCTIONAL_RANGE) {
pid_output = PID_MAX;
pid_output = BANG_MAX;
pid_reset[e] = true;
}
else if(pid_error[e] < -PID_FUNCTIONAL_RANGE) {
else if(pid_error[e] < -PID_FUNCTIONAL_RANGE || target_temperature[e] == 0) {
pid_output = 0;
pid_reset[e] = true;
}