From 103dcf27ffd7cf1c4f70868c2ba1828ee4fbe37a Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Tue, 20 Jul 2021 10:34:14 -0400 Subject: [PATCH] controller_fan: Minor updates Document change in behavior of the controller_fan module. Lookup heater objects in connect() event handler. Return list of stepper names from stepper_enable.get_steppers(). Signed-off-by: Kevin O'Connor --- docs/Config_Changes.md | 5 +++++ klippy/extras/controller_fan.py | 11 ++++++----- klippy/extras/stepper_enable.py | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/docs/Config_Changes.md b/docs/Config_Changes.md index 8e761a95..f523547e 100644 --- a/docs/Config_Changes.md +++ b/docs/Config_Changes.md @@ -6,6 +6,11 @@ All dates in this document are approximate. # Changes +20210720: A controller_fan section now monitors all stepper motors by +default (not just the kinematic stepper motors). If the previous +behavior is desired, see the `stepper` config option in the +[config reference](Config_Reference.md#controller_fan). + 20210703: A `samd_sercom` config section must now specify the sercom bus it is configuring via the `sercom` option. diff --git a/klippy/extras/controller_fan.py b/klippy/extras/controller_fan.py index 0c277723..0c886c31 100644 --- a/klippy/extras/controller_fan.py +++ b/klippy/extras/controller_fan.py @@ -28,9 +28,13 @@ class ControllerFan: self.last_on = self.idle_timeout self.last_speed = 0. def handle_connect(self): + # Heater lookup + pheaters = self.printer.lookup_object('heaters') + self.heaters = [pheaters.lookup_heater(n.strip()) + for n in self.heater_name.split(',')] + # Stepper lookup + all_steppers = self.stepper_enable.get_steppers() steppers = [n.strip() for n in self.steppers_to_monitor.split(',')] - all_steppers = [s.get_name() - for s in self.stepper_enable.get_steppers()] if steppers == [""]: self.stepper_names = all_steppers return @@ -41,9 +45,6 @@ class ControllerFan: % (steppers, ", ".join(all_steppers))) self.stepper_names = steppers def handle_ready(self): - pheaters = self.printer.lookup_object('heaters') - self.heaters = [pheaters.lookup_heater(n.strip()) - for n in self.heater_name.split(',')] reactor = self.printer.get_reactor() reactor.register_timer(self.callback, reactor.monotonic()+PIN_MIN_TIME) def get_status(self, eventtime): diff --git a/klippy/extras/stepper_enable.py b/klippy/extras/stepper_enable.py index 90458458..cd1d34c6 100644 --- a/klippy/extras/stepper_enable.py +++ b/klippy/extras/stepper_enable.py @@ -127,7 +127,7 @@ class PrinterStepperEnable: raise self.printer.config_error("Unknown stepper '%s'" % (name,)) return self.enable_lines[name] def get_steppers(self): - return [e.stepper for e in self.enable_lines.values()] + return list(self.enable_lines.keys()) def load_config(config): return PrinterStepperEnable(config)