Skip to content

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

Open
KarthikV17 wants to merge 1 commit intoruvnet:mainfrom
KarthikV17:fix/sensing-improvements
Open

fix: improve sensing accuracy, presence detection, and UI reliability#518
KarthikV17 wants to merge 1 commit intoruvnet: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.

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.

1 participant