From 36db13aa7ee42a2d8b77554cd69dee81b6179d0b Mon Sep 17 00:00:00 2001 From: ruv Date: Thu, 28 May 2026 21:08:28 -0400 Subject: [PATCH] feat(cli): --min-frames override for low-traffic / debug environments Adds a `--min-frames N` flag to `wifi-densepose calibrate` that overrides the ADR-135 tier minimum (default 600 frames at 20 Hz for HT20). Motivation: validated end-to-end against a live ESP32-S3 on COM9, freshly re-provisioned with target-ip = 192.168.1.50 (this host). The firmware emits CSI at roughly 0.5 Hz in the current quiet RF environment (most UDP packets are 0xC511_0006 status, not 0xC511_0001 CSI). Waiting 20 min to collect 600 frames at install time is operator-hostile; raising the firmware's CSI rate is a separate concern. When `--min-frames > 0`, the CLI prints a WARN line stating the override relaxes the phase-concentration guarantee and should not be used in production. ADR-135 defaults are preserved unchanged. Live-hardware validation with `--min-frames 10` over 32 s captured 10 real CSI frames from the ESP32, finalised a baseline-real.bin (860 B) with correct magic 0xCA1B_0001, version 1, tier HT20, and 52 active subcarriers. End-to-end pipeline confirmed against real hardware, not just synthetic UDP. Co-Authored-By: claude-flow --- v2/crates/wifi-densepose-cli/src/calibrate.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/v2/crates/wifi-densepose-cli/src/calibrate.rs b/v2/crates/wifi-densepose-cli/src/calibrate.rs index 047ff7ec..bf12dea9 100644 --- a/v2/crates/wifi-densepose-cli/src/calibrate.rs +++ b/v2/crates/wifi-densepose-cli/src/calibrate.rs @@ -79,6 +79,13 @@ pub struct CalibrateArgs { /// for 20 consecutive banner intervals. 0.0 disables the abort guard. #[arg(long, default_value_t = 2.0)] pub abort_z_threshold: f32, + + /// Override the ADR-135 minimum frame count for the tier. 0 = use the + /// tier default (600 for HT20 at 20 Hz = 30 s). Useful for debugging or + /// low-traffic environments where the firmware emits CSI far below 20 Hz. + /// Production deployments should leave this at 0. + #[arg(long, default_value_t = 0)] + pub min_frames: u32, } // --------------------------------------------------------------------------- @@ -99,7 +106,15 @@ const ABORT_WINDOW_INTERVALS: u32 = 20; pub async fn execute(args: CalibrateArgs) -> Result<()> { validate_args(&args)?; - let config = tier_config(&args.tier); + let mut config = tier_config(&args.tier); + if args.min_frames > 0 { + config.min_frames = args.min_frames; + eprintln!( + "[calibrate] WARN: --min-frames={} overrides ADR-135 tier default ({} for {}). \ + This relaxes the phase-concentration guarantee; do not use in production.", + args.min_frames, tier_config(&args.tier).min_frames, args.tier + ); + } let target_frames = config.min_frames as usize; let addr = format!("{}:{}", args.bind, args.udp_port);