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:
Kevin O'Connor 2019-02-28 13:40:57 -05:00 committed by KevinOConnor
parent 8e8063a9d9
commit 893bb32d01
1 changed files with 2 additions and 1 deletions

View File

@ -52,7 +52,8 @@ class HeaterCheck:
logging.info("Heater %s within range of %.3f",
self.heater_name, target)
self.met_target = True
self.error = 0.
if temp <= target + self.hysteresis:
self.error = 0.
elif self.met_target:
self.error += (target - self.hysteresis) - temp
if target != self.last_target: