Skip to content

Add raw pulse-train callback API with documentation and example integration#211

Draft
Copilot wants to merge 4 commits into
mainfrom
copilot/feature-user-callback-raw-pulse-trains
Draft

Add raw pulse-train callback API with documentation and example integration#211
Copilot wants to merge 4 commits into
mainfrom
copilot/feature-user-callback-raw-pulse-trains

Conversation

Copilot AI commented May 27, 2026

Copy link
Copy Markdown
Contributor

This change adds a user-registerable callback for raw pulse/gap trains so downstream code can consume captured RF pulse data even when no built-in decoder matches. The callback is invoked from the decoder task for every captured signal, enabling on-device custom protocol decoding without parsing serial output.

  • Public API: raw pulse callback registration

    • Added rtl_433_raw_pulse_cb typedef to expose raw pulse/gap, pulse count, duration, and RSSI.
    • Added rtl_433_ESP::setRawPulsesCallback(...) to register/unregister the callback.
  • Decoder pipeline wiring

    • Added internal _setRawPulsesCallback(...) plumbing.
    • Invoked the callback in rtl_433_DecoderTask after pulse data is prepared, independent of decode result (events may be zero or non-zero).
  • Concurrency safety

    • Stored callback pointer as an atomic and used release/acquire semantics on registration/use to avoid cross-task races during callback updates.
  • Documentation and example updates

    • Documented the callback interface and usage in README.md (including callback signature and pointer lifetime note).
    • Updated example/OOK_Receiver/OOK_Receiver.ino to register setRawPulsesCallback(...) and demonstrate raw pulse/gap logging.
    • Updated example/OOK_Receiver/README.md to note both JSON and raw pulse callback paths.
typedef void (*rtl_433_raw_pulse_cb)(
    const int* pulse_us,
    const int* gap_us,
    unsigned int num_pulses,
    unsigned long duration_us,
    int rssi
);

rf.setRawPulsesCallback(myRawPulseHandler);

Copilot AI changed the title [WIP] Add user callback for raw pulse trains Add raw pulse-train callback API for custom decoder integrations May 27, 2026
Copilot AI requested a review from NorthernMan54 May 27, 2026 03:01
@NorthernMan54

Copy link
Copy Markdown
Owner

@copilot Pls also document the interface, and create an example

Copilot AI commented May 27, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Pls also document the interface, and create an example

Added both in commit 22777dc.

  • Documented the raw pulse callback interface and usage in README.md.
  • Updated example/OOK_Receiver/OOK_Receiver.ino to register setRawPulsesCallback(...) and log sample raw pulse/gap timing data.
  • Updated example/OOK_Receiver/README.md to note both callback types in the sample.

Copilot AI changed the title Add raw pulse-train callback API for custom decoder integrations Add raw pulse-train callback API with documentation and example integration May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: user callback for raw pulse trains (enables custom decoders without modifying the library)

2 participants