diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..b2bf706 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "external/aldis"] + path = external/aldis + url = https://github.com/mjonuschat/aldis.git diff --git a/CLAUDE.md b/CLAUDE.md index 7de560c..47fb21c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -39,7 +39,11 @@ detection, `filament_error_sensitivity`), iHeater chamber heater. On the Pi, `macros/` is linked as `~/printer_data/config/klipper-macros/` and `scripts/` as `~/printer_data/config/klipper-macros-scripts/`. - `extras/*.py` are linked into `~/klipper/klippy/extras/`. -- `scripts/` MCU firmware update scripts (printer-specific IDs) and +- MCU firmware: aldis (`external/aldis`, git submodule pinned to the release in + use, v0.4.0; the Pi runs the released binary in `~/aldis`). Bump the + submodule when the Pi's aldis is updated. +- `scripts/` Katapult update script (printer-specific IDs), the archived Klipper + update script in `scripts/archive/`, and `twist_check.py` (axis twist calibration, runs on the Pi and talks to Moonraker on localhost; started by `TWIST_CALIBRATE` in `macros/calibration/twist_check.cfg`, results in `config/twist_data/`). diff --git a/README.md b/README.md index 9b4beae..7188400 100644 --- a/README.md +++ b/README.md @@ -73,9 +73,13 @@ here (`purge_check.cfg`, `nozzle_guard.cfg`, `bd_pa_spoolman.cfg`) still use the ### Scripts (`scripts/`) -Firmware update scripts for all MCUs (Klipper and Katapult). They contain -this printer's CAN UUIDs and serial IDs: see [scripts/README.md](scripts/README.md) -before using them on another printer. `twist_check.py` is the axis twist +MCU firmware: Klipper on the MCUs is updated with +[aldis](https://github.com/mjonuschat/aldis), included as a git submodule in +`external/aldis` (pinned to the release in use; on the Pi run the released +program in `~/aldis`). Install and use: [scripts/README.md](scripts/README.md). +The old Klipper update script is in `scripts/archive/`; the Katapult script +(`update_katapult_all_mcus.sh`, this printer's CAN UUIDs and serial IDs) is +still used for the bootloaders. `twist_check.py` is the axis twist calibration behind `TWIST_CALIBRATE`: see [scripts/twist_check.md](scripts/twist_check.md). ### Tools (`tools/`) @@ -179,6 +183,7 @@ original licenses apply to those parts: | `pressure_advance/bd_pressure.cfg` | [bd_pressure](https://github.com/markniu/bd_pressure) `klipper/bd_pressure.cfg` | | `print/test_speed.cfg` | [Ellis' TEST_SPEED](https://ellis3dp.com/Print-Tuning-Guide/articles/determining_max_speeds_accels.html) | | `print/pause_resume.cfg`, `print/filament.cfg` | [KlipperScreen recommended macros](https://klipperscreen.readthedocs.io/en/latest/macros/#recommended) | +| `external/aldis` | [aldis](https://github.com/mjonuschat/aldis) by mjonuschat, GPL-3.0 (git submodule, unchanged) | | `scripts/` | [Voron docs: automating MCU updates](https://docs.vorondesign.com/community/howto/drachenkatze/automating_klipper_mcu_updates.html), [Esoterical's CANBus guide](https://canbus.esoterical.online/) | Uses: [Klipper](https://github.com/Klipper3d/klipper), diff --git a/external/aldis b/external/aldis new file mode 160000 index 0000000..607c8db --- /dev/null +++ b/external/aldis @@ -0,0 +1 @@ +Subproject commit 607c8db1b0765d4fd88058ba8b6a105dd1564368 diff --git a/scripts/README.md b/scripts/README.md index 53353ec..fb7f92b 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -2,14 +2,70 @@ `twist_check.py` is the axis twist calibration: start it with the macro `TWIST_CALIBRATE` in Mainsail, and see [twist_check.md](twist_check.md) for how -to use it. The rest of this page is about the firmware scripts. +to use it. The rest of this page is about MCU firmware updates. -# MCU firmware update scripts +# MCU firmware updates: aldis + +Klipper firmware on the MCUs is updated with +[aldis](https://github.com/mjonuschat/aldis) (GPL-3.0). It finds every MCU in +the running Klipper/Moonraker setup, compares its firmware with the Klipper +checkout in `~/klipper`, and builds and flashes only the ones that are out of +date, using the build config each MCU reports itself. It stops Klipper only +for the flash, and shows its plan first. It also updates Beacon's firmware. + +Its source is included as a git submodule in `external/aldis`, pinned to the +release in use (v0.4.0). On the Pi you run the released program instead, +installed in `~/aldis`; the submodule stays empty there (Moonraker does not +fetch submodules), which is fine. To get the source on a PC: +`git submodule update --init`. + +## Install (once, on the Pi) + +```bash +mkdir -p ~/aldis && curl -fL "https://github.com/mjonuschat/aldis/releases/latest/download/aldis-$(uname -m)-linux.tar.xz" | tar xJ -C ~/aldis --strip-components=1 && chmod +x ~/aldis/aldis +``` + +```bash +sudo ~/aldis/aldis setup +``` + +`setup` installs udev rules for the USB bootloaders and a narrow sudo rule so +aldis can stop and start Klipper. `sudo ~/aldis/aldis setup --check` verifies +them. Optional: `sudo ~/aldis/aldis setup --agent` runs it as a service that +the web UI can manage (restart Moonraker once afterwards). + +## Use (between prints only) + +```bash +~/aldis/aldis status +``` + +```bash +~/aldis/aldis update +``` + +- `status`: which MCUs it found and whether their firmware is current (reads only). +- `update`: builds and flashes the outdated MCUs, asking per MCU. + `update --pull` also pulls Klipper first; `update ` limits it. +- `self-update`: installs a newer aldis release (`--check` only reports). + +Notes for this printer (checked 2026-11-07): +- All Klipper MCUs (`mcu` Leviathan, `Turtle_1`, `MC_1`, `EBB42`, `nhk`, + `iHeater`) run `v0.13.0-777`, and Beacon 2.1.0; all report `mcu_kconfig`, + which aldis needs (Klipper `v0.13.0-753` or newer). +- Every board has Katapult (CAN or USB), which aldis supports. +- Flashing the Leviathan (USB-CAN bridge) resets the CAN bus. +- aldis writes each MCU's build config to `~/klipper/.config`. The named build + configs used by the old script (`leviathan`, `EBB42`, ...) are not touched. +- Not covered: the bd_pressure sensor (not a Klipper MCU; it has its own + `stm32flash` procedure in the bd_pressure repo) and Katapult itself (see below). + +# Old scripts | Script | Does | |---|---| -| `update_all_mcus.sh` | Pulls Klipper, builds and flashes **Klipper** to every MCU, prints a summary, restarts Klipper | -| `update_katapult_all_mcus.sh` | Builds and flashes **Katapult** (the bootloader) to every MCU | +| `archive/update_all_mcus.sh` | **Archived 2026-11-07, replaced by aldis.** Pulls Klipper, builds and flashes **Klipper** to every MCU, prints a summary, restarts Klipper | +| `update_katapult_all_mcus.sh` | Builds and flashes **Katapult** (the bootloader) to every MCU. Still in use: aldis does not update bootloaders | Based on the [Voron guide to automating MCU updates](https://docs.vorondesign.com/community/howto/drachenkatze/automating_klipper_mcu_updates.html) and [Esoterical's CANBus guide](https://canbus.esoterical.online/). @@ -17,7 +73,7 @@ and [Esoterical's CANBus guide](https://canbus.esoterical.online/). Run them on the Klipper host, between prints: ```bash -~/klipper-macros/scripts/update_all_mcus.sh +~/klipper-macros/scripts/update_katapult_all_mcus.sh ``` They stop Klipper while flashing (and need `sudo` for that). @@ -96,5 +152,5 @@ not used by the flashing itself; they only document the UUIDs. `update_katapult_all_mcus.sh` ends after the last board: it does not print the summary and does not start Klipper again. Run `sudo systemctl start -klipper` afterwards, or add the last lines of `update_all_mcus.sh` +klipper` afterwards, or add the last lines of `archive/update_all_mcus.sh` (`print_summary` and the restart) to it. diff --git a/scripts/update_all_mcus.sh b/scripts/archive/update_all_mcus.sh similarity index 96% rename from scripts/update_all_mcus.sh rename to scripts/archive/update_all_mcus.sh index a42e930..8cf5970 100755 --- a/scripts/update_all_mcus.sh +++ b/scripts/archive/update_all_mcus.sh @@ -1,4 +1,6 @@ #!/bin/bash +# ARCHIVED 2026-11-07: replaced by aldis (https://github.com/mjonuschat/aldis), +# see scripts/README.md. Kept for reference; the IDs below are still this printer's. # https://docs.vorondesign.com/community/howto/drachenkatze/automating_klipper_mcu_updates.html # https://canbus.esoterical.online/mainboard_klipper_updating.html