Skip to content

fix(autoresearch): reject unsupported RX pins - #3356

Merged
zackees merged 1 commit into
masterfrom
codex/teensy-driver-bringup
Jun 24, 2026
Merged

zackees merged 1 commit into
masterfrom
codex/teensy-driver-bringup

Conversation

@zackees

@zackees zackees commented Jun 24, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes #3355.
Part of #3353.

This makes AutoResearch reject unsupported RX pins honestly instead of allowing FastLED.addRx() to hand back a dummy channel and then spending time on a driver test that cannot capture bytes.

Changes:

  • Treat RX channel creation as failed when FastLED.addRx() returns null or a channel whose getPin() does not match the requested RX pin.
  • Treat JSON-RPC error responses as failures even when the response omits success: false.
  • Stop immediately when setup RPCs such as setPins fail.
  • Surface captured-byte counts and zero-capture status in host diagnostics.

Verification

uv run --no-sync pytest ci/tests/test_autoresearch_phases.py::TestRunTestsOrSpecialMode::test_rpc_control_success_without_passed_field ci/tests/test_autoresearch_phases.py::TestRunTestsOrSpecialMode::test_rpc_control_error_without_success_false_stops_run ci/tests/test_autoresearch_phases.py::TestRunTestsOrSpecialMode::test_rpc_test_failure ci/tests/test_autoresearch_phases.py::TestRunTestsOrSpecialMode::test_rpc_test_all_pass

Result: 4 passed.

bash autoresearch teensy41 --object-fled --tx-pin 8 --rx-pin 9 --strip-sizes 1 --timeout 2m

Result: expected failure at setPins with RxChannelCreationFailed; only 1 RPC test request sent. This confirms the unsupported Teensy RX pin is rejected before driver testing.

Summary by CodeRabbit

  • Bug Fixes

    • Improved RX diagnostics so failed captures now show how many bytes were received and when no decodable data was produced.
    • Made setup-related control operations stop earlier when an error occurs, preventing follow-on commands from running after a failed initialization step.
    • Strengthened RX channel creation to avoid using a channel when it does not match the requested pin, reducing misconfiguration issues.
  • Tests

    • Added coverage for control errors that do not explicitly report success: false.

@zackees
zackees merged commit 525ee20 into master Jun 24, 2026
7 of 10 checks passed
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Jun 24, 2026
@zackees
zackees deleted the codex/teensy-driver-bringup branch June 24, 2026 17:35
@coderabbitai

coderabbitai Bot commented Jun 24, 2026 •

Copy link
Copy Markdown

Review Change Stack

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: 1b15742c-4e79-4765-a60f-5444bc46b9e7

📥 Commits

Reviewing files that changed from the base of the PR and between bb2e544 and 5ae40c5.

📒 Files selected for processing (4)
  • ci/autoresearch/context.py
  • ci/autoresearch/phases.py
  • ci/tests/test_autoresearch_phases.py
  • examples/AutoResearch/AutoResearch.ino

📝 Walkthrough

Walkthrough

The PR adds a pin-match guard to createRxDevice in AutoResearch.ino, refactors RPC setup-method failure handling in phases.py to detect errors via success is False or an error field and break early, and extends context.py pattern failure output with capturedBytes/captureFailed diagnostics. A new test verifies that an error-only RPC response stops the run.

Changes

AutoResearch RX validation and RPC error handling

Layer / File(s) Summary
Firmware RX channel pin-match validation
examples/AutoResearch/AutoResearch.ino
createRxDevice captures the FastLED.addRx(config) return value and returns an empty shared_ptr when the channel's getPin() does not match the requested pin, instead of returning the channel unconditionally.
RPC setup-method detection and early-exit on failure
ci/autoresearch/phases.py
Introduces a setup_method boolean for pin/lane/color RPCs (setPins, setTxPin, setRxPin, setLaneSizes, setSolidColor); unifies failure detection to cover both success is False and presence of an error field; breaks out of the RPC loop early when a setup RPC fails; removes the previously separate success is False branch.
RX capture diagnostics and test
ci/autoresearch/context.py, ci/tests/test_autoresearch_phases.py
display_pattern_details extracts capturedBytes and captureFailed from each pattern result and conditionally prints byte counts and an "RX produced no decodable bytes" message. A new test confirms that an RPC error response without an explicit success: False causes _run_tests_or_special_mode to return exit code 1 and issue exactly one RpcClient.send call.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related issues

Possibly related PRs

  • FastLED/FastLED#2297: Both PRs modify the autoresearch RX-capture failure path — this PR adds capturedBytes/captureFailed reporting in display_pattern_details, while that PR hard-fails on truncated RX capture in the WS2812 comparison loop.
  • FastLED/FastLED#2400: Both PRs modify examples/AutoResearch/AutoResearch.ino RX channel construction — this PR adds a pin-verification guard on the returned channel, while that PR introduced the fl::RxChannel/addRx API used here.

Poem

🐇 Hoppity-hop through the RX lane,
A pin that's wrong won't cause more pain.
Setup RPCs now break on error,
No dummy channel, no decoder terror.
Bytes captured or none — we print the truth,
AutoResearch is now a careful sleuth! 🔌

✨ 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 codex/teensy-driver-bringup

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.

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.

fix(autoresearch): reject unsupported Teensy RX pins before driver tests

1 participant