Skip to content

fix(esp32): preserve tested FFT and remove unused ESP-DSP adapter - #4871

Merged
zackees merged 2 commits into
masterfrom
perf/esp32-rmt-memory-4870
Oct 21, 2026
Merged

zackees merged 2 commits into
masterfrom
perf/esp32-rmt-memory-4870

Conversation

@zackees

@zackees zackees commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Summary

Refs #4870.

Remove the unused experimental ESP-DSP adapter and call FastLED's existing optimized real kiss_fftr transform directly at all eight production call sites. The old dispatcher already called kiss_fftr unconditionally; its extra size argument was ignored. Public FFT APIs, numeric precision, FFT math, windowing, magnitude batching and CQ/binning are unchanged.

The adapter's umbrella esp_dsp.h included mat.h and <iostream>, whose static std::ios_base::Init retained stream/locale support through the audio unity object even for LED-only sketches. Removing this unused path eliminates that dependency. The fixed Lolin image has no std::ios_base::Init symbols.

Per maintainer direction, this supersedes the initial narrower-header patch: the experimental alternative and its dedicated AudioFftParity example are removed entirely. The real Audio example and FFT golden suite validate production callers. Removed example inventory and lint-baseline entries are cleaned up.

RMT buffering, network detection, interrupt handling, recovery and diagnostics are unchanged. No new settings or GitHub Actions changes. No comparison claims that ESP-DSP is smaller or faster; production continues using the same tested FFT.

Measured result

The reporter's unchanged 96-pixel sketch, pinned to Lolin D32 / espressif32 6.13.0 / Arduino ESP32 2.0.17 / IDF 4.4.7 / GCC 8.4 patch5, using fbuild 2.5.42:

Library Board flash Static RAM
3.10.3 253,022 B 22,216 B
3.10.8 / master control 528a6fdbeb 513,110 B 30,344 B
Fixed 272,434 B 23,292 B

240,676 B less flash and 7,052 B less static RAM, recovering about 93% and 87% of the controlled increases, respectively. These are matched local controls, not exact reproduction of the reporter's unspecified resolved toolchain/flags. Residual versus 3.10.3: 19,412 B flash / 1,076 B static RAM. No runtime heap or hardware waveform claim.

Regression guard and validation

  • New legacy ESP32 Blink budget: bash bloat esp32dev_idf44 --build --budget tests/data/esp32dev_idf44_bloat_budget.json passes. The saved original report fails both ceilings; the fixed report passes.
  • Legacy Blink physical board flash/RAM: 473,598/24,292 -> 232,250/17,248 B. Budget metrics separately: image flash 473,613 -> 232,265 B; attributed RAM 33,005 -> 21,511 B. Attributed RAM includes aliases and is not physical static RAM.
  • Existing production Audio SDK builds pass on both legacy esp32dev_idf44 and modern esp32dev. FFT golden tests pass before and after the cleanup. No hardware execution claimed.
  • bash test --cpp --debug: 321 unit suites + 95 examples passed with sanitizers. Earlier quick runs stopped at stale-artifact validation before assertions; the complete debug rebuild/run passed.
  • Full bash lint passes; 18 example/smoke inventory tests and 3 lint-baseline tests pass; independent repository code review found no issues.
  • Methodology, pinned sketch reference, toolchains and remaining costs: docs/ESP32_MEMORY_4870.md.

Summary by CodeRabbit

  • Bug Fixes

    • Improved ESP32 memory usage by streamlining FFT processing, reducing flash by approximately 240 KB and static RAM by 7 KB.
    • Preserved existing FFT and audio-pipeline behavior while improving compatibility with ESP32 memory budgets.
  • Documentation

    • Added measurements, validation results, regression context, and troubleshooting details for the ESP32 memory improvement.
  • Tests

    • Added an ESP32 default-profile size budget and documented cross-version and native validation results.

@zackees zackees added the ci-full Run the complete release-equivalent CI matrix on this PR SHA label Oct 21, 2026
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Oct 21, 2026
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: FastLED/FastLED/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c7f56528-9f00-4a0f-85ec-1fbecc8a6996
📥 Commits

Reviewing files that changed from the base of the PR and between 560a928 and 0a3c606.

📒 Files selected for processing: 9
  • agents/tasks/todo.md
  • ci/examples/example_groups.py
  • ci/lint_cpp_rs/src/checkers/int_template.rs
  • ci/standardized_smoke_sketches.py
  • docs/ESP32_MEMORY_4870.md
  • examples/AudioFftParity/AudioFftParity.ino
  • src/fl/audio/fft/fft_backend.h
  • src/fl/audio/fft/fft_impl.cpp.hpp
  • tests/data/esp32dev_idf44_bloat_budget.json
💤 Files with no reviewable changes: 4
  • ci/examples/example_groups.py
  • ci/lint_cpp_rs/src/checkers/int_template.rs
  • src/fl/audio/fft/fft_backend.h
  • examples/AudioFftParity/AudioFftParity.ino
🚧 Files skipped from review as they are similar to previous changes: 3
  • agents/tasks/todo.md
  • docs/ESP32_MEMORY_4870.md
  • tests/data/esp32dev_idf44_bloat_budget.json

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

📝 Walkthrough

The PR removes the unused ESP-DSP FFT adapter and dispatcher. Production FFT paths now call kiss_fftr directly. It removes the related parity sketch and CI entries, then adds ESP32 memory-budget validation and regression documentation.

Changes: ESP32 memory regression

Layer / File(s) Summary
Route production FFT paths through kiss_fftr
src/fl/audio/fft/fft_backend.h, src/fl/audio/fft/fft_impl.cpp.hpp
The FFT backend header and dispatcher are removed. Log-rebin, naive, octave-wise, and hybrid FFT paths call kiss_fftr directly.
Remove obsolete FFT validation integration
examples/AudioFftParity/*, ci/examples/example_groups.py, ci/lint_cpp_rs/src/checkers/int_template.rs, ci/standardized_smoke_sketches.py
The AudioFftParity sketch and its inventory and lint-baseline entries are removed. Smoke-sketch documentation now describes existing per-sketch filtering.
Record memory budgets and validation
tests/data/esp32dev_idf44_bloat_budget.json, docs/ESP32_MEMORY_4870.md, agents/tasks/todo.md
The PR adds ESP32 flash and RAM ceilings and records measurements, validation results, and completed regression checks.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 0a3c6

The FFT cleanup is mergeable; no concrete correctness, availability, or integration risk remains.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. (3 skipped: 3 … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main changes: preserving the tested FFT path and removing the unused ESP-DSP adapter for ESP32.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. (3 skipped: 3 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@zackees zackees changed the title fix(esp32): recover RAM and flash retained by ESP-DSP umbrella header fix(esp32): preserve tested FFT and remove unused ESP-DSP adapter Oct 21, 2026
@zackees
zackees merged commit 0c088a1 into master Oct 21, 2026
122 checks passed
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Oct 21, 2026
@zackees
zackees deleted the perf/esp32-rmt-memory-4870 branch November 5, 2026 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-full Run the complete release-equivalent CI matrix on this PR SHA

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant