Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: BLEAdvertising methods return error codes #11154

Merged
merged 4 commits into from
Mar 27, 2025

Conversation

FidelSch
Copy link
Contributor

Some methods on BLEAdvertising returned void even if they could produce an error, in which case they failed silently. They now return the corresponding error code.

Description of Change

These methods have been modified to return any potential error code

Tests scenarios

Unfortunately I currently do not have the necessary HW available

Related links

Addresses #6003

Some methods returned void even if they could produce an error, in which case they failed silently. They now return the corresponding error code.
@CLAassistant
Copy link

CLAassistant commented Mar 20, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

github-actions bot commented Mar 20, 2025

Warnings
⚠️

Some issues found for the commit messages in this PR:

  • the commit message "fix: BLEAdvertising methods return error codes":
    • body's lines must not be longer than 100 characters

Please fix these commit messages - here are some basic tips:

  • follow Conventional Commits style
  • correct format of commit message should be: <type/action>(<scope/component>): <summary>, for example fix(esp32): Fixed startup timeout issue
  • allowed types are: change,ci,docs,feat,fix,refactor,remove,revert,test
  • sufficiently descriptive message summary should be between 10 to 72 characters and start with upper case letter
  • avoid Jira references in commit messages (unavailable/irrelevant for our customers)

TIP: Install pre-commit hooks and run this check when committing (uses the Conventional Precommit Linter).

⚠️

The source branch "BLEAdvertising-return-codes" incorrect format:

  • contains uppercase letters. This can cause troubles on case-insensitive file systems (macOS).
    Please rename your branch.

👋 Hello FidelSch, 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.
- Resolve all warnings (⚠️ ) before requesting a review from human reviewers - they will appreciate it.
- 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 GitHub 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 ae1d904

@SuGlider
Copy link
Collaborator

@FidelSch - Arduino returns bool to indicate an operation success or failure.
esp_err_t is used under IDF. A possible way to chage it would by testing esp_err_t ESP_OK in the return of an IDF functions.

Could you change the code to test ESP_OK returning true or false instead?
All functions would return bool.

@SuGlider SuGlider self-requested a review March 21, 2025 14:52
Changed from returning esp_error_t, in order to be more arduino compatible.
@FidelSch FidelSch requested a review from SuGlider March 24, 2025 22:27
@FidelSch
Copy link
Contributor Author

Thanks for your suggestions. I should mention I now used "yoda notation" for the evaluation of the return value, as this is how it is implemented in other methods in the same file. I was not sure wether to modify the if statements with similar expressions, so I didn't. If you think this would be a good idea, I am happy to implement it.

Copy link
Contributor

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
ESP32S30⚠️ +320.000.00000.000.00
ESP32C3💚 -500💚 -0.010.00000.000.00
ESP32C6💚 -5000.000.00000.000.00
ESP32H2💚 -5000.000.00000.000.00
ESP320⚠️ +400.000.00000.000.00
Click to expand the detailed deltas report [usage change in BYTES]
TargetESP32S3ESP32C3ESP32C6ESP32H2ESP32
ExampleFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAM
libraries/BLE/examples/BLE5_extended_scan00000000--
libraries/BLE/examples/BLE5_multi_advertising00000000--
libraries/BLE/examples/BLE5_periodic_advertising00000000--
libraries/BLE/examples/BLE5_periodic_sync00000000--
libraries/BLE/examples/Beacon_Scanner0000000000
libraries/BLE/examples/Client0000000000
libraries/BLE/examples/EddystoneTLM_Beacon⚠️ +320💚 -160💚 -160💚 -160⚠️ +280
libraries/BLE/examples/EddystoneURL_Beacon⚠️ +320💚 -160💚 -160💚 -160⚠️ +400
libraries/BLE/examples/Notify00💚 -500💚 -500💚 -50000
libraries/BLE/examples/Scan0000000000
libraries/BLE/examples/Server00💚 -500💚 -500💚 -500⚠️ +40
libraries/BLE/examples/Server_multiconnect00💚 -500💚 -500💚 -500⚠️ +40
libraries/BLE/examples/UART00💚 -500💚 -500💚 -500⚠️ +40
libraries/BLE/examples/Write00💚 -500💚 -500💚 -500⚠️ +40
libraries/BLE/examples/iBeacon⚠️ +240💚 -220💚 -220💚 -220⚠️ +200

Copy link
Collaborator

@SuGlider SuGlider left a comment

Choose a reason for hiding this comment

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

bool BLEAdvertising::start() must return a value. all good.

Copy link
Contributor

github-actions bot commented Mar 25, 2025

Test Results

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

Results for commit ae1d904.

♻️ This comment has been updated with latest results.

@SuGlider SuGlider self-requested a review March 27, 2025 01:26
Copy link
Collaborator

@SuGlider SuGlider left a comment

Choose a reason for hiding this comment

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

All fine. Thanks!

@SuGlider SuGlider added Area: BLE Issues related to BLE Status: Review needed Issue or PR is awaiting review labels Mar 27, 2025
@SuGlider SuGlider added this to the 3.2.0 milestone Mar 27, 2025
@me-no-dev me-no-dev added Status: Pending Merge Pull Request is ready to be merged and removed Status: Review needed Issue or PR is awaiting review labels Mar 27, 2025
@me-no-dev me-no-dev merged commit 8622147 into espressif:master Mar 27, 2025
87 of 93 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: BLE Issues related to BLE Status: Pending Merge Pull Request is ready to be merged
Projects
Development

Successfully merging this pull request may close these issues.

6 participants