gcode: Improve end-of-file handling when input is a debug file
Wait for any pending moves to be fully handled before exiting. Make sure the wait is done inside the "self.is_processing_data" check to avoid infinite recursion. Don't keep reading from the file while waiting to exit. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
19090bdd5b
commit
7faa5fe233
|
@ -126,9 +126,10 @@ class GCodeParser:
|
|||
lines[0] = self.partial_input + lines[0]
|
||||
self.partial_input = lines.pop()
|
||||
if self.is_processing_data:
|
||||
if not self.is_fileinput:
|
||||
if not lines:
|
||||
return
|
||||
if not self.is_fileinput and lines[0].strip().upper() == 'M112':
|
||||
if lines[0].strip().upper() == 'M112':
|
||||
self.cmd_M112({})
|
||||
self.reactor.unregister_fd(self.fd_handle)
|
||||
self.fd_handle = None
|
||||
|
@ -136,12 +137,14 @@ class GCodeParser:
|
|||
eventtime = self.reactor.pause(eventtime + 0.100)
|
||||
self.is_processing_data = True
|
||||
self.process_commands(lines)
|
||||
if not data and self.is_fileinput:
|
||||
self.motor_heater_off()
|
||||
if self.toolhead is not None:
|
||||
self.toolhead.wait_moves()
|
||||
self.printer.request_exit('exit_eof')
|
||||
self.is_processing_data = False
|
||||
if self.fd_handle is None:
|
||||
self.fd_handle = self.reactor.register_fd(self.fd, self.process_data)
|
||||
if not data and self.is_fileinput:
|
||||
self.motor_heater_off()
|
||||
self.printer.request_exit('exit_eof')
|
||||
# Response handling
|
||||
def ack(self, msg=None):
|
||||
if not self.need_ack or self.is_fileinput:
|
||||
|
|
Loading…
Reference in New Issue