aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/gcode.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2017-10-10 11:12:15 -0400
committerKevin O'Connor <kevin@koconnor.net>2018-02-11 14:13:12 -0500
commit08a1183a01ab84484e284e4f8dbb9427a5b614cf (patch)
tree1c43501656538334672267e5810bf4ebd05074c3 /klippy/gcode.py
parentf77e1b67f64604ef48f4239b6db9c2fcc1ead0c5 (diff)
downloadkutter-08a1183a01ab84484e284e4f8dbb9427a5b614cf.tar.gz
kutter-08a1183a01ab84484e284e4f8dbb9427a5b614cf.tar.xz
kutter-08a1183a01ab84484e284e4f8dbb9427a5b614cf.zip
virtual_sdcard: Initial support for virtual sdcard
Add support for directly printing from a local file on the host. This may be useful if the host cpu is not fast enough to run OctoPrint well. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/gcode.py')
-rw-r--r--klippy/gcode.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/klippy/gcode.py b/klippy/gcode.py
index 5090a4c5..2a23106a 100644
--- a/klippy/gcode.py
+++ b/klippy/gcode.py
@@ -123,7 +123,7 @@ class GCodeParser:
self.speed_factor, self.extrude_factor, self.speed))
logging.info("\n".join(out))
# Parse input into commands
- args_r = re.compile('([A-Z_]+|[A-Z*])')
+ args_r = re.compile('([A-Z_]+|[A-Z*/])')
def process_commands(self, commands, need_ack=True):
for line in commands:
# Ignore comments and leading/trailing spaces
@@ -205,6 +205,17 @@ class GCodeParser:
pending_commands = self.pending_commands
if self.fd_handle is None:
self.fd_handle = self.reactor.register_fd(self.fd, self.process_data)
+ def process_batch(self, command):
+ if self.is_processing_data:
+ return False
+ self.is_processing_data = True
+ try:
+ self.process_commands([command], need_ack=False)
+ finally:
+ if self.pending_commands:
+ self.process_pending()
+ self.is_processing_data = False
+ return True
def run_script(self, script):
prev_need_ack = self.need_ack
try: