Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
baf2c69aee |
@@ -75,32 +75,30 @@ jobs:
|
||||
|
||||
- name: Deploy via OTA
|
||||
run: |
|
||||
SENSORS="muddy-storm amber-maple hollow-acorn"
|
||||
# Sensor IPs (update if DHCP changes)
|
||||
declare -A SENSORS
|
||||
SENSORS["muddy-storm"]="192.168.129.29"
|
||||
SENSORS["amber-maple"]="192.168.129.30"
|
||||
SENSORS["hollow-acorn"]="192.168.129.31"
|
||||
PORT=8070
|
||||
|
||||
# Get host IP (first non-loopback IPv4)
|
||||
HOST_IP=$(hostname -I | awk '{print $1}')
|
||||
# Get host IP - try multiple methods
|
||||
HOST_IP=$(ip route get 1 2>/dev/null | awk '{print $7; exit}')
|
||||
if [ -z "$HOST_IP" ]; then
|
||||
HOST_IP=$(hostname -I | awk '{print $1}')
|
||||
fi
|
||||
echo "Host IP: $HOST_IP"
|
||||
|
||||
# Start HTTP server in background
|
||||
cd get-started/csi_recv_router/build
|
||||
python3 -m http.server $PORT &
|
||||
python3 -m http.server $PORT --bind 0.0.0.0 &
|
||||
HTTP_PID=$!
|
||||
sleep 2
|
||||
|
||||
# Deploy to each sensor
|
||||
for sensor in $SENSORS; do
|
||||
echo "=== Deploying to $sensor ==="
|
||||
# Resolve mDNS hostname
|
||||
SENSOR_IP=$(getent hosts ${sensor}.local 2>/dev/null | awk '{print $1}')
|
||||
if [ -z "$SENSOR_IP" ]; then
|
||||
SENSOR_IP=$(avahi-resolve -4 -n ${sensor}.local 2>/dev/null | awk '{print $2}')
|
||||
fi
|
||||
if [ -z "$SENSOR_IP" ]; then
|
||||
echo "Warning: Could not resolve $sensor.local, skipping"
|
||||
continue
|
||||
fi
|
||||
echo "Sensor IP: $SENSOR_IP"
|
||||
for sensor in "${!SENSORS[@]}"; do
|
||||
SENSOR_IP="${SENSORS[$sensor]}"
|
||||
echo "=== Deploying to $sensor ($SENSOR_IP) ==="
|
||||
|
||||
# Send OTA command via UDP
|
||||
echo "OTA http://${HOST_IP}:${PORT}/csi_recv_router.bin" | nc -u -w 2 $SENSOR_IP 5501
|
||||
|
||||
Reference in New Issue
Block a user