From 93d3a6e1d1f298bdbe4d6dc5c88226c63f7c6c41 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Mon, 9 Jan 2017 23:50:13 -0500 Subject: klippy: Warn the user on common errors due to old firmware Check for msgproto.error and warn the user about version firmware version mismatch. Raise msgproto.error when extracting firmware constants. Signed-off-by: Kevin O'Connor --- klippy/klippy.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'klippy/klippy.py') diff --git a/klippy/klippy.py b/klippy/klippy.py index 7af2e9b8..92fe6363 100644 --- a/klippy/klippy.py +++ b/klippy/klippy.py @@ -6,6 +6,7 @@ # This file may be distributed under the terms of the GNU GPLv3 license. import sys, optparse, ConfigParser, logging, time, threading import gcode, toolhead, util, mcu, fan, heater, extruder, reactor, queuelogger +import msgproto message_startup = """ The klippy host software is attempting to connect. Please @@ -19,6 +20,15 @@ command to reload the config and restart the host software. Printer is halted """ +message_protocol_error = """ +This type of error is frequently caused by running an older +version of the firmware on the micro-controller (fix by +recompiling and flashing the firmware). +Once the underlying issue is corrected, use the "RESTART" +command to reload the config and restart the host software. +Protocol error connecting to printer +""" + message_mcu_connect_error = """ This is an unrecoverable error. Please manually restart the micro-controller and then issue the "RESTART" command to @@ -169,6 +179,10 @@ class Printer: logging.exception("Config error") self.state_message = "%s%s" % (str(e), message_restart) self.reactor.update_timer(self.stats_timer, self.reactor.NEVER) + except msgproto.error, e: + logging.exception("Protocol error") + self.state_message = "%s%s" % (str(e), message_protocol_error) + self.reactor.update_timer(self.stats_timer, self.reactor.NEVER) except mcu.error, e: logging.exception("MCU error during connect") self.state_message = "%s%s" % (str(e), message_mcu_connect_error) -- cgit v1.2.3-70-g09d2