Skip to content

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

Closed

Description

@zackees

Proposal

Retire the FASTLED_LPC_RX_SCT_WS2812 build flag. It's a relic from the period when the LPC845 LowMemory build couldn't fit <FastLED.h> + fl::Remote together in 64 KB; that's no longer true post-#3084 / #3085 / #3087 / #3088 / #3089, and #3089 already flipped the flag default-on in platformio.ini.

The flag survives in 12 places across the tree:

File Reference
examples/AutoResearch/AutoResearchLowMemory.h:42, 64, 201, 299 gates <FastLED.h> + fl/chipsets/timing_traits.h include + the ws2812SctTest RPC handler body + the FASTLED_LPC_RX_SCT_DMA auto-enable
platformio.ini:168, 180, 181 now-stale comment + default-on entry + commented-out warning about the 64 KB budget
ci/autoresearch/args.py:351 docstring on --ws2812-loopback
ci/autoresearch/phases.py:1250, 1698, 1716 docstring + user-facing reminder text
ci/autoresearch/test_lpc_ws2812_loopback.py:31 docstring on "default off"

All gated content (the ws2812SctTest handler, the <FastLED.h> pull-in, the fl::chipsets::timing_traits include) is needed only on the LPC845-BRK and similar SCT-equipped LPC8xx parts -- and is useless on parts that don't have an SCT input-capture peripheral. So the right gate is platform, not a manual user-set macro.

What "the right gate" looks like

The pieces we have to compose:

  1. FL_IS_ARM_LPC_845 (and siblings for the other LPC8xx variants) -- already defined in platforms/arm/lpc/is_lpc.h. Tells us "this device has the SCT and the LPC SCT-RX driver."
  2. FL_PLATFORM_HAS_TINY_MEMORY / FL_PLATFORM_HAS_LARGE_MEMORY from Rename SKETCH_HAS_*_MEMORY macros to FL_PLATFORM_HAS_*_MEMORY #3000. Tells us "the target can fit the FastLED chipset matrix."

Today's AutoResearchLowMemory.h:64-67 is:

#if defined(FASTLED_LPC_RX_SCT_WS2812)
#include "FastLED.h"
#include "fl/chipsets/timing_traits.h"
#endif

The replacement should be unconditional on LPC845-BRK-class parts after the bloat sweep:

#if defined(FL_IS_ARM_LPC) && !defined(FL_PLATFORM_HAS_TINY_MEMORY_NO_FASTLED)
// LPC845-BRK and successors fit <FastLED.h> + fl::Remote post-#3084 sweep.
// Gate with the platform marker, NOT a user-set opt-in macro -- the
// macro was a relic from when this wouldn't fit in 64 KB.
#include "FastLED.h"
#include "fl/chipsets/timing_traits.h"
#endif

#if defined(FL_IS_ARM_LPC)
// ... ws2812SctTest RPC binding ...
#endif

(The exact gate name above is illustrative -- the right answer is whichever FL_PLATFORM_HAS_* family member already exists and maps to "has enough flash for FastLED.h.")

If a future LPC variant truly can't fit (e.g. some smaller LPC family member with 32 KB flash), the gate auto-engages via FL_PLATFORM_HAS_TINY_MEMORY without needing a manual build flag.

Why this matters

  1. Cognitive load. The platformio.ini comment block today documents the macro as a 64-KB-budget gate even though current master fits without it. Anyone reading that comment will believe the macro is required when it isn't.
  2. One-platform builds break silently. If a bash autoresearch lpc845brk --ws2812-loopback job ever runs against an environment that forgets to define the macro, the RPC isn't bound, the orchestrator gets Method not found, and the failure trail leads nowhere useful. Auto-gating on platform removes that footgun.
  3. Tree-shaking is the right mental model. The user-facing claim "code that isn't called is dropped by the linker" should be true here -- and it nearly is. The remaining 20 KB is <FastLED.h> worth of EngineEvents registration + gamma LUT + global constructors that LTO can't eliminate because they have observable side effects. Those are fundamentally compile-time-gated -- but the gate should be derived from the target's properties, not from user opt-in.

Proposed sub-tasks

  • Sub-1: Pick the platform predicate. Walk through fl/system/sketch_macros.h to confirm which of the FL_PLATFORM_HAS_* family maps to "fits <FastLED.h> + fl::Remote together." Most likely FL_PLATFORM_HAS_LARGE_MEMORY is too strict (excludes LPC845-BRK), so we may need a new tier (FL_PLATFORM_HAS_MEDIUM_MEMORY?) or use !FL_PLATFORM_HAS_TINY_MEMORY if the bloat budget allows.
  • Sub-2: Replace the macro in AutoResearchLowMemory.h with the predicate from Sub-1.
  • Sub-3: Delete the macro from platformio.ini plus the stale comments around it.
  • Sub-4: Update the autoresearch test runner (ci/autoresearch/phases.py, args.py, test_lpc_ws2812_loopback.py) so the "must be built with" advisory text goes away.
  • Sub-5: Confirm bash autoresearch lpc845brk --ws2812-loopback still works end-to-end on hardware with zero build flags set.

Acceptance

This closes when:

  • No reference to FASTLED_LPC_RX_SCT_WS2812 remains anywhere in the source tree (grep -r FASTLED_LPC_RX_SCT_WS2812 src/ examples/ ci/ platformio.ini returns empty).
  • bash autoresearch lpc845brk --ws2812-loopback --upload-port COM<N> succeeds on real hardware with default platformio.ini.
  • The retirement is documented in the closing PR's description so future readers understand why the gate moved from "manual opt-in" to "platform-derived."

Refs

🤖 Filed via Claude Code.

Activity

  1. moved this from Triage to Done in FastLED Trackeron Jun 17, 2026
  2. zackees commented on Jun 17, 2026

    @zackees
    MemberAuthor

    Fixed by #3209, merged in 01d40ff.

    Upgrade/use notes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions