From b054ec47adb7201877c2f99446b1b9499e2bf6ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Sat, 29 Sep 2018 13:28:09 +0200 Subject: [PATCH] Special handling for fatal errors If the firmware locks up it doesn't make sense to stay connected to it even if we are supposed to only cancel an ongoing print. --- src/octoprint/util/comm.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index f83290daf..9492b0e18 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -2507,6 +2507,9 @@ class MachineCom(object): "cannot open", "open failed", "cannot enter") + _fatal_errors = ("system stopped", + "kill() called", + "fatal:") def _handle_errors(self, line): if line is None: return @@ -2554,11 +2557,12 @@ class MachineCom(object): level=logging.WARN) if not self._ignore_errors: - if self._disconnect_on_errors: + if self._disconnect_on_errors or any(map(lambda x: x in lower_line, self._fatal_errors)): self._trigger_error(stripped_error, "firmware") elif self.isPrinting(): self.cancelPrint(firmware_error=stripped_error) self._clear_to_send.set() + else: self._log("WARNING! Received an error from the printer's firmware, ignoring that as configured " "but you might want to investigate what happened here! Error: {}".format(stripped_error))