Repository navigation
fix(channels): emit FL_ERROR when queued data has no enabled driver (Closes #2517) - #2795
Conversation
…er (Closes #2517) Before this change, a channel with a bound driver that had been disabled (e.g. by FastLED.setExclusiveDriver<OtherBus>()) would enqueue data to that driver every frame, but ChannelManager::onEndFrame() iterates only ENABLED drivers when calling show(), so the frame was silently dropped on the floor with no diagnostic. This was the silent-failure mode that the ESP32-P4 PARLIO no-output bug (#2515) surfaced. Adds ChannelManager::driverStatus(name) — a silent tri-state lookup (NOT_REGISTERED / DISABLED / ENABLED) — and ChannelManager:: exclusiveDriverName() accessor. Channel::showPixels() consults these immediately before driver->enqueue() and: - On DISABLED: emits a one-shot FL_ERROR naming the channel, the bound driver, the active exclusive-driver setting, and the FastLED.enableDrivers<>() / FastLED.enableAllDrivers() remediation, then skips the enqueue (the data wouldn't be transmitted anyway). - On ENABLED (happy path): clears the one-shot latch so a later disable re-emits the diagnostic, then enqueues as before. - On NOT_REGISTERED: enqueues as before (preserves the historic behaviour for custom drivers that bypass the manager). The mDisabledDriverWarned latch keeps the diagnostic from spamming once per frame — it fires once per disable event per channel. Three regression tests added to tests/fl/channels/channel.cpp: - "[#2517] Disabled driver: enqueue is suppressed" — reproduces the setExclusiveDriverByName("DOES_NOT_EXIST") silent-drop scenario and asserts the driver's enqueue count stops growing. - "[#2517] Normal flush path does NOT trigger the silent-drop FL_ERROR" — three happy-path frames, all enqueue. - "[#2517] Re-enabling the driver resumes enqueue and re-arms the latch" — covers the disable -> enable -> disable cycle. 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 (5)
📝 WalkthroughWalkthroughThis PR addresses issue ChangesDisabled Driver Diagnostic
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 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)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Infer (1.2.0)tests/fl/channels/channel.cpptests/fl/channels/channel.cpp:5:10: fatal error: 'FastLED.h' file not found ... [truncated 1058 characters] ... stall/lib/clang/18/include" Warning Review ran into problems🔥 ProblemsStopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a 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 |
…astLED#2773) The esp32dev_binary_size workflow had been pinned to --backend platformio (PR FastLED#2605) and the budget bumped 330000 -> 700000 (PR FastLED#2790) to dodge two fbuild deficiencies — fbuild#297 (no build_info.json emitter) and fbuild#304 (framework objects not archived). Both upstream issues are fixed in fbuild 2.2.10+ (we pin 2.2.17), so restore both: - build_template_binary_size.yml: drop the three --backend platformio flags so ci.ci-compile defaults to fbuild and we get .eh_frame stripping back on every size workflow (~169KB on esp32dev). - check_esp32_size.yml: revert max_size/max_size_apa102 to the historical 330000 high-water mark. The test will fail at this ceiling — that is the regression signal the user asked for ("minimal memory size... goal is complete when the esp size test is failing again with its historical high water mark"). Also fix a master-blocking compile error introduced by FastLED#2795: the new enum class DriverStatus { DISABLED, ENABLED } in fl/channels/manager.h is textually rewritten by Arduino-ESP32's `#define DISABLED 0x00` (esp32-hal-gpio.h:59) at every site that includes Arduino.h before manager.h — which is every esp32 sketch. The platformio-backend CI is failing for the same reason (`esp32dev_binary_size` red on every push). Rename to STATUS_DISABLED/STATUS_ENABLED and update the four callers in channel.cpp.hpp, manager.cpp.hpp, and tests/fl/channels/channel.cpp. Local verification: fbuild build of examples/Blink on esp32dev succeeds, emits build_info_Blink.json (with tool aliases the symbol_analysis pipeline needs), and ci-check-compiled-size.py reports "esp32dev size 640228 is greater than max size 330000" — the expected regression signal. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Closes #2517
Silent-failure scenario
Before this change, a channel whose bound driver got disabled at runtime
(typically by
FastLED.setExclusiveDriver<OtherBus>()orsetDriverEnabled(name, false)) would still calldriver->enqueue()everyframe — but
ChannelManager::onEndFrame()only iterates enabled driverswhen invoking
show(), so the queued bytes were dropped on the floor withno diagnostic. This is the silent-failure mode the ESP32-P4 PARLIO
no-output bug (#2515) surfaced.
What changed
src/fl/channels/manager.{h,cpp.hpp}— added two diagnostic accessors:ChannelManager::driverStatus(name)returns a tri-stateNOT_REGISTERED/DISABLED/ENABLEDwith no logging on miss(companion to the existing
findDriverByName()silent lookup).ChannelManager::exclusiveDriverName()returns the currentsetExclusiveDriver(...)selection (or empty if none).src/fl/channels/channel.{h,cpp.hpp}—Channel::showPixels()nowconsults
driverStatus()immediately beforedriver->enqueue():DISABLED→ emit one-shotFL_ERRORnaming the channel, the bounddriver, the active exclusive-driver setting, and the
FastLED.enableDrivers<>()/FastLED.enableAllDrivers()remediation, then skip the enqueue (data would not transmit anyway).
ENABLED→ clear the one-shot latch (so a later disable re-emits thediagnostic), then enqueue as before.
NOT_REGISTERED→ enqueue as before (preserves behaviour for customdrivers that bypass the manager).
Channel::mDisabledDriverWarnedlatch prevents per-frame log spam —the FL_ERROR fires once per channel times disable event.
Tests added
Three regression tests in
tests/fl/channels/channel.cpp:[#2517] Disabled driver: enqueue is suppressed (would-be silent drop)—reproduces the issue scenario verbatim: enqueue →
setExclusiveDriverByName("DOES_NOT_EXIST")→ enqueue is suppressed.[#2517] Normal flush path does NOT trigger the silent-drop FL_ERROR—three consecutive happy-path frames, all enqueue (regression guard for
the "must not trigger on success" acceptance criterion).
[#2517] Re-enabling the driver resumes enqueue and re-arms the latch—covers the disable → enable → disable cycle so the one-shot latch is
proven to be re-armable.
Verification is behavioural — the project log macros don't have a capture
sink today, so each test asserts the fake driver's enqueue counter stops
growing on disable and resumes on enable.
Test plan
bash lint— passes (cpp + js + python)bash test channel --cpp— passes (includes the 3 new cases)bash test channel_manager --cpp— passes (regression guard)bash test --cpp— 309/309 tests pass🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes