mirror of
https://github.com/ruvnet/RuView
synced 2026-07-20 17:03:24 +00:00
66e2fa0835
* docs: ADR-063 mmWave sensor fusion with WiFi CSI 60 GHz mmWave radar (Seeed MR60BHA2, HLK-LD2410/LD2450) fusion with WiFi CSI for dual-confirm fall detection, clinical-grade vitals, and self-calibrating CSI pipeline. Covers auto-detection, 6 supported sensors, Kalman fusion, extended 48-byte vitals packet, RuVector/RuvSense integration points, and 6-phase implementation plan. Based on live hardware capture from ESP32-C6 + MR60BHA2 on COM4. Co-Authored-By: claude-flow <ruv@ruv.net> * feat(firmware): ADR-063 mmWave sensor fusion — full implementation Phase 1-2 of ADR-063: mmwave_sensor.c/h: - MR60BHA2 UART parser (60 GHz: HR, BR, presence, distance) - LD2410 UART parser (24 GHz: presence, distance) - Auto-detection: probes UART for known frame headers at boot - Mock generator for QEMU testing (synthetic HR 72±2, BR 16±1) - Capability flag registration per sensor type edge_processing.c/h: - 48-byte fused vitals packet (magic 0xC5110004) - Kalman-style fusion: mmWave 80% + CSI 20% when both available - Automatic fallback to CSI-only 32-byte packet when no mmWave - Dual presence flag (Bit3 = mmwave_present) main.c: - mmwave_sensor_init() called at boot with auto-detect - Status logged in startup banner Fuzz stubs updated for mmwave_sensor API. Build verified: QEMU mock build passes. Co-Authored-By: claude-flow <ruv@ruv.net> * fix(firmware): correct MR60BHA2 + LD2410 UART protocols (ADR-063) MR60BHA2: SOF=0x01 (not 0x5359), XOR+NOT checksums on header and data, frame types 0x0A14 (BR), 0x0A15 (HR), 0x0A16 (distance), 0x0F09 (presence). Based on Seeed Arduino library research. LD2410: 256000 baud (not 115200), 0xAA report head marker, target state byte at offset 2 (after data_type + head_marker). Auto-detect: probes MR60 at 115200 first, then LD2410 at 256000. Sets final baud rate after detection. Co-Authored-By: claude-flow <ruv@ruv.net> * feat: ADR-063 Phase 6 server-side mmWave + CSI fusion bridge Python script reads both serial ports simultaneously: - COM4 (ESP32-C6 + MR60BHA2): parses ESPHome debug output for HR, BR, presence, distance - COM7 (ESP32-S3): reads CSI edge processing frames Kalman-style fusion: mmWave 80% + CSI 20% for vitals, OR gate for presence. Verified on real hardware: mmWave HR=75bpm, BR=25/min at 52cm range, CSI frames flowing concurrently. Both sensors live for 30 seconds. Co-Authored-By: claude-flow <ruv@ruv.net> * docs: ADR-064 multimodal ambient intelligence roadmap 25+ applications across 4 tiers from practical to exotic: - Tier 1 (build now): zero-FP fall detection, sleep monitoring, occupancy HVAC, baby breathing, bathroom safety - Tier 2 (research): gait analysis, stress detection, gesture control, respiratory screening, multi-room activity - Tier 3 (frontier): cardiac arrhythmia, RF tomography, sign language, cognitive load, swarm sensing - Tier 4 (exotic): emotion contagion, lucid dreaming, plant monitoring, pet behavior Priority matrix with effort estimates. All P0-P1 items work with existing hardware (ESP32-S3 + MR60BHA2 + BH1750). Co-Authored-By: claude-flow <ruv@ruv.net> * fix(ci): add ESP_ERR_NOT_FOUND to fuzz stubs mmwave_sensor stub returns ESP_ERR_NOT_FOUND which wasn't defined in the minimal esp_stubs.h for host-based fuzz testing. Co-Authored-By: claude-flow <ruv@ruv.net>
76 lines
2.3 KiB
C
76 lines
2.3 KiB
C
/**
|
|
* @file esp_stubs.c
|
|
* @brief Implementation of ESP-IDF stubs for host-based fuzz testing.
|
|
*
|
|
* Must be compiled with: -Istubs -I../main
|
|
* so that ESP-IDF headers resolve to stubs/ and firmware headers
|
|
* resolve to ../main/.
|
|
*/
|
|
|
|
#include "esp_stubs.h"
|
|
#include "edge_processing.h"
|
|
#include "wasm_runtime.h"
|
|
#include <stdint.h>
|
|
|
|
/** Monotonically increasing microsecond counter for esp_timer_get_time(). */
|
|
static int64_t s_fake_time_us = 0;
|
|
|
|
int64_t esp_timer_get_time(void)
|
|
{
|
|
/* Advance by 50ms each call (~20 Hz CSI rate simulation). */
|
|
s_fake_time_us += 50000;
|
|
return s_fake_time_us;
|
|
}
|
|
|
|
/* ---- stream_sender stubs ---- */
|
|
|
|
int stream_sender_send(const uint8_t *data, size_t len)
|
|
{
|
|
(void)data;
|
|
return (int)len;
|
|
}
|
|
|
|
int stream_sender_init(void)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
int stream_sender_init_with(const char *ip, uint16_t port)
|
|
{
|
|
(void)ip; (void)port;
|
|
return 0;
|
|
}
|
|
|
|
void stream_sender_deinit(void)
|
|
{
|
|
}
|
|
|
|
/* ---- wasm_runtime stubs ---- */
|
|
|
|
void wasm_runtime_on_frame(const float *phases, const float *amplitudes,
|
|
const float *variances, uint16_t n_sc,
|
|
const edge_vitals_pkt_t *vitals)
|
|
{
|
|
(void)phases; (void)amplitudes; (void)variances;
|
|
(void)n_sc; (void)vitals;
|
|
}
|
|
|
|
esp_err_t wasm_runtime_init(void) { return ESP_OK; }
|
|
esp_err_t wasm_runtime_load(const uint8_t *d, uint32_t l, uint8_t *id) { (void)d; (void)l; (void)id; return ESP_OK; }
|
|
esp_err_t wasm_runtime_start(uint8_t id) { (void)id; return ESP_OK; }
|
|
esp_err_t wasm_runtime_stop(uint8_t id) { (void)id; return ESP_OK; }
|
|
esp_err_t wasm_runtime_unload(uint8_t id) { (void)id; return ESP_OK; }
|
|
void wasm_runtime_on_timer(void) {}
|
|
void wasm_runtime_get_info(wasm_module_info_t *info, uint8_t *count) { (void)info; if(count) *count = 0; }
|
|
esp_err_t wasm_runtime_set_manifest(uint8_t id, const char *n, uint32_t c, uint32_t m) { (void)id; (void)n; (void)c; (void)m; return ESP_OK; }
|
|
|
|
/* ---- mmwave_sensor stubs (ADR-063) ---- */
|
|
|
|
#include "mmwave_sensor.h"
|
|
|
|
static mmwave_state_t s_stub_mmwave = {0};
|
|
|
|
esp_err_t mmwave_sensor_init(int tx, int rx) { (void)tx; (void)rx; return ESP_ERR_NOT_FOUND; }
|
|
bool mmwave_sensor_get_state(mmwave_state_t *s) { if (s) *s = s_stub_mmwave; return false; }
|
|
const char *mmwave_type_name(mmwave_type_t t) { (void)t; return "None"; }
|