aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/virtual_sdcard.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2019-11-24 14:30:26 -0500
committerKevin O'Connor <kevin@koconnor.net>2019-11-24 14:30:26 -0500
commit05472bb8a311e6971877b7ecbb57e0bfd7087469 (patch)
tree8c689278527105d07b95ef51c6a51be31d7c525c /klippy/extras/virtual_sdcard.py
parentade65b90af93577ae5ab5c413d5570d51084c401 (diff)
downloadkutter-05472bb8a311e6971877b7ecbb57e0bfd7087469.tar.gz
kutter-05472bb8a311e6971877b7ecbb57e0bfd7087469.tar.xz
kutter-05472bb8a311e6971877b7ecbb57e0bfd7087469.zip
virtual_sdcard: Don't wait for M25 in an SD gcode file
If an M25 is in a gcode file that is being printed from virtual SD, it would cause a permanent hang. Detect that case and don't wait for those M25 commands. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras/virtual_sdcard.py')
-rw-r--r--klippy/extras/virtual_sdcard.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/klippy/extras/virtual_sdcard.py b/klippy/extras/virtual_sdcard.py
index 6cdfacd4..bc0d6c2d 100644
--- a/klippy/extras/virtual_sdcard.py
+++ b/klippy/extras/virtual_sdcard.py
@@ -16,7 +16,7 @@ class VirtualSD:
self.file_position = self.file_size = 0
# Work timer
self.reactor = printer.get_reactor()
- self.must_pause_work = False
+ self.must_pause_work = self.cmd_from_sd = False
self.work_timer = None
# Register commands
self.gcode = printer.lookup_object('gcode')
@@ -64,7 +64,7 @@ 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:
+ while self.work_timer is not None and not self.cmd_from_sd:
self.reactor.pause(self.reactor.monotonic() + .001)
# G-Code commands
def cmd_error(self, params):
@@ -177,6 +177,7 @@ class VirtualSD:
self.reactor.pause(self.reactor.monotonic() + 0.100)
continue
# Dispatch command
+ self.cmd_from_sd = True
try:
self.gcode.run_script(lines[-1])
except self.gcode.error as e:
@@ -184,9 +185,11 @@ class VirtualSD:
except:
logging.exception("virtual_sdcard dispatch")
break
+ self.cmd_from_sd = False
self.file_position += len(lines.pop()) + 1
logging.info("Exiting SD card print (position %d)", self.file_position)
self.work_timer = None
+ self.cmd_from_sd = False
return self.reactor.NEVER
def load_config(config):