Public Access
Settings had grown to 21 rows in one list. It opens on five groups (This device, Display, GNSS and radio, Network, System); Enter opens one, Back returns to the groups, and Back from the groups leaves Settings. SettingsMenu holds the groups and which one is open (host-tested: every setting is in exactly one group). The guide, the how-tos, the README, the scripts' messages and the firmware's own name the new paths, such as "Settings > System > Firmware". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0162FokPdvY2KsS4NBfwyWPk
43 lines
2.6 KiB
Bash
Executable File
43 lines
2.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Flash the firmware over USB, then open the serial monitor.
|
|
# Usage: scripts/flash.sh [--debug] [port] USB (default: the first Espressif device found)
|
|
# scripts/flash.sh --ota [host] Wi-Fi: build, sign and push a Firmware Update
|
|
# (host: the device's IP from Settings > System > Firmware, or $RORO_OTA_HOST)
|
|
# --debug (USB only): once flashed, switches the Debug Console on and gives it the token in
|
|
# ~/.config/roro9stack/debug-token, over the serial port (ADR 0010, Q192), so scripts/rdbg.py works
|
|
# at once. The settings survive later updates: it is needed once for a device, not at each flash.
|
|
set -euo pipefail
|
|
ENV=cardputer-adv
|
|
PROVISION=
|
|
if [ "${1:-}" = "--debug" ]; then
|
|
PROVISION=1
|
|
shift
|
|
fi
|
|
|
|
if [ "${1:-}" = "--ota" ]; then
|
|
[ -z "$PROVISION" ] || echo "flash.sh: --debug does nothing over Wi-Fi: the console's setting stays as it is on the device" >&2
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
HOST="${2:-${RORO_OTA_HOST:-}}"
|
|
[ -n "$HOST" ] || { echo "Usage: scripts/flash.sh --ota <device IP> (or set RORO_OTA_HOST)" >&2; exit 1; }
|
|
source "$(dirname "$0")/_docker.sh"
|
|
DOCKER_EXTRA=()
|
|
run_in_container bash -c "git config --global --add safe.directory /work && pio run -e $ENV" | tail -3
|
|
VERSION="$(git -C "$ROOT" describe --tags --always --dirty)"
|
|
OUT="$ROOT/.pio/build/$ENV/roro9stack-$VERSION.ota"
|
|
"$ROOT/scripts/make_ota.py" "$ROOT/.pio/build/$ENV/firmware.bin" "$VERSION" "$OUT"
|
|
exec "$ROOT/scripts/ota_push.py" "$OUT" "$HOST"
|
|
fi
|
|
PORT="${1:-$(readlink -f /dev/serial/by-id/*Espressif* 2>/dev/null | head -1)}"
|
|
[ -n "$PORT" ] || { echo "No Cardputer found on USB (is it plugged in / attached to the VM?)" >&2; exit 1; }
|
|
source "$(dirname "$0")/_docker.sh"
|
|
docker rm -f roro9stack-serial >/dev/null 2>&1 || true # a serial log would hold the port
|
|
DOCKER_EXTRA=(--device "$PORT" --group-add "$(stat -c %g "$PORT")" -it)
|
|
|
|
# The token is read from the environment inside the container (_docker.sh passes it), so it is on no
|
|
# command line of the host; serial_log.py prints what the device says, not what it sends.
|
|
SETUP=""
|
|
# serial_log.py finds the port by its name, and follows it when the device re-enumerates after the upload.
|
|
[ -z "$PROVISION" ] || DOCKER_EXTRA=(--group-add "$(stat -c %g "$PORT")" --privileged -v /dev:/dev -it)
|
|
[ -z "$PROVISION" ] || SETUP='&& /pio/penv/bin/python scripts/serial_log.py 8 sleep:4 "debug token $RORO_DEBUG_TOKEN" "debug on"'
|
|
run_in_container bash -c "git config --global --add safe.directory /work && pio run -e $ENV -t upload --upload-port $PORT $SETUP && pio device monitor -p $PORT -b 115200"
|