diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2018-01-19 22:22:17 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2018-01-28 12:19:26 -0500 |
commit | 81013ba5c8638dd42932bd893e1b3115b1b98041 (patch) | |
tree | 3e0d60c2d084f808f2788a4645579093abdc8739 /klippy/fan.py | |
parent | f0a754e496ca989bc355555e2c798c362299abc3 (diff) | |
download | kutter-81013ba5c8638dd42932bd893e1b3115b1b98041.tar.gz kutter-81013ba5c8638dd42932bd893e1b3115b1b98041.tar.xz kutter-81013ba5c8638dd42932bd893e1b3115b1b98041.zip |
klippy: Add access methods and avoid peeking into the printer classes
Add get_reactor(), lookup_object(), lookup_module_objects(), and
set_rollover_info() to the main Printer class so that callers do not
need to peek into the class' members. Similarly, add get_printer()
and get_name() methods to the ConfigWrapper class.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/fan.py')
-rw-r--r-- | klippy/fan.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/klippy/fan.py b/klippy/fan.py index 5cf05861..50dc2500 100644 --- a/klippy/fan.py +++ b/klippy/fan.py @@ -1,6 +1,6 @@ # Printer fan support # -# Copyright (C) 2016,2017 Kevin O'Connor <kevin@koconnor.net> +# Copyright (C) 2016-2018 Kevin O'Connor <kevin@koconnor.net> # # This file may be distributed under the terms of the GNU GPLv3 license. import extruder, pins @@ -35,7 +35,7 @@ class PrinterFan: class PrinterHeaterFan: def __init__(self, printer, config): self.fan = PrinterFan(printer, config) - self.mcu = printer.objects['mcu'] + self.mcu = printer.lookup_object('mcu') heater = config.get("heater", "extruder0") self.heater = extruder.get_printer_heater(printer, heater) self.heater_temp = config.getfloat("heater_temp", 50.0) @@ -43,7 +43,8 @@ class PrinterHeaterFan: self.fan_speed = config.getfloat( "fan_speed", max_power, minval=0., maxval=max_power) self.fan.mcu_fan.setup_start_value(0., max_power) - printer.reactor.register_timer(self.callback, printer.reactor.NOW) + reactor = printer.get_reactor() + reactor.register_timer(self.callback, reactor.NOW) def callback(self, eventtime): current_temp, target_temp = self.heater.get_temp(eventtime) if not current_temp and not target_temp and not self.fan.last_fan_time: |