-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·68 lines (63 loc) · 2.38 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·68 lines (63 loc) · 2.38 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
# Build script for GoudFlight monorepo
# Usage: ./build.sh [environment] or ./build.sh all
PIO=/home/aram/.platformio/penv/bin/platformio
# Check for .env file
if [ ! -f ".env" ]; then
echo ""
echo "============================================================"
echo "ERROR: .env file not found!"
echo "============================================================"
echo ""
echo "Please create a .env file with your ESP32 MAC addresses."
echo "You can copy .env.template as a starting point:"
echo ""
echo " cp .env.template .env"
echo ""
echo "Then edit .env and add your device MAC addresses:"
echo " HANDHELD_MAC_ADDRESS=XX:XX:XX:XX:XX:XX"
echo " BASE_STATION_MAC_ADDRESS=XX:XX:XX:XX:XX:XX"
echo ""
echo "To find your ESP32 MAC addresses, use the upload_test.sh"
echo "script or upload a sketch that prints WiFi.macAddress()"
echo "============================================================"
echo ""
exit 1
fi
# Validate .env file has required entries
if ! grep -q "HANDHELD_MAC_ADDRESS=" .env || ! grep -q "BASE_STATION_MAC_ADDRESS=" .env; then
echo ""
echo "============================================================"
echo "ERROR: .env file is missing required MAC addresses!"
echo "============================================================"
echo ""
echo "Your .env file must contain:"
echo " HANDHELD_MAC_ADDRESS=XX:XX:XX:XX:XX:XX"
echo " BASE_STATION_MAC_ADDRESS=XX:XX:XX:XX:XX:XX"
echo ""
echo "Current .env contents:"
cat .env | grep -E "MAC_ADDRESS=" || echo " (no MAC addresses found)"
echo "============================================================"
echo ""
exit 1
fi
if [ "$1" == "all" ] || [ -z "$1" ]; then
echo "Building all environments..."
$PIO run
elif [ "$1" == "handheld" ]; then
echo "Building handheld controller..."
$PIO run -e handheld_controller
elif [ "$1" == "drone" ]; then
echo "Building drone flight controller..."
$PIO run -e drone_flight_controller
elif [ "$1" == "base" ]; then
echo "Building base station..."
$PIO run -e base_station
else
echo "Usage: $0 [handheld|drone|base|all]"
echo " handheld - Build handheld controller"
echo " drone - Build drone flight controller"
echo " base - Build base station"
echo " all - Build all environments (default)"
exit 1
fi