All example configurations now meet "Made for ESPHome" requirements
WiFi Provisioning
- BLE provisioning:
esp32_improvfor easy setup via ESPHome/HA Companion app - USB provisioning:
improv_serialfor web.esphome.io configuration (not yet supported on ESP32-C5) - Captive Portal: Fallback AP "ESPectre Fallback" for WiFi configuration
- No hardcoded credentials: Removed
YOUR_WIFI_SSIDplaceholders
Dashboard Adoption
dashboard_import: One-click adoption from ESPHome Dashboardprojectmetadata: Version tracking for firmware updates
Code Cleanup
- Renamed
espectre_component.cpp/.h→espectre.cpp/.h - Component ID standardized to
espectre_csi - Updated
meCLI:erase_flash→erase-flash(esptool deprecation fix)
⚡ Performance Optimization
Unified variance algorithm and optimized Hampel filter across both platforms
This release focuses on code uniformity between MicroPython and C++ implementations, improving numerical stability and performance.
Algorithm Uniformity
- Two-pass variance: Both platforms now use the same numerically stable algorithm
- Formula:
Var(X) = Σ(x - μ)² / n(more stable thanE[X²] - E[X]²) - Eliminates catastrophic cancellation risk with float32
- Identical behavior between MicroPython and C++
- Formula:
Hampel Filter Optimization
-
C++ (ESPHome): Eliminated dynamic memory allocation
- Pre-allocated static buffers in
hampel_turbulence_state_t - Insertion sort replaces
qsort()for small arrays (N=3-11) - ~20-25μs saved per packet (no malloc/free overhead)
- Pre-allocated static buffers in
-
MicroPython: Pre-allocated buffers and circular buffer
- Eliminated list creation per call
- Insertion sort for small arrays
- ~120μs saved per packet
Validation
- New test script
16_test_optimization_equivalence.pyusing real CSI data - Verified with 2000 real CSI packets (baseline + movement)
- Maximum variance difference: 9.41e-14 (effectively zero)
| Change | C++ Impact | MicroPython Impact |
|---|---|---|
| Two-pass variance | Unchanged (already used) | +25μs (acceptable) |
| Hampel optimization | -20-25μs | -120μs |
| Net improvement | -20-25μs/pkt | -95μs/pkt |
🧪 Test Suite & Code Coverage
- 140 test cases (+72 from 2.0.0) with real CSI data
- Full device testing: All tests run on both native and ESP32-C6 via
IWiFiCSIdependency injection - Codecov integration: Coverage badge, PR comments, 80% threshold
- 84% line coverage, 94% function coverage
- Refactoring: Shared utilities in
utils.h, configurableCalibrationManager