-
Notifications
You must be signed in to change notification settings - Fork 313
Expand file tree
/
Copy pathflash.sh
More file actions
executable file
·31 lines (26 loc) · 839 Bytes
/
Copy pathflash.sh
File metadata and controls
executable file
·31 lines (26 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
# 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)"
BOARD="$1"
PORT="${2:-/dev/ttyACM0}"
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 -e "$BOARD" -t upload --upload-port "$PORT"
echo ""
echo "=== Done! ==="