wifi-densepose/firmware/esp32-csi-node/main
arsen fc905c5c77 deploy(esp32s3): fix DSP, OTA, discovery, mobile WS for room01/room02
End-to-end deployment fixes that took the two ESP32-S3 sensor boards
(room01, room02) from "boots but DSP frozen, OTA always rolls back" to
"motion/presence/breathing all live, two consecutive OTA round-trips
succeed". Full forensic write-up in docs/adr/ADR-098.

Firmware (firmware/esp32-csi-node/main/):
* csi_collector.c — remove esp_wifi_set_promiscuous(true): this call
  silenced the CSI RX callback entirely on this silicon revision
  (yield=0pps). Without it, callbacks resume at ~5-10 pps.
* edge_processing.c — root cause: incoming CSI frames carry 192
  subcarriers but EDGE_MAX_SUBCARRIERS=128, so the size check
  early-returned every frame and Step 8 (motion) never ran. Truncate
  to 128 + warn once instead of returning.
* edge_processing.c — replace per-bin unwrapped-phase variance with
  temporal variance of per-frame broadband mean amplitude. Empirical
  separation on deployed hardware: empty 0.07-0.10, walking 3.5-14
  (~44x). Scaled by /3.0 and clamped to [0,1].
* edge_processing.c — biquad fs 20.0 -> 10.0, matching the actual
  callback rate (was halving the breathing passband).
* ota_update.c — OTA_WITH_SEQUENTIAL_WRITES -> OTA_SIZE_UNKNOWN to
  erase the full target partition (stale tail of the previous larger
  image was crashing the new image on boot, looking like rollback).
* ota_update.c — httpd_config_t.stack_size = 8192 (default 4 KB
  overflowed in OTA verify path).
* main.c — log esp_reset_reason() and running_partition->label once
  at app_main start, so OTA outcomes are visible without guesswork.
* sdkconfig.defaults — local deployment defaults: tier=2, display
  disabled (no expander on these boards), 8192 timer stack.

Sensing server (v2/crates/wifi-densepose-sensing-server/):
* src/main.rs — parse_rv_feature_state() for the 0xC5110006
  feature_state packet that RuView FW emits by default; this format
  was previously unhandled. Wire ahead of parse_esp32_vitals.
* src/main.rs — BaselineTracker with hysteretic motion gating on top
  of FW-reported scores, so UI sees clean boolean presence transitions.
* src/main.rs — refuse --source simulate; remove auto-fallback to
  synthetic data. Production builds never run on fake signals.
* src/main.rs/csi.rs — parse_csi_lean() for legacy FW 5.47 CSV
  packets; defence-in-depth for mistakenly flashed legacy sensors.

Desktop UI (v2/crates/wifi-densepose-desktop/):
* src/commands/discovery.rs — third discovery path: HTTP /status sweep
  across the local /24 in parallel with mDNS/UDP. mDNS+UDP-beacon are
  not advertised by current RuView FW. Replace sequential
  for-task-in-tasks select-with-deadline (which blocked on slow
  unrelated IPs) with futures::join_all + overall timeout.
* src/commands/server.rs — pass --bind-addr (was --bind); pass
  RUST_LOG env instead of unsupported --log-level; auto-load bundled
  wifi-densepose-v1.rvf next to the binary; reasonable defaults
  (esp32 source, 0.0.0.0 bind).
