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

Clear advertising data when BLE end is called #373

Merged
merged 1 commit into from
Oct 25, 2024

Conversation

fabik111
Copy link
Contributor

The _advertisingData and _scanResponseData structure are never cleared even if the user call the BLE.end().
If the user after a BLE.end() opens again the BLE.begin() and confgure local name, service, characteristic, etc. some of them are not set properly since the counters and the data pointers are full from the previous iteration.

With this PR the clear method of _advertisingData and _scanResponseData is called inside the BLE.end() method.

Copy link

Memory usage change @ 910dd44

Board flash % RAM for global variables %
arduino:mbed_nano:nano33ble 🔺 0 - +64 0.0 - +0.01 0 - 0 0.0 - 0.0
arduino:mbed_nano:nanorp2040connect 🔺 +54 - +54 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:megaavr:uno2018:mode=on 🔺 +116 - +116 +0.24 - +0.24 0 - 0 0.0 - 0.0
arduino:renesas_uno:unor4wifi 🔺 +48 - +48 +0.02 - +0.02 0 - 0 0.0 - 0.0
arduino:samd:mkrwifi1010 🔺 +48 - +56 +0.02 - +0.02 0 - 0 0.0 - 0.0
arduino:samd:nano_33_iot 🔺 +48 - +56 +0.02 - +0.02 0 - 0 0.0 - 0.0
Click for full report table
Board examples/Central/LedControl
flash
% examples/Central/LedControl
RAM for global variables
% examples/Central/PeripheralExplorer
flash
% examples/Central/PeripheralExplorer
RAM for global variables
% examples/Central/Scan
flash
% examples/Central/Scan
RAM for global variables
% examples/Central/ScanCallback
flash
% examples/Central/ScanCallback
RAM for global variables
% examples/Central/SensorTagButton
flash
% examples/Central/SensorTagButton
RAM for global variables
% examples/Peripheral/Advertising/EnhancedAdvertising
flash
% examples/Peripheral/Advertising/EnhancedAdvertising
RAM for global variables
% examples/Peripheral/Advertising/RawDataAdvertising
flash
% examples/Peripheral/Advertising/RawDataAdvertising
RAM for global variables
% examples/Peripheral/BatteryMonitor
flash
% examples/Peripheral/BatteryMonitor
RAM for global variables
% examples/Peripheral/ButtonLED
flash
% examples/Peripheral/ButtonLED
RAM for global variables
% examples/Peripheral/CallbackLED
flash
% examples/Peripheral/CallbackLED
RAM for global variables
% examples/Peripheral/EncryptedBatteryMonitor
flash
% examples/Peripheral/EncryptedBatteryMonitor
RAM for global variables
% examples/Peripheral/LED
flash
% examples/Peripheral/LED
RAM for global variables
%
arduino:mbed_nano:nano33ble 64 0.01 0 0.0 64 0.01 0 0.0 64 0.01 0 0.0 64 0.01 0 0.0 64 0.01 0 0.0 64 0.01 0 0.0 0 0.0 0 0.0 64 0.01 0 0.0 64 0.01 0 0.0 64 0.01 0 0.0 0 0.0 0 0.0 64 0.01 0 0.0
arduino:mbed_nano:nanorp2040connect 54 0.0 0 0.0 54 0.0 0 0.0 54 0.0 0 0.0 54 0.0 0 0.0 54 0.0 0 0.0 54 0.0 0 0.0 54 0.0 0 0.0 54 0.0 0 0.0 54 0.0 0 0.0 54 0.0 0 0.0 54 0.0 0 0.0 54 0.0 0 0.0
arduino:megaavr:uno2018:mode=on 116 0.24 0 0.0 116 0.24 0 0.0 116 0.24 0 0.0 116 0.24 0 0.0 116 0.24 0 0.0 116 0.24 0 0.0 116 0.24 0 0.0 116 0.24 0 0.0 116 0.24 0 0.0 116 0.24 0 0.0 116 0.24 0 0.0 116 0.24 0 0.0
arduino:renesas_uno:unor4wifi 48 0.02 0 0.0 48 0.02 0 0.0 48 0.02 0 0.0 48 0.02 0 0.0 48 0.02 0 0.0 48 0.02 0 0.0 48 0.02 0 0.0 48 0.02 0 0.0 48 0.02 0 0.0 48 0.02 0 0.0 48 0.02 0 0.0 48 0.02 0 0.0
arduino:samd:mkrwifi1010 48 0.02 0 0.0 48 0.02 0 0.0 56 0.02 0 0.0 56 0.02 0 0.0 48 0.02 0 0.0 48 0.02 0 0.0 56 0.02 0 0.0 56 0.02 0 0.0 56 0.02 0 0.0 48 0.02 0 0.0 56 0.02 0 0.0 48 0.02 0 0.0
arduino:samd:nano_33_iot 48 0.02 0 0.0 48 0.02 0 0.0 56 0.02 0 0.0 56 0.02 0 0.0 48 0.02 0 0.0 48 0.02 0 0.0 56 0.02 0 0.0 56 0.02 0 0.0 56 0.02 0 0.0 48 0.02 0 0.0 56 0.02 0 0.0 48 0.02 0 0.0
Click for full report CSV
Board,examples/Central/LedControl<br>flash,%,examples/Central/LedControl<br>RAM for global variables,%,examples/Central/PeripheralExplorer<br>flash,%,examples/Central/PeripheralExplorer<br>RAM for global variables,%,examples/Central/Scan<br>flash,%,examples/Central/Scan<br>RAM for global variables,%,examples/Central/ScanCallback<br>flash,%,examples/Central/ScanCallback<br>RAM for global variables,%,examples/Central/SensorTagButton<br>flash,%,examples/Central/SensorTagButton<br>RAM for global variables,%,examples/Peripheral/Advertising/EnhancedAdvertising<br>flash,%,examples/Peripheral/Advertising/EnhancedAdvertising<br>RAM for global variables,%,examples/Peripheral/Advertising/RawDataAdvertising<br>flash,%,examples/Peripheral/Advertising/RawDataAdvertising<br>RAM for global variables,%,examples/Peripheral/BatteryMonitor<br>flash,%,examples/Peripheral/BatteryMonitor<br>RAM for global variables,%,examples/Peripheral/ButtonLED<br>flash,%,examples/Peripheral/ButtonLED<br>RAM for global variables,%,examples/Peripheral/CallbackLED<br>flash,%,examples/Peripheral/CallbackLED<br>RAM for global variables,%,examples/Peripheral/EncryptedBatteryMonitor<br>flash,%,examples/Peripheral/EncryptedBatteryMonitor<br>RAM for global variables,%,examples/Peripheral/LED<br>flash,%,examples/Peripheral/LED<br>RAM for global variables,%
arduino:mbed_nano:nano33ble,64,0.01,0,0.0,64,0.01,0,0.0,64,0.01,0,0.0,64,0.01,0,0.0,64,0.01,0,0.0,64,0.01,0,0.0,0,0.0,0,0.0,64,0.01,0,0.0,64,0.01,0,0.0,64,0.01,0,0.0,0,0.0,0,0.0,64,0.01,0,0.0
arduino:mbed_nano:nanorp2040connect,54,0.0,0,0.0,54,0.0,0,0.0,54,0.0,0,0.0,54,0.0,0,0.0,54,0.0,0,0.0,54,0.0,0,0.0,54,0.0,0,0.0,54,0.0,0,0.0,54,0.0,0,0.0,54,0.0,0,0.0,54,0.0,0,0.0,54,0.0,0,0.0
arduino:megaavr:uno2018:mode=on,116,0.24,0,0.0,116,0.24,0,0.0,116,0.24,0,0.0,116,0.24,0,0.0,116,0.24,0,0.0,116,0.24,0,0.0,116,0.24,0,0.0,116,0.24,0,0.0,116,0.24,0,0.0,116,0.24,0,0.0,116,0.24,0,0.0,116,0.24,0,0.0
arduino:renesas_uno:unor4wifi,48,0.02,0,0.0,48,0.02,0,0.0,48,0.02,0,0.0,48,0.02,0,0.0,48,0.02,0,0.0,48,0.02,0,0.0,48,0.02,0,0.0,48,0.02,0,0.0,48,0.02,0,0.0,48,0.02,0,0.0,48,0.02,0,0.0,48,0.02,0,0.0
arduino:samd:mkrwifi1010,48,0.02,0,0.0,48,0.02,0,0.0,56,0.02,0,0.0,56,0.02,0,0.0,48,0.02,0,0.0,48,0.02,0,0.0,56,0.02,0,0.0,56,0.02,0,0.0,56,0.02,0,0.0,48,0.02,0,0.0,56,0.02,0,0.0,48,0.02,0,0.0
arduino:samd:nano_33_iot,48,0.02,0,0.0,48,0.02,0,0.0,56,0.02,0,0.0,56,0.02,0,0.0,48,0.02,0,0.0,48,0.02,0,0.0,56,0.02,0,0.0,56,0.02,0,0.0,56,0.02,0,0.0,48,0.02,0,0.0,56,0.02,0,0.0,48,0.02,0,0.0

@facchinm facchinm merged commit 30e2cac into arduino-libraries:master Oct 25, 2024
10 of 11 checks passed
@facchinm
Copy link
Contributor

Merged, thx!

@per1234 per1234 added type: imperfection Perceived defect in any part of project topic: code Related to content of the project itself labels Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants