[ESP32 OTA] Critical fix - Make sure that the BT coreTask gets suspended when not needed (#795)

* make sure that coreTask gets supended when not needed

Co-authored-by: mtiutiu <marius.tiutiu@softvision.com>
This commit is contained in:
Tiutiu Marius Cristianandmtiutiu authored and GitHub committed 2020-11-06 14:02:05 -06:00
1 parent 9a66c9ef09
commit a6e6d98262
1 file changed
+6 -1
+6 -1
View File
@@ -90,6 +90,9 @@ int minRssi = abs(MinimumRSSI); //minimum rssi value
unsigned int scanCount = 0;
# ifdef ESP32
static TaskHandle_t xCoreTaskHandle;
# endif
bool ProcessLock = false; // Process lock when we want to use a critical function like OTA for example
BLEdevice* getDeviceByMac(const char* mac);
@@ -586,6 +589,7 @@ void stopProcessing() {
void startProcessing() {
Log.notice(F("Start BLE processing" CR));
ProcessLock = false;
vTaskResume(xCoreTaskHandle);
}
void coreTask(void* pvParameters) {
@@ -615,6 +619,7 @@ void coreTask(void* pvParameters) {
}
} else {
Log.trace(F("BLE core task canceled by processLock" CR));
vTaskSuspend(xCoreTaskHandle);
}
}
}
@@ -678,7 +683,7 @@ void setupBT() {
10000, /* Stack size in words */
NULL, /* Task input parameter */
1, /* Priority of the task */
NULL, /* Task handle. */
&xCoreTaskHandle, /* Task handle. */
taskCore); /* Core where the task should run */
Log.trace(F("ZgatewayBT multicore ESP32 setup done " CR));
}