forked from h2zero/esp-nimble-cpp
Fix delayed advertising when first called.
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user