Skip to content

fix(lpc): derive AutoResearch WS2812 loopback from platform - #3209

Merged
zackees merged 3 commits into
masterfrom
codex/retire-lpc-ws2812-opt-in
Jun 17, 2026
Merged

zackees merged 3 commits into
masterfrom
codex/retire-lpc-ws2812-opt-in

Conversation

@zackees

@zackees zackees commented Jun 17, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes #3128.
Updates #3208.

Retires the user-facing FASTLED_LPC_RX_SCT_WS2812 opt-in. The LPC845 AutoResearch low-memory sketch now derives the WS2812 loopback surface from FL_IS_ARM_LPC_845, auto-enables the SCT DMA capture path for that surface, and binds ws2812SctTest without a manual build flag.

This also promotes two LPC buildability fixes needed to validate the cleanup from clean master:

  • add the five LPC8xx boards to ci/boards.py with the concrete zackees/platform-nxplpc-arduino URL;
  • stop hard-including LPC845.h / LPC804.h from FastLED's LPC sysdefs because the ArduinoCore-LPC8xx PlatformIO package exposes only the active variant include directory.

Validation

  • rg -n "FASTLED_LPC_RX_SCT_WS2812" src examples ci platformio.ini returns no matches.
  • bash compile lpc845brk --examples AutoResearch --backend platformio now resolves the LPC platform and compiles through to link; GCC 8.2.1 overflows by 2200 bytes, which is the known old-toolchain flash-size limit rather than a missing RPC gate.
  • Local fbuild 2.2.30 produced .build/pio/lpc845brk/.fbuild/build/release/firmware.bin at 63,984 bytes.
  • Flashed that exact binary to LPC845-BRK after chip erase with pyOCD.
  • Live SWD halt after reset: pc = 0x0000d9f6, sp = 0x10003e78.
  • Serial RPC on COM10:
    • echo returned REMOTE: {"id":1,"result":4242,"jsonrpc":"2.0"}
    • ws2812SctTest returned REMOTE: {"id":2,"result":"0,0,1,3,0,0,3,0","jsonrpc":"2.0"}

The WS2812 response proves the RPC is bound without the retired FASTLED_LPC_RX_SCT_WS2812 build flag. The nonzero mismatch payload is the existing SCT capture/loopback behavior tracked by the hardware bench meta, not a method-registration failure.

Summary by CodeRabbit

  • New Features

    • Added support for NXP LPC8xx boards (LPC845BRK, LPC845, LPC804, LPCXPRESSO845MAX, LPCXPRESSO804).
  • Improvements

    • WS2812 loopback testing is now automatically enabled on LPC845 low-memory builds (no manual compile-time flag needed).
    • --ws2812-loopback help text updated, and the option is now accepted only for supported LPC845-related environments with a clear failure message otherwise.
  • Documentation

    • Updated AutoResearch LPC examples and run info to match the new automatic WS2812 RPC binding behavior.

@coderabbitai

coderabbitai Bot commented Jun 17, 2026 •

Copy link
Copy Markdown

Review Change Stack

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d6d12ec6-69df-42b7-aa78-e09f1416145b

📥 Commits

Reviewing files that changed from the base of the PR and between 4d3253c and 2d71bf6.

📒 Files selected for processing (1)
  • ci/autoresearch/phases.py
 ____________________________________________________________________________________
< Half-Life 3 could have been released by now, but I'm too busy reviewing your code. >
 ------------------------------------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
📝 Walkthrough

Walkthrough

Retires the FASTLED_LPC_RX_SCT_WS2812 manual build flag by introducing a derived FASTLED_AUTORESEARCH_LPC_WS2812 macro gated on FL_IS_ARM_LPC_845. The LPC platform sysdefs header gains self-contained __disable_irq/__enable_irq inline-assembly definitions. PlatformIO environments switch to an explicit Git-based platform URL. Five new LPC8xx board constants are added to ci/boards.py, and CI orchestrator comments are updated to reflect automatic RPC binding.

Changes

Retire FASTLED_LPC_RX_SCT_WS2812 and platform-derive the WS2812 loopback gate

Layer / File(s) Summary
Firmware: derived FASTLED_AUTORESEARCH_LPC_WS2812 guard and self-defined IRQ primitives
examples/AutoResearch/AutoResearchLowMemory.h, src/platforms/arm/lpc/led_sysdefs_arm_lpc.h
AutoResearchLowMemory.h derives FASTLED_AUTORESEARCH_LPC_WS2812 from FL_IS_ARM_LPC_845, moves LPC-only includes under FL_IS_ARM_LPC, and replaces all FASTLED_LPC_RX_SCT_WS2812 guards on the ws2812SctTest RPC handler. led_sysdefs_arm_lpc.h removes the conditional LPC845.h/LPC804.h CMSIS includes and instead defines __disable_irq()/__enable_irq() locally via cpsid i/cpsie i inline assembly when those symbols are not already defined.
PlatformIO config: explicit platform URL, removed flag, new LPC8xx board constants
platformio.ini, ci/boards.py
platformio.ini switches lpc845brk and the four LPC canary environments to the zackees/platform-nxplpc-arduino.git URL, removes FASTLED_LPC_RX_SCT_WS2812=1, and adds FASTLED_AUTORESEARCH_LOW_MEMORY=1. ci/boards.py adds LPC845BRK, LPC845, LPC804, LPCXPRESSO845MAX, and LPCXPRESSO804 as Board instances sharing a _NXPLPC_PLATFORM URL constant with platform_needs_install=True.
CI orchestrator: bring-up environment handling and WS2812 loopback validation
ci/autoresearch/phases.py
LPC bring-up logic now includes lpc845 in the bring_up_envs set and normalizes environment comparison to lowercase for case-insensitive matching. A new lpc_ws2812_envs allowlist guards --ws2812-loopback acceptance and returns a clear error message when invoked on unsupported environments.
CI orchestrator: stale flag references removed from docs and runtime messages
ci/autoresearch/args.py, ci/autoresearch/phases.py, ci/autoresearch/test_lpc_ws2812_loopback.py
Updates --ws2812-loopback help text, _run_lpc_ws2812_loopback_tests docstring, an inline comment, and a print() call to describe the ws2812SctTest RPC as automatically platform-enabled on LPC845 low-memory builds, replacing the prior "must be built with -DFASTLED_LPC_RX_SCT_WS2812=1" wording.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

  • #3128 (cleanup(lpc): retire FASTLED_LPC_RX_SCT_WS2812 manual opt-in): This PR directly implements the retirement of FASTLED_LPC_RX_SCT_WS2812 described in that issue, replacing it with FL_IS_ARM_LPC_845-derived gating across firmware, PlatformIO config, and CI orchestration.

Possibly related PRs

  • FastLED/FastLED#3031: Introduced the ws2812SctTest RPC and --ws2812-loopback Phase-2 plumbing that this PR now auto-enables without the manual build flag.
  • FastLED/FastLED#2837: Also modifies src/platforms/arm/lpc/led_sysdefs_arm_lpc.h to adjust how __disable_irq()/__enable_irq() and cli()/sei() are provided on LPC builds.
  • FastLED/FastLED#3089: Previously set FASTLED_LPC_RX_SCT_WS2812=1 as a default-on flag in platformio.ini for lpc845brk; this PR completes that by removing the flag entirely in favor of platform-derived gating.

Poem

🐇 Hop, hop, no more flags to set by hand,
The LPC845 knows its own land!
FL_IS_ARM_LPC_845 says "I'm the one,"
And ws2812SctTest auto-spun.
No more grep trails leading nowhere—
The platform gate is always there. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly summarizes the main change: retiring the manual FASTLED_LPC_RX_SCT_WS2812 flag and deriving WS2812 loopback enablement from platform predicates instead.
Linked Issues check ✅ Passed All primary coding objectives from #3128 are met: FASTLED_LPC_RX_SCT_WS2812 references removed, platform-derived gating implemented, boards added, and platformio.ini updated.
Out of Scope Changes check ✅ Passed All changes are directly aligned with #3128: removing the manual flag, implementing platform-based derivation, and adding necessary LPC8xx board configurations.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ 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 codex/retire-lpc-ws2812-opt-in

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.

@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Jun 17, 2026

@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/phases.py`:
- Around line 1273-1276: The `--ws2812-loopback` flag check before calling
`_run_lpc_ws2812_loopback_tests` does not verify that the target environment is
specifically LPC845, allowing non-LPC845 platforms like lpcxpresso804 to reach
the function where the firmware has no RPC binding for ws2812SctTest, causing
late failures. Add a guard condition to validate the environment is LPC845
(check for FL_IS_ARM_LPC_845 or appropriate platform predicate) in the
conditional block that gates the call to `_run_lpc_ws2812_loopback_tests`,
ensuring the check fails fast. Apply the same fix at lines 1906-1907 where
similar logic exists.

In `@platformio.ini`:
- Line 170: Pin the platform-nxplpc-arduino repository URL from its floating
branch tip to a fixed reference (tag or commit hash) to ensure deterministic and
reproducible builds. Update all instances of the nxplpc platform URL in
platformio.ini (lines 170, 194, 199, 204, and 209 where the platform URL is
specified for LPC environments) and the _NXPLPC_PLATFORM variable in
ci/boards.py to use the same fixed ref instead of resolving from a floating
branch. This prevents upstream drift and makes both CI and non-CI builds
deterministic.
🪄 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: a07b93d8-4604-47b8-8238-f6bb4191ee41

📥 Commits

Reviewing files that changed from the base of the PR and between ba46ef1 and f4f6bdd.

📒 Files selected for processing (7)
  • ci/autoresearch/args.py
  • ci/autoresearch/phases.py
  • ci/autoresearch/test_lpc_ws2812_loopback.py
  • ci/boards.py
  • examples/AutoResearch/AutoResearchLowMemory.h
  • platformio.ini
  • src/platforms/arm/lpc/led_sysdefs_arm_lpc.h

Comment thread ci/autoresearch/phases.py Resolved
Comment thread platformio.ini Resolved

@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: 1

🤖 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/phases.py`:
- Around line 1267-1270: The `lpc845` environment is added to the
`bring_up_envs` set at line 1267 with a case-insensitive comparison (using
.lower()), but the build/deploy branch around line 940 performs a case-sensitive
check that excludes `lpc845`. Locate the build/deploy branch logic around line
940 that handles environment routing and update it to include `lpc845` or apply
the same case-insensitive comparison pattern (using .lower()) consistently with
line 1267. This ensures `lpc845` is routed through the correct deploy path
regardless of how it's cased in the final_environment variable.
🪄 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: c1973e31-eefd-43ff-b8b5-dea702db8be9

📥 Commits

Reviewing files that changed from the base of the PR and between f4f6bdd and 4d3253c.

📒 Files selected for processing (3)
  • ci/autoresearch/phases.py
  • ci/boards.py
  • platformio.ini
🚧 Files skipped from review as they are similar to previous changes (2)
  • ci/boards.py
  • platformio.ini

Comment thread ci/autoresearch/phases.py Resolved
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.

cleanup(lpc): retire FASTLED_LPC_RX_SCT_WS2812 manual opt-in — derive from platform predicate instead

1 participant