gcode: Fix error that could cause commands to be processed out of order
Commitd0932009
changed the way command handling was performed, and commit95950949
fixed a defect in that commit. Unfortunately, the fix was incomplete. If multiple commands were sent to Klippy without waiting for an "ok" response from Klippy, then it was possible for those additional commands to be queued and processed after subsequent commands. This would result in commands being processed out of order. Fix this by only reregistering the input fd in the greenlet that performs the unregistration of the fd. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
ac53806e04
commit
0d13834293
|
@ -126,15 +126,15 @@ 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:
|
||||
if not self.is_fileinput and not lines:
|
||||
return
|
||||
if lines[0].strip().upper() == 'M112':
|
||||
self.cmd_M112({})
|
||||
self.reactor.unregister_fd(self.fd_handle)
|
||||
self.fd_handle = None
|
||||
if not self.is_fileinput and lines[0].strip().upper() == 'M112':
|
||||
self.cmd_M112({})
|
||||
while self.is_processing_data:
|
||||
eventtime = self.reactor.pause(eventtime + 0.100)
|
||||
self.fd_handle = self.reactor.register_fd(self.fd, self.process_data)
|
||||
self.is_processing_data = True
|
||||
self.process_commands(lines)
|
||||
if not data and self.is_fileinput:
|
||||
|
@ -143,8 +143,6 @@ class GCodeParser:
|
|||
self.toolhead.wait_moves()
|
||||
self.printer.request_exit()
|
||||
self.is_processing_data = False
|
||||
if self.fd_handle is None:
|
||||
self.fd_handle = self.reactor.register_fd(self.fd, self.process_data)
|
||||
# Response handling
|
||||
def ack(self, msg=None):
|
||||
if not self.need_ack or self.is_fileinput:
|
||||
|
|
Loading…
Reference in New Issue