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:
Kevin O'Connor 2019-06-09 13:33:21 -04:00
parent 962f7b98bd
commit 30d2ae8f9f
3 changed files with 12 additions and 16 deletions

View file

@ -277,12 +277,6 @@ class GCodeParser:
if self.fd_handle is None:
self.fd_handle = self.reactor.register_fd(self.fd,
self._process_data)
def process_batch(self, commands):
if self.mutex.test():
return False
with self.mutex:
self._process_commands(commands, need_ack=False)
return True
def run_script_from_command(self, script):
prev_need_ack = self.need_ack
try:
@ -292,6 +286,8 @@ class GCodeParser:
def run_script(self, script):
with self.mutex:
self._process_commands(script.split('\n'), need_ack=False)
def get_mutex(self):
return self.mutex
# Response handling
def ack(self, msg=None):
if not self.need_ack or self.is_fileinput: