virtual_sdcard: Only return from M25 after print confirmed paused

Wait in the M25 command handler until the work_handler() background
timer fully exits.  This ensures that subsequent g-code commands (such
as M27 or M24) will correctly report a paused state.

Reported by @foosel.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2019-10-30 14:21:28 -04:00
parent 40e2c64c82
commit 430ad0b658
1 changed files with 2 additions and 1 deletions

View File

@ -6,7 +6,6 @@
import os, logging import os, logging
class VirtualSD: class VirtualSD:
def __init__(self, config): def __init__(self, config):
printer = config.get_printer() printer = config.get_printer()
printer.register_event_handler("klippy:shutdown", self.handle_shutdown) printer.register_event_handler("klippy:shutdown", self.handle_shutdown)
@ -65,6 +64,8 @@ class VirtualSD:
def do_pause(self): def do_pause(self):
if self.work_timer is not None: if self.work_timer is not None:
self.must_pause_work = True self.must_pause_work = True
while self.work_timer is not None:
self.reactor.pause(self.reactor.monotonic() + .001)
# G-Code commands # G-Code commands
def cmd_error(self, params): def cmd_error(self, params):
raise self.gcode.error("SD write not supported") raise self.gcode.error("SD write not supported")