From 82f15c112a20cc1ea73e21924993a0170cdc49b1 Mon Sep 17 00:00:00 2001 From: griffin Date: Tue, 26 May 2026 09:47:31 -0700 Subject: [PATCH] fix(macos-rssi-bridge): pin sensing-server to --source esp32 in `make start` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- scripts/macos-rssi-bridge/Makefile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/macos-rssi-bridge/Makefile b/scripts/macos-rssi-bridge/Makefile index 2a5e8079..bfa28350 100644 --- a/scripts/macos-rssi-bridge/Makefile +++ b/scripts/macos-rssi-bridge/Makefile @@ -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) & \