Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Architecture Overview

**Last Updated:** July 24, 2026 | **Phase 4 Complete, Phase 6 Complete** | **3243 unit tests (3220 passing + 23 skipped), 147 files + 37 Playwright E2E tests**
**Last Updated:** July 24, 2026 | **Phase 4 Complete, Phase 6 Complete** | **3370 unit tests (3347 passing + 23 skipped), 154 files + 37 Playwright E2E tests**

---

Expand Down Expand Up @@ -57,8 +57,8 @@
│ │ ┌───┴──────────┐ ┌─────────────────┐ ┌──────────────────┐ │ │
│ │ │MSPConnection │ │ BlackboxParser │ │ Analysis Engine │ │ │
│ │ │ + CLI Mode │ │ (6 modules, │ │ FFT + Step Resp │ │ │
│ │ │ + fcEntered │ │ 245 tests) │ │ (27 modules, │ │ │
│ │ │ CLI flag │ │ │ │ 1127 tests) │ │ │
│ │ │ + fcEntered │ │ 245 tests) │ │ (31 modules, │ │ │
│ │ │ CLI flag │ │ │ │ 1207 tests) │ │ │
│ │ └───┬──────────┘ └─────────────────┘ └──────────────────┘ │ │
│ │ │ │ │
│ │ ┌───┴──────────┐ │ │
Expand Down Expand Up @@ -291,13 +291,17 @@ Two independent analysis pipelines: **filter tuning** (FFT noise analysis) and *
| `SegmentSelector.ts` | 375 | 31 | Hover + throttle sweep detection, yaw steadiness gating (1.5×) |
| `NoiseAnalyzer.ts` | 342 | 36 | Peak detection (plateau handling, 15 Hz spacing, parabolic interpolation), size-aware noise classification |
| `FilterRecommender.ts` | 1045 | 108 | Noise-based filter targets, RPM-aware bounds, dynamic-lowpass-aware (tunes dyn_min/max when active), propwash floor, medium noise, notch-aware resonance, LPF2, yaw-only resonance observation, preset gap analysis settings |
| `RpmFilterRecommender.ts` | 326 | 18 | RPM filter tuning rules (F-RPM-*): min_hz from dyn idle floor and measured fundamental track, harmonic count from integer-ratio tracks, fade-range/weights advisories |
| `FilterPlacementOptimizer.ts` | 257 | 9 | Discrete search over LPF cutoffs / notch count / RPM harmonics minimizing group delay subject to attenuation targets at measured peaks (P3.3) |
| `FilterAnalyzer.ts` | 372 | 20 | Filter analysis orchestrator (data quality, throttle spectrogram, group delay) |
| `ThrottleSpectrogramAnalyzer.ts` | 210 | 23 | Throttle-dependent spectrogram analysis (contiguous runs only) |
| `GroupDelayEstimator.ts` | 216 | 28 | Group delay estimation, filter latency measurement, uses dyn_min_hz when dynamic active |
| `StepDetector.ts` | 164 | 16 | Derivative-based step input detection |
| `StepMetrics.ts` | 416 | 53 | Rise time, overshoot, settling, trace, FF contribution, adaptive window |
| `StepResponseStacker.ts` | 153 | 10 | Deconvolved (stacked) step response via Wiener windows, input-magnitude split (<500 / >500 deg/s), coherence-weighted trust gate (P2.1) |
| `PIDRecommender.ts` | 1840 | 266 | Flight-PID-anchored P/D recommendations, FF-aware, damping ratio, I-term, quad-size-aware bounds, D-min/TPA advisory, TF coherence gate, preset gap analysis settings |
| `PIDAnalyzer.ts` | 640 | 28 | PID analysis orchestrator (FF context, data quality, cross-axis, propwash) |
| `SystemIdentifier.ts` | 357 | 9 | System identification: 2nd-order + delay plant fit from coherence-weighted H(f), what-if predicted step response for proposed gains (P3.2) |
| `CrossAxisDetector.ts` | 162 | 20 | Cross-axis coupling detection |
| `PropWashDetector.ts` | 367 | 20 | Propwash detection and analysis (clean-segment baseline) |
| `DataQualityScorer.ts` | 403 | 39 | Flight data quality scoring (0-100), confidence adjustment, low coherence warning |
Expand Down Expand Up @@ -841,18 +845,20 @@ Hardware error (FC timeout, USB disconnect)
| File | Key Exports |
|------|-------------|
| `metricsExtract.ts` | `downsampleSpectrum()`, `downsampleStepResponse()`, `extractFilterMetrics()`, `extractPIDMetrics()`, `extractThrottleSpectrogram()` — compact metrics for history storage |
| `filterResponse.ts` | `lowpassMagnitudeDb()` (PT1/PT2/PT3/biquad), `notchMagnitudeDb()`, `dynLpfCutoffHz()`, `computeFilterChainCurve()`, `gyroLpf1CutoffAtThrottle()` — filter magnitude models for chart overlays |
| `bfVersionCapabilities.ts` | `parseBFVersion()` (semver + calendar), `getBFCapabilities()` (4.4/4.5/4.6 gates), `translateSettingForVersion()` (d_min→d_max CLI rename) |

