mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-11-25 14:40:55 +01:00
Remove client delay calls and check if task is valid before notifying.
This commit is contained in:
parent
740f280664
commit
09ff0c3472
2 changed files with 5 additions and 4 deletions
|
@ -221,7 +221,6 @@ bool NimBLEClient::connect(const NimBLEAddress &address, bool deleteAttibutes) {
|
||||||
if (!NimBLEDevice::getScan()->stop()) {
|
if (!NimBLEDevice::getScan()->stop()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
vTaskDelay(1 / portTICK_PERIOD_MS);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLE_HS_EDONE:
|
case BLE_HS_EDONE:
|
||||||
|
@ -1028,7 +1027,9 @@ uint16_t NimBLEClient::getMTU() {
|
||||||
|
|
||||||
if(client->m_pTaskData != nullptr) {
|
if(client->m_pTaskData != nullptr) {
|
||||||
client->m_pTaskData->rc = rc;
|
client->m_pTaskData->rc = rc;
|
||||||
xTaskNotifyGive(client->m_pTaskData->task);
|
if(client->m_pTaskData->task) {
|
||||||
|
xTaskNotifyGive(client->m_pTaskData->task);
|
||||||
|
}
|
||||||
client->m_pTaskData = nullptr;
|
client->m_pTaskData = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -174,7 +174,7 @@ void NimBLEDevice::stopAdvertising() {
|
||||||
}
|
}
|
||||||
|
|
||||||
while(pClient->isConnected()) {
|
while(pClient->isConnected()) {
|
||||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
taskYIELD();
|
||||||
}
|
}
|
||||||
} else if(pClient->m_pTaskData != nullptr) {
|
} else if(pClient->m_pTaskData != nullptr) {
|
||||||
rc = ble_gap_conn_cancel();
|
rc = ble_gap_conn_cancel();
|
||||||
|
@ -182,7 +182,7 @@ void NimBLEDevice::stopAdvertising() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
while(pClient->m_pTaskData != nullptr) {
|
while(pClient->m_pTaskData != nullptr) {
|
||||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
taskYIELD();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue