Repository navigation
refactor(channels): trampoline enableAllDrivers platform bundles - #2480
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (11)
✅ Files skipped from review due to trivial changes (4)
🚧 Files skipped from review as they are similar to previous changes (7)
📝 WalkthroughWalkthroughThe PR refactors ChangesDriver enablement refactor
Sequence DiagramsequenceDiagram
participant Sketch
participant CFastLED
participant FlEnable as fl::enableAllDrivers
participant PlatEnable as platforms::enableAllChannelDrivers
participant ChannelManager
Sketch->>CFastLED: FastLED.enableAllDrivers()
CFastLED->>FlEnable: forwards
FlEnable->>PlatEnable: delegates (platform-selected)
PlatEnable->>ChannelManager: registers drivers
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
178442c to
d87106b
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/platforms/arm/teensy/channel_drivers_teensy.impl.hpp (1)
1-1: ⚡ Quick winReplace raw
#pragma oncewith the project-approved guard style.Line 1 uses a raw pragma directive. Please switch to include guards (or the repository’s compiler-control macro form) to match project conventions.
As per coding guidelines, "Use FastLED compiler control macros from fl/stl/compiler_control.h instead of raw
#pragmadirectives".🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/platforms/arm/teensy/channel_drivers_teensy.impl.hpp` at line 1, Replace the raw `#pragma once` at the top of channel_drivers_teensy.impl.hpp with the project-approved include guard style: either include `fl/stl/compiler_control.h` and wrap the header with the repository’s compiler control macros, or use a conventional include guard like `#ifndef CHANNEL_DRIVERS_TEENSY_IMPL_HPP` / `#define CHANNEL_DRIVERS_TEENSY_IMPL_HPP` ... `#endif`; ensure the guard macro is unique (e.g., CHANNEL_DRIVERS_TEENSY_IMPL_HPP) and remove the `#pragma once` line.src/platforms/esp/32/channel_drivers_esp32.impl.hpp (1)
1-1: ⚡ Quick winReplace raw
#pragma oncewith the project-approved guard style.Line 1 uses a raw pragma directive. Please switch to include guards (or the repository’s compiler-control macro form) to match project conventions.
As per coding guidelines, "Use FastLED compiler control macros from fl/stl/compiler_control.h instead of raw
#pragmadirectives".🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/platforms/esp/32/channel_drivers_esp32.impl.hpp` at line 1, Remove the raw "#pragma once" at the top of src/platforms/esp/32/channel_drivers_esp32.impl.hpp and replace it with the project-approved include guard pattern: add `#include` "fl/stl/compiler_control.h" (to use the FastLED compiler-control macros) and then wrap the header with a conventional include guard macro (for example, use SRC_PLATFORMS_ESP_32_CHANNEL_DRIVERS_ESP32_IMPL_HPP) or the specific compiler-control BEGIN/END macros from fl/stl/compiler_control.h if the project provides them; ensure the guard macro name matches the header and closes at the end of the file to prevent multiple inclusion.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/platforms/arm/teensy/channel_drivers_teensy.impl.hpp`:
- Line 1: Replace the raw `#pragma once` at the top of
channel_drivers_teensy.impl.hpp with the project-approved include guard style:
either include `fl/stl/compiler_control.h` and wrap the header with the
repository’s compiler control macros, or use a conventional include guard like
`#ifndef CHANNEL_DRIVERS_TEENSY_IMPL_HPP` / `#define
CHANNEL_DRIVERS_TEENSY_IMPL_HPP` ... `#endif`; ensure the guard macro is unique
(e.g., CHANNEL_DRIVERS_TEENSY_IMPL_HPP) and remove the `#pragma once` line.
In `@src/platforms/esp/32/channel_drivers_esp32.impl.hpp`:
- Line 1: Remove the raw "#pragma once" at the top of
src/platforms/esp/32/channel_drivers_esp32.impl.hpp and replace it with the
project-approved include guard pattern: add `#include` "fl/stl/compiler_control.h"
(to use the FastLED compiler-control macros) and then wrap the header with a
conventional include guard macro (for example, use
SRC_PLATFORMS_ESP_32_CHANNEL_DRIVERS_ESP32_IMPL_HPP) or the specific
compiler-control BEGIN/END macros from fl/stl/compiler_control.h if the project
provides them; ensure the guard macro name matches the header and closes at the
end of the file to prevent multiple inclusion.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 577996a5-8093-463c-859f-cc7ca0361e3b
📒 Files selected for processing (11)
src/FastLED.cpp.hppsrc/FastLED.hsrc/fl/channels/README.mdsrc/fl/channels/all_drivers.hsrc/platforms/_build.cpp.hppsrc/platforms/arm/teensy/channel_drivers_teensy.impl.hppsrc/platforms/channel_drivers.impl.cpp.hppsrc/platforms/esp/32/channel_drivers_esp32.impl.hppsrc/platforms/shared/channel_drivers_default.impl.hppsrc/platforms/stub/channel_drivers_stub.impl.hpptests/fl/channels/all_drivers.cpp
✅ Files skipped from review due to trivial changes (6)
- src/platforms/stub/channel_drivers_stub.impl.hpp
- src/platforms/_build.cpp.hpp
- src/platforms/shared/channel_drivers_default.impl.hpp
- src/FastLED.cpp.hpp
- src/FastLED.h
- src/fl/channels/README.md
🚧 Files skipped from review as they are similar to previous changes (2)
- tests/fl/channels/all_drivers.cpp
- src/fl/channels/all_drivers.h
Move enableAllDrivers out of the declaration header and route the implementation through platform-specific channel-driver bundles. This keeps call sites on FastLED.h only while ensuring each platform owns the bus_traits includes used to instantiate its supported drivers. Also updates host tests to verify registry behavior rather than comparing BusTraits function-local singleton addresses across DLL boundaries.
d87106b to
8553d60
Compare
* perf(wasm): wire ctc-emcc native launcher into WASM cross-file The native build pipeline previously replaced clang-tool-chain-cpp.EXE (a Python entry point with ~828ms startup per invocation) with the raw clang++ binary resolved in the Meson native file. That alone cut total native build time 54% (Meson Setup 27.6s -> 10.1s, see PR #2480 and predecessor work). The WASM build still routed every emcc invocation through clang-tool-chain-emcc (Python entry point). This change wires the compiled ctc-emcc / ctc-em++ native launchers (built on demand via clang_tool_chain.commands.compile_native) into a dynamically generated WASM Meson cross-file at <build_dir>/wasm_cross_file.generated.ini. The launcher implements a 3-tier strategy (user-template -> flag-hash auto-cache -> Python fallback), so uncached link/preprocess steps still work correctly via the Python emcc.py underneath. Fallback is preserved: if launcher resolution fails for any reason the generated cross-file falls back to clang-tool-chain-emcc, matching the historical static cross-file content. Worst case: WASM build is no slower than before. The static template at ci/meson/wasm_cross_file.ini is retained as both documentation and a stable fingerprint anchor (so structural edits to host_machine/properties still invalidate the library cache). Out of scope (follow-up issues): - ctc-wasm-ld.exe wiring (separate optimization) - ctc-emar (no native launcher exists for it yet) Closes #2485 Refs #2480 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * fix(wasm): address CodeRabbit feedback on ctc-emcc launcher - _ensure_emcc_native_launcher: log a [WASM] warning with the exception text before falling back to the Python wrapper (previously a silent except Exception: pass masked compile failures). KeyboardInterrupt still routes through handle_keyboard_interrupt. - resolve_wasm_native_entries: same logging treatment on the outer resolver fallback path so callers see why the native launcher was bypassed. - ensure_meson_configured: render the WASM cross-file before the fast-path return so a freshly built or repaired native launcher is picked up on the next meson invocation against an existing build directory. No reconfigure is forced; the cheap ini write is enough. - Apply ruff format normalizations to ci/compiler/pio.py and ci/esbuild_frontend.py that were flagged by bash lint. Skipped: - @TypeChecked on WasmNativeEntries: decorator is not used elsewhere in ci/meson/build_config.py and the dataclass plus consumers are already statically typed. Better handled in a repo-wide pass. - Reworking the hardcoded wasm_cross_file.ini contents into a template: the static file is still referenced as a fingerprint anchor in _compute_library_fingerprint (line 144), so removing or templating it adds non-trivial scope to this PR. Deferred to a follow-up. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Summary
Supersedes #2478 with a single squashed commit.
fl::enableAllDrivers()out ofall_drivers.hand into the platform unity buildplatforms/channel_drivers.impl.cpp.hppis the include-once router, and platform-owned*.impl.hppfragments provide ESP32, Teensy 4.x, stub/WASM, plus a null fallthrough implementationBIT_BANGFastLED.enableAllDrivers()callable from<FastLED.h>without the old magic include requirementBusTraitsfunction-local singleton addresses across DLL boundariesVerification
python -m ci.lint_cpp.impl_hpp_includes_checkerpython -m ci.lint_cpp.cpp_hpp_includes_checkerpython -m ci.lint_cpp.iwyu_pragma_checkbash lint --cppbash test fl_channels_all_drivers --debugbash test --cpp --force- 304/304 passingbash lint- not clean locally due pre-existing Python KeyboardInterrupt checker findings inci/compiler/pio.pyandci/util/fbuild_runner.pybash compile --no-interactive --local --max-failures 1 esp32s3 SpecialDrivers/ESP/DriverTest- timed out locally after 30 minutes with no useful output before timeoutNotes
This keeps the tree-shaking strategy from #2478, but routes the per-platform
bus_traits.hinclude list through the existing.impl.cpp.hpptrampoline pattern and its special linting rules. The final router branch now lands onplatforms/shared/channel_drivers_null.impl.hpp, whoseenableAllChannelDrivers()body is intentionally empty.Summary by CodeRabbit
Documentation
FastLED.enableAllDrivers()usage—header inclusion no longer requiredRefactor
enableAllDrivers()now incurs zero binary size cost when unused through compiler optimization