Repository navigation
Conversation
…tem 3.5) The existing allocateTx / allocateRx return result<size_t, RmtMemoryError> — a sum type with discriminator + payload. At the 4 internal callers inside the RMT5 driver chain (ChannelEngineRMT::createChannel × 2, RmtRxChannelImpl::ctor + begin) the specific error code is never read; callers just log + return false on any failure. Add tryAllocateTx / tryAllocateRx wrappers returning bool + size_t out parameter. The result<>-bearing API is retained for callers that need error fidelity (tests, future callers, the public surface). Migrate the 4 internal sites to the new API. Mock RmtMemoryManager (rmt5_support_stubs.h) gets matching always-succeeds stubs so the host test build still links. Refs #2856 item 3.5. Estimated savings: small (call-site result<> constructor + .ok() + .value() decoded into bool check + out param read). Real win compounds with #2791 (FASTLED_LOG_VERBOSITY=0) and #2846 (FASTLED_RMT_STATIC_ALLOCATION=1) where the FL_WARN diagnostic chains already disappear.
|
Wondering what really moved? Review this PR in Change Stack to inspect semantic changes, definitions, and references. Caution Review failedPull request was closed or merged during review 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 adds status-code allocation variants ( ChangesRMT Memory Allocation API Refactoring
Possibly related PRs
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 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 |
|
Consolidating into single combined PR per /clud-pr workflow's 'one PR per task' rule. New PR will include this commit + #2861 + items 3.1/3.2/3.3. |
This is the consolidated PR for items 3.1, 3.2, 3.3, 3.5 of FastLED#2856. Item 3.6 already merged via FastLED#2861; item 3.4 was already in master before FastLED#2856 was filed (encoder is already a runtime virtual on IRMT5Peripheral::createEncoder). Item 3.1 — Cold-helper split of ChannelEngineRMTImpl::~dtor ============================================================ The destructor body (drain-wait + per-channel cleanup loop + FL_WARN timeout diagnostic + FL_LOG_RMT trailer) is a cold path — only reached at process end. Move it into an FL_NO_INLINE destructorCleanup() helper so its operator<< instantiations + the multi-line cleanup loop body don't contribute to icache footprint in the steady-state code that calls into the engine. Item 3.2 — FL_WARN_LIT / FL_LOG_LIT for literal-only sites ========================================================== Each FL_WARN(literal) bakes an fl::sstream + operator<< chain for the file/line prefix + the literal at every call site. For sites that pass nothing but a literal string, that's pure overhead vs a single fl::println call. Add FL_WARN_LIT(literal) / FL_LOG_LIT(literal) macros: route literal- only messages through fl::println directly, dropping the file/line prefix. The literal carries its own "[RMT]" prefix to partially compensate. The non-literal FL_WARN remains available for sites that need operator<< formatting or the file/line prefix. Migrates the destructor timeout warning as a first proof-of-concept. Other call sites can move to FL_WARN_LIT incrementally. Item 3.3 — Skip NetworkDetector under FASTLED_RMT_STATIC_ALLOCATION =================================================================== ChannelEngineRMT::createChannel calls NetworkDetector::isAnyNetworkActive() on every allocation to choose network-mode vs idle-mode buffer sizing. Under FASTLED_RMT_STATIC_ALLOCATION the user has asserted no network during LED transmission (per FastLED#2846), so this resolves to constexpr false. The linker then drops the NetworkDetector singleton + WiFi-state-reading chain from the binary. Item 3.5 — tryAllocateTx / tryAllocateRx status-code variants ============================================================= (Same as the closed FastLED#2862 — cherry-picked here for the single combined PR.) Adds bool-returning wrappers around the result<>-bearing allocateTx/allocateRx for the 4 internal callsites that don't need the specific error code. Result<>-bearing API retained for tests + public callers. Refs FastLED#2856. Closes the actionable scope of the meta; the deferred items (full Level B refactor, full printf backend, full static-bind addLeds<>) are independently large enough to deserve their own issues and aren't safe to land in one PR session.
Summary
Second PR against meta #2856. Implements item 3.5.
The existing `allocateTx` / `allocateRx` return `result<size_t, RmtMemoryError>` — a sum type with discriminator + payload. At the 4 internal callers inside the RMT5 driver chain (`ChannelEngineRMT::createChannel` × 2, `RmtRxChannelImpl::ctor` + `begin`) the specific error code is never read; callers just log + return false on any failure.
Add `tryAllocateTx` / `tryAllocateRx` wrappers returning `bool` + `size_t&` out parameter. The `result<>`-bearing API is retained for callers that need error fidelity (tests, future callers, the public surface).
Migrated the 4 internal sites to the new API. Mock `RmtMemoryManager` (`rmt5_support_stubs.h`) gets matching always-succeeds stubs so the host test build links.
Stack vs the rest of meta #2856
This is the second PR (after #2861, item 3.6). Status of the remaining items:
The clud-pr skill's "one PR per task" rule conflicts with #2856 being a meta covering 6 architecturally-separate items. The split chosen here: ship the bounded items (3.5, 3.6) immediately as their own PRs, defer the multi-day items (3.1, 3.2, 3.3) for explicit follow-up rather than landing speculative scaffolding.
Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit