From 430ad0b65841419e2e24ab926314236c01a07476 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Wed, 30 Oct 2019 14:21:28 -0400 Subject: [PATCH] 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 --- klippy/extras/virtual_sdcard.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/klippy/extras/virtual_sdcard.py b/klippy/extras/virtual_sdcard.py index c25bbc78..6cdfacd4 100644 --- a/klippy/extras/virtual_sdcard.py +++ b/klippy/extras/virtual_sdcard.py @@ -6,7 +6,6 @@ import os, logging class VirtualSD: - def __init__(self, config): printer = config.get_printer() printer.register_event_handler("klippy:shutdown", self.handle_shutdown) @@ -65,6 +64,8 @@ class VirtualSD: def do_pause(self): if self.work_timer is not None: self.must_pause_work = True + while self.work_timer is not None: + self.reactor.pause(self.reactor.monotonic() + .001) # G-Code commands def cmd_error(self, params): raise self.gcode.error("SD write not supported")