🐛 Don't try to trigger M112 on connection errors

Doesn't make sense, we don't HAVE a connection yet.
This commit is contained in:
Gina Häußge committed 2019-09-19 10:19:19 +02:00
1 parent 15522a98b0
commit b9665a8af4
1 file changed
+7 -5
+7 -5
View File
@@ -2779,7 +2779,9 @@ class MachineCom(object):
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)
@@ -3730,11 +3732,11 @@ class MachineCom(object):
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)