mirror of
https://github.com/ruvnet/RuView.git
synced 2026-04-30 23:19:32 +00:00
- Add 154 missing vendor files (gitignore was filtering them) - vendor/midstream: 564 files (was 561) - vendor/sublinear-time-solver: 1190 files (was 1039) - Add ESP32 edge processing (ADR-039): presence, vitals, fall detection - Add WASM programmable sensing (ADR-040/041) with wasm3 runtime - Add firmware CI workflow (.github/workflows/firmware-ci.yml) - Add wifi-densepose-wasm-edge crate for edge WASM modules - Update sensing server, provision.py, UI components Co-Authored-By: claude-flow <ruv@ruv.net>
64 lines
2.7 KiB
C
64 lines
2.7 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. */
|
|
} 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 */
|