Skip to content

feat(uart): UART2 second lane on classic ESP32 (#3576 Phase 2) - #3579

Merged
zackees merged 1 commit into
masterfrom
feat/uart2-second-lane-3576
Jul 2, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/uart2-second-lane-3576

Conversation

@zackees

@zackees zackees commented Jul 2, 2026 •

Copy link
Copy Markdown
Member

Phase 2 of the #3576 program: a second concurrent UART LED lane on the UART2 block (Bus::UART instance 1, driver name "UART2"). UART0 stays reserved for the console.

  • ChannelEngineUART is parameterized by uart_num (1 = "UART", 2 = "UART2"); the peripheral config carries it instead of the hardcoded UART1.
  • BusTraits<Bus::UART, 1> with its own peripheral+engine holder; enrolled by enableAllDrivers() on classic ESP32 only for now (S3/C6 get theirs in the Phase 9 board audit).
  • default_bus_priority(UART, which): secondary lane one below primary (-2 vs -1).
  • Both waveN geometries (UART clockless: generalize wave10 to waveN frame geometries (wave4/wave5) with per-chipset selection #3574) apply per lane with independent baud/word-length.
  • i2sPortClaim contention warning → FL_WARN_F_ONCE per review direction.
  • fl/channels/README.md engine table updated.

Verification

  • Bench (WROOM COM11, GPIO33→34): UART2 passed: true, 4/4 patterns byte-exact on the UART2 block; regression UART (lane 1), I2S, I2S0 all 4/4.
  • Host: 345/345; lint clean.

Refs #3576.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added support for an additional UART lane on ESP32-dev (original) devices, enabling a second concurrent UART channel while keeping the console channel reserved.
    • UART channels now report a lane-specific name where applicable.
  • Bug Fixes

    • Improved UART channel selection so the correct hardware block is used for each lane.
    • Reduced repeated warning spam when a shared port claim fails due to contention.

Classic ESP32 has three UARTs; UART0 is the console and UART1 carried
the only LED lane. This adds a second concurrent lane on UART2
("UART2", Bus::UART instance 1).

- ChannelEngineUART takes uart_num (1 = "UART", 2 = "UART2"); the
  peripheral config carries it instead of the hardcoded UART1.
- BusTraits<Bus::UART, 1> with its own peripheral+engine holder;
  enableAllDrivers() enrolls it on classic ESP32 only for now.
- default_bus_priority(UART, which): secondary lane one below primary.
- i2sPortClaim conflict warning switched to FL_WARN_F_ONCE per review
  direction (surprising-but-by-design contention should warn once per
  call site, not once per frame).
- fl/channels/README.md engine table updated.

Bench (WROOM COM11, GPIO33→34): UART2 passed: true 4/4 patterns
byte-exact on the UART2 block; regression UART/I2S/I2S0 4/4 each.
Host: 345/345, lint clean.

Co-Authored-By: Claude Fable 5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 2, 2026 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9b96d506-7160-48c9-91b0-c569d104ba24

📥 Commits

Reviewing files that changed from the base of the PR and between 7af3470 and d1d6dae.

📒 Files selected for processing (7)
  • src/fl/channels/README.md
  • src/fl/channels/bus_priorities.h
  • src/platforms/esp/32/channel_drivers_esp32.impl.hpp
  • src/platforms/esp/32/drivers/i2s/i2s_port_claim.cpp.hpp
  • src/platforms/esp/32/drivers/uart/bus_traits.h
  • src/platforms/esp/32/drivers/uart/channel_driver_uart.cpp.hpp
  • src/platforms/esp/32/drivers/uart/channel_driver_uart.h

📝 Walkthrough

Walkthrough

Adds ESP32 UART2 as a second concurrent UART lane: ChannelEngineUART now accepts a uart_num parameter, a new BusTraitsBus::UART,1 specialization is registered with an updated priority function, enableAllChannelDrivers conditionally enables it on ESP32-dev, docs are updated, and an I2S warning macro is switched to warn-once.

Changes

ESP32 UART2 Second Lane Support

Layer / File(s) Summary
ChannelEngineUART uart_num parameterization
src/platforms/esp/32/drivers/uart/channel_driver_uart.h, channel_driver_uart.cpp.hpp
Constructor gains a uart_num parameter (default 1) stored as mUartNum, used to configure the UART peripheral block in beginTransmission(), and getName() returns "UART2" when mUartNum == 2.
BusTraitsBus::UART,1 and priority mapping
src/platforms/esp/32/drivers/uart/bus_traits.h, src/fl/channels/bus_priorities.h
UartBusHolder now takes a uart_num; a new BusTraits<Bus::UART, 1> specialization is added for UART2 (uart_num=2), registering via default_bus_priority(Bus::UART, 1); default_bus_priority() returns -2 for non-zero which instead of a fixed -1.
UART2 driver enablement and documentation
src/platforms/esp/32/channel_drivers_esp32.impl.hpp, src/fl/channels/README.md
enableAllChannelDrivers() includes platforms/is_platform.h and conditionally enables Bus::UART instance 1 when FASTLED_ESP32_HAS_UART and FL_IS_ESP_32DEV are defined; README's engine priority table adds a UART2 row.
I2S port claim warning frequency change
src/platforms/esp/32/drivers/i2s/i2s_port_claim.cpp.hpp
Port-contention warning switches from FL_WARN_F to FL_WARN_F_ONCE while preserving the failed-claim return value.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant enableAllChannelDrivers
  participant BusTraits_UART1
  participant UartBusHolder
  participant ChannelEngineUART

  enableAllChannelDrivers->>BusTraits_UART1: enableDriver<Bus::UART,1>() [ESP32-dev]
  BusTraits_UART1->>UartBusHolder: instancePtr(uart_num=2)
  UartBusHolder->>ChannelEngineUART: ChannelEngineUART(peripheral, uart_num=2)
  ChannelEngineUART-->>BusTraits_UART1: driver instance
  BusTraits_UART1->>BusTraits_UART1: registerWithManager(default_bus_priority(UART,1))
Loading

Possibly related PRs

  • FastLED/FastLED#2480: Both PRs modify the ESP32 enableAllChannelDrivers() bundle and its underlying channel driver enablement fragment.
  • FastLED/FastLED#3444: The UART2 lane addition builds directly on the which-based default_bus_priority and BusTraits<Bus::UART, N> infrastructure from this PR.
  • FastLED/FastLED#2448: The new BusTraits<Bus::UART, 1> registration interacts with the driver enrollment mechanism this PR touches.
✨ 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/uart2-second-lane-3576

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.

@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jul 2, 2026
@zackees
zackees deleted the feat/uart2-second-lane-3576 branch August 21, 2026 19:15
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.

1 participant