# WiFi Monitor Threshold Tuning - Quick Reference ## GDB Commands ```gdb # View current thresholds show_thresholds # Preset profiles tune_sensitive # Catch more issues (stricter) tune_normal # Default settings tune_relaxed # Fewer false positives # Individual thresholds set_high_nav # High NAV threshold (default: 5000) set_mismatch_log # Log when NAV exceeds (default: 10000) set_rate_fallback # Rate fallback threshold (default: 100) set_multiplier # Duration multiplier (default: 2) set_log_rate # Log every Nth mismatch (default: 1) ``` ## Tunable Variables | Variable | Default | Description | |----------|---------|-------------| | `threshold_high_nav_us` | 5000 | NAV above this = "high" | | `threshold_duration_mismatch_us` | 10000 | Log mismatches above this NAV | | `threshold_phy_rate_fallback_mbps` | 100 | PHY rate below this = fallback | | `threshold_duration_multiplier` | 2 | NAV > expected × this = mismatch | | `threshold_retry_rate_percent` | 20.0 | Retry % for collapse | | `threshold_avg_nav_collapse_us` | 10000 | Avg NAV for collapse | | `threshold_collision_percent` | 10.0 | Collision % for collapse | | `threshold_mismatch_percent` | 5.0 | Mismatch % for collapse | | `log_every_n_mismatches` | 1 | Log every Nth (1=all, 10=every 10th) | ## Quick Examples ### Too Much Logging ```gdb (gdb) set_log_rate 10 # Log every 10th mismatch (gdb) set_mismatch_log 20000 # Only log >20ms NAV (gdb) continue ``` ### Not Catching Issues ```gdb (gdb) tune_sensitive # Use stricter thresholds (gdb) continue ``` ### 2.4GHz Network ```gdb (gdb) tune_relaxed # More lenient (gdb) set_rate_fallback 24 # 2.4GHz rates lower (gdb) continue ``` ### 5GHz High Performance ```gdb (gdb) tune_sensitive (gdb) set_rate_fallback 200 # Expect >200 Mbps (gdb) continue ``` ## Preset Profile Settings | Threshold | Sensitive | Normal | Relaxed | |-----------|-----------|--------|---------| | High NAV | 3000 us | 5000 us | 10000 us | | Mismatch log | 5000 us | 10000 us | 20000 us | | Rate fallback | 150 Mbps | 100 Mbps | 50 Mbps | | Multiplier | 1.5x | 2x | 3x | | Retry rate | 15% | 20% | 30% | ## Installation ```bash cd ~/Code/esp32/esp32-iperf # Update files cp wifi_monitor.c components/wifi_monitor/ cp .gdbinit . # Build once idf.py build idf.py -p /dev/ttyACM0 flash # Enable GDB auto-load (one-time) mkdir -p ~/.config/gdb echo "set auto-load safe-path /" >> ~/.config/gdb/gdbinit ``` ## Typical Workflow ```gdb # Start GDB $ idf.py gdb # Check defaults (gdb) show_thresholds # Start monitoring (gdb) continue # Adjust on the fly (Ctrl-C to pause) (gdb) Ctrl-C (gdb) set_log_rate 20 (gdb) continue # Check effect, adjust again if needed (gdb) Ctrl-C (gdb) tune_sensitive (gdb) continue ``` ## Benefits ✅ **No rebuild** - Adjust thresholds instantly ✅ **Zero overhead** - Full C code performance ✅ **Live tuning** - Change while running ✅ **Experiment** - Try different settings easily --- **For complete guide**: See GDB_THRESHOLD_TUNING_GUIDE.md