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 <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2021-07-20 10:34:14 -04:00
parent de57ce3a99
commit 103dcf27ff
3 changed files with 12 additions and 6 deletions

View File

@ -6,6 +6,11 @@ All dates in this document are approximate.
# Changes # 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 20210703: A `samd_sercom` config section must now specify the sercom
bus it is configuring via the `sercom` option. bus it is configuring via the `sercom` option.

View File

@ -28,9 +28,13 @@ class ControllerFan:
self.last_on = self.idle_timeout self.last_on = self.idle_timeout
self.last_speed = 0. self.last_speed = 0.
def handle_connect(self): 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(',')] 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 == [""]: if steppers == [""]:
self.stepper_names = all_steppers self.stepper_names = all_steppers
return return
@ -41,9 +45,6 @@ class ControllerFan:
% (steppers, ", ".join(all_steppers))) % (steppers, ", ".join(all_steppers)))
self.stepper_names = steppers self.stepper_names = steppers
def handle_ready(self): 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 = self.printer.get_reactor()
reactor.register_timer(self.callback, reactor.monotonic()+PIN_MIN_TIME) reactor.register_timer(self.callback, reactor.monotonic()+PIN_MIN_TIME)
def get_status(self, eventtime): def get_status(self, eventtime):

View File

@ -127,7 +127,7 @@ class PrinterStepperEnable:
raise self.printer.config_error("Unknown stepper '%s'" % (name,)) raise self.printer.config_error("Unknown stepper '%s'" % (name,))
return self.enable_lines[name] return self.enable_lines[name]
def get_steppers(self): def get_steppers(self):
return [e.stepper for e in self.enable_lines.values()] return list(self.enable_lines.keys())
def load_config(config): def load_config(config):
return PrinterStepperEnable(config) return PrinterStepperEnable(config)