flashtool: don't allow MCU mismatches

Raise a FlashError if Katapult's MCU does not match the
MCU detected in klipper.bin.  If a user wants to flash a  binary
built for a different they can rename klipper.bin, which will
bypass detection.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2025-03-05 06:06:29 -05:00
parent b22330e917
commit 6c836fc898

View File

@ -301,9 +301,9 @@ class CanFlasher:
if self.klipper_dict is not None:
bin_mcu = self.klipper_dict.get("config", {}).get("MCU", "")
if bin_mcu and bin_mcu != mcu_type:
output_line(
"WARNING: MCU returned by Katapult does not match MCU"
"stored in klipper.bin.\n"
raise FlashError(
"MCU returned by Katapult does not match MCU"
"identified in klipper.bin.\n"
f"Katapult MCU: {mcu_type}\n"
f"Klipper Binary MCU: {bin_mcu}"
)