aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/controller_fan.py
diff options
context:
space:
mode:
authorSophie Hirn <sophie.hirn@wyvernscale.com>2021-07-20 16:19:59 +0200
committerGitHub <noreply@github.com>2021-07-20 10:19:59 -0400
commitde57ce3a99805502f61ff000668cd5e7b5b93aa1 (patch)
tree7619587b60c47abef972cee0fac33f1700cab11f /klippy/extras/controller_fan.py
parentdafb74e3aba707db364ed773bb2135084ac0fffa (diff)
downloadkutter-de57ce3a99805502f61ff000668cd5e7b5b93aa1.tar.gz
kutter-de57ce3a99805502f61ff000668cd5e7b5b93aa1.tar.xz
kutter-de57ce3a99805502f61ff000668cd5e7b5b93aa1.zip
controller_fan: Add "stepper" config option (#4447)
Allows contoller_fan sections to monitor only certain steppers instead of all of them, similar to how heaters are currently handled. Signed-off-by: Sophie Hirn <sophie.hirn@wyvernscale.com>
Diffstat (limited to 'klippy/extras/controller_fan.py')
-rw-r--r--klippy/extras/controller_fan.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/klippy/extras/controller_fan.py b/klippy/extras/controller_fan.py
index 267a2856..0c277723 100644
--- a/klippy/extras/controller_fan.py
+++ b/klippy/extras/controller_fan.py
@@ -11,6 +11,9 @@ class ControllerFan:
def __init__(self, config):
self.printer = config.get_printer()
self.printer.register_event_handler("klippy:ready", self.handle_ready)
+ self.printer.register_event_handler("klippy:connect",
+ self.handle_connect)
+ self.steppers_to_monitor = config.get("stepper", "")
self.stepper_names = []
self.stepper_enable = self.printer.load_object(config, 'stepper_enable')
self.printer.load_object(config, 'heaters')
@@ -24,12 +27,23 @@ class ControllerFan:
self.heater_name = config.get("heater", "extruder")
self.last_on = self.idle_timeout
self.last_speed = 0.
+ def handle_connect(self):
+ 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
+ if not all(x in all_steppers for x in steppers):
+ raise self.printer.config_error(
+ ("One or more of these steppers are unknown: "
+ "%s (valid steppers are: %s)")
+ % (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(',')]
- kin = self.printer.lookup_object('toolhead').get_kinematics()
- self.stepper_names = [s.get_name() for s in kin.get_steppers()]
reactor = self.printer.get_reactor()
reactor.register_timer(self.callback, reactor.monotonic()+PIN_MIN_TIME)
def get_status(self, eventtime):