This Moonraker component enables the flashing of MCUs via a Klipper command from the Mainsail/Fluidd/KlipperScreen console.
To install the MCU_FLASHER component, follow these steps:
-
Clone the repository:
cd ~ git clone https://github.com/juliapythoncpp/moonraker-mcu-flasher.git
-
Create symbolic links for the necessary files:
ln -s moonraker-mcu-flasher/moonraker/mcu_flasher.py moonraker/moonraker/components/mcu_flasher.py ln -s moonraker-mcu-flasher/klipper_macro/mcu_flasher.klipper_macro.cfg printer_data/config/macros/mcu_flasher.cfg
⚠️ Ensure that the paths are consistent with your installation -
Update your
moonraker.conf
file by adding[mcu_flasher mcu_name]
sections for each MCU you wish to manage. -
Add
[include macros/mcu_flasher.cfg]
to yourprinter.cfg
file.
In your moonraker.conf
file, add a section for each MCU you want to flash. Here is the template:
[mcu_flasher mcu_name]
kconfig:
# Contains the `menuconfig` options for this mcu.
flash_cmd:
# Command to flash the MCU (see below for details)
silent: True # Enable to suppress all standard output messages
These are the exact commands you would typically type in your SSH shell to flash the MCU.
Some examples could be:
-
klipper way:
make flash FLASH_DEVICE=/dev/serial/by-id/ID
-
if using canbus and katapult bootloader:
python3 ~/katapult/scripts/flashtool.py -i can0 -f ~/klipper/out/klipper.bin -u e3e8e93f53df
-
Or if multiple MCUs use the same firmware, you can flash them in sequence without recompiling Klipper
flash_cmd: make flash FLASH_DEVICE=/dev/serial/by-id/ID1 make flash FLASH_DEVICE=/dev/serial/by-id/ID2
For configuration examples, refer to the example_mcu_flasher.moonraker.cfg file in the repository.
You can flash the mcus from the Mainsail/Fluidd console:
FLASH_MCU mcu=all
to flash all mcus (in the declared order)FLASH_MCU mcu=foobar
to flash the mcu named foobar