---

## Testing Strategy

**3243 unit tests across 147 files (3220 passing + 23 skipped fixture-gated) + 37 Playwright E2E tests**. See [TESTING.md](./TESTING.md) for complete inventory.
**3370 unit tests across 154 files (3347 passing + 23 skipped fixture-gated) + 37 Playwright E2E tests**. See [TESTING.md](./TESTING.md) for complete inventory.

| Area | Files | Tests |
|------|-------|-------|
| Blackbox Parser | 9 | 245 |
| FFT Analysis (+ Data Quality + Spectrogram + Delay + Throttle Utils) | 9 | 313 |
| Step Response + PID + TF + CrossAxis + PropWash + DTerm + Bayesian + Verification + Golden Outputs | 21 | 758 |
| FFT Analysis (+ Data Quality + Spectrogram + Delay + Throttle Utils + RPM Rules + Filter Response + BF Capabilities) | 11 | 373 |
| Step Response + PID + TF + CrossAxis + PropWash + DTerm + Bayesian + Verification + Golden Outputs + Stacker + SysID + Placement | 25 | 806 |
| Header Validation + Constants + Main Utils | 3 | 82 |
| MSP Protocol & Client | 4 | 196 |
| MSC (Mass Storage) | 2 | 45 |
Expand All @@ -863,7 +869,7 @@ Hardware error (FC timeout, USB disconnect)
| Diagnostic | 1 | 12 |
| License | 1 | 12 |
| Auto-Updater | 1 | 12 |
| UI Components + Charts + Contexts | 56 | 829 |
| UI Components + Charts + Contexts | 57 | 848 |
| React Hooks + Utils | 18 | 197 |
| Shared Constants & Utils | 5 | 102 |
| E2E Workflows (Vitest) | 1 | 31 |
Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ FPVPIDlab reads your Blackbox log, analyzes the data (FFT noise spectrum, step r
- **Safety-first** — automatic pre/post-tuning snapshots, all values clamped to proven safe bounds
- **Multi-quad profiles** — auto-detects each FC by serial number, stores configs and history per quad
- **Flight style adaptation** — Smooth (cinematic), Balanced (freestyle), Aggressive (racing) thresholds
- **27 analysis modules** — FFT, step response, Wiener deconvolution, setpoint→gyro coherence, prop wash, D-term effectiveness, cross-axis coupling, throttle spectrograms, group delay, feedforward, dynamic lowpass, Bayesian optimizer, convergence detection, verification matching, and more
- **31 analysis modules** — FFT, step response, Wiener deconvolution, deconvolved (stacked) step response, setpoint→gyro coherence, system identification with what-if prediction, prop wash, D-term effectiveness, cross-axis coupling, throttle spectrograms, group delay, feedforward, dynamic lowpass, RPM filter tuning, filter placement optimization, Bayesian optimizer, convergence detection, verification matching, and more
- **Works offline** — demo mode with simulated FC for testing without hardware
- **Anonymous telemetry** — opt-in usage telemetry with per-session analytics (tuning mode usage, drone sizes, quality scores, recommendation rule tracing, verification deltas; no flight data or PIDs ever sent)
- **Freemium license system** — free tier (1 profile), Pro tier (unlimited profiles). Ed25519-signed offline-first license validation
Expand Down Expand Up @@ -215,7 +215,7 @@ See [QUICK_START.md](./QUICK_START.md) for installation, setup, all available co

All UI changes must include tests. Tests automatically run before commits. Coverage thresholds enforced: 80% lines/functions/statements, 75% branches.

**Unit tests:** 3220 tests across 147 files (plus 23 skipped fixture-gated tests) — MSP protocol, storage managers, IPC handlers, UI components, hooks, BBL parser fuzz, analysis pipeline validation, golden-output regression, telemetry, diagnostic, license, auto-updater.
**Unit tests:** 3347 tests across 154 files (plus 23 skipped fixture-gated tests) — MSP protocol, storage managers, IPC handlers, UI components, hooks, BBL parser fuzz, analysis pipeline validation, golden-output regression, telemetry, diagnostic, license, auto-updater.

**Playwright E2E:** 37 tests across 7 spec files — launches real Electron app in demo mode, walks through complete tuning cycles (Filter Tune, PID Tune, Flash Tune, diagnostic reports, and stress-test edge cases).

Expand Down Expand Up @@ -249,18 +249,22 @@ pidlab/
│ │ │ ├── commands.ts # MSP command definitions
│ │ │ └── types.ts # MSP type definitions
│ │ ├── blackbox/ # BBL binary log parser (6 modules, 245 tests)
│ │ ├── analysis/ # Signal processing & tuning engine (27 modules)
│ │ ├── analysis/ # Signal processing & tuning engine (31 modules)
│ │ │ ├── FFTCompute.ts # Welch's method, Hanning window
│ │ │ ├── SegmentSelector.ts # Hover/sweep segment detection
│ │ │ ├── NoiseAnalyzer.ts # Peak detection, noise classification
│ │ │ ├── FilterRecommender.ts # Noise-based filter targets
│ │ │ ├── DynamicLowpassRecommender.ts # Dynamic lowpass cutoff optimization
│ │ │ ├── RpmFilterRecommender.ts # RPM filter tuning rules (min_hz, harmonics, weights)
│ │ │ ├── FilterPlacementOptimizer.ts # Notch/LPF placement search (delay vs attenuation)
│ │ │ ├── FilterAnalyzer.ts # Filter analysis orchestrator
│ │ │ ├── StepDetector.ts # Step input detection in setpoint
│ │ │ ├── StepMetrics.ts # Rise time, overshoot, settling, FF classification
│ │ │ ├── StepResponseStacker.ts # Deconvolved (stacked) step response, magnitude split
│ │ │ ├── PIDRecommender.ts # Rule-based P/I/D recommendations
│ │ │ ├── PIDAnalyzer.ts # Unified PID analysis orchestrator (Deep + Flash)
│ │ │ ├── TransferFunctionEstimator.ts # Wiener deconvolution engine
│ │ │ ├── SystemIdentifier.ts # Plant model fit + what-if step prediction
│ │ │ ├── ThrottleTFAnalyzer.ts # Per-band TF across throttle levels
│ │ │ ├── DataQualityScorer.ts # Flight data quality scoring (0-100)
│ │ │ ├── PropWashDetector.ts # Throttle-down event detection + severity
Expand Down
2 changes: 1 addition & 1 deletion SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ Automated end-to-end tests running in CI pipeline against a real FC connected to

## Progress Summary

**Last Updated:** July 24, 2026 | **Tests:** 3243 unit tests across 147 files (3220 passing + 23 skipped) + 37 Playwright E2E tests | **PRs Merged:** #1–#432
**Last Updated:** July 24, 2026 | **Tests:** 3370 unit tests across 154 files (3347 passing + 23 skipped) + 37 Playwright E2E tests | **PRs Merged:** #1–#432

| Phase | Status | Notes |
|-------|--------|-------|
Expand Down
Loading
Loading