Conversation

SuGlider

Description of Change

Extends Arduino OpenThread Library to implement Native API.
For more details, please read the new README.md file and provided library examples.

Tests scenarios

Using C6 and H2 with the provided CLI and Native examples

Related links

None

@SuGliderSuGlider added this to the 3.2.1 milestone Jun 16, 2025
@SuGliderSuGlider self-assigned this Jun 16, 2025
@SuGliderSuGlider requested a review from lucasssvaz as a code owner June 16, 2025 05:33
@SuGliderSuGlider added the Area: OpenThreadIssues and Feature Request about OpenThread Protocollabel Jun 16, 2025
@SuGliderSuGlider moved this from Todo to In Progress in Arduino ESP32 Core Project Roadmap Jun 16, 2025
@github-actionsGitHub Actions
Messages
📖This PR seems to be quite large (total lines of code: 1038), you might consider splitting it into smaller PRs

👋 Hello SuGlider, we appreciate your contribution to this project!


📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more.

🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project.

Click to see more instructions ...


This automated output is generated by the PR linter DangerJS, which checks if your Pull Request meets the project's requirements and helps you fix potential issues.

DangerJS is triggered with each push event to a Pull Request and modify the contents of this comment.

Please consider the following:
- Danger mainly focuses on the PR structure and formatting and can't understand the meaning behind your code or changes.
- Danger is not a substitute for human code reviews; it's still important to request a code review from your colleagues.
- Addressing info messages (📖) is strongly recommended; they're less critical but valuable.
- To manually retry these Danger checks, please navigate to the Actions tab and re-run last Danger workflow.

Review and merge process you can expect ...


We do welcome contributions in the form of bug reports, feature requests and pull requests.

1. An internal issue has been created for the PR, we assign it to the relevant engineer.
2. They review the PR and either approve it or ask you for changes or clarifications.
3. Once the PR is approved we do the final review, collect approvals from core owners and make sure all the automated tests are passing.
- At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
4. If the change is approved and passes the tests it is merged into the default branch.

Generated by 🚫 dangerJS against a0e01f4

@github-actionsGitHub Actions

Test Results

 76 files   76 suites   12m 45s ⏱️
 38 tests  38 ✅ 0 💤 0 ❌
241 runs  241 ✅ 0 💤 0 ❌

Results for commit a0e01f4.

♻️ This comment has been updated with latest results.

@SuGliderSuGlider requested a review from me-no-dev as a code owner June 16, 2025 05:38
@SuGliderSuGlider requested a review from P-R-O-C-H-Y June 16, 2025 05:39
@github-actionsGitHub Actions

Memory usage test (comparing PR against master branch)

The table below shows the summary of memory usage change (decrease - increase) in bytes and percentage for each target.

MemoryFLASH [bytes]FLASH [%]RAM [bytes]RAM [%]
TargetDECINCDECINCDECINCDECINC
ESP32C6💚 -110K⚠️+434💚 -10.42⚠️+0.04💚 -200⚠️+184💚 -0.43⚠️+0.39
ESP32H2💚 -110K⚠️+434💚 -10.23⚠️+0.04💚 -216⚠️+168💚 -0.47⚠️+0.37
Click to expand the detailed deltas report [usage change in BYTES]
TargetESP32C6ESP32H2
ExampleFLASHRAMFLASHRAM
libraries/OpenThread/examples/CLI/COAP/coap_lamp⚠️+394⚠️+184⚠️+386⚠️+160
libraries/OpenThread/examples/CLI/COAP/coap_switch⚠️+388⚠️+176⚠️+394⚠️+160
libraries/OpenThread/examples/CLI/SimpleCLI⚠️+432⚠️+152⚠️+434⚠️+144
libraries/OpenThread/examples/CLI/SimpleNode💚 -1430⚠️+176💚 -1440⚠️+168
libraries/OpenThread/examples/CLI/SimpleThreadNetwork/ExtendedRouterNode⚠️+318⚠️+176⚠️+322⚠️+168
libraries/OpenThread/examples/CLI/SimpleThreadNetwork/LeaderNode⚠️+350⚠️+184⚠️+358⚠️+160
libraries/OpenThread/examples/CLI/SimpleThreadNetwork/RouterNode⚠️+350⚠️+184⚠️+358⚠️+160
libraries/OpenThread/examples/CLI/ThreadScan⚠️+366⚠️+152⚠️+364⚠️+144
libraries/OpenThread/examples/CLI/onReceive⚠️+434⚠️+152⚠️+434⚠️+144
libraries/OpenThread/examples/Native/SimpleThreadNetwork/LeaderNode💚 -109K💚 -200💚 -110K💚 -216
libraries/OpenThread/examples/Native/SimpleThreadNetwork/RouterNode💚 -110K💚 -200💚 -110K💚 -216

