Skip to content

feat(autoresearch): wire LPUART driver into --lpuart and --all (refs #3023) - #3033

Merged
zackees merged 1 commit into
masterfrom
feat/lpuart-autoresearch-wiring
Jun 14, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/lpuart-autoresearch-wiring

Conversation

@zackees

@zackees zackees commented Jun 14, 2026 •

Copy link
Copy Markdown
Member

Summary

Phase 2 of workstream A in #3023: extends the AutoResearch orchestration so the upcoming Teensy 4 LPUART clockless driver can be exercised end-to-end the moment the engine TU lands. Mirrors the --flex-io wiring pattern shipped in #3005.

Changes

  • examples/AutoResearch/AutoResearchRemote.cpp:944 — adds else if (n == "LPUART") opts.mBus = fl::Bus::LPUART; to the driver-name → Bus mapping. Bus::LPUART itself was reserved in feat(channels): reserve Bus::LPUART enum slot (refs #3023) #3026.
  • ci/autoresearch/args.py — new lpuart: bool field on Args, new --lpuart argparse flag with a help string documenting the iMXRT1062 LPUART TX pin set ({1, 8, 14, 17, 20, 24, 29, 35, 47, 48}), and the --all help text is updated to mention --lpuart alongside --flex-io.
  • ci/autoresearch/phases.py — LPUART added to the --all driver list and to the per-flag mapping. Adds an lpuart_tx_pin = 1 override (LPUART6_TX, Teensy 4's default Serial2 TX) so AutoResearch pins the LPUART tests to a known-good pin when the user doesn't supply --tx-pin — analogous to the existing flex_io_tx_pin = 6 override.
  • ci/tests/test_autoresearch_phases.py — adds lpuart=False to _make_args defaults and includes LPUART in the test_all_drivers expected set. Also patches a pre-existing unrelated breakage in _make_args (was missing pin_toggle_rx and ws2812_loopback after recent additions to Args — the test file was failing with TypeError: missing 2 required positional arguments).

Test plan

  • uv run pytest ci/tests/test_autoresearch_phases.py -x -q → 48 passed in 7.58s.
  • bash autoresearch teensy40 --lpuart becomes runnable once the lpuart_peripheral_real.cpp.hpp + engine TU land (workstream A Phase 1 follow-up).

Why ship Phase 2 before Phase 1 completes

Phase 2 is purely orchestration — the runtime sketch silently falls back to Bus::AUTO until the LPUART engine registers itself with the channel manager. Landing the AutoResearch wiring early means the Phase 1 follow-up PR (real iMXRT register driver) doesn't need to touch the AutoResearch infrastructure at all, keeping that PR focused on the hardware-verified driver code.

Refs #3023

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added Teensy 4.x LPUART clockless driver option to the autoresearch test runner with automatic pin configuration support.
  • Tests

    • Updated unit tests to validate LPUART driver integration and test generation.

…3023)

Phase 2 of workstream A: extends the AutoResearch orchestration so the
upcoming Teensy 4 LPUART clockless driver can be exercised end-to-end
the moment the engine TU lands. Mirrors the FLEX_IO wiring pattern
shipped in #3005.

Changes:

- `examples/AutoResearch/AutoResearchRemote.cpp:944`
  Add `else if (n == "LPUART") opts.mBus = fl::Bus::LPUART;` to the
  driver-name → Bus mapping. Bus::LPUART itself was reserved in #3026.

- `ci/autoresearch/args.py`
  New `lpuart: bool` field on `Args`, new `--lpuart` argparse flag with
  a help string documenting the iMXRT1062 LPUART TX pin set
  (`{1, 8, 14, 17, 20, 24, 29, 35, 47, 48}`), and the `--all` help text
  is updated to mention `--lpuart` alongside `--flex-io`.

- `ci/autoresearch/phases.py`
  `LPUART` added to the `--all` driver list and to the per-flag mapping.
  Adds an `lpuart_tx_pin = 1` override (LPUART6_TX, Teensy 4's default
  Serial2 TX) so AutoResearch pins the LPUART tests to a known-good pin
  when the user doesn't supply `--tx-pin` — analogous to the existing
  `flex_io_tx_pin = 6` override.

- `ci/tests/test_autoresearch_phases.py`
  Add `lpuart=False` to `_make_args` defaults and include `LPUART` in
  the `test_all_drivers` expected set. Also patches a pre-existing
  unrelated breakage in `_make_args` (was missing `pin_toggle_rx` and
  `ws2812_loopback` after recent additions to `Args` — the test file
  failed with `TypeError: missing 2 required positional arguments`).

Test plan:

- [x] `uv run pytest ci/tests/test_autoresearch_phases.py -x -q`
      passes: 48 passed in 7.58s.
- [ ] `bash autoresearch teensy40 --lpuart` becomes runnable once the
      `lpuart_peripheral_real.cpp.hpp` + engine TU land (workstream A
      Phase 1 follow-up).

Refs #3023

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

coderabbitai Bot commented Jun 14, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds LPUART (Teensy 4.x clockless) driver support to the autoresearch CI test runner. The Args dataclass gains an lpuart: bool field and matching CLI flag; the phase logic includes LPUART in driver selection and assigns a default TX pin of 1; the C++ runtime maps the driver name to fl::Bus::LPUART; unit tests are updated accordingly.

Changes

LPUART Driver Integration

Layer / File(s) Summary
Args dataclass and CLI flag registration
ci/autoresearch/args.py
Adds lpuart: bool to Args, registers --lpuart in the argument parser, updates --all help text, adds epilog docs, and populates the field in parse_args().
Driver selection and TX pin default in phases
ci/autoresearch/phases.py
Adds LPUART to the --all driver list and to the individual args.lpuart branch; introduces lpuart_tx_pin = 1 and assigns it to test_config["pinTx"] when driver is LPUART and no CLI TX pin is given.
C++ bus mapping and unit tests
examples/AutoResearch/AutoResearchRemote.cpp, ci/tests/test_autoresearch_phases.py
Maps driver name "LPUART" to fl::Bus::LPUART in runParallelTestImpl; updates _make_args defaults and test_all_drivers expectation to include "LPUART".

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Poem

🐇 A new flag hops into the queue,
--lpuart joins the driver crew.
TX pin set to one by default,
Teensy's UART leaps like a somersault!
The tests all pass, the phases align —
FastLED rabbits think this looks fine. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding LPUART driver support to the autoresearch CLI via --lpuart and --all flags, matching the core objective of integrating LPUART into the FastLED AutoResearch infrastructure.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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/lpuart-autoresearch-wiring

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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ci/autoresearch/args.py`:
- Around line 248-252: In the help text for the "--lpuart" argument, remove the
redundant "pin pinned" phrasing. Replace the awkward phrase "pin pinned to
1=LPUART6_TX by default" with clearer wording such as "defaults to pin
1=LPUART6_TX" or "pinned to pin 1=LPUART6_TX by default" to improve clarity and
eliminate the repetitive language.

In `@examples/AutoResearch/AutoResearchRemote.cpp`:
- Line 945: Remove the assignment `opts.mBus = fl::Bus::LPUART` from the
conditional branch since the `fl::Bus` enum defined in `src/fl/channels/bus.h`
does not contain an `LPUART` enumerator (the enum ends at `STUB`). Either delete
this entire else-if branch for the "LPUART" case, or add the `LPUART` enumerator
to the `fl::Bus` enum definition and add a corresponding case in the `busName()`
function if you intend to support this bus type in this PR.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 91b27b28-e812-4d66-bf07-8c177a4ac5ba

📥 Commits

Reviewing files that changed from the base of the PR and between a85d665 and db9a1ed.

📒 Files selected for processing (4)
  • ci/autoresearch/args.py
  • ci/autoresearch/phases.py
  • ci/tests/test_autoresearch_phases.py
  • examples/AutoResearch/AutoResearchRemote.cpp

Comment thread ci/autoresearch/args.py
Comment on lines +248 to +252
driver_group.add_argument(
"--lpuart",
action="store_true",
help="Test only LPUART clockless driver (Teensy 4.x only; eDMA-backed UART TX; pin pinned to 1=LPUART6_TX by default, override with --tx-pin in {1,8,14,17,20,24,29,35,47,48})",
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Minor wording improvement: "pin pinned" is redundant.

Line 251's help text says "pin pinned to 1" which is awkward. Consider rewording to "defaults to pin 1=LPUART6_TX" or "pinned to pin 1=LPUART6_TX by default" for clarity.

✏️ Suggested rewording
         driver_group.add_argument(
             "--lpuart",
             action="store_true",
-            help="Test only LPUART clockless driver (Teensy 4.x only; eDMA-backed UART TX; pin pinned to 1=LPUART6_TX by default, override with --tx-pin in {1,8,14,17,20,24,29,35,47,48})",
+            help="Test only LPUART clockless driver (Teensy 4.x only; eDMA-backed UART TX; defaults to pin 1=LPUART6_TX, override with --tx-pin in {1,8,14,17,20,24,29,35,47,48})",
         )
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ci/autoresearch/args.py` around lines 248 - 252, In the help text for the
"--lpuart" argument, remove the redundant "pin pinned" phrasing. Replace the
awkward phrase "pin pinned to 1=LPUART6_TX by default" with clearer wording such
as "defaults to pin 1=LPUART6_TX" or "pinned to pin 1=LPUART6_TX by default" to
improve clarity and eliminate the repetitive language.

else if (n == "UART") opts.mBus = fl::Bus::UART;
else if (n == "FLEX_IO") opts.mBus = fl::Bus::FLEX_IO;
else if (n == "OBJECT_FLED") opts.mBus = fl::Bus::OBJECT_FLED;
else if (n == "LPUART") opts.mBus = fl::Bus::LPUART;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Verify fl::Bus enum includes LPUART and busName() handles it

# Check Bus enum definition
echo "=== Checking fl::Bus enum for LPUART ==="
rg -n 'enum class Bus' -A 30 src/fl/channels/bus.h

echo ""
echo "=== Checking busName() switch for LPUART case ==="
rg -n 'inline const char\* busName' -A 50 src/fl/channels/bus.h | rg -C 3 'LPUART|return ""'

Repository: FastLED/FastLED

Length of output: 3833


Remove fl::Bus::LPUART assignment — enum value does not exist.

Line 945 assigns opts.mBus = fl::Bus::LPUART, but the fl::Bus enum (defined in src/fl/channels/bus.h) does not include an LPUART enumerator. The enum ends at STUB, and busName() has no corresponding case, so this code will fail to compile or function. Either remove this line or include the LPUART enum definition in this PR.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/AutoResearch/AutoResearchRemote.cpp` at line 945, Remove the
assignment `opts.mBus = fl::Bus::LPUART` from the conditional branch since the
`fl::Bus` enum defined in `src/fl/channels/bus.h` does not contain an `LPUART`
enumerator (the enum ends at `STUB`). Either delete this entire else-if branch
for the "LPUART" case, or add the `LPUART` enumerator to the `fl::Bus` enum
definition and add a corresponding case in the `busName()` function if you
intend to support this bus type in this PR.

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