diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2018-04-03 17:01:10 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2018-04-04 23:13:53 -0400 |
commit | aed958eb5c32003c7ffcd10d8852082b6d896794 (patch) | |
tree | 8fed6212b4170da3fecefca103cbc70ffa4575ce /klippy/extras | |
parent | 4eeb43b191e3d928cf817d3be0350711dc05526d (diff) | |
download | kutter-aed958eb5c32003c7ffcd10d8852082b6d896794.tar.gz kutter-aed958eb5c32003c7ffcd10d8852082b6d896794.tar.xz kutter-aed958eb5c32003c7ffcd10d8852082b6d896794.zip |
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>
Diffstat (limited to 'klippy/extras')
-rw-r--r-- | klippy/extras/heater_bed.py | 8 | ||||
-rw-r--r-- | klippy/extras/heater_fan.py | 6 | ||||
-rw-r--r-- | klippy/extras/pid_calibrate.py | 5 | ||||
-rw-r--r-- | klippy/extras/verify_heater.py | 5 |
4 files changed, 16 insertions, 8 deletions
diff --git a/klippy/extras/heater_bed.py b/klippy/extras/heater_bed.py new file mode 100644 index 00000000..94040b8c --- /dev/null +++ b/klippy/extras/heater_bed.py @@ -0,0 +1,8 @@ +# Support for a heated bed +# +# Copyright (C) 2018 Kevin O'Connor <kevin@koconnor.net> +# +# This file may be distributed under the terms of the GNU GPLv3 license. + +def load_config(config): + return config.get_printer().lookup_object('heater').setup_heater(config) diff --git a/klippy/extras/heater_fan.py b/klippy/extras/heater_fan.py index fdeb9f71..5d2d6f44 100644 --- a/klippy/extras/heater_fan.py +++ b/klippy/extras/heater_fan.py @@ -3,7 +3,7 @@ # Copyright (C) 2016-2018 Kevin O'Connor <kevin@koconnor.net> # # This file may be distributed under the terms of the GNU GPLv3 license. -import fan, extruder +import fan PIN_MIN_TIME = 0.100 @@ -20,8 +20,8 @@ class PrinterHeaterFan: self.fan.mcu_fan.setup_start_value(0., max_power) def printer_state(self, state): if state == 'ready': - 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) reactor = self.printer.get_reactor() reactor.register_timer(self.callback, reactor.NOW) def callback(self, eventtime): diff --git a/klippy/extras/pid_calibrate.py b/klippy/extras/pid_calibrate.py index 477f3a93..1caffeb7 100644 --- a/klippy/extras/pid_calibrate.py +++ b/klippy/extras/pid_calibrate.py @@ -4,7 +4,7 @@ # # This file may be distributed under the terms of the GNU GPLv3 license. import math, logging -import extruder, heater +import heater class PIDCalibrate: def __init__(self, config): @@ -18,8 +18,9 @@ class PIDCalibrate: heater_name = self.gcode.get_str('HEATER', params) target = self.gcode.get_float('TARGET', params) write_file = self.gcode.get_int('WRITE_FILE', params, 0) + pheater = self.printer.lookup_object('heater') try: - heater = extruder.get_printer_heater(self.printer, heater_name) + heater = pheater.lookup_heater(heater_name) except self.printer.config_error as e: raise self.gcode.error(str(e)) print_time = self.printer.lookup_object('toolhead').get_last_move_time() diff --git a/klippy/extras/verify_heater.py b/klippy/extras/verify_heater.py index 3b4902a7..41ef2613 100644 --- a/klippy/extras/verify_heater.py +++ b/klippy/extras/verify_heater.py @@ -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) |