mirror of
https://github.com/ruvnet/RuView.git
synced 2026-10-22 14:42:44 -05:00
DEBOUNCE_FRAMES, MOTION_EMA_ALPHA, and BASELINE_EMA_ALPHA were tuned assuming CSI frames arrive at ~10 FPS (per their own doc comments). smooth_and_classify_node() runs once per raw incoming UDP frame, and ESP32-C6 boards measured in the field run at ~48-50 FPS - about 5x faster. That silently compressed a ~0.4s debounce window to ~0.08s and a ~1s motion EMA to ~0.2s of real smoothing, letting per-frame CSI noise flip the reported motion_level almost directly instead of being smoothed - the reported UI "seizure" of rapid label flicker. Rather than hardcode a different fixed rate (which would just move the same bug to whatever chip/capture-mode/config next diverges from it), derive each frame's effective alpha and frame-count thresholds from the node's own measured csi_fps_ema, which is already tracked and burst-filtered elsewhere (observe_csi_frame_arrival). Time constants are back-derived from the original alphas at the assumed 10 FPS point, so behavior is unchanged for a node at exactly 10 FPS and now scales correctly to whatever rate a node actually runs at. smooth_and_classify() (simulated/WiFi-scan sources, already tick- gated at a known fixed cadence) is unaffected - not exhibiting this bug, left as-is. Co-Authored-By: claude-flow <ruv@ruv.net> (cherry picked from commit d29d9fb02078b066be8557af24023c22e99fa3d1)