-
Notifications
You must be signed in to change notification settings - Fork 223
Louisza patch phy #405
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
Louisza patch phy #405
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name=ArduinoBLE | ||
version=1.4.1 | ||
name=ArduinoBLE-CodedPHY | ||
version=1.4.2-custom | ||
author=Arduino | ||
maintainer=Arduino <[email protected]> | ||
sentence=Enables Bluetooth® Low Energy connectivity on the Arduino MKR WiFi 1010, Arduino UNO WiFi Rev2, Arduino Nano 33 IoT, Arduino Nano 33 BLE, Nicla Sense ME and UNO R4 WiFi. | ||
|
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -25,6 +25,10 @@ | |||||||
|
||||||||
#include "BLEDevice.h" | ||||||||
|
||||||||
#include "ble/AdvertisingParameters.h" | ||||||||
#include "ble/Gap.h" | ||||||||
|
||||||||
|
||||||||
extern "C" int strcasecmp(char const *a, char const *b); | ||||||||
|
||||||||
BLEDevice::BLEDevice() : | ||||||||
|
@@ -576,3 +580,25 @@ bool BLEDevice::discovered() | |||||||
return (_advertisementTypeMask & 0x18) != 0; | ||||||||
} | ||||||||
|
||||||||
void BLEDevice::setTxPower(int8_t dbm) { | ||||||||
if (!_ble_interface.hasInitialized()) return; | ||||||||
_ble_interface.gap().setTxPower(dbm); | ||||||||
} | ||||||||
|
||||||||
void BLEDevice::enableCodedPHYAdvertising(bool enabled) { | ||||||||
if (!_ble_interface.hasInitialized()) return; | ||||||||
|
||||||||
ble::AdvertisingParameters advParams( | ||||||||
ble::advertising_type_t::NON_CONNECTABLE_UNDIRECTED, | ||||||||
ble::adv_interval_t(ble::millisecond_t(200)) | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The advertising interval is hardcoded to 200ms. This magic number should be made configurable or defined as a named constant to improve maintainability.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||
); | ||||||||
if (enabled) { | ||||||||
advParams.setPhy(ble::phy_t::LE_1M, ble::phy_t::LE_CODED); | ||||||||
} | ||||||||
auto& gap = _ble_interface.gap(); | ||||||||
gap.setAdvertisingParameters(_adv_handle, advParams); | ||||||||
|
||||||||
// Set TX power here if not using setTxPower separately | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The comment is unclear about when this automatic TX power setting occurs versus when setTxPower() should be used. This could confuse users about the intended API usage pattern. Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||
gap.setTxPower(4); | ||||||||
Comment on lines
+601
to
+602
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hardcoded TX power value (4) should be made configurable or removed. This conflicts with the separate setTxPower() method and creates unexpected behavior where enabling Coded PHY always sets power to 4 dBm.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||
} | ||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The advertising type is hardcoded to NON_CONNECTABLE_UNDIRECTED, which may not be appropriate for all use cases. Consider making this configurable or using the existing advertising configuration.
Copilot uses AI. Check for mistakes.