Skip to content

fix(esp32): remove unused timer teardown and startup initialization - #4873

Merged
zackees merged 5 commits into
masterfrom
perf/esp32-dead-dependencies-4870
Oct 22, 2026
Merged

zackees merged 5 commits into
masterfrom
perf/esp32-dead-dependencies-4870

Conversation

@zackees

@zackees zackees commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Summary

Follow up merged #4871 for #4870 with measured dead-dependency removal, preserving features and current backend selection.

  • Late-bind software PWM teardown only after successful timer setup; ordinary digital pin cleanup no longer retains unused timer/GPIO interrupt teardown.
  • Constant-initialize vector operation tables with C++11-compatible named thunks; preserve copy/move/swap/default/destroy operations and SFINAE.
  • Constant-initialize UCS7604 defaults while retaining runtime brightness controls.
  • Tighten the existing Blink size budget; no workflow changes, logging changes, FFT replacement or driver substitution.

Matched measurements

Unchanged reporter sketch, Lolin D32, espressif32 6.13.0 / Arduino ESP32 2.0.17 / IDF 4.4.7 / GCC 8.4 patch5, clean rebuild:

Revision Board flash Physical static RAM
3.10.3 control 253,022 22,216
Merged FFT fix #4871 272,434 23,292
This follow-up 270,414 23,148

Additional savings: 2,020 bytes flash / 144 bytes RAM. Remaining versus 3.10.3: 17,392 / 932 bytes. This does not resolve the complete original increase.

Blink clean control: board flash/RAM 232,250/17,248 -> 230,626/17,192; bloat image/attributed RAM 232,265/21,511 -> 230,641/21,369. New ceilings 231,000 / 21,400 reject the saved pre-change report on both metrics and accept the new image.

Validation

  • Full bash lint: passed.
  • Repository code review: no blocking findings.
  • Real SDK feature consumer explicitly using software PWM setup/cleanup/restart, Serial initialization/output and UCS7604 brightness: builds and links. ELF retains timer teardown, Serial begin and brightness accessor.
  • Reporter ELF: unused timer cleanup, vector table guards and UCS7604 startup initializer absent.
  • bash bloat esp32dev_idf44 --budget tests/data/esp32dev_idf44_bloat_budget.json: passed.
  • Full bash test --cpp --debug: 321/321 unit suites and 95/95 examples passed (416 total, 300.91s wall).

Limits and costs

Both current size controls select the generic blocking fallback because these legacy SDKs omit SOC_RMT_SUPPORTED. The 3.10.3 image uses RMT4, so historical totals do not establish equivalent RMT behavior. No RMT selection or reliability change is included. See docs/ESP32_FLASH_REMAINDER_4870.md for the independent legacy RMT risks and rejected console experiment.

PWM users add one function pointer (4 bytes on ESP32) in existing lazy state; pin-only users do not instantiate that state. Explicit consumer compilation plus native lifecycle tests provide link/runtime evidence; no on-device waveform test is claimed.

Summary by CodeRabbit

  • New Features
    • Reduced the ESP32 application footprint by approximately 2 KB of flash and 144 bytes of static RAM, with existing device behavior preserved.
  • Bug Fixes
    • Removed unused runtime dependencies without changing device features.
  • Tests
    • Added compile-time checks for current-control values and vector operations.
    • Added guidance for verifying size measurements with clean builds.
  • Documentation
    • Updated ESP32 footprint measurements, budget limits, and validation details.

@zackees zackees added the ci-full Run the complete release-equivalent CI matrix on this PR SHA label 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
📥 Commits

Reviewing files that changed from the base of the PR and between c4b5f30 and 78e5c77.

📒 Files selected for processing: 4
  • agents/tasks/lessons.md
  • agents/tasks/todo.md
  • docs/ESP32_FLASH_REMAINDER_4870.md
  • tests/data/esp32s3_bloat_baseline.txt
🚧 Files skipped from review as they are similar to previous changes: 3
  • agents/tasks/todo.md
  • agents/tasks/lessons.md
  • docs/ESP32_FLASH_REMAINDER_4870.md

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

📝 Walkthrough

The change updates vector operation callbacks, UCS7604 constructors, and PWM ISR detachment. It adds compile-time checks and refreshes ESP32 size budgets and measurements. Documentation and task notes record implementation details and validation results.

Changes: ESP32 dead-dependency cleanup

Layer / File(s) Summary
Compile-time operations and PWM detach state
src/fl/stl/basic_vector.h, src/fl/chipsets/encoders/ucs7604.h, src/fl/system/pin.cpp.hpp
Vector operations use named function templates in a static constexpr table. UCS7604 constructors are constexpr. PWM state stores the ISR detach function and uses it during shutdown.
Compile-time checks
tests/fl/stl/vector.cpp, tests/fl/chipsets/ucs7604.cpp
Compile-time assertions check UCS7604 default values and masking. Vector assertions check operation-pointer selection for fl::string and a move-only type.
Footprint measurements and validation records
tests/data/esp32dev_idf44_bloat_budget.json, tests/data/esp32s3_bloat_baseline.txt, docs/ESP32_FLASH_REMAINDER_4870.md, agents/tasks/todo.md, agents/tasks/lessons.md
The ESP32 budget ceilings and S3 baseline are updated. The document and task notes record footprint measurements, implementation details, and validation guidance.

Priority: ⬇️ Low

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

Change: Refactor

Possibly related issues

Merge Risk: ⚪ Minimal · up to 78e5c

No actionable merge-blocking risk is established by the reviewed changes.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Out of Scope Changes check Warning The source cleanup, tests, budget update, and related documentation match the stated ESP32 follow-up. The PR also changes agents/tasks/lessons.md and agents/tasks/todo.md with process notes and change… Remove the unrelated agents/tasks/lessons.md, agents/tasks/todo.md, and ESP32-S3 baseline changes, or provide a direct justification and scope update for each change.
Docstring Coverage Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 5 files. (4 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies the primary ESP32 change: removing unused timer teardown and startup initialization. It is concise and directly related to the main implementation objective.
Linked Issues check Passed Issue #4871 is closed and completed. It provides historical context only. No active directly linked issue supplies coding requirements for this pull request.
Full details: Out of Scope Changes check

Explanation

The source cleanup, tests, budget update, and related documentation match the stated ESP32 follow-up. The PR also changes agents/tasks/lessons.md and agents/tasks/todo.md with process notes and changes tests/data/esp32s3_bloat_baseline.txt for an ESP32-S3 measurement. These changes have no demonstrated connection to the stated ESP32 IDF 4.4 dead-dependency cleanup or its Blink budget.

Resolution

Remove the unrelated agents/tasks/lessons.md, agents/tasks/todo.md, and ESP32-S3 baseline changes, or provide a direct justification and scope update for each change.

Full details: Docstring Coverage

Explanation

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

Resolution

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

✨ Finishing Touches
🧪 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 commented Oct 22, 2026

Copy link
Copy Markdown
Member Author

Final merge gate: head 78e5c77 is APPROVED/CLEAN, all 122 hosted checks complete successfully, and zero unresolved review threads. Targeted native debug vector/UCS7604/pin tests, source lint and the claimed S3 image ratchet pass. Integration validation additionally passed all 326 native unit tests and 95 examples with debug sanitizers. Stock SDK support is required; #4898 remains closed.

@zackees
zackees merged commit f9bc614 into master Oct 22, 2026
122 checks passed
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Oct 22, 2026
@zackees
zackees deleted the perf/esp32-dead-dependencies-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