Skip to content

refactor(examples): pass fl::Remote* explicitly to AutoResearchRemote bind*Methods - #3188

Merged
zackees merged 1 commit into
masterfrom
refactor/3187-pass-remote-to-binders
Jun 16, 2026
Merged

zackees merged 1 commit into
masterfrom
refactor/3187-pass-remote-to-binders

Conversation

@zackees

@zackees zackees commented Jun 16, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #3187. Makes the bind target explicit in the signature instead of implicit via mRemote.

Before: void bindBasicMethods(); (lambdas captured [this] and called mRemote->bind(...))

After: void bindBasicMethods(fl::Remote* remote); (lambdas still capture [this] for state/method access; binding goes through the parameter)

Mechanical sweep: 50 mRemote->bind sites rewritten to remote->bind across 7 binder files. Header signatures updated. registerFunctions() shell updated to pass mRemote.get() to each call.

Why:

  • The bind target is now obvious from the signature alone
  • Same partitioning could serve mBleRemote (or any future transport) without code duplication
  • Easier to reason about — no implicit this->mRemote coupling

Verified: bash compile wasm --examples AutoResearch — success (48.42 s total).

Generated with Claude Code.

Summary by CodeRabbit

  • Refactor
    • Updated remote control method binding to accept explicit remote instances instead of relying on implicit internal references, improving flexibility in handling remote communication configurations across multiple binding method groups.

…d*Methods

Follow-up to #3187 (AutoResearchRemote.cpp split). Each bind*Methods()
now takes the fl::Remote* target as a parameter rather than implicitly
using mRemote. Makes the dependency obvious from the signature and lets
the same partitioning serve mBleRemote or any future transport without
duplicating code.

Before:
  void bindBasicMethods();             // implicit this->mRemote
  void registerFunctions(state) {
      mState = state;
      bindBasicMethods();
      bindFlexioMethods();
      ...
  }

After:
  void bindBasicMethods(fl::Remote* remote);
  void registerFunctions(state) {
      mState = state;
      bindBasicMethods(mRemote.get());
      bindFlexioMethods(mRemote.get());
      ...
  }

Mechanical sweep across 7 binder .cpp files: 50 mRemote->bind sites
rewritten to remote->bind; signatures updated; registerFunctions shell
in AutoResearchRemote.cpp updated to pass mRemote.get() to each call.

Verified: bash compile wasm --examples AutoResearch — success (library
32.53 s, sketch 2.37 s, link 4.86 s, total 48.42 s).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@zackees
zackees merged commit b39716c into master Jun 16, 2026
5 of 6 checks passed
@zackees
zackees deleted the refactor/3187-pass-remote-to-binders branch June 16, 2026 06:19
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Jun 16, 2026
@coderabbitai

coderabbitai Bot commented Jun 16, 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: d29a8ff8-2c4b-4228-9da4-f4ddee5449bc

📥 Commits

Reviewing files that changed from the base of the PR and between ec94e4d and b01dd5f.

📒 Files selected for processing (9)
  • examples/AutoResearch/AutoResearchRemote.cpp
  • examples/AutoResearch/AutoResearchRemote.h
  • examples/AutoResearch/AutoResearchRemoteAsyncNetMethods.cpp
  • examples/AutoResearch/AutoResearchRemoteBasicMethods.cpp
  • examples/AutoResearch/AutoResearchRemoteBenchmarkMethods.cpp
  • examples/AutoResearch/AutoResearchRemoteCoroutineMethods.cpp
  • examples/AutoResearch/AutoResearchRemoteFlexioMethods.cpp
  • examples/AutoResearch/AutoResearchRemoteGpioMethods.cpp
  • examples/AutoResearch/AutoResearchRemotePerfMethods.cpp

📝 Walkthrough

Walkthrough

All seven private bind*Methods helpers in AutoResearchRemoteControl are refactored to accept an explicit fl::Remote* remote parameter. The header declarations, the registerFunctions call site (which now passes mRemote.get()), and all seven implementation files are updated uniformly; no handler logic changes.

Changes

RPC Binding Parameter Refactor

Layer / File(s) Summary
Header declarations and registerFunctions call site
examples/AutoResearch/AutoResearchRemote.h, examples/AutoResearch/AutoResearchRemote.cpp
Private bind*Methods declarations updated from parameterless to fl::Remote* remote signatures; registerFunctions updated to pass mRemote.get() to each binder.
All bind*Methods implementations
examples/AutoResearch/AutoResearchRemoteBasicMethods.cpp, examples/AutoResearch/AutoResearchRemoteFlexioMethods.cpp, examples/AutoResearch/AutoResearchRemoteGpioMethods.cpp, examples/AutoResearch/AutoResearchRemoteBenchmarkMethods.cpp, examples/AutoResearch/AutoResearchRemoteAsyncNetMethods.cpp, examples/AutoResearch/AutoResearchRemoteCoroutineMethods.cpp, examples/AutoResearch/AutoResearchRemotePerfMethods.cpp
Each bind method definition adds the fl::Remote* remote parameter and switches all mRemote->bind(...) call sites to remote->bind(...). Handler logic and lambda bodies are unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 Hopping through the code with glee,
Each method now receives its key—
A remote pointer, passed with care,
No more members pulled from thin air.
The binders bind where they are told,
A tidy refactor, clean and bold!

✨ 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 refactor/3187-pass-remote-to-binders

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 from Triage to Done in FastLED Tracker Jun 16, 2026
zackees added a commit that referenced this pull request Jun 16, 2026
…(non-null by type) (#3189)

Follow-up to #3188. mRemote is created in the AutoResearchRemoteControl
constructor and never reassigned to null — the bind targets are
non-nullable by construction. Express that in the type system by
switching from fl::Remote* to fl::Remote&.

Header signatures:
  void bindBasicMethods(fl::Remote& remote);
  // ... etc, 7 binders ...

Caller (registerFunctions shell):
  bindBasicMethods(*mRemote);    // was mRemote.get()
  bindFlexioMethods(*mRemote);
  ...

Call sites inside each binder:
  remote.bind("status", ...);    // was remote->bind(...)

Mechanical sweep: 50 remote->bind sites rewritten to remote.bind across
the 7 binder .cpp files; signatures updated in header + each .cpp; core
shell now dereferences mRemote at the call site.

Verified: bash compile wasm --examples AutoResearch — success (library
59.60 s, sketch 3.02 s, link 4.89 s, total 76.96 s).

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
zackees added a commit that referenced this pull request Jun 16, 2026
…ey test (#3191)

Follow-up to #3187/#3188/#3189. Old names were partly implementation-named
(FlexIO is Teensy-only), partly vague (Basic, Coroutine). Renaming so each
group describes WHAT the RPCs exercise.

Rename map:
  bindBasicMethods     → bindSystemMethods      // status, ping, debug, help
  bindFlexioMethods    → bindDriverMethods      // LED driver tests (FlexIO today)
  bindGpioMethods      → bindPinMethods         // pin config (GPIO is impl)
  bindBenchmarkMethods → bindMathMethods        // SIMD/animartrix/wave/parlio
  bindAsyncNetMethods  → bindNetworkMethods     // WiFi/OTA/BLE/codec/testAsync
  bindCoroutineMethods → bindAsyncMethods       // coroutine + promise primitives
  bindPerfMethods      → bindBenchmarkMethods   // perfProbe* + wave2dPerf

Files renamed (git mv preserves history):
  BasicMethods.cpp     → SystemMethods.cpp
  FlexioMethods.cpp    → DriverMethods.cpp
  GpioMethods.cpp      → PinMethods.cpp
  BenchmarkMethods.cpp → MathMethods.cpp
  AsyncNetMethods.cpp  → NetworkMethods.cpp
  CoroutineMethods.cpp → AsyncMethods.cpp
  PerfMethods.cpp      → BenchmarkMethods.cpp  (swap: was PerfMethods, takes
                                                BenchmarkMethods name now)

Header file-comments rewritten to describe the *category* rather than
enumerate every RPC — categories are stable, RPC lists drift.

Driver bin's comment notes the platform-specificity intent: today it
holds Teensy 4.x FlexIO RX validation; future platform-specific driver
tests for other MCUs land in the same bin, gated by per-binding #if
guards rather than file-level partitioning.

Verified: bash compile wasm --examples AutoResearch — success
(library 40.03 s, sketch 2.89 s, link 6.05 s, total 59.89 s).

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
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