From 08a1183a01ab84484e284e4f8dbb9427a5b614cf Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Tue, 10 Oct 2017 11:12:15 -0400 Subject: 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 --- klippy/gcode.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'klippy/gcode.py') 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: -- cgit v1.2.3-70-g09d2