@me-no-devme-no-dev requested a review from Copilot June 16, 2025 08:17

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Extends the Arduino OpenThread library by adding a native OThread API alongside the existing CLI API and updates all examples and build scripts to use the new class.

  • Introduces OThread.begin()/end() and prefixes all static API calls with OThread.
  • Updates example sketches to call OThread.begin(...) before OThreadCLI.begin()
  • Updates README documentation and CMakeLists to include the new source

Reviewed Changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated no comments.

Show a summary per file
FileDescription
libraries/OpenThread/examples/CLI/onReceive/onReceive.inoSwitched from OThreadCLI.begin() to OThread.begin() then CLI
libraries/OpenThread/examples/CLI/ThreadScan/ThreadScan.inoUpdated API calls to OThread. prefix and copyright
libraries/OpenThread/examples/CLI/SimpleThreadNetwork/RouterNode/RouterNode.inoPrefixed API with OThread. and reordered init calls
libraries/OpenThread/examples/CLI/SimpleThreadNetwork/LeaderNode/LeaderNode.inoPrefixed API with OThread. and reordered init calls
libraries/OpenThread/examples/CLI/SimpleThreadNetwork/ExtendedRouterNode/ExtendedRouterNode.inoPrefixed API with OThread. and reordered init calls
libraries/OpenThread/examples/CLI/SimpleNode/SimpleNode.inoPrefixed API with OThread. and reordered init calls
libraries/OpenThread/examples/CLI/SimpleCLI/SimpleCLI.inoPrefixed API with OThread. and reordered init calls
libraries/OpenThread/examples/CLI/COAP/coap_switch/coap_switch.inoPrefixed API with OThread. and reordered init calls
libraries/OpenThread/examples/CLI/COAP/coap_lamp/coap_lamp.inoPrefixed API with OThread. and reordered init calls
libraries/OpenThread/README.mdAdded native API docs, updated classes and methods
CMakeLists.txtAdded OThread.cpp to OpenThread library sources
Comments suppressed due to low confidence (4)

libraries/OpenThread/examples/CLI/ThreadScan/ThreadScan.ino:30

  • [nitpick] The inline comment still refers to CLI auto-start behavior; update it to clarify that the true argument now applies to OThread.begin.
OThread.begin(true);      // For scanning, AutoStart must be active, any setup

libraries/OpenThread/README.md:239

  • [nitpick] This method description is duplicated under Console Management; consider consolidating to avoid confusion about which begin applies to CLI versus native API.
-- `begin(bool OThreadAutoStart = true)`: Initializes the OpenThread stack (optional auto-start).

libraries/OpenThread/README.md:165

  • The heading uses inline asterisks instead of a markdown heading; consider changing to ## Notes for consistency with other sections.
** Notes

CMakeLists.txt:168

  • If DataSet has its own .cpp implementation, it should also be added to the ARDUINO_LIBRARY_OpenThread_SRCS list to ensure it’s compiled.
  libraries/OpenThread/src/OThread.cpp

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@me-no-devme-no-dev added the Status: Pending MergePull Request is ready to be mergedlabel Jun 16, 2025
@me-no-devme-no-dev merged commit ef995b6 into espressif:master Jun 16, 2025
52 checks passed
@github-project-automation-project-automation bot moved this from In Progress to Done in Arduino ESP32 Core Project Roadmap Jun 16, 2025
Sign up for free to join this conversation on . Already have an account? Sign in to comment
Area: OpenThreadIssues and Feature Request about OpenThread ProtocolStatus: Pending MergePull Request is ready to be merged

Successfully merging this pull request may close these issues.