Skip to content

perf(rmt5): stop enabling/disabling the RMT channel around every frame (#5356) #5359

Closed

Description

@zackees

Sub-issue of #5356 (show() latency on the ESP32-C6 forced-RMT legacy path).

Cause

ChannelEngineRMTImpl enables the RMT channel before every frame and disables it again when the frame completes:

  • processPendingChannels() calls rmt_enable() for every transmission.
  • poll() calls rmt_disable() on completion, before releaseChannel().

The channel is then reused on the same pin by the next frame, so the pair only costs time. ESP-IDF's rmt_enable() / rmt_disable() take the channel spinlock, toggle the PM lock and touch the GPIO/RMT registers.

Measurement (ESP32-C6, 35 WS2812, cycle-counter phase timers, timingDriftTest)

phase µs/frame
enableChannel in driver.show() 13.3
completion disable + release in poll() 32.0

Fix

Keep a reused channel enabled between frames. Disable it only where the handle is deleted (pin change, encoder failure, network reconfiguration, destructor) through a single deleteHwChannel() helper, because rmt_del_channel() rejects an enabled channel.

The RMT mock now enforces the same IDF state rules (no double enable, no delete while enabled) and counts enables.

Metadata

Metadata

Assignees

No one assigned

    Labels

    sanitized

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions