mirror of
https://github.com/ruvnet/RuView.git
synced 2026-04-28 14:09:33 +00:00
* feat: happiness scoring pipeline with ESP32 swarm + Cognitum Seed coordinator ADR-065: Hotel guest happiness scoring from WiFi CSI physiological proxies. ADR-066: ESP32 swarm with Cognitum Seed as coordinator for multi-zone analytics. Firmware: - swarm_bridge.c/h: FreeRTOS task on Core 0, HTTP client with Bearer auth, registers with Seed, sends heartbeats (30s) and happiness vectors (5s) - nvs_config: seed_url, seed_token, zone_name, swarm intervals - provision.py: --seed-url, --seed-token, --zone CLI args - esp32-hello-world: capability discovery firmware for 4MB ESP32-S3 variant WASM edge modules: - exo_happiness_score.rs: 8-dim happiness vector from gait speed, stride regularity, movement fluidity, breathing calm, posture, dwell time (events 690-694, 11 tests, ESP32-optimized buffers + event decimation) - ghost_hunter.rs standalone binary: 5.7 KB WASM, feature-gated default pipeline RuView Live: - --mode happiness dashboard with bar visualization - --seed flag for Cognitum Seed bridge (urllib, background POST) - HappinessScorer + SeedBridge classes (stdlib only, no deps) Examples: - seed_query.py: CLI tool (status, search, witness, monitor, report) - provision_swarm.sh: batch provisioning for multi-node deployment - happiness_vector_schema.json: 8-dim vector format documentation Verified live: ESP32 on COM5 (4MB flash) registered with Seed at 10.1.10.236, vectors flowing, witness chain growing (epoch 455, chain 1108). Co-Authored-By: claude-flow <ruv@ruv.net> * ci: raise firmware binary size gate to 1100 KB for HTTP client stack The swarm bridge (ADR-066) adds esp_http_client for Seed communication, which pulls in the HTTP/TLS stack (~150 KB). Binary grew from ~978 KB to ~1077 KB. Raise the gate from 950 KB to 1100 KB. Still fits comfortably in both 4MB (1856 KB OTA slot, 43% free) and 8MB flash variants. Co-Authored-By: claude-flow <ruv@ruv.net>
76 lines
3.5 KiB
C
76 lines
3.5 KiB
C
/**
|
|
* @file nvs_config.h
|
|
* @brief Runtime configuration via NVS (Non-Volatile Storage).
|
|
*
|
|
* Reads WiFi credentials and aggregator target from NVS.
|
|
* Falls back to compile-time Kconfig defaults if NVS keys are absent.
|
|
* This allows a single firmware binary to be shipped and configured
|
|
* per-device using the provisioning script.
|
|
*/
|
|
|
|
#ifndef NVS_CONFIG_H
|
|
#define NVS_CONFIG_H
|
|
|
|
#include <stdint.h>
|
|
|
|
/** Maximum lengths for NVS string fields. */
|
|
#define NVS_CFG_SSID_MAX 33
|
|
#define NVS_CFG_PASS_MAX 65
|
|
#define NVS_CFG_IP_MAX 16
|
|
|
|
/** Maximum channels in the hop list (must match CSI_HOP_CHANNELS_MAX). */
|
|
#define NVS_CFG_HOP_MAX 6
|
|
|
|
/** Runtime configuration loaded from NVS or Kconfig defaults. */
|
|
typedef struct {
|
|
char wifi_ssid[NVS_CFG_SSID_MAX];
|
|
char wifi_password[NVS_CFG_PASS_MAX];
|
|
char target_ip[NVS_CFG_IP_MAX];
|
|
uint16_t target_port;
|
|
uint8_t node_id;
|
|
|
|
/* ADR-029: Channel hopping and TDM configuration */
|
|
uint8_t channel_hop_count; /**< Number of channels to hop (1 = no hop). */
|
|
uint8_t channel_list[NVS_CFG_HOP_MAX]; /**< Channel numbers for hopping. */
|
|
uint32_t dwell_ms; /**< Dwell time per channel in ms. */
|
|
uint8_t tdm_slot_index; /**< This node's TDM slot index (0-based). */
|
|
uint8_t tdm_node_count; /**< Total nodes in the TDM schedule. */
|
|
|
|
/* ADR-039: Edge intelligence configuration */
|
|
uint8_t edge_tier; /**< Processing tier (0=raw, 1=basic, 2=full). */
|
|
float presence_thresh; /**< Presence threshold (0 = auto-calibrate). */
|
|
float fall_thresh; /**< Fall detection threshold (rad/s^2). */
|
|
uint16_t vital_window; /**< Phase history window for BPM. */
|
|
uint16_t vital_interval_ms; /**< Vitals packet interval (ms). */
|
|
uint8_t top_k_count; /**< Number of top subcarriers to track. */
|
|
uint8_t power_duty; /**< Power duty cycle (10-100%). */
|
|
|
|
/* ADR-040: WASM programmable sensing configuration */
|
|
uint8_t wasm_max_modules; /**< Max concurrent WASM modules (1-8). */
|
|
uint8_t wasm_verify; /**< Require Ed25519 signature for uploads. */
|
|
uint8_t wasm_pubkey[32]; /**< Ed25519 public key for WASM signature. */
|
|
uint8_t wasm_pubkey_valid; /**< 1 if pubkey was loaded from NVS. */
|
|
|
|
/* ADR-060: Channel override and MAC address filtering */
|
|
uint8_t csi_channel; /**< Explicit CSI channel override (0 = auto-detect). */
|
|
uint8_t filter_mac[6]; /**< MAC address to filter CSI frames. */
|
|
uint8_t filter_mac_set; /**< 1 if filter_mac was loaded from NVS. */
|
|
|
|
/* ADR-066: Swarm bridge configuration */
|
|
char seed_url[64]; /**< Cognitum Seed base URL (empty = disabled). */
|
|
char seed_token[64]; /**< Seed Bearer token (from pairing). */
|
|
char zone_name[16]; /**< Zone name for this node (e.g. "lobby"). */
|
|
uint16_t swarm_heartbeat_sec; /**< Heartbeat interval (seconds, default 30). */
|
|
uint16_t swarm_ingest_sec; /**< Vector ingest interval (seconds, default 5). */
|
|
} nvs_config_t;
|
|
|
|
/**
|
|
* Load configuration from NVS, falling back to Kconfig defaults.
|
|
*
|
|
* Must be called after nvs_flash_init().
|
|
*
|
|
* @param cfg Output configuration struct.
|
|
*/
|
|
void nvs_config_load(nvs_config_t *cfg);
|
|
|
|
#endif /* NVS_CONFIG_H */
|