Made communication mode more error resilient
parent
8b702db0d0
commit
50914df07a
|
@ -581,6 +581,7 @@ class MachineCom(object):
|
|||
startSeen = not settings().getBoolean(["feature", "waitForStartOnConnect"])
|
||||
heatingUp = False
|
||||
while True:
|
||||
try:
|
||||
line = self._readline()
|
||||
if line == None:
|
||||
break
|
||||
|
@ -795,6 +796,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 = "Please 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):
|
||||
|
@ -849,7 +857,7 @@ class MachineCom(object):
|
|||
return ret
|
||||
|
||||
def close(self, isError = False):
|
||||
if self._serial != None:
|
||||
if self._serial is not None:
|
||||
self._serial.close()
|
||||
if isError:
|
||||
self._changeState(self.STATE_CLOSED_WITH_ERROR)
|
||||
|
|
Loading…
Reference in New Issue