diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2019-06-09 13:33:21 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2019-06-09 18:44:44 -0400 |
commit | 30d2ae8f9fba2aa618363f13d812e8db886dfd97 (patch) | |
tree | 1d808f6133a8d9eb5719cee5ef16893ebaa97c2c /klippy/extras/virtual_sdcard.py | |
parent | 962f7b98bd3bafe5ffefc00e22e95a7fab377a10 (diff) | |
download | kutter-30d2ae8f9fba2aa618363f13d812e8db886dfd97.tar.gz kutter-30d2ae8f9fba2aa618363f13d812e8db886dfd97.tar.xz kutter-30d2ae8f9fba2aa618363f13d812e8db886dfd97.zip |
gcode: Eliminate the process_batch() method
Allow the callers of process_batch() to directly inspect the gcode
mutex. Those callers can then directly invoke run_script().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras/virtual_sdcard.py')
-rw-r--r-- | klippy/extras/virtual_sdcard.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/klippy/extras/virtual_sdcard.py b/klippy/extras/virtual_sdcard.py index 4116d2c5..c25bbc78 100644 --- a/klippy/extras/virtual_sdcard.py +++ b/klippy/extras/virtual_sdcard.py @@ -146,6 +146,7 @@ class VirtualSD: self.gcode.respond_error("Unable to seek file") self.work_timer = None return self.reactor.NEVER + gcode_mutex = self.gcode.get_mutex() partial_input = "" lines = [] while not self.must_pause_work: @@ -170,12 +171,13 @@ class VirtualSD: lines.reverse() self.reactor.pause(self.reactor.NOW) continue + # Pause if any other request is pending in the gcode class + if gcode_mutex.test(): + self.reactor.pause(self.reactor.monotonic() + 0.100) + continue # Dispatch command try: - res = self.gcode.process_batch([lines[-1]]) - if not res: - self.reactor.pause(self.reactor.monotonic() + 0.100) - continue + self.gcode.run_script(lines[-1]) except self.gcode.error as e: break except: |