#!/usr/bin/env bash set -euo pipefail # Build + flash the M5Stack Dashboard project via PlatformIO. # # Usage: # ./scripts/deploy.sh # auto-detect USB port # ./scripts/deploy.sh /dev/ttyUSB0 # force a specific port # # This script intentionally does NOT open the serial monitor afterwards. cd "$(dirname "$0")/.." if ! command -v pio &> /dev/null; then echo "Error: PlatformIO CLI ('pio') not found in PATH." echo "Install it via: pip install -U platformio" exit 1 fi if [ "$#" -ge 1 ]; then PORT="$1" echo "Using forced upload port: $PORT" pio run --target upload --upload-port "$PORT" else echo "Auto-detecting upload port..." pio run --target upload fi echo "Build + flash complete."