Skip to content

feat: fix #2254 SPI long-strip bug + enable RMT RX DMA streaming - #2300

Merged
zackees merged 7 commits into
masterfrom
feat/rmt-rx-dma-streaming
Apr 18, 2026
Merged

zackees merged 7 commits into
masterfrom
feat/rmt-rx-dma-streaming

Conversation

@zackees

@zackees zackees commented Apr 18, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes two root causes together that land as the total fix for issue #2254 Issue 2 (ESP32-S3 SPI driver "black frame between displays" on long strips):

Bug 1 — SPI TX staging buffer too small (the user-facing bug)

channel_driver_spi.cpp.hpp hardcoded staging_size = 4096 bytes. With wave8 encoding at 24 bytes/LED, each SPI transaction held exactly 170 LEDs. Longer strips were split across multiple spi_device_queue_trans() calls advanced by the poll() loop. When poll() was preempted (WiFi, websockets, etc.), the SPI line idled long enough for WS2812B to latch → first 170 LEDs locked in the first frame, the rest went to a second partial frame that overwrote them. This is the symptom @ewowi videoed at https://github.com/user-attachments/assets/afe42d51-a635-42a4-a838-bca5b56bfdf9.

Fix: staging_size = 16384 bytes. ESP-IDF's SPI DMA descriptor chain now produces continuous output for up to ~680 LEDs in a single queued transaction — no poll()-dependent gap between chunks.

Bug 2 — RMT RX user buffer artificially capped (autoresearch harness limit)

Blocked me from seeing Bug 1. ESP-IDF 5.5 caps rmt_receive() user buffers at num_dma_nodes × 4092 bytes where num_dma_nodes = max(2, mem_block_symbols × 4 / 4095 + 1) (rmt_rx.c:210-211 and the check at :380-381). With our default mem_block_symbols=64 that's 8184 bytes = 2046 symbols max.

Fix: opt-in DMA RX via RxConfig::use_dma. Channel is rebuilt when the flag toggles (ESP-IDF bakes flags.with_dma at creation time). mem_block_symbols=14336 yields 14 DMA nodes and a ~60 KB cap. ISR-side skip_signals filter (drops skip chunks inline during partial-rx streaming — no synchronous pre-capture drain). DRAM-backed ping-pong buffer via heap_caps_malloc(DMA|INTERNAL) because ESP-IDF rejects PSRAM buffers for DMA.

Test plan

