Skip to content

Commit

Permalink
馃悰 Don't try to trigger M112 on connection errors
Browse files Browse the repository at this point in the history
Doesn't make sense, we don't HAVE a connection yet.
  • Loading branch information
foosel committed Sep 19, 2019
1 parent 15522a9 commit b9665a8
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/octoprint/util/comm.py
Expand Up @@ -2779,7 +2779,9 @@ def _trigger_error(self, text, reason, close=True):
self._changeState(self.STATE_ERROR)
eventManager().fire(Events.ERROR, {"error": self.getErrorString(), "reason": reason})
if close:
if self._send_m112_on_error and not self.isSdPrinting():
if self._send_m112_on_error and not self.isSdPrinting() and reason not in ("connection",
"autodetect_baudrate",
"autodetect_port"):
self._trigger_emergency_stop(close=False)
self.close(is_error=True)

Expand Down Expand Up @@ -3730,11 +3732,11 @@ def _trigger_emergency_stop(self, close=True):
if self._printerProfileManager.get_current_or_default()["heatedBed"]:
self._do_increment_and_send_with_checksum("M140 S0")

# close to reset host state
error_text = "Closing serial port due to emergency stop M112."
self._log(error_text)

if close:
# close to reset host state
error_text = "Closing serial port due to emergency stop M112."
self._log(error_text)

self._errorValue = error_text
self.close(is_error=True)

Expand Down

0 comments on commit b9665a8

Please sign in to comment.