Browse Source
Merge pull request #475 from rightup/NRF52-BLE-FIX
Remove ScanResponse.addName() to fix re-advertising after disconnect
pull/490/head
ripplebiz
11 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
5 additions and
1 deletions
-
src/helpers/nrf52/SerialBLEInterface.cpp
|
|
|
@ -18,6 +18,10 @@ void SerialBLEInterface::begin(const char* device_name, uint32_t pin_code) { |
|
|
|
} |
|
|
|
|
|
|
|
void SerialBLEInterface::startAdv() { |
|
|
|
Bluefruit.Advertising.stop(); // always clean restart
|
|
|
|
Bluefruit.Advertising.clearData(); // clear advertising data
|
|
|
|
Bluefruit.ScanResponse.clearData(); // clear scan response data
|
|
|
|
|
|
|
|
// Advertising packet
|
|
|
|
Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE); |
|
|
|
Bluefruit.Advertising.addTxPower(); |
|
|
|
@ -38,7 +42,7 @@ void SerialBLEInterface::startAdv() { |
|
|
|
* For recommended advertising interval |
|
|
|
* https://developer.apple.com/library/content/qa/qa1931/_index.html
|
|
|
|
*/ |
|
|
|
Bluefruit.Advertising.restartOnDisconnect(true); |
|
|
|
Bluefruit.Advertising.restartOnDisconnect(false); // don't restart automatically as already beeing done in checkRecvFrame()
|
|
|
|
Bluefruit.Advertising.setInterval(32, 244); // in unit of 0.625 ms
|
|
|
|
Bluefruit.Advertising.setFastTimeout(30); // number of seconds in fast mode
|
|
|
|
Bluefruit.Advertising.start(0); // 0 = Don't stop advertising after n seconds
|
|
|
|
|