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

Allows you to specify which channels are used to advertise. #4954

Merged
merged 1 commit into from
Mar 16, 2021

Conversation

raulcigil
Copy link
Contributor

In some use cases getting rssi signal from one channel is more stable (less variance) than rssi from the three advertising channels.

This change allows you to specify which channels are used to advertise.

@me-no-dev me-no-dev merged commit d362e1e into espressif:master Mar 16, 2021
@me-no-dev
Copy link
Member

thanks :)

@selman-nus
Copy link

an example code would be very nice to understand @raulcigil

@raulcigil
Copy link
Contributor Author

Good idea.
Using BleServer.ino from examples:

BLEAdvertising *pAdvertising = BLEDevice::getAdvertising();
  pAdvertising->addServiceUUID(SERVICE_UUID);
  pAdvertising->setScanResponse(true);
  pAdvertising->setMinPreferred(0x06);  // functions that help with iPhone connections issue
  pAdvertising->setMaxPreferred(0x12);

  //Setting the advertising channel
  pAdvertising->setAdvertisementChannelMap(ADV_CHNL_37);
  
  BLEDevice::startAdvertising();

You can set the channel with this enumeration:

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/bluetooth/esp_gap_ble.html#_CPPv421esp_ble_adv_channel_t

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