Yet another fix for the M999 resend issue

Should hopefully now be also fixed in case of a newly established connection with the printer, which was a regression due to the fix of the resending code.
master
Gina Häußge 2013-06-27 21:12:06 +02:00
parent 24bb0fdf05
commit dd3e9030fa
1 changed files with 182 additions and 174 deletions

View File

@ -578,6 +578,7 @@ class MachineCom(object):
sdStatusRequestTimeout = timeout
startSeen = not settings().getBoolean(["feature", "waitForStartOnConnect"])
while True:
try:
line = self._readline()
if line == None:
break
@ -766,6 +767,13 @@ class MachineCom(object):
self._sendNext()
elif "resend" in line.lower() or "rs" in line:
self._handleResendRequest(line)
except:
self._logger.exception("Something crashed inside the serial connection loop, please report this in OctoPrint's bug tracker:")
errorMsg = "See octoprint.log for details"
self._log(errorMsg)
self._errorValue = errorMsg
self._changeState(self.STATE_ERROR)
self._log("Connection closed, closing down monitor")
def _handleResendRequest(self, line):
@ -778,7 +786,7 @@ class MachineCom(object):
if lineToResend is not None:
self._resendDelta = self._currentLine - lineToResend
if self._resendDelta > len(self._lastLines):
if self._resendDelta > len(self._lastLines) or len(self._lastLines) == 0:
self._errorValue = "Printer requested line %d but no sufficient history is available, can't resend" % lineToResend
self._logger.warn(self._errorValue)
if self.isPrinting():