aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2019-06-07 11:10:27 -0400
committerKevin O'Connor <kevin@koconnor.net>2019-06-07 11:38:43 -0400
commitd0be48da741416369496279d19a71dc2e790cdf9 (patch)
tree67d5a6900e02eaf3c6ff9cb5000e5aa89a54a7fe /klippy/extras
parent3f4190c792954da13a07bd064d4471478d61d2ab (diff)
downloadkutter-d0be48da741416369496279d19a71dc2e790cdf9.tar.gz
kutter-d0be48da741416369496279d19a71dc2e790cdf9.tar.xz
kutter-d0be48da741416369496279d19a71dc2e790cdf9.zip
filament_runout_sensor: Auto load pause_resume module if pause_on_runout enabled
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras')
-rw-r--r--klippy/extras/filament_switch_sensor.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/klippy/extras/filament_switch_sensor.py b/klippy/extras/filament_switch_sensor.py
index 7ef8402e..fbe9b4c1 100644
--- a/klippy/extras/filament_switch_sensor.py
+++ b/klippy/extras/filament_switch_sensor.py
@@ -14,6 +14,7 @@ class BaseSensor(object):
self.insert_gcode = config.get('insert_gcode', None)
self.runout_pause = config.getboolean('pause_on_runout', True)
if self.runout_pause:
+ self.printer.try_load_module(config, 'pause_resume')
if self.runout_gcode is None:
self.runout_gcode = "PAUSE"
else:
@@ -46,8 +47,8 @@ class BaseSensor(object):
self.event_running = True
# Pausing from inside an event requires that the pause portion
# of pause_resume execute immediately.
- pause_resume = self.printer.lookup_object('pause_resume', None)
- if self.runout_pause and pause_resume is not None:
+ if self.runout_pause:
+ pause_resume = self.printer.lookup_object('pause_resume')
pause_resume.send_pause_command()
self._exec_gcode(self.runout_gcode)
self.event_running = False