Repository navigation
feat(channels): portable Bus enum migration (#3439) - #3444
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (67)
📝 WalkthroughWalkthroughThe PR refactors ChangesPortable Bus and Which Refactor
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ 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 |
Implements the portable, capability-based Bus enum from #3439: enum class Bus : u8 { AUTO, BIT_BANG, UART, SPI, DUAL_SPI, QUAD_SPI, OCTAL_SPI, RMT, FLEX_IO }; Replaces the previous vendor-named taxonomy (RMT/PARLIO/SPI/I2S/I2S_SPI/ LCD_RGB/LCD_SPI/LCD_CLOCKLESS/UART/FLEX_IO/OBJECT_FLED/LPUART/BIT_BANG/STUB) with 9 user-facing engine types. Per-platform instance selection happens via a separate `Which` template parameter (defaults to 0). New surface: - `src/fl/channels/bus_features.h` — zero-fills FASTLED_HAS_* macros. - `src/fl/channels/bus_info.h` — `DeviceInfo`/`DeviceRuntime` + `deviceInfo<B, Which>()` primary template + per-platform specializations. - `src/fl/channels/bus_info.json.h` — JSON adapter for AutoResearch. - `src/fl/channels/bus_info_impl.cpp.hpp` — unity-build anchor. - `BusInstanceCount<B>` trait with per-platform max-Which values. - `busName(b, which)` / `busDriverName(b, which, spi)` helpers. - `tests/fl/channels/bus_info.cpp` — static_asserts on instance counts + runtime checks for the no-op fallback path. Per-driver `_build.cpp.hpp` files updated to advertise the right `FASTLED_HAS_*` feature macro when their TU is compiled in. ChannelManager, DefaultBus<Chipset>, BusTraits<>, and the existing `enableDrivers<>` / `setExclusiveDriver<>` machinery rewired to the portable names. All sketches under `examples/` and tests under `tests/` updated to use the new portable names in the same commit (single breaking swap per the issue's rollout section). Validation: - bash test --cpp --clean: 338/338 pass. - bash compile wasm --examples Blink: pass. - bash lint: pass (no new warnings). Refs: #3428 (unified clockless+SPI engine rule preserved) Closes-pending: #3439 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
f95321d to
4e0d31b
Compare
Today the cross-platform build matrix only fires on push to master. For large refactors (e.g. the #3444 bus enum migration), contributors have no way to exercise the matrix on a feature branch before merge, which forces a merge-then-fix-forward cycle on any board the local WASM/Teensy validation didn't cover. Adding workflow_dispatch lets a maintainer run the matrix on demand against any branch via the Actions UI or `gh workflow run build.yml --ref <branch>`. Path filters are unchanged; the dispatch path doesn't honour them anyway. No behavioural change for push events. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 16
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/fl/channels/manager.h (1)
118-128: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winRefresh the docs for the new
which-aware overloads.The comments still describe
setExclusiveDriverByName(busName(bus))andBusTraits<B>::instancePtr(), but the code now routes throughbusDriverName(bus, which)andBusTraits<B, Which>::instancePtr(). Please documentwhichexplicitly so the public contract matches the implementation.🤖 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/channels/manager.h` around lines 118 - 128, The docs for setExclusiveDriver and setExclusiveDriver(Bus bus, fl::u8 which) are stale and still mention the old busName(bus) and BusTraits<bus>::instancePtr() paths. Update the comments on these overloads to document the which parameter explicitly, and describe that the runtime version delegates through busDriverName(bus, which) while the template version uses BusTraits<B, Which>::instancePtr(). Keep the public contract aligned with the current implementation and mention Which in the template overload summary.
🤖 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 `@ci/meson/discover_examples_all.py`:
- Around line 93-103: The _filter_value_matches helper does not trim whitespace
after removing the -d prefix, so space-separated filters like "-d esp32s3" fail
to match in both the exact and wildcard branches. Update the filter handling in
_filter_value_matches to strip surrounding whitespace immediately after dropping
the "-d" prefix, then continue using the normalized value for the fnmatch and
equality checks.
- Around line 280-305: Update discover_examples_all.py in the filter handling
logic so YAML-style blocks are detected and parsed before the generic one-line
`@filter`:/@filter-out: branch. In the filtering section around
parse_yaml_filter(), reorder the conditions (or otherwise distinguish block
openers from single-line annotations) so a // `@filter`: opener is handled by
parse_yaml_filter() instead of being treated as an empty inline filter. Keep the
existing FILTER| and SKIP| output behavior, but ensure the symbols
should_skip_for_stub() and parse_yaml_filter() are used for the correct
annotation type.
- Around line 25-29: Update the filter parser to use FilterDiscovery end-to-end
instead of returning a raw (bool, str) from _should_skip_yaml_filter(); have
that helper construct and return a FilterDiscovery instance so the caller can
use the same shape consistently. Also add `@typechecked` to the FilterDiscovery
dataclass definition to match the repo’s Python typing rules and keep the
discovery flow aligned with the existing parser symbols.
In `@ci/wasm_build.py`:
- Around line 831-836: The extra source filtering in the example scan is using
the full path from Path.parts, so checkout directories like build or .pio can
wrongly exclude every .cpp file. Update the predicate in the extra_cpps
collection to inspect the example-relative path from
f.relative_to(example_dir).parts instead, keeping the exclusion set in the
existing wasm_build.py source discovery logic intact.
In `@examples/AutoResearch/AutoResearchRemoteRunParallelTest.cpp`:
- Around line 228-238: The bus selection logic in
AutoResearchRemoteRunParallelTest::parse should not map I2S_SPI or LCD_SPI to
FLEX_IO, because those names still need SPI semantics and currently resolve to
the wrong driver name during pin matching. Update the parsing branch that sets
opts.mBus and opts.mBusWhich so these SPI-only cases are either rejected here or
converted into a proper SPI ChannelConfig, and keep the existing FLEX_IO
mappings only for the clockless variants like I2S and LCD_CLOCKLESS.
In `@src/fl/channels/bus_features.h`:
- Around line 12-115: The new capability macros in bus_features.h use the
disallowed FASTLED_HAS_* namespace, so rename each newly introduced identifier
to the required FL_* form and update any internal checks that reference them.
Keep the same feature detection logic in this header, but move the public API
surface away from FASTLED_HAS_OBJECTFLED, FASTLED_HAS_FLEXIO,
FASTLED_HAS_PARLIO, FASTLED_HAS_LCD_CAM_CLOCKLESS, FASTLED_HAS_LCD_SPI,
FASTLED_HAS_I2S_LED, FASTLED_HAS_I2S_SPI, FASTLED_HAS_RMT4, FASTLED_HAS_RMT5,
FASTLED_HAS_LPSPI, FASTLED_HAS_LPUART_PARALLEL, FASTLED_HAS_PIO,
FASTLED_HAS_PIO1, FASTLED_HAS_SOFT_SPI, and FASTLED_HAS_SOFT_UART by replacing
them with FL_<COMPONENT>_<NAME> equivalents wherever they are defined or
consumed.
In `@src/fl/channels/bus_info.h`:
- Around line 161-171: Update DeviceInfoResolver<Bus::FLEX_IO, 0>::get() so
clockless-only I2S builds are reported as available, not NOOP. Extend the
existing FASTLED_HAS_I2S_SPI check to also recognize FASTLED_HAS_I2S_LED,
matching the capability already used by Bus::FLEX_IO in bus.h. Keep the makeInfo
path consistent with the other available drivers and preserve the fallback
makeNoop only when neither I2S nor the other FLEX_IO backends are enabled.
In `@src/fl/channels/bus.h`:
- Around line 126-133: The new feature-gate checks in bus.h still use frozen
FASTLED_* naming, so rename them to the FL_<COMPONENT>_HAS_<FEATURE> family and
update every matching caller in the same change. Locate the conditional branches
in the bus-related helpers that currently test FASTLED_HAS_PARLIO,
FASTLED_HAS_LCD_SPI, FASTLED_HAS_LCD_CAM_CLOCKLESS, FASTLED_HAS_I2S_SPI, and
FASTLED_HAS_I2S_LED, and replace those identifiers with the new FL-prefixed
macros consistently across the diff.
- Around line 14-20: The macro save/undef block in bus.h leaves UART, SPI, and
I2S permanently undefined for later includes, so restore them before the header
ends. Update the same bus.h header to pair the existing `#pragma` push_macro
entries with matching pop_macro directives after the affected declarations,
keeping the public include from leaking macro state into the rest of the
translation unit.
In `@src/fl/channels/channel.cpp.hpp`:
- Around line 395-399: The remediation text is incorrectly reusing the concrete
driver key from busDriverName(), which can produce impossible fl::Bus::...
suggestions for portable buses. Keep using busDriverName() for the registry
lookup in the channel/bus registration path, but change the miss-path hint
construction to derive the user-facing API suggestion from the portable (mBus,
mBusWhich) tuple instead, using the relevant symbols in channel.cpp.hpp that
format the fl::Bus::%s message.
In `@src/fl/channels/manager.cpp.hpp`:
- Around line 242-243: The setExclusiveDriver(Bus, which) overload is always
resolving the non-SPI driver name because it calls busDriverName(bus, which)
with the default spi=false, so FLEX_IO can never select LCD_SPI/I2S_SPI on
ESP32. Update this path in ChannelManager::setExclusiveDriver so the {bus,
which} lookup maps to the correct concrete driver name for the intended mode,
either by threading the SPI/non-SPI choice through the API or by making
busDriverName selection explicit before calling setExclusiveDriverByName.
In `@src/platforms/arm/teensy/teensy4_common/drivers/objectfled/bus_traits.h`:
- Around line 39-48: Remove the premature SPI compile-time enablement for
ObjectFLED in BusSupports so Bus::FLEX_IO with SpiChipsetConfig is not
advertised as supported until the runtime path can truly handle it. Update the
BusSupports specialization in bus_traits.h to match the current
ChannelEngineObjectFLED/canHandle() behavior and the stubbed
objectfled_spi_lookup_pins() logic, keeping only the clockless path enabled for
now. If SPI support is meant to land in this change, then also update
ChannelEngineObjectFLED so canHandle() and the SPI pin lookup accept real SPI
channels before exposing the Bus::FLEX_IO, 0 contract.
In `@src/platforms/esp/32/drivers/i2s_spi/bus_traits.h`:
- Around line 44-45: `registerWithManager()` is now using the shared FLEX_IO
baseline instead of the ESP32-specific I2S-SPI priority, which can cause this
backend to register too low and lose selection to other SPI drivers. Update the
`registerWithManager()` path in `bus_traits.h` to preserve the concrete ESP32
priority used for this driver (matching the explicit priority in
`channel_manager_esp32.cpp.hpp`) rather than calling
`default_bus_priority(Bus::FLEX_IO, 0)`, so `enableDrivers<Bus::FLEX_IO, 0>()`
and `enableAllDrivers()` continue to prefer the intended engine.
In `@src/platforms/esp/32/drivers/lcd_cam/bus_traits.h`:
- Around line 41-42: The registration in registerWithManager() is using
default_bus_priority(Bus::FLEX_IO, 1), which ties PARLIO with LCD_RGB on
ESP32-P4 and breaks the documented precedence. Update the priority used by the
opt-in driver registration so PARLIO remains above LCD_RGB, and keep the
ordering consistent with the constants in channel_manager_esp32.cpp.hpp
(PRIORITY_PARLIO and PRIORITY_LCD_RGB). Focus the fix in the bus_traits.h
registration path and preserve the intended clockless-driver selection order.
In `@src/platforms/esp/32/drivers/lcd_spi/bus_traits.h`:
- Around line 38-67: The FLEX_IO bus trait is registering two separate drivers
for the same LCD_CAM slot, while instancePtr() only exposes the clockless one,
so the shared peripheral is split incorrectly. Update BusTraits<Bus::FLEX_IO, 0>
and the LcdCamBusHolder/lcd_cam_bus_holder setup to use one unified driver or
adapter for both SPI and clockless modes, and have registerWithManager()
register that single ChannelEngine instead of separate spi and clockless
engines. Ensure the unified driver’s canHandle() and show() dispatch
appropriately based on isSpi() versus isClockless().
In `@tests/fl/channels/channel.cpp`:
- Around line 346-347: Update the comment in the Channel test near
Channel::create<Bus::BIT_BANG>(cfg) and FastLED.add<Bus::BIT_BANG>(cfg) to use
ASCII-only punctuation; replace the non-ASCII em dash in the sentence about the
real BIT_BANG driver with a plain ASCII equivalent such as "--" so the C++
source-text rule is satisfied.
---
Outside diff comments:
In `@src/fl/channels/manager.h`:
- Around line 118-128: The docs for setExclusiveDriver and
setExclusiveDriver(Bus bus, fl::u8 which) are stale and still mention the old
busName(bus) and BusTraits<bus>::instancePtr() paths. Update the comments on
these overloads to document the which parameter explicitly, and describe that
the runtime version delegates through busDriverName(bus, which) while the
template version uses BusTraits<B, Which>::instancePtr(). Keep the public
contract aligned with the current implementation and mention Which in the
template overload summary.
🪄 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: 9c886f8f-1958-4820-a485-7608e0bb70c9
📒 Files selected for processing (69)
agents/docs/cpp-standards.mdagents/docs/hardware-autoresearch.mdci/autoresearch/test_flexio_rx_objectfled.pyci/meson/discover_examples_all.pyci/tests/test_autoresearch_phases.pyci/wasm_build.pyexamples/AutoResearch/AutoResearchParlioStream.hexamples/AutoResearch/AutoResearchRemoteDriverMethods.cppexamples/AutoResearch/AutoResearchRemotePinMethods.cppexamples/AutoResearch/AutoResearchRemoteRunParallelTest.cppexamples/AutoResearch/AutoResearchRemoteSystemMethods.cppexamples/AutoResearch/LegacyClocklessProxy.hexamples/meson.buildpyproject.tomlsrc/FastLED.cpp.hppsrc/FastLED.hsrc/fl/channels/README.mdsrc/fl/channels/_build.cpp.hppsrc/fl/channels/bus.hsrc/fl/channels/bus_features.hsrc/fl/channels/bus_info.hsrc/fl/channels/bus_info.json.hsrc/fl/channels/bus_info_impl.cpp.hppsrc/fl/channels/bus_priorities.hsrc/fl/channels/bus_traits.hsrc/fl/channels/channel.cpp.hppsrc/fl/channels/channel.hsrc/fl/channels/channel_typed.hsrc/fl/channels/manager.cpp.hppsrc/fl/channels/manager.hsrc/fl/channels/options.hsrc/platforms/arm/teensy/channel_drivers_teensy.impl.hppsrc/platforms/arm/teensy/teensy4_common/drivers/flexio/bus_traits.hsrc/platforms/arm/teensy/teensy4_common/drivers/lpuart/_build.cpp.hppsrc/platforms/arm/teensy/teensy4_common/drivers/lpuart/bus_traits.hsrc/platforms/arm/teensy/teensy4_common/drivers/lpuart/channel_engine_lpuart.cpp.hppsrc/platforms/arm/teensy/teensy4_common/drivers/lpuart/ilpuart_peripheral.hsrc/platforms/arm/teensy/teensy4_common/drivers/objectfled/_build.cpp.hppsrc/platforms/arm/teensy/teensy4_common/drivers/objectfled/bus_traits.hsrc/platforms/arm/teensy/teensy4_common/drivers/objectfled/channel_engine_objectfled.hsrc/platforms/esp/32/channel_drivers_esp32.impl.hppsrc/platforms/esp/32/drivers/channel_manager_esp32.cpp.hppsrc/platforms/esp/32/drivers/i2s/_build.cpp.hppsrc/platforms/esp/32/drivers/i2s/bus_traits.hsrc/platforms/esp/32/drivers/i2s_spi/_build.cpp.hppsrc/platforms/esp/32/drivers/i2s_spi/bus_traits.hsrc/platforms/esp/32/drivers/lcd_cam/_build.cpp.hppsrc/platforms/esp/32/drivers/lcd_cam/bus_traits.hsrc/platforms/esp/32/drivers/lcd_spi/_build.cpp.hppsrc/platforms/esp/32/drivers/lcd_spi/bus_traits.hsrc/platforms/esp/32/drivers/parlio/_build.cpp.hppsrc/platforms/esp/32/drivers/parlio/bus_traits.hsrc/platforms/esp/32/drivers/parlio/clockless_parlio_esp32.hsrc/platforms/esp/32/drivers/spi/_build.cpp.hppsrc/platforms/esp/32/drivers/spi/bus_traits.hsrc/platforms/stub/bus_traits.hsrc/platforms/stub/channel_drivers_stub.impl.hppsrc/platforms/stub/clockless_channel_stub.hsrc/platforms/stub/init_channel_driver.hsrc/platforms/stub/spi_channel_stub.hsrc/platforms/wasm/clockless_channel_wasm.hsrc/platforms/wasm/spi_channel_wasm.htests/fl/channels/all_drivers.cpptests/fl/channels/bus_info.cpptests/fl/channels/bus_traits.cpptests/fl/channels/channel.cpptests/fl/channels/channel_typed.cpptests/fl/channels/wave8.cpptests/platforms/shared/active_strip_data/active_strip_data.cpp
| @dataclass(slots=True) | ||
| class FilterDiscovery: | ||
| metadata: str | None | ||
| should_skip: bool | ||
| reason: str |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
file="ci/meson/discover_examples_all.py"
printf '\n== file outline ==\n'
ast-grep outline "$file" --view expanded || true
printf '\n== relevant lines 1-220 ==\n'
sed -n '1,220p' "$file" | cat -n
printf '\n== relevant lines 220-360 ==\n'
sed -n '220,360p' "$file" | cat -nRepository: FastLED/FastLED
Length of output: 15625
🏁 Script executed:
#!/bin/bash
set -euo pipefail
file="ci/meson/discover_examples_all.py"
printf '\n== search for FilterDiscovery and parser helpers ==\n'
rg -n "FilterDiscovery|_should_skip_yaml_filter|parse_yaml_filter|`@typechecked`|tuple\[bool, str\]|return .*should_skip|return .*reason" "$file"
printf '\n== surrounding helper code ==\n'
sed -n '1,220p' "$file" | awk 'NR>=1 && NR<=220 {print NR ":" $0}'Repository: FastLED/FastLED
Length of output: 9111
Use FilterDiscovery end-to-end in the filter parser. _should_skip_yaml_filter() still returns a raw (bool, str), and FilterDiscovery is missing @typechecked; returning the dataclass here keeps the parser consistent with the repo’s Python rules.
🤖 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 `@ci/meson/discover_examples_all.py` around lines 25 - 29, Update the filter
parser to use FilterDiscovery end-to-end instead of returning a raw (bool, str)
from _should_skip_yaml_filter(); have that helper construct and return a
FilterDiscovery instance so the caller can use the same shape consistently. Also
add `@typechecked` to the FilterDiscovery dataclass definition to match the repo’s
Python typing rules and keep the discovery flow aligned with the existing parser
symbols.
Source: Coding guidelines
| def _filter_value_matches(board_value: str, filter_values: list[str]) -> bool: | ||
| board_value_lower = board_value.lower() | ||
| for filter_value in filter_values: | ||
| filter_value_lower = filter_value.lower() | ||
| if filter_value_lower.startswith("-d"): | ||
| filter_value_lower = filter_value_lower[2:] | ||
| if "*" in filter_value_lower: | ||
| if fnmatch.fnmatch(board_value_lower, filter_value_lower): | ||
| return True | ||
| elif board_value_lower == filter_value_lower: | ||
| return True |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Strip whitespace after removing the -d prefix.
-d esp32s3 becomes " esp32s3" here, so both the exact-match and wildcard paths miss. That breaks the newly added -d filter form for the common space-separated syntax.
Suggested fix
if filter_value_lower.startswith("-d"):
- filter_value_lower = filter_value_lower[2:]
+ filter_value_lower = filter_value_lower[2:].strip()📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| def _filter_value_matches(board_value: str, filter_values: list[str]) -> bool: | |
| board_value_lower = board_value.lower() | |
| for filter_value in filter_values: | |
| filter_value_lower = filter_value.lower() | |
| if filter_value_lower.startswith("-d"): | |
| filter_value_lower = filter_value_lower[2:] | |
| if "*" in filter_value_lower: | |
| if fnmatch.fnmatch(board_value_lower, filter_value_lower): | |
| return True | |
| elif board_value_lower == filter_value_lower: | |
| return True | |
| def _filter_value_matches(board_value: str, filter_values: list[str]) -> bool: | |
| board_value_lower = board_value.lower() | |
| for filter_value in filter_values: | |
| filter_value_lower = filter_value.lower() | |
| if filter_value_lower.startswith("-d"): | |
| filter_value_lower = filter_value_lower[2:].strip() | |
| if "*" in filter_value_lower: | |
| if fnmatch.fnmatch(board_value_lower, filter_value_lower): | |
| return True | |
| elif board_value_lower == filter_value_lower: | |
| return True |
🤖 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 `@ci/meson/discover_examples_all.py` around lines 93 - 103, The
_filter_value_matches helper does not trim whitespace after removing the -d
prefix, so space-separated filters like "-d esp32s3" fail to match in both the
exact and wildcard branches. Update the filter handling in _filter_value_matches
to strip surrounding whitespace immediately after dropping the "-d" prefix, then
continue using the normalized value for the fnmatch and equality checks.
| excluded_dirs = {".build", ".fbuild", ".pio", ".vscode", "build", "fastled_js"} | ||
| extra_cpps = sorted( | ||
| f | ||
| for f in example_dir.rglob("*.cpp") | ||
| if f.name != f"{example_name}.ino" and ".build" not in f.parts | ||
| if not f.name.endswith(".ino.cpp") | ||
| and all(part not in excluded_dirs for part in f.parts) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Filter against the example-relative path, not the absolute checkout path.
f.parts includes every ancestor of the repository. If the checkout lives under build/, .pio/, .build/, etc., this predicate excludes every extra .cpp file and the wrapper silently misses required sources. Scope the check to f.relative_to(example_dir).parts instead.
Suggested fix
extra_cpps = sorted(
f
for f in example_dir.rglob("*.cpp")
if not f.name.endswith(".ino.cpp")
- and all(part not in excluded_dirs for part in f.parts)
+ and all(
+ part not in excluded_dirs
+ for part in f.relative_to(example_dir).parts
+ )
)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| excluded_dirs = {".build", ".fbuild", ".pio", ".vscode", "build", "fastled_js"} | |
| extra_cpps = sorted( | |
| f | |
| for f in example_dir.rglob("*.cpp") | |
| if f.name != f"{example_name}.ino" and ".build" not in f.parts | |
| if not f.name.endswith(".ino.cpp") | |
| and all(part not in excluded_dirs for part in f.parts) | |
| excluded_dirs = {".build", ".fbuild", ".pio", ".vscode", "build", "fastled_js"} | |
| extra_cpps = sorted( | |
| f | |
| for f in example_dir.rglob("*.cpp") | |
| if not f.name.endswith(".ino.cpp") | |
| and all( | |
| part not in excluded_dirs | |
| for part in f.relative_to(example_dir).parts | |
| ) |
🤖 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 `@ci/wasm_build.py` around lines 831 - 836, The extra source filtering in the
example scan is using the full path from Path.parts, so checkout directories
like build or .pio can wrongly exclude every .cpp file. Update the predicate in
the extra_cpps collection to inspect the example-relative path from
f.relative_to(example_dir).parts instead, keeping the exclusion set in the
existing wasm_build.py source discovery logic intact.
| else if (n == "PARLIO") opts.mBus = fl::Bus::FLEX_IO; | ||
| else if (n == "SPI") opts.mBus = fl::Bus::SPI; | ||
| else if (n == "I2S") opts.mBus = fl::Bus::I2S; | ||
| else if (n == "I2S_SPI") opts.mBus = fl::Bus::I2S_SPI; | ||
| else if (n == "LCD_RGB") opts.mBus = fl::Bus::LCD_RGB; | ||
| else if (n == "LCD_SPI") opts.mBus = fl::Bus::LCD_SPI; | ||
| else if (n == "LCD_CLOCKLESS") opts.mBus = fl::Bus::LCD_CLOCKLESS; | ||
| else if (n == "I2S") opts.mBus = fl::Bus::FLEX_IO; | ||
| else if (n == "I2S_SPI") opts.mBus = fl::Bus::FLEX_IO; | ||
| else if (n == "LCD_RGB") { opts.mBus = fl::Bus::FLEX_IO; opts.mBusWhich = 1; } | ||
| else if (n == "LCD_SPI") opts.mBus = fl::Bus::FLEX_IO; | ||
| else if (n == "LCD_CLOCKLESS") opts.mBus = fl::Bus::FLEX_IO; | ||
| else if (n == "UART") opts.mBus = fl::Bus::UART; | ||
| else if (n == "FLEX_IO") opts.mBus = fl::Bus::FLEX_IO; | ||
| else if (n == "OBJECT_FLED") opts.mBus = fl::Bus::OBJECT_FLED; | ||
| else if (n == "LPUART") opts.mBus = fl::Bus::LPUART; | ||
| else if (n == "FLEX_IO") { opts.mBus = fl::Bus::FLEX_IO; opts.mBusWhich = 1; } | ||
| else if (n == "OBJECT_FLED") opts.mBus = fl::Bus::FLEX_IO; | ||
| else if (n == "LPUART") opts.mBus = fl::Bus::UART; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Don’t map I2S_SPI / LCD_SPI into a clockless FLEX_IO channel.
These channels are still built from timing_config.timing, so isSpi() stays false. Downstream busDriverName(Bus::FLEX_IO, ..., false) resolves to "I2S" / "LCD_CLOCKLESS", not the requested SPI driver name, so the explicit pinning misses the enabled driver and falls back to AUTO selection. Either reject those SPI-only names in this path or build an SPI ChannelConfig for them.
🤖 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 `@examples/AutoResearch/AutoResearchRemoteRunParallelTest.cpp` around lines 228
- 238, The bus selection logic in AutoResearchRemoteRunParallelTest::parse
should not map I2S_SPI or LCD_SPI to FLEX_IO, because those names still need SPI
semantics and currently resolve to the wrong driver name during pin matching.
Update the parsing branch that sets opts.mBus and opts.mBusWhich so these
SPI-only cases are either rejected here or converted into a proper SPI
ChannelConfig, and keep the existing FLEX_IO mappings only for the clockless
variants like I2S and LCD_CLOCKLESS.
| static void registerWithManager() FL_NO_EXCEPT { | ||
| ChannelManager::instance().addDriver(default_bus_priority(Bus::I2S_SPI), instancePtr()); | ||
| ChannelManager::instance().addDriver(default_bus_priority(Bus::FLEX_IO, 0), instancePtr()); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
registerWithManager() now demotes the I2S-SPI path below the legacy contract.
default_bus_priority(Bus::FLEX_IO, 0) is the generic FLEX_IO baseline (4), but this driver still has an explicit ESP32 priority of 10 in src/platforms/esp/32/drivers/channel_manager_esp32.cpp.hpp. That means the opt-in path can now register this engine below other SPI-capable drivers such as SPI_UNIFIED (5), so enableDrivers<Bus::FLEX_IO, 0>()/enableAllDrivers() can pick a different backend than the legacy path. Please preserve the concrete ESP32 priority here instead of the shared FLEX_IO default.
🤖 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/drivers/i2s_spi/bus_traits.h` around lines 44 - 45,
`registerWithManager()` is now using the shared FLEX_IO baseline instead of the
ESP32-specific I2S-SPI priority, which can cause this backend to register too
low and lose selection to other SPI drivers. Update the `registerWithManager()`
path in `bus_traits.h` to preserve the concrete ESP32 priority used for this
driver (matching the explicit priority in `channel_manager_esp32.cpp.hpp`)
rather than calling `default_bus_priority(Bus::FLEX_IO, 0)`, so
`enableDrivers<Bus::FLEX_IO, 0>()` and `enableAllDrivers()` continue to prefer
the intended engine.
| namespace detail { | ||
| struct LcdCamBusHolder { | ||
| fl::shared_ptr<IChannelDriver> spi; | ||
| fl::shared_ptr<IChannelDriver> clockless; | ||
|
|
||
| static Driver& instance() FL_NO_EXCEPT { return *instancePtr(); } | ||
|
|
||
| static void registerWithManager() FL_NO_EXCEPT { | ||
| ChannelManager::instance().addDriver(default_bus_priority(Bus::LCD_SPI), instancePtr()); | ||
| } | ||
| LcdCamBusHolder() FL_NO_EXCEPT | ||
| : spi(createLcdSpiEngine()), | ||
| clockless(createLcdClocklessEngine()) {} | ||
| }; | ||
|
|
||
| template<> struct BusSupports<Bus::LCD_SPI, SpiChipsetConfig> : fl::true_type {}; | ||
| inline detail::LcdCamBusHolder& lcd_cam_bus_holder() FL_NO_EXCEPT { | ||
| static detail::LcdCamBusHolder gHolder; | ||
| return gHolder; | ||
| } | ||
| } // namespace detail | ||
|
|
||
| template<> struct BusTraits<Bus::LCD_CLOCKLESS> { | ||
| template<> struct BusTraits<Bus::FLEX_IO, 0> { | ||
| using Driver = IChannelDriver; | ||
|
|
||
| static fl::shared_ptr<Driver> instancePtr() FL_NO_EXCEPT { | ||
| static fl::shared_ptr<Driver> gHolder = createLcdClocklessEngine(); | ||
| return gHolder; | ||
| return detail::lcd_cam_bus_holder().clockless; | ||
| } | ||
|
|
||
| static Driver& instance() FL_NO_EXCEPT { return *instancePtr(); } | ||
|
|
||
| static void registerWithManager() FL_NO_EXCEPT { | ||
| ChannelManager::instance().addDriver(default_bus_priority(Bus::LCD_CLOCKLESS), instancePtr()); | ||
| auto& holder = detail::lcd_cam_bus_holder(); | ||
| ChannelManager::instance().addDriver(default_bus_priority(Bus::FLEX_IO, 0), holder.spi); | ||
| ChannelManager::instance().addDriver(default_bus_priority(Bus::FLEX_IO, 0), holder.clockless); | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
Use one LCD_CAM driver for the shared FLEX_IO slot.
This registers separate SPI and clockless engines for the same LCD_CAM peripheral, while instancePtr() exposes only clockless. Any path using BusTraits<Bus::FLEX_IO, 0>::instancePtr() cannot get the SPI half. Prefer a single driver/adapter whose canHandle() and show() route on isSpi() vs isClockless().
As per path instructions, parallel-IO peripherals must use a single unified ChannelEngine for both clockless and SPI modes.
🤖 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/drivers/lcd_spi/bus_traits.h` around lines 38 - 67, The
FLEX_IO bus trait is registering two separate drivers for the same LCD_CAM slot,
while instancePtr() only exposes the clockless one, so the shared peripheral is
split incorrectly. Update BusTraits<Bus::FLEX_IO, 0> and the
LcdCamBusHolder/lcd_cam_bus_holder setup to use one unified driver or adapter
for both SPI and clockless modes, and have registerWithManager() register that
single ChannelEngine instead of separate spi and clockless engines. Ensure the
unified driver’s canHandle() and show() dispatch appropriately based on isSpi()
versus isClockless().
Source: Path instructions
| // Verify Channel::create<Bus::BIT_BANG>(cfg) and FastLED.add<Bus::BIT_BANG>(cfg) | ||
| // on the host build (FL_IS_STUB). Tests run against the real BIT_BANG driver — |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Use ASCII-only punctuation in this C++ comment.
Line 347 introduces a non-ASCII em dash, which violates the repository’s C++ source-text rule. Replace it with plain ASCII punctuation (for example --). As per path instructions, "ASCII-only in C++/hpp/cpp.hpp files (no emoji / non-ASCII glyphs in code comments or string literals)".
🤖 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 `@tests/fl/channels/channel.cpp` around lines 346 - 347, Update the comment in
the Channel test near Channel::create<Bus::BIT_BANG>(cfg) and
FastLED.add<Bus::BIT_BANG>(cfg) to use ASCII-only punctuation; replace the
non-ASCII em dash in the sentence about the real BIT_BANG driver with a plain
ASCII equivalent such as "--" so the C++ source-text rule is satisfied.
Source: Path instructions
Summary
Closes #3439 — implements the portable, capability-based
Busenum migration.The 15-value vendor-named enum (
RMT/PARLIO/I2S/I2S_SPI/LCD_RGB/LCD_SPI/LCD_CLOCKLESS/OBJECT_FLED/FLEX_IO/LPUART/UART/SPI/BIT_BANG/STUB/AUTO) is replaced by 9 portable engine-type values:Per-platform instance selection moves to a separate
Whichtemplate parameter (default0).New surface (all per the issue's binding contract)
src/fl/channels/bus_features.h— zero-fillsFASTLED_HAS_*macros so feature-detection chains compile uniformly.src/fl/channels/bus_info.h—DeviceInfo/DeviceRuntimestructs +deviceInfo<B, Which>()primary template (no-op fallback) + per-platform(B, Which)specializations.src/fl/channels/bus_info.json.h— opt-in JSON adapter for AutoResearch (only linksfl::jsonwhen explicitly called).src/fl/channels/bus_info_impl.cpp.hpp— unity-build anchor.BusInstanceCount<B>trait +busName(b, which)/busDriverName(b, which, spi)helpers inbus.h.tests/fl/channels/bus_info.cpp—FL_STATIC_ASSERTon instance counts per platform + runtime no-op fallback check + JSON round-trip.Rollout — single breaking swap
Per the issue's rollout section: no deprecation aliases, no transition window. All callers (sketches, examples, tests, internal
BusTraits<>registrations) flip to the new enum in this same commit. Sketches inexamples/AutoResearch/that referencedBus::OBJECT_FLED/Bus::PARLIO/Bus::LCD_SPI/Bus::I2S_SPI/Bus::STUB/Bus::LPUARTare updated to the portable names.Compliance with #3428 (unified clockless+SPI engine rule)
Bus::X_SPIenum value for any peripheral with aBus::Xclockless mode.ChannelEngineXxxSPIclass added.Bus::FLEX_IOis the single engine-class name for any parallel-IO peripheral; per-mode dispatch happens at show-time inside the channel engine, not at the enum layer.Validation
bash test --cpp --clean— 338/338 passed (93s wall clock).bash compile wasm --examples Blink— pass.bash lint— pass, no new warnings.bash compile esp32s3 --examples Blink— running on push.Notes
2.3.14(inpyproject.toml) to pull in the serial-WebSocket and async-timeout fixes needed for the AutoResearch validation pass.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Documentation