Skip to content

perf(rpc/lpc): gate schema generator + enable RX_SCT_WS2812 default on lpc845brk (closes #3079) - #3089

Merged
zackees merged 1 commit into
masterfrom
feat/lpc-schema-gate-and-default-rx-3079
Jun 15, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/lpc-schema-gate-and-default-rx-3079

Conversation

@zackees

@zackees zackees commented Jun 15, 2026 •

Copy link
Copy Markdown
Member

Summary

Final piece of meta #3079 (LPC845 64 KB flash bloat hunt). Closes the meta with:

  1. Gate `mSchemaGenerator` construction on Low-memory targets (drops per-signature 800+ B `TypedSchemaGenerator::params()` instantiations that PR perf(rpc): gate rpc.discover + revert SBO bump to fix LowMemory regression (closes #3081) #3088 didn't reach because they're constructed at registration time, not at `rpc.discover` time).
  2. Default-enable `-DFASTLED_LPC_RX_SCT_WS2812=1` in `[env:lpc845brk]` — the WS2812 SCT-RX loopback RPC binding now ships on by default. The original blocker: "Re-enable `-DFASTLED_LPC_RX_SCT_WS2812=1` once additional flash-budget reduction lands".

Final flash budget on LPC845-BRK

```
PLATFORMIO_SRC_DIR=examples/AutoResearch fbuild build -e lpc845brk

Flash: 62.61KB / 64.00KB (97.8%)
RAM: 10.50KB / 16.00KB (65.6%)
build succeeded
```

1,420 B headroom under the 64 KB ceiling with `FASTLED_LPC_RX_SCT_WS2812=1` ON.

Meta #3079 progress arc

PR Closes Saved Cumulative
Baseline — — 77,004 B (+11,112)
#3084 #3077 (fl::function variant) -3,904 -3,904
#3085 #3076 (soft-FP cascade) -4,016 -7,920
#3086 unblocker (AVR `F()` macro) 0 -7,920
#3087 #3082 (ieee754 codec gate) -2,528 various interaction
#3088 #3081 (rpc.discover gate) various -11,256 net
this PR #3079 (final + default-on) -1,632 -12,888 net

Acceptance verification

Meta #3079 acceptance criteria:

Related

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Optimization

    • Reduced memory consumption on resource-constrained devices by conditionally compiling remote procedure call features based on available platform memory.
  • Improvements

    • Enabled FastLED WS2812 LED driver hardware acceleration support for the LPC845 breakout board.

…n lpc845brk (closes #3079)

Final piece of meta #3079 (LPC845 64 KB flash bloat hunt). Closes the meta.

## Two changes

### 1. Gate `mSchemaGenerator` construction on Low-memory

PR #3088 (closed #3081) gated the `rpc.discover` dispatch path, but the
`TypedSchemaGenerator<Sig>` constructors were still called from the RPC
registration sites in `Rpc::bind*()` -- so the per-signature 800+ B
`params()` instantiations stayed in `.text`. This PR gates the construction
itself on `FL_PLATFORM_HAS_LARGE_MEMORY`. The schema generator field stays
in `RpcEntry` (left nullptr on Low-memory) so the struct layout doesn't
change.

### 2. Enable `FASTLED_LPC_RX_SCT_WS2812=1` by default in platformio.ini

The original problem statement (meta #3079): "Re-enable
`-DFASTLED_LPC_RX_SCT_WS2812=1` once additional flash-budget reduction
lands". Reduction has landed across PRs #3084, #3085, #3087, #3088. With
this PR's schema gate, the LPC845-BRK AutoResearch build with the WS2812
SCT-RX loopback binding ON fits comfortably under 64 KB.

## Cumulative meta #3079 progress (LPC845-BRK, `+RX_SCT_WS2812=1`)

| Stage | Flash | Δ vs prev | Δ vs baseline |
|---|---:|---:|---:|
| Baseline (master pre-meta) | 77,004 B | — | 0 |
| + #3084 (closes #3077 — fl::function variant) | 73,100 B | -3,904 | -3,904 |
| + #3085 (closes #3076 — soft-FP cascade) | post-merge | various | -8 KB cumulative |
| + #3087 (closes #3082 — ieee754 codec gate) | post-merge | various | -10 KB cumulative |
| + #3088 (closes #3081 — rpc.discover gate) | 65,748 B | various | -11,256 |
| **+ this PR (schema gen gate)** | **64,116 B** | **-1,632** | **-12,888** |

Final state: **64,116 B / 65,536 B (97.8%) -- 1,420 B headroom**.

## Verification

```
PLATFORMIO_SRC_DIR=examples/AutoResearch fbuild build -e lpc845brk
  -> Flash: 62.61KB / 64.00KB (97.8%)
     RAM:   10.50KB / 16.00KB (65.6%)
     build succeeded
```

LD region overflow: NONE. .data LMA + .text within 64 KB FLASH.

Closes #3079
Closes #3081 (final schema-gen piece — #3088 closed the discover dispatch)

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

coderabbitai Bot commented Jun 15, 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: c6ffc3d1-4c8f-4227-a4a7-ea91550e1cce

📥 Commits

Reviewing files that changed from the base of the PR and between 370a840 and 741eb8a.

📒 Files selected for processing (3)
  • platformio.ini
  • src/fl/remote/rpc/rpc.cpp.hpp
  • src/fl/remote/rpc/rpc.h

📝 Walkthrough

Walkthrough

Rpc::registerMethod and Rpc::bindAsync now skip mSchemaGenerator construction and setParamNames calls when FL_PLATFORM_HAS_LARGE_MEMORY is not set, discarding paramNames via (void) on low-memory targets. The resulting flash savings enable uncommenting -DFASTLED_LPC_RX_SCT_WS2812=1 in the lpc845brk PlatformIO environment.

Changes

RPC Low-Memory Gating and LPC845 WS2812 Enable

Layer / File(s) Summary
Conditional schema generator in registerMethod and bindAsync
src/fl/remote/rpc/rpc.h, src/fl/remote/rpc/rpc.cpp.hpp
Rpc::registerMethod wraps entry.mSchemaGenerator construction and setParamNames in #if FL_PLATFORM_HAS_LARGE_MEMORY; low-memory targets discard paramNames via (void). Rpc::bindAsync applies the same guard around the mSchemaGenerator initialization for the response-aware async binding path.
Enable FASTLED_LPC_RX_SCT_WS2812 build flag
platformio.ini
Adds -DFASTLED_LPC_RX_SCT_WS2812=1 to the lpc845brk environment's build_flags, activating the previously commented-out WS2812 SCT RX feature for that bring-up target.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related issues

Possibly related PRs

  • FastLED/FastLED#3057: Modifies the same env:lpc845brk build_flags in platformio.ini, specifically around the -DFASTLED_LPC_RX_SCT_WS2812=1 flag being activated in this PR.
  • FastLED/FastLED#3055: Fixes LPC platform-detection include ordering so FL_PLATFORM_HAS_LARGE_MEMORY is computed correctly for LPC builds — the same macro this PR gates schema generation on.
  • FastLED/FastLED#3041: Consolidates AutoResearch low-memory mode registering the same JSON-RPC handlers (including ws2812SctTest) for LPC bring-up that this PR's memory savings and flag enablement support.

Poem

🐇 Hop hop, the memory bloat is gone,
No schema giant on the little LPC drawn,
The WS2812 flag at last set free,
A single line uncommented with glee.
The RAM is saved, the flash has room to spare,
This rabbit checks the build with nary a care! ✨

✨ 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/lpc-schema-gate-and-default-rx-3079

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.

@zackees
zackees merged commit 81bcaf3 into master Jun 15, 2026
8 checks passed
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Jun 15, 2026
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jun 15, 2026
zackees added a commit that referenced this pull request Jun 16, 2026
…RESEARCH_LOW_MEMORY (#3123)

The AutoResearch sketch already gates `<FastLED.h>` and the full LED-protocol
matrix behind `FASTLED_AUTORESEARCH_LOW_MEMORY` in AutoResearch.ino itself
(line 18). But the companion files in `examples/AutoResearch/` -- Ble.cpp,
Helpers.cpp, Net.cpp, Ota.cpp, Remote.cpp, Test.cpp -- compile
unconditionally and link the full BLE / Net / Helpers / Remote / Test code
into every build, including the LowMemory branch.

Two problems land at the same time:

1. **Master build regression** (verified now): AutoResearchRemote.cpp:3650
   references bare `memcpy`. With current master + LowMemory target the
   compile fails with "memcpy was not declared in this scope" because the
   LowMemory include set doesn't pull in `<cstring>`. The LowMemory sketch
   doesn't use anything in Remote.cpp anyway -- gating it out fixes the
   regression cleanly.

2. **Bloat hygiene** (refs #3076 / #3079): even though LTO dead-code-
   eliminates most of the unused symbols, the gates make the build's
   intent explicit -- the LowMemory bring-up doesn't need BLE/Net/OTA/
   schema-generator etc., and the LTO output reflects that.

Pattern matches `AutoResearch.ino`'s own `#if !FASTLED_AUTORESEARCH_LOW_MEMORY`
gate. Each .cpp picks up the same `fl/system/sketch_macros.h` auto-detect
(`FL_PLATFORM_HAS_LARGE_MEMORY == 0` -> LowMemory) so AVR / ATtiny / similar
Tiny-memory targets benefit without an explicit build flag.

Verification on LPC845-BRK with current master:

* Before this PR: build fails at compile (memcpy regression) under
  -DFASTLED_AUTORESEARCH_LOW_MEMORY=1.
* After this PR: build succeeds, fits 64 KB flash budget, echo RPC round-
  trips end-to-end via `bash autoresearch lpc845brk --pin-toggle-rx`.

Refs #3076 (LowMemory bloat hunt). Does NOT close #3076 -- that closes via
the bloat-reduction PRs that already shipped (#3084 / #3085 / #3087 / #3088
/ #3089); this is the compile-side hygiene the bloat-fix sweep didn't pick
up.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
@zackees
zackees deleted the feat/lpc-schema-gate-and-default-rx-3079 branch August 21, 2026 19:15
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