[OTA] Stop the BLE scan when doing OTA (#1731)

Rather than waiting for its end. This will improve the success rate of OTA especially when the scan duration is high
This commit is contained in:
Florian authored and GitHub committed 2023-08-11 21:12:46 -05:00
1 parent 7a2bb04a1b
commit 9caccbd14c
1 file changed
+5 -1
+5 -1
View File
@@ -850,7 +850,11 @@ void BLEconnect() {
void stopProcessing() {
ProcessLock = true;
delay(BTConfig.scanDuration < 2000 ? BTConfig.scanDuration : 2000);
// We stop the scan
BLEScan* pBLEScan = BLEDevice::getScan();
if (pBLEScan->isScanning()) {
pBLEScan->stop();
}
//Suspending, deleting tasks and stopping BT to free memory
vTaskSuspend(xCoreTaskHandle);
vTaskDelete(xCoreTaskHandle);