-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflash.sh
More file actions
executable file
·31 lines (26 loc) · 836 Bytes
/
Copy pathflash.sh
File metadata and controls
executable file
·31 lines (26 loc) · 836 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 firmware to the M5Stack AtomS3.
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PORT="${1:-/dev/cu.usbmodem101}"
ENVIRONMENT="${2:-m5stack_atoms3}"
echo "=== Flashing Codex Usage Tracker ==="
echo "Port: $PORT"
echo "Environment: $ENVIRONMENT"
echo ""
cd "$SCRIPT_DIR/firmware"
if [ -x "$HOME/.platformio/penv/bin/pio" ]; then
PIO="$HOME/.platformio/penv/bin/pio"
elif [ -x "$SCRIPT_DIR/.venv/bin/platformio" ]; then
PIO="$SCRIPT_DIR/.venv/bin/platformio"
elif command -v pio >/dev/null; then
PIO="$(command -v pio)"
else
echo "Error: PlatformIO CLI is required. Install it with:"
echo " python3 -m venv .venv"
echo " .venv/bin/python -m pip install platformio -r requirements.txt"
exit 1
fi
"$PIO" run -e "$ENVIRONMENT" -t upload --upload-port "$PORT"
echo ""
echo "=== Done! ==="