Repository navigation
feat(FastLED): CFastLED::load + loadChannels + loadScreenMap + FledDispatcher (#3311 PR5) - #3330
Conversation
…spatcher (#3311 PR5) PR5 of #3311. Adds the bundle-load surface on CFastLED, with each method in its own TU so the linker tree-shakes them out of sketches that never reference Fled bundles. New surface on CFastLED: - load(const Fled&) - composes channels + screenmap + script dispatch - loadChannels(const Fled&) - iterates fled.channels() and calls add() per - loadScreenMap(const Fled&) - shipped as a stub (FL_WARN_F) - the controller-binding policy decision is deferred to a follow-up; #3311 spec says "broadcasts via EngineEvents::onCanvasUiSet" but onCanvasUiSet needs a CLEDController* and CFastLED has no specific controller to bind to. New singleton: fl::detail::FledDispatcher (in fl/fled/fled_dispatch.h) holds the default-empty wasmLoader / microPyLoader fl::function slots. fledDispatcher() is a construct-on-first-use accessor - the singleton tree-shakes when no one references it (i.e. enableWasm / enableMicroPy are never called). Tree-shake plumbing follows the existing fl.system.sd pattern: - src/fl/fled/load/, load_channels/, load_screen_map/ - one TU each - src/fl/build/fl.fled.load+.cpp / fl.fled.load_channels+.cpp / fl.fled.load_screen_map+.cpp - recursive unity entry points - ci/lint_cpp_rs/src/checkers/unity_build.rs UNITY_EXPECTED_BUILD_FILES allowlist extended for the three new build files Forward decl of fl::Fled moved to src/fl/fled/fwd.h so FastLED.h does not have to include fled.h. Tests: 6 cases in tests/fl/fled/fled_load.cpp - null Fled is no-op for each method, valid-but-empty bundle is no-op, FledDispatcher singleton accessor returns the same object on repeated calls. Refs #3311 (this is the fifth of seven planned PRs) Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
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 (2)
📝 WalkthroughWalkthroughAdds three new Changes.fled Bundle Load API
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/fl/fled/load_screen_map/fastled_load_screen_map.cpp.hpp (1)
32-32: ⚡ Quick winUse stream-style warning macro here instead of
FL_WARN_F.This line uses the printf-style warning path; project standards require stream-style
FL_WARN(...)/FL_DBG(...)usage in C++ sources.As per coding guidelines, "Warning/debug output: use
FL_WARN(...)/FL_DBG(...)... warning macros are stream-style (<<), notprintf-style."🤖 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/fl/fled/load_screen_map/fastled_load_screen_map.cpp.hpp` at line 32, The warning message in the CFastLED::loadScreenMap function uses the printf-style macro FL_WARN_F, but project coding standards require stream-style warning macros. Replace FL_WARN_F with FL_WARN and convert the printf-style format string to stream-style syntax using the << operator to concatenate the warning message about the stub implementation.Source: Coding guidelines
🤖 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.
Inline comments:
In `@src/fl/fled/load/fastled_load.cpp.hpp`:
- Around line 35-51: The current if-else if chain handling script kinds
(fl::ScriptKind::Wasm and fl::ScriptKind::MicroPy) does not handle the case
where script->kind is neither of these supported types, causing silent failures.
Add a final else clause after the else if block for MicroPy that logs an error
message using FL_ERROR_F indicating that the script kind is unsupported or
unknown. This will ensure that bundle failures with unrecognized script kinds
are properly diagnosable rather than silently no-opping.
---
Nitpick comments:
In `@src/fl/fled/load_screen_map/fastled_load_screen_map.cpp.hpp`:
- Line 32: The warning message in the CFastLED::loadScreenMap function uses the
printf-style macro FL_WARN_F, but project coding standards require stream-style
warning macros. Replace FL_WARN_F with FL_WARN and convert the printf-style
format string to stream-style syntax using the << operator to concatenate the
warning message about the stub implementation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: bb20b015-fbfe-48db-8394-d70e76cd0571
📒 Files selected for processing (16)
ci/lint_cpp_rs/src/checkers/unity_build.rssrc/FastLED.hsrc/fl/build/fl.fled.load+.cppsrc/fl/build/fl.fled.load_channels+.cppsrc/fl/build/fl.fled.load_screen_map+.cppsrc/fl/fled/_build.cpp.hppsrc/fl/fled/fled_dispatch.cpp.hppsrc/fl/fled/fled_dispatch.hsrc/fl/fled/fwd.hsrc/fl/fled/load/_build.cpp.hppsrc/fl/fled/load/fastled_load.cpp.hppsrc/fl/fled/load_channels/_build.cpp.hppsrc/fl/fled/load_channels/fastled_load_channels.cpp.hppsrc/fl/fled/load_screen_map/_build.cpp.hppsrc/fl/fled/load_screen_map/fastled_load_screen_map.cpp.hpptests/fl/fled/fled_load.cpp
) Per follow-up direction: wasm/micropy script-host runtimes are design-only for v1, not shipped. That makes the FledDispatcher singleton + the script-dispatch block in CFastLED::load dead code today, so removing both: - Delete src/fl/fled/fled_dispatch.h - Delete src/fl/fled/fled_dispatch.cpp.hpp - Drop its include from src/fl/fled/_build.cpp.hpp - Strip the script-dispatch block from src/fl/fled/load/fastled_load.cpp.hpp - load() is now just: if (!fled) return; loadChannels(fled); loadScreenMap(fled); - Drop the dispatcher test case + fled_dispatch.h include from tests/fl/fled/fled_load.cpp. fl::FledScript (the passive data wrapper from PR2) and fl::Fled::script() stay - they are forward-looking section accessors for the v2 bundle format and have no runtime cost when no bundle ever carries a script section (which is always today, since v1 bundles do not). Refs #3311 #3330 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Summary
PR5 of #3311. Adds the bundle-load surface on
CFastLED, with each method in its own TU so the linker tree-shakes them out of sketches that never reference Fled bundles.New surface on CFastLED
void load(const Fled& fled)— composes channels + screenmap + script dispatchvoid loadChannels(const Fled& fled)— iteratesfled.channels()and callsadd()pervoid loadScreenMap(const Fled& fled)— shipped as a stub (FL_WARN_F); the controller-binding policy decision is deferred to a follow-up. The feat(fl/fled): create new fl::Fled bundle subsystem (value + runner + section accessors) under src/fl/fled/ #3311 spec says "broadcasts viaEngineEvents::onCanvasUiSet", butonCanvasUiSetneeds aCLEDController*andCFastLED::loadScreenMaphas no specific controller to bind to. Filed for follow-up.New singleton
fl::detail::FledDispatcherinsrc/fl/fled/fled_dispatch.h— holds the default-emptywasmLoader/microPyLoaderfl::functionslots.fledDispatcher()is a construct-on-first-use accessor — the singleton tree-shakes when no one references it (i.e.enableWasm/enableMicroPyare never called).Tree-shake plumbing
Follows the existing
fl.system.sdpattern:src/fl/fled/load/,load_channels/,load_screen_map/— one TU eachsrc/fl/build/fl.fled.load+.cpp/fl.fled.load_channels+.cpp/fl.fled.load_screen_map+.cpp— recursive unity entry pointsci/lint_cpp_rs/src/checkers/unity_build.rsUNITY_EXPECTED_BUILD_FILESallowlist extended for the three new build filesForward decl of
fl::Fledmoved tosrc/fl/fled/fwd.hsoFastLED.hdoes not have to includefled.h.Test plan
bash test fled --debug— green (1/1 DLL, 6 new cases)bash lint --cpp— greenRefs #3311
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
.fledbundles:load(),loadChannels(), andloadScreenMap().Tests