temperature_fan: Fix divide by zero error when pid_Ki is zero
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
647a1cd8ca
commit
22297229b7
|
@ -147,7 +147,9 @@ class ControlPID:
|
||||||
self.Ki = config.getfloat('pid_Ki') / PID_PARAM_BASE
|
self.Ki = config.getfloat('pid_Ki') / PID_PARAM_BASE
|
||||||
self.Kd = config.getfloat('pid_Kd') / PID_PARAM_BASE
|
self.Kd = config.getfloat('pid_Kd') / PID_PARAM_BASE
|
||||||
self.min_deriv_time = config.getfloat('pid_deriv_time', 2., above=0.)
|
self.min_deriv_time = config.getfloat('pid_deriv_time', 2., above=0.)
|
||||||
self.temp_integ_max = self.temperature_fan.get_max_speed() / self.Ki
|
self.temp_integ_max = 0.
|
||||||
|
if self.Ki:
|
||||||
|
self.temp_integ_max = self.temperature_fan.get_max_speed() / self.Ki
|
||||||
self.prev_temp = AMBIENT_TEMP
|
self.prev_temp = AMBIENT_TEMP
|
||||||
self.prev_temp_time = 0.
|
self.prev_temp_time = 0.
|
||||||
self.prev_temp_deriv = 0.
|
self.prev_temp_deriv = 0.
|
||||||
|
|
Loading…
Reference in New Issue