feat(uno-q): flash-sketch helper + matrix_rain as the board boot default
- flash-sketch.sh: compile + flash a sketch dir onto a board's MCU over adb (push → arduino-cli compile with TMPDIR=/tmp → arduino-flash @ 0x80F0000). Defaults to sketches/matrix_rain; includes a fleet loop over adb devices. DRYs up the recipe and makes "set the board default" one command. - Designate matrix_rain as the boot animation boards ship with (the flashed MCU sketch persists across power cycles). Documented in the sketches README + parent Files list. Flashed matrix_rain to the board via the helper (821 bytes, verified E2E). Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
5f2456e5cb
commit
a2ccf519d4
@@ -191,6 +191,8 @@ cloud-with-fallback. In APESS, the team's provider/fallback toggle picks the ali
|
|||||||
- `provision-fleet.sh` — host: provision a whole fleet from `fleet.csv` (env + self-register + timer/cron).
|
- `provision-fleet.sh` — host: provision a whole fleet from `fleet.csv` (env + self-register + timer/cron).
|
||||||
- `fleet.csv.example` — kit→adb-serial assignment template for `provision-fleet.sh`.
|
- `fleet.csv.example` — kit→adb-serial assignment template for `provision-fleet.sh`.
|
||||||
- `gen-qr-sheet.sh` — host: render the sticker CSV into a self-contained printable QR sheet (needs `qrencode`).
|
- `gen-qr-sheet.sh` — host: render the sticker CSV into a self-contained printable QR sheet (needs `qrencode`).
|
||||||
|
- `flash-sketch.sh` — host: compile + flash a sketch onto a board's MCU (sets the boot animation; default `sketches/matrix_rain`).
|
||||||
|
- `sketches/` — LED-matrix animations (`matrix_rain` is the board default; `matrix_effects` is a sampler). See `sketches/README.md`.
|
||||||
- `apess-selfregister.sh` — on-board: announce into APESS's unclaimed pool on boot.
|
- `apess-selfregister.sh` — on-board: announce into APESS's unclaimed pool on boot.
|
||||||
- `apess-node.env.example` — per-board onboarding identity (KIT_ID / CLAIM_CODE / FLEET_SECRET / APESS_URL).
|
- `apess-node.env.example` — per-board onboarding identity (KIT_ID / CLAIM_CODE / FLEET_SECRET / APESS_URL).
|
||||||
- `systemd/*.service` + `apess-selfregister.timer` — production units (need root).
|
- `systemd/*.service` + `apess-selfregister.timer` — production units (need root).
|
||||||
|
|||||||
Executable
+36
@@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Compile + flash an Arduino sketch onto an Uno Q's MCU over adb. The sketch is
|
||||||
|
# written to MCU flash (0x80F0000) and runs on every boot/reset — so this is how
|
||||||
|
# you set a board's default ("boot") animation. Attendees overwrite it when they
|
||||||
|
# flash their own sketch during the workshop; re-run this to restore the default.
|
||||||
|
#
|
||||||
|
# ./flash-sketch.sh <adb-serial> [sketch-dir]
|
||||||
|
# ./flash-sketch.sh 65301572 # defaults to the boot animation
|
||||||
|
# ./flash-sketch.sh 65301572 sketches/matrix_effects
|
||||||
|
#
|
||||||
|
# Fleet-wide (restore the default on every connected board):
|
||||||
|
# for s in $(adb devices | awk 'NR>1 && $2=="device"{print $1}'); do ./flash-sketch.sh "$s"; done
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
HERE="$(cd "$(dirname "$0")" && pwd)"
|
||||||
|
S="${1:?usage: flash-sketch.sh <adb-serial> [sketch-dir]}"
|
||||||
|
# The designated board default (boot animation).
|
||||||
|
SKETCH_DIR="${2:-$HERE/sketches/matrix_rain}"
|
||||||
|
NAME="$(basename "$SKETCH_DIR")"
|
||||||
|
[ -r "$SKETCH_DIR/$NAME.ino" ] || { echo "no $SKETCH_DIR/$NAME.ino" >&2; exit 1; }
|
||||||
|
|
||||||
|
REMOTE="/home/arduino/sketches/$NAME"
|
||||||
|
|
||||||
|
echo "==> [$S] push $NAME"
|
||||||
|
adb -s "$S" shell 'mkdir -p /home/arduino/sketches' >/dev/null
|
||||||
|
adb -s "$S" push "$SKETCH_DIR" /home/arduino/sketches/ >/dev/null
|
||||||
|
|
||||||
|
echo "==> [$S] compile (TMPDIR=/tmp dodges the adb shell's /data/local/tmp)"
|
||||||
|
adb -s "$S" shell "cd $REMOTE && TMPDIR=/tmp arduino-cli compile --fqbn arduino:zephyr:unoq --export-binaries . 2>&1 | tail -3"
|
||||||
|
|
||||||
|
echo "==> [$S] flash (OpenOCD @ 0x80F0000)"
|
||||||
|
adb -s "$S" shell "BIN=\$(ls $REMOTE/build/arduino.zephyr.unoq/*.elf-zsk.bin 2>/dev/null | head -1); \
|
||||||
|
[ -n \"\$BIN\" ] || { echo 'no .elf-zsk.bin — compile failed' >&2; exit 1; }; \
|
||||||
|
/usr/local/bin/arduino-flash \"\$BIN\" 2>&1 | tail -3"
|
||||||
|
|
||||||
|
echo "==> [$S] done — $NAME flashed and running"
|
||||||
@@ -6,9 +6,23 @@ Animations for the Arduino Uno Q's built-in **13×8 monochrome blue** LED matrix
|
|||||||
|
|
||||||
| Sketch | What it does |
|
| Sketch | What it does |
|
||||||
|--------|--------------|
|
|--------|--------------|
|
||||||
| `matrix_rain/` | Digital "rain" — per-column drops (head + short trail) at staggered speeds. |
|
| `matrix_rain/` | Digital "rain" — per-column drops (head + short trail) at staggered speeds. **The board default** (boot animation). |
|
||||||
| `matrix_effects/` | Sampler that cycles rain → knight-rider → comet → ripple → bloom → breathe → sparkle → checker → wipe. |
|
| `matrix_effects/` | Sampler that cycles rain → knight-rider → comet → ripple → bloom → breathe → sparkle → checker → wipe. |
|
||||||
|
|
||||||
|
## The board default (boot animation)
|
||||||
|
|
||||||
|
`matrix_rain` is the designated default a board shows on boot. The flashed sketch
|
||||||
|
lives in MCU flash and runs on every power-up, so setting the default is just
|
||||||
|
flashing it. Attendees overwrite it when they flash their own sketch during the
|
||||||
|
workshop; re-run `flash-sketch.sh` to restore it afterward.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
../flash-sketch.sh <adb-serial> # flashes matrix_rain (the default)
|
||||||
|
../flash-sketch.sh <adb-serial> matrix_effects # or any sketch dir
|
||||||
|
# restore the default on every connected board:
|
||||||
|
for s in $(adb devices | awk 'NR>1 && $2=="device"{print $1}'); do ../flash-sketch.sh "$s"; done
|
||||||
|
```
|
||||||
|
|
||||||
## How they work
|
## How they work
|
||||||
|
|
||||||
The matrix API is intentionally tiny: `matrix.begin()` and
|
The matrix API is intentionally tiny: `matrix.begin()` and
|
||||||
|
|||||||
Reference in New Issue
Block a user