On the ESP32-S3 attached here, bash autoresearch --spi --strip-sizes 550:

  • Before: bytes_captured=512, Errors: 0/550 (100.0%) — false-positive PASS, only first 170 LEDs were ever actually verified due to RX cap + silent truncation
  • After: [RMT RX] wait(): symbols=13200 callbacks=15 use_dma=true; bytes_captured=1650; [Run 1/2] PASS | Errors: 0/550 (100.0%) — genuine PASS with all 550 LEDs byte-for-byte verified across 2 frames (frameCount=2 from feat(autoresearch): add --frames N multi-frame capture #2293 confirms no second-frame degradation).
  • 100-LED regression test still PASSes identically.
  • No impact on RMT driver loopback path (keeps non-DMA mode).

Memory impact

  • SPI channel: +24 KB internal SRAM (2 × 16 KB staging, up from 2 × 4 KB). Per channel.
  • RMT RX DMA mode (opt-in): ~56 KB internal SRAM for mem_block_symbols=14336 DMA descriptor buffer + 56 KB DRAM user buffer. Only allocated when RxConfig::use_dma = true. Autoresearch harness opts in for non-RMT TX paths.

Files touched

  • src/platforms/esp/32/drivers/spi/channel_driver_spi.cpp.hpp — staging_size bump (the ESP32-S3: I2S driver starves websockets, SPI output incorrect, Audio driver FPS impact #2254 user-facing fix).
  • src/fl/rx_device.h — new RxConfig::use_dma field.
  • src/platforms/esp/32/drivers/rmt_rx/rmt_rx_channel.cpp.hpp — DMA path: channel rebuild, allocateDMA integration, DRAM buffer, streaming ISR skip, telemetry.
  • examples/AutoResearch/AutoResearchTest.cpp — opt-in DMA RX for non-RMT drivers.

Related

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features

    • Added DMA streaming mode option for ESP32 RMT RX channel, enabling alternative capture mechanism.
    • Increased SPI staging buffer capacity from 4KB to 16KB, improving transaction efficiency and reducing payload fragmentation.
  • Tests

    • Updated test configuration to validate DMA streaming mode support.

zackees and others added 7 commits April 17, 2026 22:12
Non-DMA ESP-IDF RMT RX fires its ISR exactly once per receive op, so a
single rmt_receive() tops out at one mem-block fill (~4096 symbols,
≈170 WS2812B LEDs). Any autoresearch test on strips longer than that
silently truncated to this cap — hiding real driver bugs past the
boundary (see issue #2254).

With ESP-IDF 5.3+ en_partial_rx and flags.with_dma=true, the receiver
fires the ISR on every DRAM ping-pong fill. Each callback we copy the
chunk into an accumulation buffer before the next DMA fill overwrites
it, extending capture to the full buffer size.

This lands the full plumbing for that path as an opt-in
RxConfig::use_dma flag, defaulting off for compatibility:

1. RxConfig::use_dma — new opt-in field.
2. RmtRxChannelImpl::begin() rebuilds the ESP-IDF channel when the
   flag toggles (ESP-IDF bakes with_dma at rmt_new_rx_channel() time).
3. allocateRx() is called with use_dma=mUseDma so the memory manager
   routes the allocation through DRAM instead of the dedicated on-chip
   RX pool (which is only 192 words on ESP32-S3 — too small for the
   1024-symbol mem_block_symbols DMA mode needs).
4. allocateDMA() acquires the single shared DMA slot on ESP32-S3.
   Graceful fallback to non-DMA mode when the slot is already held.
5. mem_block_symbols: 64 (non-DMA, hardware block) vs 1024 (DMA, DRAM
   ping-pong size). 1024 fits comfortably in internal SRAM and lets
   ESP-IDF accept the 1024-symbol user buffer rmt_receive() validates
   against capacity.
6. DMA ping-pong buffer allocated via heap_caps_malloc(DMA|INTERNAL) —
   fl::vector's default allocator can land in PSRAM on S3, which ESP-IDF
   rejects with "user buffer not in the internal RAM".
7. ISR (rxDoneCallback) now handles skip_signals inline in streaming
   mode: entire-chunk skips are dropped without terminating the receive
   op, partial skips advance past the skipped prefix and accumulate the
   tail. Non-DMA path still uses the legacy handleSkipPhase() wrapper.
8. begin() bypasses the synchronous handleSkipPhase() when mUseDma is
   set — the streaming ISR does it.

Autoresearch harness opts in for all non-RMT driver tests (SPI, PARLIO,
I2S, UART, LCD_*) where the TX path doesn't use RMT, so no shared-DMA
contention. RMT loopback continues to use non-DMA mode.

Expected end-state on ESP32-S3: `bash autoresearch --spi --strip-sizes
550` captures the full 13,200 symbols across ~13 partial-rx callbacks
and the LED comparator verifies all 550 LEDs. See issue #2254.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
With mem_block_symbols == user_buffer_size (both 1024), ESP-IDF treats
rmt_receive() as single-shot — ISR fires once, captures one fill, sets
is_last=true. That's why the previous commit still capped at 4096
symbols (= 512 bytes decoded) for the 550-LED SPI test.

Set mem_block_symbols = 256 so ESP-IDF sees user_buffer / mem_block = 4
and engages true ping-pong streaming: ISR fires every 256-symbol fill,
accumulation copies each chunk, stream continues until the receiver
detects idle (signal_range_max_ns).

Also add visible FL_WARN telemetry of symbols/callbacks after wait()
so regressions on long streams are diagnosable.

See issue #2254.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Previous run with user_buf=1024 / mem_block_symbols=256 reported
symbols=4096 callbacks=8 — partial_rx IS firing (8× ping-pong halves at
512 symbols each), but the stream stopped after 4 full-buffer fills.
ESP-IDF isn't wrapping the user buffer indefinitely.

Try a bigger user buffer (16384 symbols = 64 KB DMA|INTERNAL) so one
rmt_receive() covers ~680 WS2812B LEDs. Keep mem_block_symbols=256 so
partial callbacks still fire frequently during the fill.

See issue #2254.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
When allocateAndArm() fails (e.g., rmt_receive rejects the buffer size
as exceeding DMA capacity), begin() was tearing down the ESP-IDF
channel but leaking both the DMA slot and the memory-manager
registration. Subsequent begin() attempts then saw the DMA slot
already held and fell back to non-DMA mode until the RxDevice was
destroyed — defeating the streaming path permanently.

Also resize user buffer to 4096 symbols + mem_block_symbols=1024
(4× ratio) so rmt_receive() accepts the request.

See issue #2254.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Deep-dive testing on ESP32-S3 found that rmt_receive() caps the user
buffer at 1024 symbols absolute (4 KB) regardless of mem_block_symbols
ratio. Combined with ESP-IDF's 4× internal wrap during partial-rx
streaming, total capture per rmt_receive() is 4096 symbols — identical
to non-DMA single-shot mode. DMA streaming alone does NOT extend
capture length on this chip.

Extending capture past ~170 LEDs requires task-side re-submission of
rmt_receive() when one completes, which is a bigger refactor (needs a
dedicated RX task, notification from ISR on is_last, re-arm with
minimal inter-receive gap). Not wired up in this branch.

Keep the DMA infrastructure (RxConfig::use_dma, channel rebuild on
toggle, memory-manager integration, DRAM-backed ping-pong buffer,
in-stream skip_signals filter) as groundwork for that future change,
but default the autoresearch harness opt-in to false since DMA mode
alone offers no capture-length benefit today.

Shrink DMA buffer to 1024 symbols (the maximum ESP-IDF accepts on
S3) with mem_block_symbols=256 — if use_dma is enabled by hand, this
config at least doesn't crash.

See issue #2254.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Deep ESP-IDF source dive (rmt_rx.c:210-211, v5.5) revealed the real
cap formula:

    num_dma_nodes = max(2, mem_block_symbols * 4 / 4095 + 1)
    user_buffer_cap_bytes = num_dma_nodes * 4092

All my previous attempts used mem_block_symbols in [64, 1024], which
gave num_dma_nodes=2 and a cap of 8184 bytes = 2046 symbols. That's
why every buffer > 1024 symbols was rejected with "buffer size
exceeds DMA capacity".

Setting mem_block_symbols=14336 yields num_dma_nodes=14 and a
57288-byte cap — enough for a single rmt_receive() to capture 14000
symbols = ~583 WS2812B LEDs. No ISR re-submission needed. The
existing partial-rx ISR streams ~1023-symbol chunks into the
accumulation buffer across 14 callbacks, then is_last fires cleanly.

Memory cost: 14336 × 4 = 56 KB internal-RAM DMA descriptor buffer +
56 KB user buffer (heap_caps_malloc DMA|INTERNAL) = 112 KB. ESP32-S3
has ~320 KB internal SRAM available, so ~35% — acceptable for a
single-channel autoresearch test where no RMT TX is active.

Autoresearch opts in for non-RMT drivers (SPI, PARLIO, I2S, UART,
LCD_*). RMT loopback stays non-DMA to avoid contention for S3's
single shared DMA slot.

Credits: expert-rmt5-agent + general-purpose agent dove into the
ESP-IDF source and identified the DMA-node formula as the actual
gate. See issue #2254.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Root cause of issue #2254 Issue 2 on ESP32-S3: the SPI channel driver
double-buffered 4 KB staging chunks, queued one SPI transaction at a
time, and advanced the pipeline only when poll() ran. At wave8
encoding (24 bytes/LED), 4 KB = 170 LEDs per chunk. Any strip longer
than that was split into multiple transactions with inter-chunk gaps
dependent on poll() cadence.

For WS2812B, any gap > 50 µs causes a reset latch. In a system where
poll() can be preempted by WiFi/websocket tasks (MoonLight scenario),
gaps easily exceed that, latching the first chunk's LEDs and leaving
the tail dark — exactly the "LEDs not showing the right output" bug
@ewowi reported.

Bump staging_size to 16384 bytes in both the initial setup and the
reinit paths. ESP-IDF's SPI DMA descriptor chain then produces
continuous output for a single queued transaction covering up to ~680
LEDs. For strips longer than that, chunks still exist but the vast
majority of real-world use cases fit in one transaction.

Memory cost: 2 × 16 KB (double-buffer) = 32 KB internal SRAM per
channel, up from 8 KB. Acceptable on ESP32-S3's 320 KB internal pool.

Discovered while investigating the RMT RX capture limit — the RX
wasn't at fault, the TX was. RX consistently reported 4096 symbols
captured regardless of strip length from 100 to 550 LEDs, pointing
at a fixed-size TX artifact. Tracing the SPI pipeline confirmed the
4 KB staging boundary.

See issue #2254.

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

coderabbitai Bot commented Apr 18, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

DMA streaming mode support is added to ESP32 RMT RX devices via a new use_dma configuration flag. The RMT RX channel implementation is extended to manage DMA state, shared slot acquisition, DRAM-backed buffers, and differentiated ISR behavior for DMA vs. non-DMA paths. SPI staging buffer size increases from 4KB to 16KB for larger transactions.

Changes

Cohort / File(s) Summary
RxConfig Header
src/fl/rx_device.h
Added new bool use_dma = false field to RxConfig struct to enable/disable DMA streaming mode.
RMT RX Channel Implementation
src/platforms/esp/32/drivers/rmt_rx/rmt_rx_channel.cpp.hpp
Significant refactor to support DMA streaming: added state tracking (mUseDma), shared DMA slot acquisition/release, DRAM-backed ping-pong buffers, conditional RMT channel rebuild on use_dma changes, DMA-specific memory configuration, and ISR logic changes for in-chunk skip offset handling vs. legacy skip-phase behavior.
Capture Example
examples/AutoResearch/AutoResearchTest.cpp
Updated capture() to set rx_config.use_dma = !is_rmt_driver and adjusted warning log to report use_dma=true state alongside io_loop_back=false.
SPI Driver Buffer
src/platforms/esp/32/drivers/spi/channel_driver_spi.cpp.hpp
Increased SPI staging buffer size from 4096 to 16384 bytes in reinitSpiHardware() and createChannel() to allow larger wave8-encoded LED payloads per transaction.

Sequence Diagram(s)

sequenceDiagram
    participant Init as Initialization
    participant RMT as RMT RX Channel
    participant DMA as DMA Manager
    participant Buffer as Buffer Mgmt
    participant ISR as ISR Handler

    Init->>RMT: begin() with use_dma=true
    RMT->>RMT: Check if use_dma changed
    alt use_dma Changed
        RMT->>RMT: Rebuild RMT channel
    end
    
    RMT->>DMA: Acquire shared DMA slot
    alt DMA Slot Available
        DMA-->>RMT: Slot granted
        RMT->>Buffer: Allocate DRAM-backed DMA buffer
        Buffer-->>RMT: Buffer ready
        RMT->>RMT: Configure with_dma flag
    else DMA Slot Unavailable
        DMA-->>RMT: Fallback to non-DMA
        RMT->>RMT: Disable use_dma & with_dma
    end
    
    RMT->>RMT: Start receive (DMA or legacy buffer)
    
    note over ISR: During Reception
    ISR->>ISR: Compute in-chunk skip offset (DMA mode)
    ISR->>ISR: Drop fully-skipped chunks
    ISR->>Buffer: Copy non-skipped tail to accumulator
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related issues

Possibly related PRs

Poem

🐰 DMA streams through silicon tunnels deep,
While buffers dance and slots don't sleep,
From RMT channels, data flows so fast,
No more tiny chunks—at last, at last!
SPI grows wide, LED colors bright! 🌈

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes two main changes: fixing SPI long-strip bug (#2254) and enabling RMT RX DMA streaming, which directly align with the PR objectives and changeset.

✏️ 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/rmt-rx-dma-streaming

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/platforms/esp/32/drivers/rmt_rx/rmt_rx_channel.cpp.hpp (1)

1502-1561: ⚠️ Potential issue | 🟡 Minor

Three-way skip logic is correct — but the zero-symbol success case deserves stronger feedback.

The split (whole-chunk-dropped / partial-skip-straddle / no-skip) is sound. When mSkipCounter >= received_count, the early return at line 1531 guarantees that received_count is strictly greater than mSkipCounter when you reach line 1550, making the subtraction safe.

The case you flagged is valid: when is_last is set with the entire chunk inside the skip window (lines 1542–1546), mReceiveDone is set to true but mSymbolsReceived remains 0. The wait() loop then exits immediately and returns SUCCESS with zero symbols. While the telemetry log at line 46 will show symbols=0, returning SUCCESS with no data is misleading — it signals completion without indicating that the transmission was entirely filtered away. If a caller configured skip_signals ≥ total_expected_symbols, they'll get SUCCESS but zero bytes on decode, which reads as normal completion rather than misconfiguration. Adding an explicit check in wait() or raising an error for the zero-symbol case would make this failure mode harder to miss.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/platforms/esp/32/drivers/rmt_rx/rmt_rx_channel.cpp.hpp` around lines 1502
- 1561, The ISR can set mReceiveDone when an entire chunk was skipped
(rxDoneCallback) leaving mSymbolsReceived==0 which makes wait() return SUCCESS
with zero data; update the receive-completion semantics so zero-symbol
completion is reported as an error: add a check in wait() that if mReceiveDone
(or the completion flag set by rxDoneCallback) and mSymbolsReceived == 0 then
return a failure status (or set a dedicated mReceiveError/mReceiveDoneError flag
that wait() checks) instead of SUCCESS; alternatively, set that error flag
inside rxDoneCallback when data->flags.is_last && mSymbolsReceived == 0 so
wait() can propagate an error to callers. Ensure you reference rxDoneCallback,
mReceiveDone, mSymbolsReceived and wait() when making the change.
🧹 Nitpick comments (5)
src/platforms/esp/32/drivers/spi/channel_driver_spi.cpp.hpp (1)

849-951: Fix looks correct; consider deduplicating the magic number and updating the stale 4KB comment.

The 16 KB staging size is correctly mirrored in both reinitSpiHardware (Line 856) and createChannel (Line 951), and bus_config.max_transfer_sz is set accordingly in both paths, so ESP-IDF will allocate enough DMA descriptors to cover the full transaction. Math checks out: 16384 / 24 ≈ 682 WS2812B LEDs per transaction.

Two small follow-ups that would harden maintenance:

  1. Extract the value into a single constexpr (e.g. kSpiStagingBytes) shared between reinitSpiHardware and createChannel, so the two call sites can never drift. If these ever disagree, the reinit path would silently configure max_transfer_sz inconsistently with the actual allocated staging buffers.
  2. The comment at Line 1081 still says "Allocate staging buffers (4KB each, double-buffered)" — update it to reflect 16 KB (32 KB total per channel) to avoid misleading future readers, especially since the per-channel SRAM footprint is now a non-trivial part of the budget called out in the PR description.
Proposed change
-    // Allocate staging buffers (4KB each, double-buffered)
+    // Allocate staging buffers (16 KB each, double-buffered → 32 KB per channel).
+    // Size chosen to fit ~680 WS2812B LEDs of wave8 output in a single SPI DMA
+    // transaction (see `#2254`). Internal SRAM + DMA-capable is required because
+    // PSRAM is not DMA-safe for SPI TX on ESP32-S3.

And, e.g., at namespace scope:

+/// SPI staging buffer size (bytes). Double-buffered → 2× this per channel.
+/// Sized to cover one wave8 transaction for ~680 WS2812B LEDs without chunking.
+constexpr size_t kSpiStagingBytes = 16384;

then replace both const size_t staging_size = 16384; locals with kSpiStagingBytes.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/platforms/esp/32/drivers/spi/channel_driver_spi.cpp.hpp` around lines 849
- 951, Both reinitSpiHardware and createChannel use the magic staging_size =
16384 value and the comment about "4KB" is stale; extract the staging size into
a single constexpr (e.g. kSpiStagingBytes) at namespace scope and replace the
local const size_t staging_size = 16384 in reinitSpiHardware and createChannel
with that constant, and update the comment near the staging-buffer allocation
(previously "4KB each, double-buffered") to reflect 16 KB (32 KB total
per-channel) so the docs and both uses cannot drift.
src/platforms/esp/32/drivers/rmt_rx/rmt_rx_channel.cpp.hpp (4)

1642-1643: mCallbackCount comment flags this as temporary instrumentation.

The member comment // Debug: Count ISR callbacks (TEMP - for testing en_partial_rx) suggests this field was added for diagnosis and is not intended to stay. If you want to keep it (it is useful for the wait() telemetry), consider removing the "TEMP" marker so future maintainers don't prune it thinking it was a leftover. Alternatively, gate it behind FASTLED_RX_LOG_ENABLED alongside the telemetry FL_WARN noted on line 945.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/platforms/esp/32/drivers/rmt_rx/rmt_rx_channel.cpp.hpp` around lines 1642
- 1643, The field volatile u32 mCallbackCount is marked as temporary
instrumentation; either remove the "TEMP" marker in the comment if you intend to
keep this telemetry for wait()/ISR callback counting, or conditionally compile
and log it under the existing FASTLED_RX_LOG_ENABLED flag (same mechanism used
for FL_WARN telemetry) so it isn't treated as throwaway debug code; update the
comment to reflect permanence if kept, or wrap its use and any diagnostic
references in the FASTLED_RX_LOG_ENABLED guard and ensure related logging uses
FL_WARN as the other telemetry does.

1249-1295: DMA buffer allocation is sized and capped correctly.

heap_caps_malloc(..., MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL) is the right call for ESP32-S3 (forces internal SRAM, rejects PSRAM) and the reuse logic (free+realloc only when current capacity is insufficient) is efficient across repeated begin() calls.

Minor nit: the zero-fill loop at lines 1286-1288 could be a memset(mDmaCapableBuffer, 0, bytes) — slightly clearer intent and lets the compiler emit a block clear. Not worth blocking on.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/platforms/esp/32/drivers/rmt_rx/rmt_rx_channel.cpp.hpp` around lines 1249
- 1295, The DMA buffer zero-fill loop in allocateAndArm() currently writes zeros
element-by-element to mDmaCapableBuffer; replace that manual loop with a single
memset(mDmaCapableBuffer, 0, bytes) after allocation (use the same bytes
variable computed as hw_buffer_size * sizeof(RmtSymbol)) to make intent clearer
and allow the compiler to optimize the block clear; keep the existing
allocation/free/reuse logic around mDmaCapableBuffer and mDmaCapableBufferSize
unchanged.

795-805: Silent use_dma downgrade — consider exposing state back to caller.

If RmtMemoryManager::allocateDMA() fails (another RMT channel holds the shared slot), mUseDma is mutated to false here but config.use_dma on the caller side still reads true. Callers inspecting RxConfig after begin() will think DMA is active when it isn't, and the ~4096 single-fill cap re-appears silently on long strips — exactly the failure mode #2254 is trying to fix.

The FL_WARN at line 798 is good, but for callers with long strips this fallback quietly re-introduces the bug. Options:

  • Return false from begin() when config.use_dma=true and the slot can't be acquired (force the caller to handle it).
  • Or expose the effective state via a new accessor (e.g., bool isDmaActive() const).

Not a blocker — the current behavior is defensible (best-effort capture) and the warning makes it diagnosable — but worth considering before release.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/platforms/esp/32/drivers/rmt_rx/rmt_rx_channel.cpp.hpp` around lines 795
- 805, The code currently flips mUseDma to false when
RmtMemoryManager::allocateDMA(...) fails but leaves the caller's
RxConfig::use_dma (and hence external expectations) unchanged; update begin() to
either propagate the failure by returning false when config.use_dma was
requested but allocateDMA failed, or keep the current best-effort behavior while
exposing the effective state by adding an accessor (e.g., bool isDmaActive()
const) and ensuring mDmaAllocated/mUseDma and rx_config.use_dma are synchronized
before returning so callers can reliably detect whether DMA is actually active;
reference mUseDma, mDmaAllocated, RmtMemoryManager::allocateDMA, rx_config, and
begin() when making the change.

940-949: Per-wait() FL_WARN telemetry will flood logs in production.

This was previously FL_LOG_RX (gated by FASTLED_RX_LOG_ENABLED) and has been promoted to FL_WARN, which is unconditional. Every successful wait() call now emits a warning line. Given the comment acknowledges this as temporary diagnostic telemetry for #2254, consider gating it so downstream users don't see diagnostic output on every frame.

♻️ Suggested gating
-        // Visible (non-FL_DBG) telemetry: lets us see whether en_partial_rx
-        // is actually firing multiple callbacks per transmission on long
-        // streams. mCallbackCount == 1 on a long-stream capture indicates
-        // ESP-IDF ended the receive after one fill (likely due to idle
-        // timeout from signal_range_max_ns). See issue `#2254`.
-        FL_WARN("[RMT RX] wait(): symbols=" << mSymbolsReceived
-                                          << " callbacks=" << mCallbackCount
-                                          << " use_dma="
-                                          << (mUseDma ? "true" : "false"));
+        // Diagnostic telemetry for en_partial_rx / issue `#2254` — gate
+        // behind FASTLED_RX_LOG_ENABLED so production captures stay quiet.
+        FL_LOG_RX("[RMT RX] wait(): symbols=" << mSymbolsReceived
+                                              << " callbacks=" << mCallbackCount
+                                              << " use_dma="
+                                              << (mUseDma ? "true" : "false"));

The similar "DMA streaming mode requested" FL_WARN at line 754 fires once per begin(), which is tolerable, but the same gating argument applies there.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/platforms/esp/32/drivers/rmt_rx/rmt_rx_channel.cpp.hpp` around lines 940
- 949, The FL_WARN in RmtRxChannel::wait() is unconditionally logging per-frame
telemetry (mSymbolsReceived, mCallbackCount, mUseDma) and will flood production
logs; change this to the gated RX logging used previously (e.g., FL_LOG_RX /
FL_DBG or wrap the FL_WARN call in an `#if` FASTLED_RX_LOG_ENABLED /
if(FASTLED_RX_LOG_ENABLED) guard) so the telemetry only appears when
FASTLED_RX_LOG_ENABLED is enabled; also apply the same gating to the one-time
"DMA streaming mode requested" message emitted in begin() (the message near the
"DMA streaming mode requested" code) to keep that diagnostic under the same log
gate.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/platforms/esp/32/drivers/rmt_rx/rmt_rx_channel.cpp.hpp`:
- Around line 1502-1561: The ISR can set mReceiveDone when an entire chunk was
skipped (rxDoneCallback) leaving mSymbolsReceived==0 which makes wait() return
SUCCESS with zero data; update the receive-completion semantics so zero-symbol
completion is reported as an error: add a check in wait() that if mReceiveDone
(or the completion flag set by rxDoneCallback) and mSymbolsReceived == 0 then
return a failure status (or set a dedicated mReceiveError/mReceiveDoneError flag
that wait() checks) instead of SUCCESS; alternatively, set that error flag
inside rxDoneCallback when data->flags.is_last && mSymbolsReceived == 0 so
wait() can propagate an error to callers. Ensure you reference rxDoneCallback,
mReceiveDone, mSymbolsReceived and wait() when making the change.

---

Nitpick comments:
In `@src/platforms/esp/32/drivers/rmt_rx/rmt_rx_channel.cpp.hpp`:
- Around line 1642-1643: The field volatile u32 mCallbackCount is marked as
temporary instrumentation; either remove the "TEMP" marker in the comment if you
intend to keep this telemetry for wait()/ISR callback counting, or conditionally
compile and log it under the existing FASTLED_RX_LOG_ENABLED flag (same
mechanism used for FL_WARN telemetry) so it isn't treated as throwaway debug
code; update the comment to reflect permanence if kept, or wrap its use and any
diagnostic references in the FASTLED_RX_LOG_ENABLED guard and ensure related
logging uses FL_WARN as the other telemetry does.
- Around line 1249-1295: The DMA buffer zero-fill loop in allocateAndArm()
currently writes zeros element-by-element to mDmaCapableBuffer; replace that
manual loop with a single memset(mDmaCapableBuffer, 0, bytes) after allocation
(use the same bytes variable computed as hw_buffer_size * sizeof(RmtSymbol)) to
make intent clearer and allow the compiler to optimize the block clear; keep the
existing allocation/free/reuse logic around mDmaCapableBuffer and
mDmaCapableBufferSize unchanged.
- Around line 795-805: The code currently flips mUseDma to false when
RmtMemoryManager::allocateDMA(...) fails but leaves the caller's
RxConfig::use_dma (and hence external expectations) unchanged; update begin() to
either propagate the failure by returning false when config.use_dma was
requested but allocateDMA failed, or keep the current best-effort behavior while
exposing the effective state by adding an accessor (e.g., bool isDmaActive()
const) and ensuring mDmaAllocated/mUseDma and rx_config.use_dma are synchronized
before returning so callers can reliably detect whether DMA is actually active;
reference mUseDma, mDmaAllocated, RmtMemoryManager::allocateDMA, rx_config, and
begin() when making the change.
- Around line 940-949: The FL_WARN in RmtRxChannel::wait() is unconditionally
logging per-frame telemetry (mSymbolsReceived, mCallbackCount, mUseDma) and will
flood production logs; change this to the gated RX logging used previously
(e.g., FL_LOG_RX / FL_DBG or wrap the FL_WARN call in an `#if`
FASTLED_RX_LOG_ENABLED / if(FASTLED_RX_LOG_ENABLED) guard) so the telemetry only
appears when FASTLED_RX_LOG_ENABLED is enabled; also apply the same gating to
the one-time "DMA streaming mode requested" message emitted in begin() (the
message near the "DMA streaming mode requested" code) to keep that diagnostic
under the same log gate.

In `@src/platforms/esp/32/drivers/spi/channel_driver_spi.cpp.hpp`:
- Around line 849-951: Both reinitSpiHardware and createChannel use the magic
staging_size = 16384 value and the comment about "4KB" is stale; extract the
staging size into a single constexpr (e.g. kSpiStagingBytes) at namespace scope
and replace the local const size_t staging_size = 16384 in reinitSpiHardware and
createChannel with that constant, and update the comment near the staging-buffer
allocation (previously "4KB each, double-buffered") to reflect 16 KB (32 KB
total per-channel) so the docs and both uses cannot drift.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c1162186-5985-45b6-9574-adedc35e67ff

📥 Commits

Reviewing files that changed from the base of the PR and between 66332cf and 541a015.

📒 Files selected for processing (4)
  • examples/AutoResearch/AutoResearchTest.cpp
  • src/fl/rx_device.h
  • src/platforms/esp/32/drivers/rmt_rx/rmt_rx_channel.cpp.hpp
  • src/platforms/esp/32/drivers/spi/channel_driver_spi.cpp.hpp

@github-actions

Copy link
Copy Markdown
Contributor

📊 Header Compilation Performance

Total Time: 1184.41ms

Top 5 Slowest Headers

  1. FastLED.h - 905.48ms
  2. fl/fastled.h - 392.99ms
  3. fl/task/executor.h - 286.77ms
  4. crgb.h - 218.85ms
  5. fl/gfx/crgb.h - 217.54ms

Warnings

⚠️ Header FastLED.h exceeds 150ms (905.5ms)
⚠️ Header fl/fastled.h exceeds 150ms (393.0ms)
⚠️ Header fl/task/executor.h exceeds 150ms (286.8ms)
⚠️ Header crgb.h exceeds 150ms (218.8ms)
⚠️ Header fl/gfx/crgb.h exceeds 150ms (217.5ms)
⚠️ Header fl/math/ease.h exceeds 150ms (212.6ms)
⚠️ Header fl/math/fixed_point.h exceeds 150ms (210.2ms)
⚠️ Header fl/task/scheduler.h exceeds 150ms (152.0ms)
⚠️ Header fl/stl/singleton.h exceeds 50ms (142.5ms)
⚠️ Header fl/stl/thread_local.h exceeds 50ms (141.7ms)
⚠️ Header fl/stl/thread.h exceeds 50ms (140.5ms)
⚠️ Header platforms/thread.h exceeds 50ms (140.5ms)
⚠️ Header platforms/stub/thread_stub.h exceeds 50ms (140.4ms)
⚠️ Header platforms/stub/thread_stub_stl.h exceeds 50ms (140.4ms)
⚠️ Header fl/ui.h exceeds 50ms (131.4ms)
⚠️ Header fl/task/promise.h exceeds 50ms (121.2ms)
⚠️ Header fl/stl/json.h exceeds 50ms (78.3ms)
⚠️ Header fl/stl/function.h exceeds 50ms (72.2ms)
⚠️ Header platforms.h exceeds 50ms (64.6ms)
⚠️ Header platforms/stub/fastled_stub.h exceeds 50ms (64.5ms)
⚠️ Header fl/math/fixed_point/s4x12.h exceeds 50ms (63.0ms)
⚠️ Header fl/stl/json/types.h exceeds 50ms (60.6ms)
⚠️ Template instantiation time is high (54.8%)

Full Report
================================================================================
FASTLED COMPILATION PERFORMANCE REPORT
================================================================================
Generated: 2026-04-18 08:23:56
Compiler: clang++-17
File: ci/perf/test_compile.cpp

SUMMARY
--------------------------------------------------------------------------------
Total Compilation Time:    1,755.88 ms
Frontend Time:             17.61 ms (1.0%)
Backend Time:              196.63 ms (11.2%)

COMPILATION PHASES
--------------------------------------------------------------------------------
Source                     8388.31 ms (477.7%)
Templates                   627.84 ms ( 35.8%)

FASTLED HEADERS (Level 1 - Direct Includes)
--------------------------------------------------------------------------------
  1129.4 ms - FastLED.h (SLOW)
   447.7 ms - fl/fastled.h (SLOW)
   426.8 ms - fl/task/executor.h (SLOW)
   278.6 ms - crgb.h (SLOW)
   277.2 ms - fl/gfx/crgb.h (SLOW)
   272.3 ms - fl/math/ease.h (SLOW)
   269.9 ms - fl/math/fixed_point.h (SLOW)
   216.5 ms - fl/task/promise.h (SLOW)
   196.3 ms - fl/task/scheduler.h (SLOW)
   186.8 ms - fl/stl/singleton.h (SLOW)
   186.1 ms - fl/stl/thread_local.h (SLOW)
   185.0 ms - fl/stl/thread.h (SLOW)
   184.9 ms - platforms/thread.h (SLOW)
   184.8 ms - platforms/stub/thread_stub.h (SLOW)
   184.8 ms - platforms/stub/thread_stub_stl.h (SLOW)
   166.6 ms - fl/stl/function.h (SLOW)
   123.0 ms - fl/ui.h (SLOW)
   120.2 ms - fl/math/fixed_point/s4x12.h (SLOW)
    99.4 ms - fl/math/sin32.h (SLOW)
    96.1 ms - fl/math/simd.h (SLOW)

FASTLED HEADERS (Nested Includes - Up to 10 Levels)
--------------------------------------------------------------------------------
FastLED.h (1129.4ms)
  ├─  447.7 ms - fl/fastled.h
  │ ├─  278.6 ms - crgb.h
  │ │ ├─  277.2 ms - fl/gfx/crgb.h
  │ │ │ └─  272.3 ms - fl/math/ease.h
  │ │ │   └─  269.9 ms - fl/math/fixed_point.h
  │ │ │     ├─  120.2 ms - fl/math/fixed_point/s4x12.h
  │ │ │     │ ├─   99.4 ms - fl/math/sin32.h
  │ │ │     │ │ └─   96.1 ms - fl/math/simd.h
  │ │ │     │ │   └─   95.6 ms - fl/math/simd/types.h
  │ │ │     │ │     └─   95.3 ms - platforms/simd.h
  │ │ │     │ ├─    1.1 ms - fl/math/fixed_point/traits.h
  │ │ │     │ └─    0.8 ms - fl/math/fixed_point/isqrt.h
  │ │ │     ├─   20.7 ms - fl/math/fixed_point/s24x8.h
  │ │ │     ├─   18.6 ms - fl/math/fixed_point/s8x8.h
  │ │ │     ├─   18.5 ms - fl/math/fixed_point/s8x24.h
  │ │ │     └─   18.5 ms - fl/math/fixed_point/s16x16.h
  │ │ └─    0.9 ms - chsv.h
  │ │   └─    0.8 ms - fl/gfx/hsv.h
  │ ├─   58.4 ms - platforms.h
  │ │ └─   58.3 ms - platforms/stub/fastled_stub.h
  │ │   ├─   36.8 ms - platforms/stub/clockless_stub.h
  │ │   │ └─   36.8 ms - platforms/stub/clockless_channel_stub.h
  │ │   │   ├─   13.1 ms - fl/system/log.h
  │ │   │   │ └─   12.6 ms - fl/stl/strstream.h
  │ │   │   ├─   13.0 ms - fl/channels/data.h
  │ │   │   │ └─    9.7 ms - fl/channels/config.h
  │ │   │   │   ├─    2.1 ms - fl/chipsets/chipset_timing_config.h
  │ │   │   │   │ └─    1.4 ms - fl/chipsets/led_timing.h
  │ │   │   │   └─    1.7 ms - fl/chipsets/spi.h
  │ │   │   ├─    2.4 ms - fl/channels/manager.h
  │ │   │   ├─    1.6 ms - fl/stl/weak_ptr.h
  │ │   │   └─    1.1 ms - fl/channels/driver.h
  │ │   └─   21.4 ms - platforms/stub/fastspi_stub.h
  │ │     └─   21.4 ms - platforms/stub/fastspi_stub_generic.h
  │ │       ├─   15.1 ms - platforms/shared/active_strip_data/active_strip_data.h
  │ │       │ └─   12.9 ms - fl/id_tracker.h
  │ │       │   └─   12.0 ms - fl/stl/mutex.h
  │ │       │     └─   11.9 ms - platforms/mutex.h
  │ │       │       └─   11.7 ms - platforms/stub/mutex_stub.h
  │ │       └─    5.9 ms - platforms/shared/active_strip_tracker/active_strip_tracker.h
  │ ├─   42.7 ms - colorutils.h
  │ │ └─   41.9 ms - fl/gfx/colorutils.h
  │ │   ├─    8.9 ms - fl/gfx/blur.h
  │ │   │ └─    4.8 ms - fl/gfx/canvas.h
  │ │   │   └─    3.0 ms - fl/math/alpha.h
  │ │   └─    3.1 ms - fl/gfx/fill.h
  │ ├─   23.6 ms - pixel_controller.h
  │ │ ├─   17.1 ms - pixel_iterator.h
  │ │ │ └─   17.0 ms - fl/chipsets/encoders/pixel_iterator.h
  │ │ │   ├─    5.0 ms - fl/chipsets/encoders/apa102.h
  │ │ │   │ └─    3.8 ms - fl/chipsets/encoders/encoder_utils.h
  │ │ │   │   └─    3.2 ms - fl/gfx/gamma_lut.h
  │ │ │   ├─    4.5 ms - fl/chipsets/encoders/pixel_iterator_adapters.h
  │ │ │   ├─    1.0 ms - fl/chipsets/encoders/sk9822.h
  │ │ │   └─    0.9 ms - fl/chipsets/encoders/hd108.h
  │ │ └─    2.5 ms - rgbw.h
  │ │   └─    2.3 ms - fl/gfx/rgbw.h
  │ └─   22.7 ms - pixeltypes.h
  │   ├─   19.0 ms - lib8tion.h
  │   │ ├─    9.8 ms - fl/math/math8.h
  │   │ │ ├─    5.3 ms - fl/math/intmap.h
  │   │ │ │ └─    4.1 ms - platforms/intmap.h
  │   │ │ ├─    2.5 ms - fl/math/scale8.h
  │   │ │ │ └─    2.4 ms - platforms/scale8.h
  │   │ │ │   └─    1.0 ms - platforms/shared/scale8.h
  │   │ │ └─    2.0 ms - platforms/math8.h
  │   │ │   └─    1.6 ms - platforms/shared/math8.h
  │   │ ├─    2.0 ms - fl/math/beat.h
  │   │ │ └─    1.1 ms - fl/math/trig8.h
  │   │ │   └─    1.1 ms - platforms/trig8.h
  │   │ │     └─    0.9 ms - platforms/shared/trig8.h
  │   │ └─    0.5 ms - fl/math/qfx.h
  │   └─    3.3 ms - crgb.hpp
  ├─  426.8 ms - fl/task/executor.h
  │ ├─  216.5 ms - fl/task/promise.h
  │ │ ├─  166.6 ms - fl/stl/function.h
  │ │ │ ├─   81.0 ms - fl/stl/vector.h
  │ │ │ │ ├─   50.5 ms - fl/math/math.h
  │ │ │ │ │ └─   44.8 ms - fl/stl/undef.h
  │ │ │ │ │   └─   86.4 ms - stdlib.h
  │ │ │ │ │     ├─   43.9 ms - cstdlib
  │ │ │ │ │     │ └─   86.4 ms - stdlib.h
  │ │ │ │ │     │   ├─   43.9 ms - cstdlib
  │ │ │ │ │     │   └─   11.9 ms - types.h
  │ │ │ │ │     └─   11.9 ms - types.h
  │ │ │ │ │       ├─   11.9 ms - types.h
  │ │ │ │ │       │ ├─   11.9 ms - types.h
  │ │ │ │ │       │ ├─    2.2 ms - pthreadtypes.h
  │ │ │ │ │       │ ├─    2.0 ms - select.h
  │ │ │ │ │       │ └─    1.7 ms - endian.h
  │ │ │ │ │       ├─    2.2 ms - pthreadtypes.h
  │ │ │ │ │       │ └─    1.6 ms - thread-shared-types.h
  │ │ │ │ │       ├─    2.0 ms - select.h
  │ │ │ │ │       └─    1.7 ms - endian.h
  │ │ │ │ ├─   18.6 ms - fl/stl/allocator.h
  │ │ │ │ │ └─   12.8 ms - fl/stl/bitset.h
  │ │ │ │ │   └─    8.2 ms - fl/stl/bitset_dynamic.h
  │ │ │ │ │     └─    2.2 ms - fl/stl/unique_ptr.h
  │ │ │ │ ├─    2.8 ms - fl/stl/basic_vector.h
  │ │ │ │ ├─    0.8 ms - fl/stl/initializer_list.h
  │ │ │ │ └─    0.7 ms - fl/stl/functional.h
  │ │ │ ├─   56.8 ms - fl/stl/shared_ptr.h
  │ │ │ │ ├─   44.8 ms - fl/stl/type_traits.h
  │ │ │ │ │ └─   38.3 ms - fl/stl/move.h
  │ │ │ │ ├─    6.9 ms - fl/stl/atomic.h
  │ │ │ │ │ └─    5.8 ms - platforms/atomic.h
  │ │ │ │ │   └─    5.8 ms - platforms/shared/atomic.h
  │ │ │ │ └─    0.7 ms - fl/stl/bit_cast.h
  │ │ │ ├─   13.3 ms - fl/stl/variant.h
  │ │ │ │ └─   11.5 ms - fl/stl/new.h
  │ │ │ │   └─   11.4 ms - platforms/new.h
  │ │ │ │     └─   11.4 ms - platforms/shared/new.h
  │ │ │ │       └─   10.6 ms - new
  │ │ │ │         ├─    7.2 ms - c++config.h
  │ │ │ │         │ └─    5.6 ms - os_defines.h
  │ │ │ │         └─    2.3 ms - version.h
  │ │ │ ├─    5.2 ms - fl/stl/compiler_control.h
  │ │ │ └─    4.8 ms - fl/stl/algorithm.h
  │ │ │   └─    2.1 ms - fl/math/random.h
  │ │ │     └─    1.0 ms - fl/math/random8.h
  │ │ └─   44.5 ms - fl/stl/string.h
  │ │   ├─   12.9 ms - fl/stl/basic_string.h
  │ │   │ ├─    1.1 ms - fl/stl/not_null.h
  │ │   │ ├─    0.9 ms - fl/stl/iterator.h
  │ │   │ └─    0.5 ms - fl/stl/charconv.h
  │ │   ├─    8.8 ms - fl/stl/span.h
  │ │   │ └─    3.4 ms - fl/math/geometry.h
  │ │   ├─    5.7 ms - fl/stl/string_view.h
  │ │   └─    1.5 ms - fl/stl/optional.h
  │ ├─  196.3 ms - fl/task/scheduler.h
  │ │ ├─  186.8 ms - fl/stl/singleton.h
  │ │ │ └─  186.1 ms - fl/stl/thread_local.h
  │ │ │   └─  185.0 ms - fl/stl/thread.h
  │ │ │     └─  184.9 ms - platforms/thread.h
  │ │ │       └─  184.8 ms - platforms/stub/thread_stub.h
  │ │ │         └─  184.8 ms - platforms/stub/thread_stub_stl.h
  │ │ │           └─  183.5 ms - thread
  │ │ │             ├─  106.7 ms - std_thread.h
  │ │ │             └─   74.7 ms - this_thread_sleep.h
  │ │ └─    8.7 ms - fl/task/task.h
  │ │   └─    3.5 ms - fl/trace.h
  │ │     ├─    2.3 ms - fl/stl/chrono.h
  │ │     └─    1.0 ms - fl/stl/tuple.h
  │ ├─   11.7 ms - platforms/await.h
  │ │ └─   11.3 ms - platforms/coroutine_runtime.h
  │ │   └─    9.4 ms - fl/system/engine_events.h
  │ │     ├─    4.9 ms - fl/math/screenmap.h
  │ │     │ └─    3.7 ms - fl/stl/flat_map.h
  │ │     └─    3.1 ms - fl/math/xymap.h
  │ │       └─    0.8 ms - fl/math/lut.h
  │ └─    0.8 ms - fl/task/promise_result.h
  ├─  123.0 ms - fl/ui.h
  │ ├─   79.6 ms - fl/stl/json.h
  │ │ └─   62.1 ms - fl/stl/json/types.h
  │ │   └─    7.7 ms - fl/stl/limits.h
  │ ├─   10.4 ms - fl/ui_impl.h
  │ │ └─    9.8 ms - platforms/ui_defs.h
  │ │   ├─    2.1 ms - platforms/shared/ui/json/audio.h
  │ │   │ └─    1.0 ms - platforms/shared/ui/json/audio_internal.h
  │ │   ├─    1.5 ms - platforms/shared/ui/json/button.h
  │ │   │ └─    0.6 ms - platforms/shared/ui/json/ui_internal.h
  │ │   ├─    0.9 ms - platforms/shared/ui/json/checkbox.h
  │ │   ├─    0.9 ms - platforms/shared/ui/json/help.h
  │ │   └─    0.9 ms - platforms/shared/ui/json/number_field.h
  │ └─    6.8 ms - fl/stl/url.h
  ├─   34.3 ms - fl/stl/stdint.h
  │ └─   34.1 ms - platforms/int.h
  │   └─   33.7 ms - platforms/shared/int.h
  │     └─   33.6 ms - platforms/shared/int_linux.h
  └─   28.4 ms - chipsets.h
    ├─   11.6 ms - fl/chipsets/ucs7604.h
    │ └─    8.7 ms - fl/chipsets/encoders/ucs7604.h
    ├─    6.7 ms - fl/chipsets/apa102.h
    ├─    1.7 ms - fl/chipsets/lpd880x.h
    ├─    0.9 ms - fl/chipsets/encoders/ws2816.h
    └─    0.8 ms - fl/chipsets/p9813.h
fl/fastled.h (447.7ms)
  ├─  278.6 ms - crgb.h
  │ ├─  277.2 ms - fl/gfx/crgb.h
  │ │ └─  272.3 ms - fl/math/ease.h
  │ │   └─  269.9 ms - fl/math/fixed_point.h
  │ │     ├─  120.2 ms - fl/math/fixed_point/s4x12.h
  │ │     │ ├─   99.4 ms - fl/math/sin32.h
  │ │     │ │ └─   96.1 ms - fl/math/simd.h
  │ │     │ │   └─   95.6 ms - fl/math/simd/types.h
  │ │     │ │     └─   95.3 ms - platforms/simd.h
  │ │     │ │       └─   95.2 ms - platforms/shared/simd_x86.hpp
  │ │     │ ├─    1.1 ms - fl/math/fixed_point/traits.h
  │ │     │ └─    0.8 ms - fl/math/fixed_point/isqrt.h
  │ │     ├─   20.7 ms - fl/math/fixed_point/s24x8.h
  │ │     ├─   18.6 ms - fl/math/fixed_point/s8x8.h
  │ │     ├─   18.5 ms - fl/math/fixed_point/s8x24.h
  │ │     └─   18.5 ms - fl/math/fixed_point/s16x16.h
  │ └─    0.9 ms - chsv.h
  │   └─    0.8 ms - fl/gfx/hsv.h
  ├─   58.4 ms - platforms.h
  │ └─   58.3 ms - platforms/stub/fastled_stub.h
  │   ├─   36.8 ms - platforms/stub/clockless_stub.h
  │   │ └─   36.8 ms - platforms/stub/clockless_channel_stub.h
  │   │   ├─   13.1 ms - fl/system/log.h
  │   │   │ └─   12.6 ms - fl/stl/strstream.h
  │   │   ├─   13.0 ms - fl/channels/data.h
  │   │   │ └─    9.7 ms - fl/channels/config.h
  │   │   │   ├─    2.1 ms - fl/chipsets/chipset_timing_config.h
  │   │   │   │ └─    1.4 ms - fl/chipsets/led_timing.h
  │   │   │   └─    1.7 ms - fl/chipsets/spi.h
  │   │   ├─    2.4 ms - fl/channels/manager.h
  │   │   ├─    1.6 ms - fl/stl/weak_ptr.h
  │   │   └─    1.1 ms - fl/channels/driver.h
  │   └─   21.4 ms - platforms/stub/fastspi_stub.h
  │     └─   21.4 ms - platforms/stub/fastspi_stub_generic.h
  │       ├─   15.1 ms - platforms/shared/active_strip_data/active_strip_data.h
  │       │ └─   12.9 ms - fl/id_tracker.h
  │       │   └─   12.0 ms - fl/stl/mutex.h
  │       │     └─   11.9 ms - platforms/mutex.h
  │       │       └─   11.7 ms - platforms/stub/mutex_stub.h
  │       │         └─   11.7 ms - platforms/stub/mutex_stub_stl.h
  │       └─    5.9 ms - platforms/shared/active_strip_tracker/active_strip_tracker.h
  ├─   42.7 ms - colorutils.h
  │ └─   41.9 ms - fl/gfx/colorutils.h
  │   ├─    8.9 ms - fl/gfx/blur.h
  │   │ └─    4.8 ms - fl/gfx/canvas.h
  │   │   └─    3.0 ms - fl/math/alpha.h
  │   └─    3.1 ms - fl/gfx/fill.h
  ├─   23.6 ms - pixel_controller.h
  │ ├─   17.1 ms - pixel_iterator.h
  │ │ └─   17.0 ms - fl/chipsets/encoders/pixel_iterator.h
  │ │   ├─    5.0 ms - fl/chipsets/encoders/apa102.h
  │ │   │ └─    3.8 ms - fl/chipsets/encoders/encoder_utils.h
  │ │   │   └─    3.2 ms - fl/gfx/gamma_lut.h
  │ │   ├─    4.5 ms - fl/chipsets/encoders/pixel_iterator_adapters.h
  │ │   ├─    1.0 ms - fl/chipsets/encoders/sk9822.h
  │ │   └─    0.9 ms - fl/chipsets/encoders/hd108.h
  │ └─    2.5 ms - rgbw.h
  │   └─    2.3 ms - fl/gfx/rgbw.h
  └─   22.7 ms - pixeltypes.h
    ├─   19.0 ms - lib8tion.h
    │ ├─    9.8 ms - fl/math/math8.h
    │ │ ├─    5.3 ms - fl/math/intmap.h
    │ │ │ └─    4.1 ms - platforms/intmap.h
    │ │ ├─    2.5 ms - fl/math/scale8.h
    │ │ │ └─    2.4 ms - platforms/scale8.h
    │ │ │   └─    1.0 ms - platforms/shared/scale8.h
    │ │ └─    2.0 ms - platforms/math8.h
    │ │   └─    1.6 ms - platforms/shared/math8.h
    │ ├─    2.0 ms - fl/math/beat.h
    │ │ └─    1.1 ms - fl/math/trig8.h
    │ │   └─    1.1 ms - platforms/trig8.h
    │ │     └─    0.9 ms - platforms/shared/trig8.h
    │ └─    0.5 ms - fl/math/qfx.h
    └─    3.3 ms - crgb.hpp
fl/task/executor.h (426.8ms)
  ├─  216.5 ms - fl/task/promise.h
  │ ├─  166.6 ms - fl/stl/function.h
  │ │ ├─   81.0 ms - fl/stl/vector.h
  │ │ │ ├─   50.5 ms - fl/math/math.h
  │ │ │ │ └─   44.8 ms - fl/stl/undef.h
  │ │ │ │   └─   86.4 ms - stdlib.h
  │ │ │ │     ├─   43.9 ms - cstdlib
  │ │ │ │     │ └─   86.4 ms - stdlib.h
  │ │ │ │     │   ├─   43.9 ms - cstdlib
  │ │ │ │     │   │ └─   86.4 ms - stdlib.h
  │ │ │ │     │   └─   11.9 ms - types.h
  │ │ │ │     │     ├─   11.9 ms - types.h
  │ │ │ │     │     ├─    2.2 ms - pthreadtypes.h
  │ │ │ │     │     ├─    2.0 ms - select.h
  │ │ │ │     │     └─    1.7 ms - endian.h
  │ │ │ │     └─   11.9 ms - types.h
  │ │ │ │       ├─   11.9 ms - types.h
  │ │ │ │       │ ├─   11.9 ms - types.h
  │ │ │ │       │ │ ├─   11.9 ms - types.h
  │ │ │ │       │ │ ├─    2.2 ms - pthreadtypes.h
  │ │ │ │       │ │ ├─    2.0 ms - select.h
  │ │ │ │       │ │ └─    1.7 ms - endian.h
  │ │ │ │       │ ├─    2.2 ms - pthreadtypes.h
  │ │ │ │       │ │ └─    1.6 ms - thread-shared-types.h
  │ │ │ │       │ ├─    2.0 ms - select.h
  │ │ │ │       │ └─    1.7 ms - endian.h
  │ │ │ │       ├─    2.2 ms - pthreadtypes.h
  │ │ │ │       │ └─    1.6 ms - thread-shared-types.h
  │ │ │ │       ├─    2.0 ms - select.h
  │ │ │ │       └─    1.7 ms - endian.h
  │ │ │ ├─   18.6 ms - fl/stl/allocator.h
  │ │ │ │ └─   12.8 ms - fl/stl/bitset.h
  │ │ │ │   └─    8.2 ms - fl/stl/bitset_dynamic.h
  │ │ │ │     └─    2.2 ms - fl/stl/unique_ptr.h
  │ │ │ ├─    2.8 ms - fl/stl/basic_vector.h
  │ │ │ ├─    0.8 ms - fl/stl/initializer_list.h
  │ │ │ └─    0.7 ms - fl/stl/functional.h
  │ │ ├─   56.8 ms - fl/stl/shared_ptr.h
  │ │ │ ├─   44.8 ms - fl/stl/type_traits.h
  │ │ │ │ └─   38.3 ms - fl/stl/move.h
  │ │ │ ├─    6.9 ms - fl/stl/atomic.h
  │ │ │ │ └─    5.8 ms - platforms/atomic.h
  │ │ │ │   └─    5.8 ms - platforms/shared/atomic.h
  │ │ │ └─    0.7 ms - fl/stl/bit_cast.h
  │ │ ├─   13.3 ms - fl/stl/variant.h
  │ │ │ └─   11.5 ms - fl/stl/new.h
  │ │ │   └─   11.4 ms - platforms/new.h
  │ │ │     └─   11.4 ms - platforms/shared/new.h
  │ │ │       └─   10.6 ms - new
  │ │ │         ├─    7.2 ms - c++config.h
  │ │ │         │ └─    5.6 ms - os_defines.h
  │ │ │         │   └─    5.2 ms - features.h
  │ │ │         └─    2.3 ms - version.h
  │ │ ├─    5.2 ms - fl/stl/compiler_control.h
  │ │ └─    4.8 ms - fl/stl/algorithm.h
  │ │   └─    2.1 ms - fl/math/random.h
  │ │     └─    1.0 ms - fl/math/random8.h
  │ └─   44.5 ms - fl/stl/string.h
  │   ├─   12.9 ms - fl/stl/basic_string.h
  │   │ ├─    1.1 ms - fl/stl/not_null.h
  │   │ ├─    0.9 ms - fl/stl/iterator.h
  │   │ └─    0.5 ms - fl/stl/charconv.h
  │   ├─    8.8 ms - fl/stl/span.h
  │   │ └─    3.4 ms - fl/math/geometry.h
  │   ├─    5.7 ms - fl/stl/string_view.h
  │   └─    1.5 ms - fl/stl/optional.h
  ├─  196.3 ms - fl/task/scheduler.h
  │ ├─  186.8 ms - fl/stl/singleton.h
  │ │ └─  186.1 ms - fl/stl/thread_local.h
  │ │   └─  185.0 ms - fl/stl/thread.h
  │ │     └─  184.9 ms - platforms/thread.h
  │ │       └─  184.8 ms - platforms/stub/thread_stub.h
  │ │         └─  184.8 ms - platforms/stub/thread_stub_stl.h
  │ │           └─  183.5 ms - thread
  │ │             ├─  106.7 ms - std_thread.h
  │ │             │ ├─   43.2 ms - tuple
  │ │             │ ├─   13.4 ms - refwrap.h
  │ │             │ ├─   12.4 ms - iosfwd
  │ │             │ ├─   12.1 ms - gthr.h
  │ │             │ └─    6.0 ms - unique_ptr.h
  │ │             └─   74.7 ms - this_thread_sleep.h
  │ │               ├─   69.6 ms - chrono.h
  │ │               └─    3.9 ms - cerrno
  │ └─    8.7 ms - fl/task/task.h
  │   └─    3.5 ms - fl/trace.h
  │     ├─    2.3 ms - fl/stl/chrono.h
  │     └─    1.0 ms - fl/stl/tuple.h
  ├─   11.7 ms - platforms/await.h
  │ └─   11.3 ms - platforms/coroutine_runtime.h
  │   └─    9.4 ms - fl/system/engine_events.h
  │     ├─    4.9 ms - fl/math/screenmap.h
  │     │ └─    3.7 ms - fl/stl/flat_map.h
  │     └─    3.1 ms - fl/math/xymap.h
  │       └─    0.8 ms - fl/math/lut.h
  └─    0.8 ms - fl/task/promise_result.h
fl/ui.h (123.0ms)
  ├─   79.6 ms - fl/stl/json.h
  │ └─   62.1 ms - fl/stl/json/types.h
  │   └─    7.7 ms - fl/stl/limits.h
  ├─   10.4 ms - fl/ui_impl.h
  │ └─    9.8 ms - platforms/ui_defs.h
  │   ├─    2.1 ms - platforms/shared/ui/json/audio.h
  │   │ └─    1.0 ms - platforms/shared/ui/json/audio_internal.h
  │   ├─    1.5 ms - platforms/shared/ui/json/button.h
  │   │ └─    0.6 ms - platforms/shared/ui/json/ui_internal.h
  │   ├─    0.9 ms - platforms/shared/ui/json/checkbox.h
  │   ├─    0.9 ms - platforms/shared/ui/json/help.h
  │   └─    0.9 ms - platforms/shared/ui/json/number_field.h
  └─    6.8 ms - fl/stl/url.h
fl/stl/stdint.h (34.3ms)
  └─   34.1 ms - platforms/int.h
    └─   33.7 ms - platforms/shared/int.h
      └─   33.6 ms - platforms/shared/int_linux.h

TOP 20 SLOWEST OPERATIONS
--------------------------------------------------------------------------------
  1.  1129.4 ms - Source: FastLED.h
  2.  1129.4 ms - Total Source: 
  3.   663.1 ms - Total ParseClass: 
  4.   447.7 ms - Source: fl/fastled.h
  5.   426.8 ms - Source: fl/task/executor.h
  6.   278.6 ms - Source: crgb.h
  7.   277.2 ms - Source: fl/gfx/crgb.h
  8.   272.3 ms - Source: fl/math/ease.h
  9.   269.9 ms - Source: fl/math/fixed_point.h
 10.   224.3 ms - Total InstantiateFunction: 
 11.   216.5 ms - Source: fl/task/promise.h
 12.   196.3 ms - Source: fl/task/scheduler.h
 13.   186.8 ms - Source: fl/stl/singleton.h
 14.   186.1 ms - Source: fl/stl/thread_local.h
 15.   185.0 ms - Source: fl/stl/thread.h
 16.   184.9 ms - Source: platforms/thread.h
 17.   184.8 ms - Source: platforms/stub/thread_stub.h
 18.   184.8 ms - Source: platforms/stub/thread_stub_stl.h
 19.   183.5 ms - Source: thread
 20.   179.4 ms - Total InstantiateClass: 

PERFORMANCE FLAGS
--------------------------------------------------------------------------------
⚠️  SLOW HEADERS (>50.0ms):
    - FastLED.h (1129.4ms)
    - fl/fastled.h (447.7ms)
    - fl/task/executor.h (426.8ms)
    - crgb.h (278.6ms)
    - fl/gfx/crgb.h (277.2ms)
    - fl/math/ease.h (272.3ms)
    - fl/math/fixed_point.h (269.9ms)
    - fl/task/promise.h (216.5ms)
    - fl/task/scheduler.h (196.3ms)
    - fl/stl/singleton.h (186.8ms)

⚠️  Template instantiation time is high (35.8% of total)
✓  Lexing time is acceptable (<10% of total)

RECOMMENDATIONS
--------------------------------------------------------------------------------
1. Consider optimizing FastLED.h (1129.4ms)
2. Consider optimizing fl/fastled.h (447.7ms)
3. Consider optimizing fl/task/executor.h (426.8ms)

================================================================================

@zackees
zackees merged commit a6e9513 into master Apr 18, 2026
70 of 87 checks passed
@zackees
zackees deleted the feat/rmt-rx-dma-streaming branch April 18, 2026 13:48
zackees added a commit that referenced this pull request Apr 18, 2026
`ci/ci-cppcheck.py` shells out to `pio check`, which requires a fully
populated PlatformIO project tree. Boards now compiled by fbuild don't
get their partition CSVs (e.g. `huge_app.csv`) written into the PIO
project dir, so `pio check` fails in CMake configure:

    Missing partition table file `.../.build/pio/esp32c2/huge_app.csv`
    UserSideException: Processing esp32c2 ...

This has kept esp32c2 red on master since #2292 (2026-04-18) and blocks
PR #2300.

Short-term: detect fbuild output presence by testing
`.build/.fbuild/build/<env>/release/` (the fbuild artifact dir returned
by `PioCompiler._artifacts_dir` in `ci/compiler/pio.py`). When that
directory exists for the target board, skip `pio check` with a visible
SKIP notice and return 0 rather than fail CI.

This accepts a temporary cppcheck-coverage gap on fbuild-default boards
(esp32c2 today, s3/c3/c6 on deck) until the proper clang-tool-chain-bin
integration lands — tracked by:

- #2301 — fbuild cppcheck support
- #2302 — esp32c2 CI regression (closed by this commit)
- #2303 — umbrella: clang-tool-chain-bin for IWYU + cppcheck +
  other linting tools

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
zackees added a commit that referenced this pull request Apr 18, 2026
…CI (#2305)

`ci/ci-cppcheck.py` shells out to `pio check`, which requires a fully
populated PlatformIO project tree. Boards now compiled by fbuild don't
get their partition CSVs (e.g. `huge_app.csv`) written into the PIO
project dir, so `pio check` fails in CMake configure:

    Missing partition table file `.../.build/pio/esp32c2/huge_app.csv`
    UserSideException: Processing esp32c2 ...

This has kept esp32c2 red on master since #2292 (2026-04-18) and blocks
PR #2300.

Short-term: detect fbuild output presence by testing
`.build/.fbuild/build/<env>/release/` (the fbuild artifact dir returned
by `PioCompiler._artifacts_dir` in `ci/compiler/pio.py`). When that
directory exists for the target board, skip `pio check` with a visible
SKIP notice and return 0 rather than fail CI.

This accepts a temporary cppcheck-coverage gap on fbuild-default boards
(esp32c2 today, s3/c3/c6 on deck) until the proper clang-tool-chain-bin
integration lands — tracked by:

- #2301 — fbuild cppcheck support
- #2302 — esp32c2 CI regression (closed by this commit)
- #2303 — umbrella: clang-tool-chain-bin for IWYU + cppcheck +
  other linting tools

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
@zackees zackees mentioned this pull request Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant