[OTA] Free memory by deleting BT tasks when launching OTA (#1573)

* [OTA] Free memory by deleting BT taskswhen launching OTA

and restart if fail
Also factorize restart function for ESP
This commit is contained in:
Florian authored and GitHub committed 2023-03-24 10:12:08 -05:00
1 parent d1e9e8bf9b
commit 338fc43825
2 files changed
+21 -48

No files matched your search

+5 -7
View File
@@ -801,12 +801,11 @@ void stopProcessing() {
Log.notice(F("Stop BLE processing" CR));
ProcessLock = true;
delay(BTConfig.scanDuration < 2000 ? BTConfig.scanDuration : 2000);
}
void startProcessing() {
Log.notice(F("Start BLE processing" CR));
ProcessLock = false;
vTaskResume(xCoreTaskHandle);
//Suspending and deleting tasks to free memory for OTA operations
vTaskSuspend(xCoreTaskHandle);
vTaskDelete(xCoreTaskHandle);
vTaskSuspend(xProcBLETaskHandle);
vTaskDelete(xProcBLETaskHandle);
}
void coreTask(void* pvParameters) {
@@ -847,7 +846,6 @@ void coreTask(void* pvParameters) {
}
} else {
Log.trace(F("BLE core task canceled by processLock" CR));
vTaskSuspend(xCoreTaskHandle);
}
}
}