verify_heater: Only reset the error count if within the hysteresis range
Don't reset the error counter if the reported temperature is significantly above the target temperature. This may help catch cases where the temperature sensor reports random values. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
8e8063a9d9
commit
893bb32d01
|
@ -52,7 +52,8 @@ class HeaterCheck:
|
||||||
logging.info("Heater %s within range of %.3f",
|
logging.info("Heater %s within range of %.3f",
|
||||||
self.heater_name, target)
|
self.heater_name, target)
|
||||||
self.met_target = True
|
self.met_target = True
|
||||||
self.error = 0.
|
if temp <= target + self.hysteresis:
|
||||||
|
self.error = 0.
|
||||||
elif self.met_target:
|
elif self.met_target:
|
||||||
self.error += (target - self.hysteresis) - temp
|
self.error += (target - self.hysteresis) - temp
|
||||||
if target != self.last_target:
|
if target != self.last_target:
|
||||||
|
|
Loading…
Reference in New Issue