fix(macos-rssi-bridge): pin sensing-server to --source esp32 in `make start`

The server's --source=auto probes for ESP32 frames *before* the bridge
starts emitting and falls back to `simulate` if it sees none. Simulate
mode never binds UDP, so the bridge then gets ECONNREFUSED on every
send and the UI displays fake (simulated) motion instead of real RSSI
data. Pin --source esp32 explicitly — the bridge IS the ESP32 source.

Also call `make stop` at the top of `make start` so re-running doesn't
collide with a stale instance.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
griffin 2026-05-26 09:47:31 -07:00
parent 5f8471a7ed
commit 82f15c112a
No known key found for this signature in database
GPG Key ID: E2CBC5B01EFA35EB
1 changed files with 10 additions and 2 deletions

View File

@ -49,12 +49,20 @@ build-server:
# process group, opens both UIs, waits for Ctrl-C, and kills both children
# cleanly. The sensing-server is run with cwd=v2/ so its default --ui-path of
# ../ui resolves; the bridge stays in this directory so ./mac_wifi works.
#
# --source esp32 is required: the server's "auto" probe only binds UDP if it
# detects frames *before* the bridge starts sending. The bridge IS the ESP32
# source (synthetic, but same wire format), so pin it explicitly. Otherwise
# the server falls back to `simulate`, never binds UDP, and you get
# ECONNREFUSED on the bridge + a UI showing simulated (fake) motion.
start: build build-server
@$(MAKE) -s stop >/dev/null 2>&1 || true
@echo "[start] sensing-server + macos-rssi-bridge → $(SENSING_UI_URL)"
@trap 'echo; echo "[start] stopping…"; kill $$SERVER_PID $$BRIDGE_PID 2>/dev/null; wait 2>/dev/null; exit 0' INT TERM; \
( cd $(SENSING_SERVER_DIR) && ./$(SENSING_SERVER_BIN) --udp-port $(TARGET_PORT) ) & \
( cd $(SENSING_SERVER_DIR) && ./$(SENSING_SERVER_BIN) \
--source esp32 --udp-port $(TARGET_PORT) ) & \
SERVER_PID=$$!; \
echo "[start] sensing-server pid=$$SERVER_PID — waiting 3s for UDP bind…"; \
echo "[start] sensing-server pid=$$SERVER_PID (source=esp32) — waiting 3s for UDP bind…"; \
sleep 3; \
./$(BRIDGE) --helper ./$(HELPER) --target-host $(TARGET_HOST) \
--target-port $(TARGET_PORT) --interval $(INTERVAL) & \