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 <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2017-01-09 23:50:13 -05:00
parent eebaeeff96
commit 93d3a6e1d1
3 changed files with 31 additions and 5 deletions

View File

@@ -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)