heater: Add PrinterHeaters class that stores all sensors and heaters

Add a PrinterHeaters class that can stores references to available
temperature sensors and stores references to instantiated heaters.

Add a extras/heater_bed.py file and delay instantiation of the
heater_bed object.  This allows the heater.py module to be imported
earlier during the setup phase, and allows the PrinterHeaters class to
be available for registering sensors and heaters.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2018-04-03 17:01:10 -04:00
parent 4eeb43b191
commit aed958eb5c
7 changed files with 67 additions and 31 deletions

View file

@ -4,7 +4,6 @@
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import logging
import extruder
HINT_THERMAL = """
See the 'verify_heater' section in config/example-extras.cfg
@ -29,8 +28,8 @@ class HeaterCheck:
self.fault_systime = self.printer.get_reactor().NEVER
def printer_state(self, state):
if state == 'connect':
self.heater = extruder.get_printer_heater(
self.printer, self.heater_name)
pheater = self.printer.lookup_object('heater')
self.heater = pheater.lookup_heater(self.heater_name)
logging.info("Starting heater checks for %s", self.heater_name)
reactor = self.printer.get_reactor()
reactor.register_timer(self.check_event, reactor.NOW)