klippy: Report known software versions on a protocol error during connection
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
8443c0b0f8
commit
89082b494f
|
@ -22,10 +22,12 @@ command to reload the config and restart the host software.
|
||||||
Printer is halted
|
Printer is halted
|
||||||
"""
|
"""
|
||||||
|
|
||||||
message_protocol_error = """
|
message_protocol_error1 = """
|
||||||
This type of error is frequently caused by running an older
|
This type of error is frequently caused by running an older
|
||||||
version of the firmware on the micro-controller (fix by
|
version of the firmware on the micro-controller (fix by
|
||||||
recompiling and flashing the firmware).
|
recompiling and flashing the firmware).
|
||||||
|
"""
|
||||||
|
message_protocol_error2 = """
|
||||||
Once the underlying issue is corrected, use the "RESTART"
|
Once the underlying issue is corrected, use the "RESTART"
|
||||||
command to reload the config and restart the host software.
|
command to reload the config and restart the host software.
|
||||||
Protocol error connecting to printer
|
Protocol error connecting to printer
|
||||||
|
@ -141,6 +143,15 @@ class Printer:
|
||||||
m.add_printer_objects(config)
|
m.add_printer_objects(config)
|
||||||
# Validate that there are no undefined parameters in the config file
|
# Validate that there are no undefined parameters in the config file
|
||||||
pconfig.check_unused_options(config)
|
pconfig.check_unused_options(config)
|
||||||
|
def _get_versions(self):
|
||||||
|
try:
|
||||||
|
parts = ["%s=%s" % (n.split()[-1], m.get_status()['mcu_version'])
|
||||||
|
for n, m in self.lookup_objects('mcu')]
|
||||||
|
parts.insert(0, "host=%s" % (self.start_args['software_version'],))
|
||||||
|
return "\nKnown versions: %s\n" % (", ".join(parts),)
|
||||||
|
except:
|
||||||
|
logging.exception("Error in _get_versions()")
|
||||||
|
return ""
|
||||||
def _connect(self, eventtime):
|
def _connect(self, eventtime):
|
||||||
try:
|
try:
|
||||||
self._read_config()
|
self._read_config()
|
||||||
|
@ -155,7 +166,9 @@ class Printer:
|
||||||
return
|
return
|
||||||
except msgproto.error as e:
|
except msgproto.error as e:
|
||||||
logging.exception("Protocol error")
|
logging.exception("Protocol error")
|
||||||
self._set_state("%s%s" % (str(e), message_protocol_error))
|
self._set_state("%s%s%s%s" % (str(e), message_protocol_error1,
|
||||||
|
self._get_versions(),
|
||||||
|
message_protocol_error2))
|
||||||
util.dump_mcu_build()
|
util.dump_mcu_build()
|
||||||
return
|
return
|
||||||
except mcu.error as e:
|
except mcu.error as e:
|
||||||
|
|
|
@ -811,7 +811,7 @@ class MCU:
|
||||||
self._name, eventtime)
|
self._name, eventtime)
|
||||||
self._printer.invoke_shutdown("Lost communication with MCU '%s'" % (
|
self._printer.invoke_shutdown("Lost communication with MCU '%s'" % (
|
||||||
self._name,))
|
self._name,))
|
||||||
def get_status(self, eventtime):
|
def get_status(self, eventtime=None):
|
||||||
return dict(self._get_status_info)
|
return dict(self._get_status_info)
|
||||||
def stats(self, eventtime):
|
def stats(self, eventtime):
|
||||||
load = "mcu_awake=%.03f mcu_task_avg=%.06f mcu_task_stddev=%.06f" % (
|
load = "mcu_awake=%.03f mcu_task_avg=%.06f mcu_task_stddev=%.06f" % (
|
||||||
|
|
Loading…
Reference in New Issue