From 3cd1f9676d5ef6b25711a21ef89a37c7deb152d8 Mon Sep 17 00:00:00 2001 From: Arksine Date: Sun, 24 Feb 2019 12:28:30 -0500 Subject: pause_resume: Implement send_pause_command() This allows for pausing from inside a reactor callback. Signed-off-by: Eric Callahan --- klippy/extras/virtual_sdcard.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'klippy/extras/virtual_sdcard.py') diff --git a/klippy/extras/virtual_sdcard.py b/klippy/extras/virtual_sdcard.py index 91bd31a9..b4ee948c 100644 --- a/klippy/extras/virtual_sdcard.py +++ b/klippy/extras/virtual_sdcard.py @@ -60,6 +60,9 @@ class VirtualSD: return {'progress': progress} def is_active(self): return self.work_timer is not None + def do_pause(self): + if self.work_timer is not None: + self.must_pause_work = True # G-Code commands def cmd_error(self, params): raise self.gcode.error("SD write not supported") @@ -116,8 +119,7 @@ class VirtualSD: self.work_handler, self.reactor.NOW) def cmd_M25(self, params): # Pause SD print - if self.work_timer is not None: - self.must_pause_work = True + self.do_pause() def cmd_M26(self, params): # Set SD position if self.work_timer is not None: -- cgit v1.2.3-70-g09d2