From aed958eb5c32003c7ffcd10d8852082b6d896794 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Tue, 3 Apr 2018 17:01:10 -0400 Subject: 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 --- klippy/extras/heater_fan.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'klippy/extras/heater_fan.py') 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 # # 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): -- cgit v1.2.3-70-g09d2