From 879c45db191251af2a00e75bf6ba89ab876c2fad Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Mon, 28 May 2018 11:44:42 -0400 Subject: [PATCH] mcu: Do not automatically restart MCU with new config if it is shutdown Normally, the MCU is restarted on a config change. However, that should not be done automatically if the MCU is in a shutdown state. Signed-off-by: Kevin O'Connor --- klippy/mcu.py | 3 +++ src/basecmd.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/klippy/mcu.py b/klippy/mcu.py index 7f1f7f514..2209ce4e9 100644 --- a/klippy/mcu.py +++ b/klippy/mcu.py @@ -567,6 +567,9 @@ class MCU: if start_reason == 'firmware_restart': raise error("Failed automated reset of MCU '%s'" % (self._name,)) if self._config_crc != config_params['crc']: + if config_params['is_shutdown']: + raise error("Can not update MCU '%s' config as it is shutdown" + % (self._name,)) self._check_restart("CRC mismatch") raise error("MCU '%s' CRC does not match config" % (self._name,)) move_count = config_params['move_count'] diff --git a/src/basecmd.c b/src/basecmd.c index 08dc6ec20..8ce7a27c4 100644 --- a/src/basecmd.c +++ b/src/basecmd.c @@ -201,8 +201,8 @@ static uint32_t config_crc; void command_get_config(uint32_t *args) { - sendf("config is_config=%c crc=%u move_count=%hu" - , is_finalized(), config_crc, move_count); + sendf("config is_config=%c crc=%u move_count=%hu is_shutdown=%c" + , is_finalized(), config_crc, move_count, sched_is_shutdown()); } DECL_COMMAND_FLAGS(command_get_config, HF_IN_SHUTDOWN, "get_config");