aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2017-03-08 21:42:51 -0500
committerKevin O'Connor <kevin@koconnor.net>2017-03-08 21:44:17 -0500
commit0f70b420f24302a11c29cc0e68a4ea2cb17934fc (patch)
treee86346d4e21846d025d3a5b743c3dda979871182
parent21c4dea0e634a04ffdc8826b172e5ed9842dab83 (diff)
downloadkutter-0f70b420f24302a11c29cc0e68a4ea2cb17934fc.tar.gz
kutter-0f70b420f24302a11c29cc0e68a4ea2cb17934fc.tar.xz
kutter-0f70b420f24302a11c29cc0e68a4ea2cb17934fc.zip
mcu: Improve error messages on failure to config printer
Don't report a CRC mismatch if a shutdown or other failure occurs during config - instead report the appropriate details. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--klippy/mcu.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/klippy/mcu.py b/klippy/mcu.py
index 38e34270..73f99c54 100644
--- a/klippy/mcu.py
+++ b/klippy/mcu.py
@@ -339,6 +339,7 @@ class MCU:
serialport = config.get('serial', '/dev/ttyS0')
self.serial = serialhdl.SerialReader(printer.reactor, serialport, baud)
self.is_shutdown = False
+ self._shutdown_msg = ""
self._is_fileoutput = False
self._timeout_timer = printer.reactor.register_timer(
self.timeout_handler)
@@ -371,9 +372,10 @@ class MCU:
if self.is_shutdown:
return
self.is_shutdown = True
- logging.info("%s: %s" % (params['#name'], params['#msg']))
+ self._shutdown_msg = params['#msg']
+ logging.info("%s: %s" % (params['#name'], self._shutdown_msg))
self.serial.dump_debug()
- self._printer.note_shutdown(params['#msg'])
+ self._printer.note_shutdown(self._shutdown_msg)
# Connection phase
def connect(self):
if not self._is_fileoutput:
@@ -474,6 +476,11 @@ class MCU:
self.send(self.create_command(c))
if not self._is_fileoutput:
config_params = self.serial.send_with_response(msg, 'config')
+ if not config_params['is_config']:
+ if self.is_shutdown:
+ raise error("Firmware error during config: %s" % (
+ self._shutdown_msg,))
+ raise error("Unable to configure printer")
if self._config_crc != config_params['crc']:
raise error("Printer CRC does not match config")
move_count = config_params['move_count']