* ui/* — keep last good node list when a poll returns 0 (discovery
  is jittery on busy LANs); 8 s timeout (was 3 s); remove "simulate"
  from DataSource enum and Sensing dropdown; default Sensing source
  esp32.

Mobile UI (ui/mobile/):
* constants/websocket.ts — WS_PATH '/ws/sensing' + WS_PORT 8765 to
  match the RuView sensing-server's WS endpoint (was the legacy
  FastAPI /api/v1/stream/pose).
* services/ws.service.ts — derive WS host from serverUrl but use
  WS_PORT; remove simulation fallback paths entirely (no
  generateSimulatedData, no startSimulation on reconnect failure).
* stores/settingsStore.ts — serverUrl defaults to
  http://100.123.189.10:8080 (deployed Mac's Tailscale IP), so the
  phone connects from any network without LAN dependency.
* stores/matStore.ts — default dataSource='real',
  simulationAcknowledged=true; no synthetic triage data.
* screens/MATScreen, VitalsScreen — hide simulation overlay/badge.

Docker:
* docker/docker-compose.yml — sensing-server host port 5005 -> 5006
  to match the RuView FW's compiled CSI_TARGET_PORT default.

Documentation:
* docs/adr/ADR-098-esp32s3-csi-deployment-fixes.md — full forensic
  ADR covering each decision, the empirical numbers that drove it,
  the false hypotheses we ruled out along the way, and open items.

Verified on hardware (both nodes):
* motion empty < 0.05 (room01 0.018, room02 0.070)
* motion walking > 0.3 within 1-3 s, saturates at 1.0
* motion decay < 0.1 within 5 s after leaving
* breathing 21-22 BPM detected after ~30 s stationary
* two consecutive OTA round-trips succeed without USB intervention
* discovery finds both sensors via HTTP sweep in <2 s

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 18:56:04 +07:00
..
CMakeLists.txt ADR-081: Implement 5-layer adaptive CSI mesh firmware kernel (#404) 2026-04-20 10:38:23 -04:00
Kconfig.projbuild ADR-081: Implement 5-layer adaptive CSI mesh firmware kernel (#404) 2026-04-20 10:38:23 -04:00
adaptive_controller.c ADR-081: Implement 5-layer adaptive CSI mesh firmware kernel (#404) 2026-04-20 10:38:23 -04:00
adaptive_controller.h ADR-081: Implement 5-layer adaptive CSI mesh firmware kernel (#404) 2026-04-20 10:38:23 -04:00
adaptive_controller_decide.c ADR-081: Implement 5-layer adaptive CSI mesh firmware kernel (#404) 2026-04-20 10:38:23 -04:00
csi_collector.c deploy(esp32s3): fix DSP, OTA, discovery, mobile WS for room01/room02 2026-05-14 18:56:04 +07:00
csi_collector.h fix(firmware): SPI cache crash fix + node_id/filter_mac defensive copies + esptool v5 (rebased #397) 2026-04-28 08:41:49 -04:00
display_hal.c docs: update README with ADR-045–048, Observatory, adaptive classifier, AMOLED display 2026-03-05 10:20:48 -05:00
display_hal.h docs: update README with ADR-045–048, Observatory, adaptive classifier, AMOLED display 2026-03-05 10:20:48 -05:00
display_task.c fix: remove unsafe exec() in display_task.c 2026-03-26 04:08:00 +00:00
display_task.h docs: update README with ADR-045–048, Observatory, adaptive classifier, AMOLED display 2026-03-05 10:20:48 -05:00
display_ui.c fix(firmware): defensive node_id capture prevents runtime clobber (#390) 2026-04-15 13:47:34 -04:00
display_ui.h docs: update README with ADR-045–048, Observatory, adaptive classifier, AMOLED display 2026-03-05 10:20:48 -05:00
edge_processing.c deploy(esp32s3): fix DSP, OTA, discovery, mobile WS for room01/room02 2026-05-14 18:56:04 +07:00
edge_processing.h feat: ADR-069 ESP32 CSI → Cognitum Seed RVF pipeline (v0.5.4-esp32) 2026-04-02 19:32:18 -04:00
idf_component.yml docs: update README with ADR-045–048, Observatory, adaptive classifier, AMOLED display 2026-03-05 10:20:48 -05:00
lv_conf.h docs: update README with ADR-045–048, Observatory, adaptive classifier, AMOLED display 2026-03-05 10:20:48 -05:00
main.c deploy(esp32s3): fix DSP, OTA, discovery, mobile WS for room01/room02 2026-05-14 18:56:04 +07:00
mmwave_sensor.c feat: ADR-063/064 mmWave sensor fusion + multimodal ambient intelligence (#269) 2026-03-15 16:10:10 -04:00
mmwave_sensor.h feat: ADR-063/064 mmWave sensor fusion + multimodal ambient intelligence (#269) 2026-03-15 16:10:10 -04:00
mock_csi.c feat: QEMU ESP32-S3 testing platform + swarm configurator (ADR-061/062) (#260) 2026-03-14 13:39:51 -04:00
mock_csi.h feat: QEMU ESP32-S3 testing platform + swarm configurator (ADR-061/062) (#260) 2026-03-14 13:39:51 -04:00
nvs_config.c feat: happiness scoring pipeline + ESP32 swarm with Cognitum Seed (#285) 2026-03-20 18:46:34 -04:00
nvs_config.h feat: happiness scoring pipeline + ESP32 swarm with Cognitum Seed (#285) 2026-03-20 18:46:34 -04:00
ota_update.c deploy(esp32s3): fix DSP, OTA, discovery, mobile WS for room01/room02 2026-05-14 18:56:04 +07:00
ota_update.h feat: complete vendor repos, add edge intelligence and WASM modules 2026-03-02 23:53:25 -05:00
power_mgmt.c feat: complete vendor repos, add edge intelligence and WASM modules 2026-03-02 23:53:25 -05:00
power_mgmt.h feat: complete vendor repos, add edge intelligence and WASM modules 2026-03-02 23:53:25 -05:00
rv_feature_state.c ADR-081: Implement 5-layer adaptive CSI mesh firmware kernel (#404) 2026-04-20 10:38:23 -04:00
rv_feature_state.h ADR-081: Implement 5-layer adaptive CSI mesh firmware kernel (#404) 2026-04-20 10:38:23 -04:00
rv_mesh.c ADR-081: Implement 5-layer adaptive CSI mesh firmware kernel (#404) 2026-04-20 10:38:23 -04:00
rv_mesh.h ADR-081: Implement 5-layer adaptive CSI mesh firmware kernel (#404) 2026-04-20 10:38:23 -04:00
rv_radio_ops.h ADR-081: Implement 5-layer adaptive CSI mesh firmware kernel (#404) 2026-04-20 10:38:23 -04:00
rv_radio_ops_esp32.c ADR-081: Implement 5-layer adaptive CSI mesh firmware kernel (#404) 2026-04-20 10:38:23 -04:00
rv_radio_ops_mock.c ADR-081: Implement 5-layer adaptive CSI mesh firmware kernel (#404) 2026-04-20 10:38:23 -04:00
rvf_parser.c feat: complete vendor repos, add edge intelligence and WASM modules 2026-03-02 23:53:25 -05:00
rvf_parser.h feat: complete vendor repos, add edge intelligence and WASM modules 2026-03-02 23:53:25 -05:00
stream_sender.c fix: rate-limit CSI sends and add ENOMEM backoff to prevent crash (#132) 2026-03-03 16:00:40 -05:00
stream_sender.h fix(docker): Update Dockerfile paths from src/ to v1/src/ 2026-02-28 13:38:21 -05:00
swarm_bridge.c feat: happiness scoring pipeline + ESP32 swarm with Cognitum Seed (#285) 2026-03-20 18:46:34 -04:00
swarm_bridge.h feat: happiness scoring pipeline + ESP32 swarm with Cognitum Seed (#285) 2026-03-20 18:46:34 -04:00
wasm_runtime.c fix(firmware): defensive node_id capture prevents runtime clobber (#390) 2026-04-15 13:47:34 -04:00
wasm_runtime.h feat: complete vendor repos, add edge intelligence and WASM modules 2026-03-02 23:53:25 -05:00
wasm_upload.c fix: security hardening — replace fake HMAC, add path traversal protection, OTA auth (ADR-050) 2026-03-06 13:11:04 -05:00
wasm_upload.h feat: complete vendor repos, add edge intelligence and WASM modules 2026-03-02 23:53:25 -05:00