Skip to content

Add public RxChannel API under fl/channels/rx - #2400

Merged
zackees merged 1 commit into
masterfrom
issue-2397-rx-channel
Apr 24, 2026
Merged

zackees merged 1 commit into
masterfrom
issue-2397-rx-channel

Conversation

@zackees

@zackees zackees commented Apr 24, 2026 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

Release Notes

  • New Features
    • Added RxChannel API providing flexible runtime RX device configuration and lifecycle management
    • Introduced RxBackend enum enabling selection of RX capture implementation at runtime
    • Added FastLED.addRx() public API method for creating and registering RX channels with custom configuration
    • Updated example sketches demonstrating new channel-based RX workflow and API usage

@coderabbitai

coderabbitai Bot commented Apr 24, 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: 00d06e75-c8a6-4cb2-b195-d902d10d9ff6

📥 Commits

Reviewing files that changed from the base of the PR and between 9c1377a and 44e026a.

📒 Files selected for processing (21)
  • examples/AutoResearch/AutoResearch.ino
  • examples/AutoResearch/AutoResearchHelpers.cpp
  • examples/AutoResearch/AutoResearchHelpers.h
  • examples/AutoResearch/AutoResearchRemote.cpp
  • examples/AutoResearch/AutoResearchRemote.h
  • examples/AutoResearch/AutoResearchTest.cpp
  • examples/AutoResearch/AutoResearchTest.h
  • examples/RX/RX.ino
  • examples/RX/test.cpp
  • examples/RX/test.h
  • src/FastLED.cpp.hpp
  • src/FastLED.h
  • src/fl/channels/_build.cpp.hpp
  • src/fl/channels/detail/validation/rx_test.cpp.hpp
  • src/fl/channels/detail/validation/rx_test.h
  • src/fl/channels/rx/_build.cpp.hpp
  • src/fl/channels/rx/channel.cpp.hpp
  • src/fl/channels/rx/channel.h
  • src/fl/channels/rx/config.h
  • src/fl/channels/rx/types.h
  • tests/fl/rx_device.cpp

📝 Walkthrough

Walkthrough

The PR introduces a new RX channel API layer (RxChannel, RxChannelConfig, RxBackend) to replace the device-centric approach. It adds FastLED.addRx() as a runtime factory, migrates all examples and internal tests from RxDevice to the channel-based abstraction, and establishes channel-specific configuration handling.

Changes

Cohort / File(s) Summary
New RX Channel API
src/fl/channels/rx/types.h, src/fl/channels/rx/config.h, src/fl/channels/rx/channel.h, src/fl/channels/rx/channel.cpp.hpp, src/fl/channels/rx/_build.cpp.hpp
Introduces RxChannel interface with factory creation, lifecycle methods (begin, setConfig, wait), data processing (decode, getRawEdgeTimes, injectEdges), and RxChannelConfig struct with pin/backend/edge_capacity configuration. Adds RxBackend enum (PLATFORM_DEFAULT, RMT, ISR, FLEXPWM) with toString conversion.
Core Library Integration
src/FastLED.h, src/FastLED.cpp.hpp, src/fl/channels/_build.cpp.hpp
Exposes FastLED.addRx(const RxChannelConfig&) public API for runtime channel creation, integrates RX channel build system.
AutoResearch Example Migration
examples/AutoResearch/AutoResearch.ino, examples/AutoResearch/AutoResearchHelpers.h, examples/AutoResearch/AutoResearchHelpers.cpp, examples/AutoResearch/AutoResearchRemote.h, examples/AutoResearch/AutoResearchRemote.cpp, examples/AutoResearch/AutoResearchTest.h, examples/AutoResearch/AutoResearchTest.cpp
Migrates from RxDevice to RxChannel throughout; updates function signatures, redefines RxDeviceFactory to return RxChannelPtr, changes buffer config from RxConfig::buffer_size to RxChannelConfig::edge_capacity.
RX Example Migration
examples/RX/RX.ino, examples/RX/test.h, examples/RX/test.cpp
Replaces RxDevice with RxChannel, updates setup to use FastLED.addRx with RxChannelConfig, changes config parameter passing from RxConfig to RxChannelConfig, updates executeToggles to derive config from channel instead of receiving it externally.
Validation & Test Updates
src/fl/channels/detail/validation/rx_test.h, src/fl/channels/detail/validation/rx_test.cpp.hpp, tests/fl/rx_device.cpp
Updates testRxChannel signature from RxDevice to RxChannel; adds unit tests verifying RxChannel creation/configuration persistence, setConfig mutations, and FastLED.addRx integration with config matching.

Sequence Diagram(s)

sequenceDiagram
    participant App as Application
    participant FastLED
    participant RxChannel as RxChannel<br/>(Channel Layer)
    participant RxDevice as RxDevice<br/>(Device Layer)
    
    App->>FastLED: addRx(RxChannelConfig)
    FastLED->>RxChannel: create(config)
    RxChannel->>RxDevice: new RxDevice(backend)
    RxDevice-->>RxChannel: initialized
    RxChannel-->>FastLED: RxChannelPtr
    FastLED-->>App: RxChannelPtr
    
    App->>RxChannel: begin(config)
    RxChannel->>RxDevice: (re)create if pin/backend changed
    RxDevice-->>RxChannel: ready
    RxChannel-->>App: bool
    
    App->>RxChannel: wait(timeout_ms)
    RxChannel->>RxDevice: check finished()
    RxDevice-->>RxChannel: done?
    RxChannel-->>App: RxWaitResult
    
    App->>RxChannel: decode(timing, buffer)
    RxChannel->>RxDevice: extract edges
    RxDevice-->>RxChannel: decoded data
    RxChannel-->>App: result<u32, DecodeError>
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

Poem

🐰 A channel springs to life, so clean and bright,
Where RxDevice once held the RxWait night—
Now FastLED.addRx brings configs to flow,
And backends choose freely, high and low! ✨

✨ 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 issue-2397-rx-channel

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

None yet

Development

Successfully merging this pull request may close these issues.

1 participant