#!/usr/bin/env bash # Flash the firmware over USB, then open the serial monitor. # Usage: scripts/flash.sh [/dev/ttyACM0] set -euo pipefail PORT="${1:-/dev/ttyACM0}" source "$(dirname "$0")/_docker.sh" DOCKER_EXTRA=(--device "$PORT" --group-add "$(stat -c %g "$PORT")" -it) run_in_container bash -c "git config --global --add safe.directory /work && pio run -e cardputer-adv -t upload --upload-port $PORT && pio device monitor -p $PORT -b 115200"