filament_runout_sensor: Auto load pause_resume module if pause_on_runout enabled
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
3f4190c792
commit
d0be48da74
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue