aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--klippy/extras/error_mcu.py12
-rw-r--r--klippy/klippy.py13
2 files changed, 16 insertions, 9 deletions
diff --git a/klippy/extras/error_mcu.py b/klippy/extras/error_mcu.py
index 339eb731..536debbb 100644
--- a/klippy/extras/error_mcu.py
+++ b/klippy/extras/error_mcu.py
@@ -23,6 +23,13 @@ Once the underlying issue is corrected, use the "RESTART"
command to reload the config and restart the host software.
"""
+message_mcu_connect_error = """
+Once the underlying issue is corrected, use the
+"FIRMWARE_RESTART" command to reset the firmware, reload the
+config, and restart the host software.
+Error configuring printer
+"""
+
Common_MCU_errors = {
("Timer too close",): """
This often indicates the host computer is overloaded. Check
@@ -102,9 +109,14 @@ class PrinterMCUError:
newmsg += msg_update + ["Up-to-date MCU(s):"] + msg_updated
newmsg += [message_protocol_error2, details['error']]
self.printer.update_error_msg(msg, "\n".join(newmsg))
+ def _check_mcu_connect_error(self, msg, details):
+ newmsg = "%s%s" % (details['error'], message_mcu_connect_error)
+ self.printer.update_error_msg(msg, newmsg)
def _handle_notify_mcu_error(self, msg, details):
if msg == "Protocol error":
self._check_protocol_error(msg, details)
+ elif msg == "MCU error during connect":
+ self._check_mcu_connect_error(msg, details)
def load_config(config):
return PrinterMCUError(config)
diff --git a/klippy/klippy.py b/klippy/klippy.py
index 17609b37..75ee6887 100644
--- a/klippy/klippy.py
+++ b/klippy/klippy.py
@@ -22,13 +22,6 @@ command to reload the config and restart the host software.
Printer is halted
"""
-message_mcu_connect_error = """
-Once the underlying issue is corrected, use the
-"FIRMWARE_RESTART" command to reset the firmware, reload the
-config, and restart the host software.
-Error configuring printer
-"""
-
class Printer:
config_error = configfile.error
command_error = gcode.CommandError
@@ -152,8 +145,10 @@ class Printer:
util.dump_mcu_build()
return
except mcu.error as e:
- logging.exception("MCU error during connect")
- self._set_state("%s%s" % (str(e), message_mcu_connect_error))
+ msg = "MCU error during connect"
+ logging.exception(msg)
+ self._set_state(msg)
+ self.send_event("klippy:notify_mcu_error", msg, {"error": str(e)})
util.dump_mcu_build()
return
except Exception as e: