Handle Repetier resend repetitions
Repetier might resend the same resend request to make sure it arrives. This commit makes OctoPrint not react to such a repeated request and instead ignore up to a configurable amount of repeated requests for the same (current) line.
This commit is contained in:
parent
d956773f04
commit
6f836951b5
2 changed files with 14 additions and 1 deletions
|
|
@ -86,7 +86,9 @@ default_settings = {
|
|||
"additionalBaudrates": [],
|
||||
"longRunningCommands": ["G4", "G28", "G29", "G30", "G32", "M400", "M226"],
|
||||
"checksumRequiringCommands": ["M110"],
|
||||
"helloCommand": "M110 N0"
|
||||
"helloCommand": "M110 N0",
|
||||
"ignoreIdenticalResends": False,
|
||||
"identicalResendsCountdown": 7
|
||||
},
|
||||
"server": {
|
||||
"host": "0.0.0.0",
|
||||
|
|
|
|||
|
|
@ -249,6 +249,8 @@ class MachineCom(object):
|
|||
self._lastResendNumber = None
|
||||
self._currentResendCount = 0
|
||||
self._resendSwallowNextOk = False
|
||||
self._resendSwallowRepetitions = settings().getBoolean(["serial", "ignoreIdenticalResends"])
|
||||
self._resendSwallowRepetitionsCounter = 0
|
||||
self._checksum_requiring_commands = settings().get(["serial", "checksumRequiringCommands"])
|
||||
|
||||
self._clear_to_send = CountedEvent(max=10, name="comm.clear_to_send")
|
||||
|
|
@ -1484,9 +1486,18 @@ class MachineCom(object):
|
|||
self._currentResendCount += 1
|
||||
return
|
||||
|
||||
# If we ignore resend repetitions (Repetier firmware...), check if we
|
||||
# need to do this now. If the same line number has been requested we
|
||||
# already saw and resent, we'll ignore it up to <counter> times.
|
||||
if self._resendSwallowRepetitions and lineToResend == self._lastResendNumber and self._resendSwallowRepetitionsCounter > 0:
|
||||
self._logger.debug("Ignoring resend request for line %d, that is probably a repetition sent by the firmware to ensure it arrives, not a real request" % lineToResend)
|
||||
self._resendSwallowRepetitionsCounter -= 1
|
||||
return
|
||||
|
||||
self._resendDelta = resendDelta
|
||||
self._lastResendNumber = lineToResend
|
||||
self._currentResendCount = 0
|
||||
self._resendSwallowRepetitionsCounter = settings().getInt(["serial", "identicalResendsCountdown"])
|
||||
|
||||
if self._resendDelta > len(self._lastLines) or len(self._lastLines) == 0 or self._resendDelta < 0:
|
||||
self._errorValue = "Printer requested line %d but no sufficient history is available, can't resend" % lineToResend
|
||||
|
|
|
|||
Loading…
Reference in a new issue