memlnaut-nisps/scripts/flash-useq-expander.sh
monkey-w1n5t0n b853113ac1 feat(useq-cv): flash scripts per board + handshake status in Outputs panel
- scripts/flash-useq-main.sh + scripts/flash-useq-expander.sh: build + flash
  each uSEQ board via PlatformIO (nix-shell fallback for pio; extra args pass
  through; BOOTSEL hint).
- CV backend: green status now means a CONFIRMED handshake, not just an open
  port. Any valid device->host frame (the firmware streams INPUT at 20 Hz, or an
  identify ack) flips it ready/green; a 2.5s watchdog after open surfaces a red
  'no response from module' if nothing replies. idle/grey when nothing connected.
- Outputs panel CV config: explicit handshake indicator (coloured dot + label —
  green 'Module handshake OK' / amber waiting / red error / grey not connected).
- Docs: firmware README + MAP.md note the scripts.
2026-06-28 22:39:02 +02:00

36 lines
1.3 KiB
Bash
Executable file

#!/usr/bin/env bash
# Build + flash the uSEQ-CV **expander** firmware (firmware/useq-celium/expander).
# Target: uSEQ USEQHARDWARE_EXPANDER_OUT_0_1 (RP2040). Any extra args are passed
# to pio (e.g. --upload-port /dev/ttyACM1).
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BOARD_DIR="$SCRIPT_DIR/../firmware/useq-celium/expander"
ENV="expander"
if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
echo "Usage: scripts/flash-useq-expander.sh [extra pio args]"
echo " Builds firmware/useq-celium/expander and uploads it to the uSEQ EXPANDER board."
exit 0
fi
# Resolve PlatformIO (nix-friendly: fall back to an ephemeral nix-shell).
run_pio() {
if command -v pio >/dev/null 2>&1; then
pio "$@"
elif command -v platformio >/dev/null 2>&1; then
platformio "$@"
elif command -v nix-shell >/dev/null 2>&1; then
nix-shell -p platformio --run "pio $*"
else
echo "error: PlatformIO not found. Install it, e.g.:" >&2
echo " nix-shell -p platformio # or: pipx install platformio" >&2
exit 1
fi
}
echo "==> Build + flash uSEQ EXPANDER (env: $ENV)"
echo " If the upload can't auto-reset the board, hold BOOTSEL while plugging in USB."
cd "$BOARD_DIR"
run_pio run -e "$ENV" -t upload "$@"
echo "==> Done. The expander LEDs sweep when the main board forwards an Identify."