Skip to content

fix: improve sensing accuracy, presence detection, and UI reliability#518

Closed
KarthikV17 wants to merge 2 commits into
ruvnet:mainfrom
KarthikV17:fix/sensing-improvements
Closed

fix: improve sensing accuracy, presence detection, and UI reliability#518
KarthikV17 wants to merge 2 commits into
ruvnet:mainfrom
KarthikV17:fix/sensing-improvements

Conversation

@KarthikV17
Copy link
Copy Markdown

Server-side fixes (sensing-server)

  • Fix ADR-018 packet parsing: correct byte offsets for 20-byte header
    • n_subcarriers: u8 → u16 at bytes [6..7]
    • freq_mhz: u16 → u32 at bytes [8..11]
    • RSSI at byte 16, noise floor at byte 17
  • Tune presence detection for faster response:
    • DEBOUNCE_FRAMES: 4 → 2 (faster state transitions)
    • MOTION_EMA_ALPHA: 0.15 → 0.25 (more responsive)
  • Add asymmetric person count smoothing:
    • α=0.35 decay when someone leaves (~2-3s response)
    • α=0.20 rise when someone enters (~3-4s response)
    • Prevents false jumps while staying responsive

Firmware fixes (esp32-csi-node)

  • Read node_id from NVS config instead of compile-time CONFIG_CSI_NODE_ID
    • Enables unique node IDs per device via provisioning
    • Updated: csi_collector.c, edge_processing.c, wasm_runtime.c, display_ui.c
  • Add extern declaration for g_nvs_config in nvs_config.h
  • Update provision.py to support both esp32s3 and esp32c6 chips

UI fixes (Observatory)

  • Add WebSocket auto-reconnect with exponential backoff:
    • Retries up to 5 times (1s, 2s, 4s, 8s, 16s delays)
    • Shows "RECONNECTING" status with blue pulsing indicator
    • Only falls back to demo mode after all retries exhausted
  • Prevents random switches from Live to Demo mode

Tools

  • Add csi_inspector.py for packet debugging with correct ADR-018 offsets

- Fix ADR-018 packet parsing: correct byte offsets for 20-byte header
  - n_subcarriers: u8 → u16 at bytes [6..7]
  - freq_mhz: u16 → u32 at bytes [8..11]
  - RSSI at byte 16, noise floor at byte 17
- Tune presence detection for faster response:
  - DEBOUNCE_FRAMES: 4 → 2 (faster state transitions)
  - MOTION_EMA_ALPHA: 0.15 → 0.25 (more responsive)
- Add asymmetric person count smoothing:
  - α=0.35 decay when someone leaves (~2-3s response)
  - α=0.20 rise when someone enters (~3-4s response)
  - Prevents false jumps while staying responsive

- Read node_id from NVS config instead of compile-time CONFIG_CSI_NODE_ID
  - Enables unique node IDs per device via provisioning
  - Updated: csi_collector.c, edge_processing.c, wasm_runtime.c, display_ui.c
- Add extern declaration for g_nvs_config in nvs_config.h
- Update provision.py to support both esp32s3 and esp32c6 chips

- Add WebSocket auto-reconnect with exponential backoff:
  - Retries up to 5 times (1s, 2s, 4s, 8s, 16s delays)
  - Shows "RECONNECTING" status with blue pulsing indicator
  - Only falls back to demo mode after all retries exhausted
- Prevents random switches from Live to Demo mode

- Add csi_inspector.py for packet debugging with correct ADR-018 offsets

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@KarthikV17 KarthikV17 force-pushed the fix/sensing-improvements branch from bda836b to 5bf069f Compare May 9, 2026 04:31
@KarthikV17
Copy link
Copy Markdown
Author

@ruvnet please review and let me know if there is any additional testing needed. This has been verified with ESP32-S3.

@ruvnet
Copy link
Copy Markdown
Owner

ruvnet commented May 17, 2026

Thanks for the multi-area contribution — there's good intent here but the scope is too broad to land as one PR, and several pieces need verification against current main:

Server-side

  • ADR-018 packet offsets — current csi.rs::parse_esp32_frame and the firmware csi_serialize_frame agree on a 20-byte header with n_subcarriers u16 @ [6..7], freq_mhz u32 @ [8..11], rssi i8 @ 16, noise_floor i8 @ 17 — same as your PR claims. If you're seeing offset misalignment on current main, please file an issue with the offending packet hex dump so we can trace the divergence.
  • Presence tuning + asymmetric smoothing — these are operator-tunable knobs. Worth its own focused PR with an A/B comparison on the same test fixtures so we can see what the latency-vs-stability tradeoff costs.

Firmware

UI

  • WebSocket auto-reconnect — this is genuinely useful and not currently in main. Worth its own focused PR — fix(ui): websocket auto-reconnect with exponential backoff — without the firmware / server changes.

Closing this one as superseded-or-needs-split. Strongest single follow-up: the WebSocket auto-reconnect UX, on its own, against current main. Happy to review that immediately.

@ruvnet ruvnet closed this May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants