mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-22 22:24:02 -06:00
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>
This commit is contained in:
parent
962f7b98bd
commit
30d2ae8f9f
3 changed files with 12 additions and 16 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue