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

@ -7,7 +7,7 @@
import sys, os, optparse, logging, time, threading
import collections, ConfigParser, importlib
import util, reactor, queuelogger, msgproto
import gcode, pins, mcu, toolhead, extruder, heater
import gcode, pins, heater, mcu, toolhead, extruder
message_ready = "Printer is ready"
@ -204,11 +204,11 @@ class Printer:
ConfigLogger(fileconfig, self.bglogger)
# Create printer components
config = ConfigWrapper(self, fileconfig, 'printer')
for m in [pins, mcu]:
for m in [pins, heater, mcu]:
m.add_printer_objects(self, config)
for section in fileconfig.sections():
self.try_load_module(config, section)
for m in [toolhead, extruder, heater]:
for m in [toolhead, extruder]:
m.add_printer_objects(self, config)
# Validate that there are no undefined parameters in the config file
valid_sections = { s: 1 for s, o in self.all_config_options }