mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-11-22 13:10:55 +01:00
Fix delayed advertising when first called.
This commit is contained in:
parent
bd0c7992ef
commit
26b3ba3e8f
1 changed files with 5 additions and 0 deletions
|
@ -227,6 +227,11 @@ void NimBLEAdvertising::start() {
|
|||
if(pServer != nullptr) {
|
||||
if(!pServer->m_gattsStarted){
|
||||
pServer->start();
|
||||
// When the server instance is created it resets GATT which
|
||||
// seems to put the controller in a sleep loop? This causes a delay when
|
||||
// advertising is started the first time. To avoid this we call ble_gap_adv_stop
|
||||
// to get the controller ready.
|
||||
ble_gap_adv_stop();
|
||||
} else if(pServer->getConnectedCount() >= NIMBLE_MAX_CONNECTIONS) {
|
||||
NIMBLE_LOGW(LOG_TAG, "Max connections reached - not advertising");
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue