Skip to content

perf(channel): gate emitDisabledDriverError diagnostic chain (#2950) - #2951

Merged
zackees merged 1 commit into
masterfrom
feat/2950-gate-disabled-driver-emit
Jun 7, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/2950-gate-disabled-driver-emit

Conversation

@zackees

@zackees zackees commented Jun 7, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Gates the "silent-drop" diagnostic in `Channel::showPixels` on `FASTLED_LOG_RUNTIME_ENABLED`.
  • In release builds (NDEBUG → `FASTLED_LOG_VERBOSITY=0` per perf(log): default FASTLED_LOG_VERBOSITY=0 in release builds (#2886 Stage 1) #2890), the empty `emitDisabledDriverError` body + the `ChannelManager::instance().exclusiveDriverName()` call + the 3-arg `fl::string` pass-by-const-ref chain + the `mDisabledDriverWarned` latch maintenance dead-strip.
  • The unconditional `return` on STATUS_DISABLED is preserved — release builds still drop the frame, just silently. Users opt into that by disabling logs.

Behavior matrix

Build status Behaviour
Debug DISABLED One-shot FL_ERROR emitted; frame dropped.
Debug ENABLED Latch reset; frame enqueued.
Release DISABLED Frame dropped silently.
Release ENABLED Frame enqueued.

Test plan

Closes #2950. Refs #2886.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor
    • Optimized conditional compilation of driver status diagnostics, making diagnostic behavior contingent on logging configuration settings.

The #2517 "silent-drop" diagnostic in `Channel::showPixels` exists
to help users debug `FastLED.setExclusiveDriver<>` flows where a
bound driver is currently disabled and the frame would be silently
dropped. In release builds (NDEBUG → FASTLED_LOG_VERBOSITY=0 per
#2890) every FL_ERROR site inside `emitDisabledDriverError` collapses
to `do { } while(0)`, leaving an empty function body — but the call
site is still live, so the linker keeps:

  - the empty `emitDisabledDriverError` body (3 fl::string&-args),
  - the `ChannelManager::instance().exclusiveDriverName()` getter
    (only reachable from this site),
  - the 3-argument fl::string pass-by-const-ref chain at the call
    site,
  - the `mDisabledDriverWarned` reads/writes.

Gate the diagnostic emission and the one-shot latch maintenance on
`FASTLED_LOG_RUNTIME_ENABLED`. The unconditional `return` on
STATUS_DISABLED is preserved — release still drops the frame, just
silently (the user accepted that constraint by disabling logs).

Same dead-strip cascade pattern as #2918 / #2925 / #2943.

Refs #2886.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Jun 7, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c284c619-3d19-4069-9fc3-d361b8c08e52

📥 Commits

Reviewing files that changed from the base of the PR and between d6dc670 and ce5bc26.

📒 Files selected for processing (1)
  • src/fl/channels/channel.cpp.hpp

📝 Walkthrough

Walkthrough

Channel::showPixels() conditionally gates the "driver disabled" diagnostic emission and one-shot latch updates behind FASTLED_LOG_RUNTIME_ENABLED, allowing the error helper and supporting calls to dead-strip from release builds while preserving the early return for correctness.

Changes

Driver-disabled diagnostic gating

Layer / File(s) Summary
Gate disabled-driver diagnostic and latch
src/fl/channels/channel.cpp.hpp
When driverStatus() reports STATUS_DISABLED, the emitDisabledDriverError() call and mDisabledDriverWarned latch update are wrapped in #if FASTLED_LOG_RUNTIME_ENABLED. When STATUS_ENABLED, resetting the latch is also gated. The early return on disabled status remains unconditional.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related issues

  • #2931: Also modifies Channel::showPixels to gate event-firing in the same function, complementary diagnostic dead-stripping.
  • #2517: Related to channel-level disabled-driver diagnostic behavior and mDisabledDriverWarned handling.
  • #2913: Modifies Channel::showPixels with different conditional compilation gates (FASTLED_DISABLE_SPI_CHIPSETS), sharing the same function checkpoint.

Possibly related PRs

  • FastLED/FastLED#2851: Directly overlaps in the same disabled-driver code path of Channel::showPixels, gating diagnostic/latch behavior.
  • FastLED/FastLED#2795: Modifies the same mDisabledDriverWarned one-shot handling and STATUS_DISABLED pre-enqueue path in Channel::showPixels().

Poem

🐰 A gate was placed with care and grace,
To quiet the logs in release's space—
The latch stays home, the return stays true,
Dead-stripping bytes, a bloat-busting brew!
Hops away with savings

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title clearly specifies the performance optimization (gating diagnostic chain) and references issue #2950, directly matching the PR's primary objective.
Linked Issues check ✅ Passed Changes wrap diagnostic emission and latch maintenance in FASTLED_LOG_RUNTIME_ENABLED conditionals; preserve unconditional return on STATUS_DISABLED for correct frame dropping; and maintain debug behavior per #2950 requirements.
Out of Scope Changes check ✅ Passed All modifications are scoped to the diagnostic gating requirement in Channel::showPixels; no field removals, API changes, or unrelated alterations present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/2950-gate-disabled-driver-emit

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 and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Gate emitDisabledDriverError diagnostic chain in release builds (~300-800 B)

1 participant