verify_heater: Don't report a heater error if printer is shutdown

Don't log a heater verification error if that error is due to the
printer being shutdown for some other reason.  Those spurious error
reports can be confusing.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2018-09-28 14:50:42 -04:00
parent 47b6144ff6
commit 864918b1f9
1 changed files with 6 additions and 1 deletions

View File

@ -26,6 +26,7 @@ class HeaterCheck:
self.met_target = False self.met_target = False
self.last_target = self.goal_temp = self.error = 0. self.last_target = self.goal_temp = self.error = 0.
self.fault_systime = self.printer.get_reactor().NEVER self.fault_systime = self.printer.get_reactor().NEVER
self.check_timer = None
def printer_state(self, state): def printer_state(self, state):
if state == 'connect': if state == 'connect':
if self.printer.get_start_args().get('debugoutput') is not None: if self.printer.get_start_args().get('debugoutput') is not None:
@ -35,7 +36,11 @@ class HeaterCheck:
self.heater = pheater.lookup_heater(self.heater_name) self.heater = pheater.lookup_heater(self.heater_name)
logging.info("Starting heater checks for %s", self.heater_name) logging.info("Starting heater checks for %s", self.heater_name)
reactor = self.printer.get_reactor() reactor = self.printer.get_reactor()
reactor.register_timer(self.check_event, reactor.NOW) self.check_timer = reactor.register_timer(self.check_event,
reactor.NOW)
elif state == 'shutdown' and self.check_timer is not None:
reactor = self.printer.get_reactor()
reactor.update_timer(self.check_timer, reactor.NEVER)
def check_event(self, eventtime): def check_event(self, eventtime):
temp, target = self.heater.get_temp(eventtime) temp, target = self.heater.get_temp(eventtime)
if temp >= target - self.hysteresis: if temp >= target - self.hysteresis: