aboutsummaryrefslogtreecommitdiffstats
path: root/klippy
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2019-02-28 17:43:32 -0500
committerKevinOConnor <kevin@koconnor.net>2019-03-08 10:55:46 -0500
commitf2ca7d5c66f4e45b1b5888e396188b2c0b98371b (patch)
tree240ab999247b82e6731a8f0243d2e423bf80ae1c /klippy
parent893bb32d01aa0db85be2da72b087eeb0c3ca011d (diff)
downloadkutter-f2ca7d5c66f4e45b1b5888e396188b2c0b98371b.tar.gz
kutter-f2ca7d5c66f4e45b1b5888e396188b2c0b98371b.tar.xz
kutter-f2ca7d5c66f4e45b1b5888e396188b2c0b98371b.zip
verify_heater: Improve handling of new targets when temperature is dropping
Allow the first check_gain_time interval to only require a heating_gain relative to the lowest observed temperature during that interval. This makes the code less likely to raise a spurious error when the heater is enabled while the heater temperature is dropping. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy')
-rw-r--r--klippy/extras/verify_heater.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/klippy/extras/verify_heater.py b/klippy/extras/verify_heater.py
index c449e3cb..5f47ebad 100644
--- a/klippy/extras/verify_heater.py
+++ b/klippy/extras/verify_heater.py
@@ -27,7 +27,7 @@ class HeaterCheck:
default_gain_time = 60.
self.check_gain_time = config.getfloat(
'check_gain_time', default_gain_time, minval=1.)
- self.met_target = False
+ self.met_target = self.starting_approach = False
self.last_target = self.goal_temp = self.error = 0.
self.fault_systime = self.printer.get_reactor().NEVER
self.check_timer = None
@@ -61,6 +61,7 @@ class HeaterCheck:
logging.info("Heater %s approaching new target of %.3f",
self.heater_name, target)
self.met_target = False
+ self.starting_approach = True
self.goal_temp = temp + self.heating_gain
self.fault_systime = eventtime + self.check_gain_time
elif self.error >= self.max_error:
@@ -68,11 +69,14 @@ class HeaterCheck:
return self.heater_fault()
elif temp >= self.goal_temp:
# Temperature approaching target - reset checks
+ self.starting_approach = False
self.goal_temp = temp + self.heating_gain
self.fault_systime = eventtime + self.check_gain_time
elif eventtime >= self.fault_systime:
# Failure due to inability to approach target temperature
return self.heater_fault()
+ elif self.starting_approach:
+ self.goal_temp = min(self.goal_temp, temp + self.heating_gain)
self.last_target = target
return eventtime + 1.
def heater_fault(self):