must specify board target (e.g. waveshare_amoled_216), fixes 'flash all environments' bug.
This commit is contained in:
@@ -1,16 +1,31 @@
|
||||
#!/bin/bash
|
||||
# Build and flash firmware to the SC01 Plus.
|
||||
# Build and flash Clawdmeter firmware on Linux.
|
||||
# Usage:
|
||||
# ./flash.sh <board> # default port /dev/ttyACM0
|
||||
# ./flash.sh <board> /dev/ttyACM1 # explicit USB serial port
|
||||
#
|
||||
# <board> is the PlatformIO env name, e.g. waveshare_amoled_216 or waveshare_amoled_18.
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
PORT="${1:-/dev/ttyACM0}"
|
||||
BOARD="$1"
|
||||
PORT="${2:-/dev/ttyACM0}"
|
||||
|
||||
echo "=== Flashing Claude Usage Tracker ==="
|
||||
echo "Port: $PORT"
|
||||
if [ -z "$BOARD" ]; then
|
||||
echo "Error: board env name is required."
|
||||
echo "Usage: $0 <board> [port]"
|
||||
echo "Available boards:"
|
||||
grep -E '^\[env:' "$SCRIPT_DIR/firmware/platformio.ini" | sed 's/\[env:/ /;s/\]//'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "=== Flashing Clawdmeter ==="
|
||||
echo "Board: $BOARD"
|
||||
echo "Port: $PORT"
|
||||
echo ""
|
||||
|
||||
cd "$SCRIPT_DIR/firmware"
|
||||
~/.platformio/penv/bin/pio run -t upload --upload-port "$PORT"
|
||||
~/.platformio/penv/bin/pio run -e "$BOARD" -t upload --upload-port "$PORT"
|
||||
|
||||
echo ""
|
||||
echo "=== Done! ==="
|
||||
|
||||
Reference in New Issue
Block a user