Only resend next line after first resend is through
Tracking the "ok" attached to a resend is necessary in order to make sure that it does not trigger the resend of the next line after the requested one right after, causing resend loops in some cases, e.g. "> 100", "> 101" , "< rs 100", "ok", "> 100", "< expected 100, got 101, rs 100" -- here the last error from the firmware could not be processed as "false negative" correctly (101 was already sent to the printer when it detected the error for 100, so this error just needs to be ignored) since the resend flag was already cleared due to line 100 and 101 having been enqueued, 100 in the resend handler, 101 due to the following ok. This patch fixes the latter, thus solving the problem.
This commit is contained in:
parent
594636e0e3
commit
354e064969
1 changed files with 11 additions and 3 deletions
|
|
@ -162,6 +162,7 @@ class MachineCom(object):
|
|||
self._lastCommError = None
|
||||
self._lastResendNumber = None
|
||||
self._currentResendCount = 0
|
||||
self._resendSwallowNextOk = False
|
||||
|
||||
self._clear_to_send = CountedEvent(max=10, name="comm.clear_to_send")
|
||||
self._send_queue = TypedQueue()
|
||||
|
|
@ -1048,7 +1049,9 @@ class MachineCom(object):
|
|||
elif self._state == self.STATE_OPERATIONAL or self._state == self.STATE_PAUSED:
|
||||
if "ok" in line:
|
||||
# if we still have commands to process, process them
|
||||
if self._resendDelta is not None:
|
||||
if self._resendSwallowNextOk:
|
||||
self._resendSwallowNextOk = False
|
||||
elif self._resendDelta is not None:
|
||||
self._resendNextCommand()
|
||||
elif self._sendFromQueue():
|
||||
pass
|
||||
|
|
@ -1067,8 +1070,12 @@ class MachineCom(object):
|
|||
self._logger.debug("Ran into a communication timeout, but a blocking command is currently active")
|
||||
|
||||
if "ok" in line:
|
||||
if self._resendDelta is not None:
|
||||
if self._resendSwallowNextOk:
|
||||
self._resendSwallowNextOk = False
|
||||
|
||||
elif self._resendDelta is not None:
|
||||
self._resendNextCommand()
|
||||
|
||||
else:
|
||||
if self._sendFromQueue(sendChecksum=True):
|
||||
pass
|
||||
|
|
@ -1308,6 +1315,8 @@ class MachineCom(object):
|
|||
lineToResend = int(line.split()[1])
|
||||
|
||||
if lineToResend is not None:
|
||||
self._resendSwallowNextOk = True
|
||||
|
||||
lastCommError = self._lastCommError
|
||||
self._lastCommError = None
|
||||
|
||||
|
|
@ -1339,7 +1348,6 @@ class MachineCom(object):
|
|||
self._resendNextCommand()
|
||||
|
||||
def _resendNextCommand(self):
|
||||
lastCommError = self._lastCommError
|
||||
self._lastCommError = None
|
||||
|
||||
# Make sure we are only handling one sending job at a time
|
||||
|
|
|
|||
Loading…
Reference in a new issue