Skip to content

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

Closed
wants to merge 3 commits into from
Closed

Conversation

louisza
Copy link

@louisza louisza commented Aug 4, 2025

No description provided.

@Copilot Copilot AI review requested due to automatic review settings August 4, 2025 08:22
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@louisza louisza marked this pull request as draft August 4, 2025 08:22
@louisza louisza closed this Aug 4, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for Coded PHY (long range) advertising and transmit power control to the ArduinoBLE library. The changes enable developers to use Bluetooth Low Energy's extended range capabilities and adjust transmission power for better range or power efficiency.

  • Adds two new public methods: enableCodedPHYAdvertising() and setTxPower()
  • Updates library properties to reflect the custom modifications
  • Implements the new functionality using the underlying BLE interface

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/BLEDevice.h Declares new methods for Coded PHY advertising and TX power control
src/BLEDevice.cpp Implements the new methods with proper BLE interface calls
library.properties Updates library name and version to indicate custom modifications

Comment on lines +601 to +602
// Set TX power here if not using setTxPower separately
gap.setTxPower(4);
Copy link
Preview

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

The 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
// Set TX power here if not using setTxPower separately
gap.setTxPower(4);
// TX power should be set via setTxPower() if needed

Copilot uses AI. Check for mistakes.

Comment on lines +588 to +592
void BLEDevice::enableCodedPHYAdvertising(bool enabled) {
if (!_ble_interface.hasInitialized()) return;

ble::AdvertisingParameters advParams(
ble::advertising_type_t::NON_CONNECTABLE_UNDIRECTED,
Copy link
Preview

Copilot AI Aug 4, 2025

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.

Suggested change
void BLEDevice::enableCodedPHYAdvertising(bool enabled) {
if (!_ble_interface.hasInitialized()) return;
ble::AdvertisingParameters advParams(
ble::advertising_type_t::NON_CONNECTABLE_UNDIRECTED,
void BLEDevice::enableCodedPHYAdvertising(bool enabled, ble::advertising_type_t advType /* = ble::advertising_type_t::NON_CONNECTABLE_UNDIRECTED */) {
if (!_ble_interface.hasInitialized()) return;
ble::AdvertisingParameters advParams(
advType,

Copilot uses AI. Check for mistakes.


ble::AdvertisingParameters advParams(
ble::advertising_type_t::NON_CONNECTABLE_UNDIRECTED,
ble::adv_interval_t(ble::millisecond_t(200))
Copy link
Preview

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

The 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
ble::adv_interval_t(ble::millisecond_t(200))
ble::adv_interval_t(ble::millisecond_t(DEFAULT_ADVERTISING_INTERVAL_MS))

Copilot uses AI. Check for mistakes.

auto& gap = _ble_interface.gap();
gap.setAdvertisingParameters(_adv_handle, advParams);

// Set TX power here if not using setTxPower separately
Copy link
Preview

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

The 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.

@Hsubtnarg
Copy link

This sounds like exactly what I have been looking for.

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.

3 participants