[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:
1 parent
9a66c9ef09
commit
a6e6d98262
1 file changed
+6
-1
+6
-1
@@ -90,6 +90,9 @@ int minRssi = abs(MinimumRSSI); //minimum rssi value
|
|||||||
|
|
||||||
unsigned int scanCount = 0;
|
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
|
bool ProcessLock = false; // Process lock when we want to use a critical function like OTA for example
|
||||||
|
|
||||||
BLEdevice* getDeviceByMac(const char* mac);
|
BLEdevice* getDeviceByMac(const char* mac);
|
||||||
@@ -586,6 +589,7 @@ void stopProcessing() {
|
|||||||
void startProcessing() {
|
void startProcessing() {
|
||||||
Log.notice(F("Start BLE processing" CR));
|
Log.notice(F("Start BLE processing" CR));
|
||||||
ProcessLock = false;
|
ProcessLock = false;
|
||||||
|
vTaskResume(xCoreTaskHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void coreTask(void* pvParameters) {
|
void coreTask(void* pvParameters) {
|
||||||
@@ -615,6 +619,7 @@ void coreTask(void* pvParameters) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.trace(F("BLE core task canceled by processLock" CR));
|
Log.trace(F("BLE core task canceled by processLock" CR));
|
||||||
|
vTaskSuspend(xCoreTaskHandle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -678,7 +683,7 @@ void setupBT() {
|
|||||||
10000, /* Stack size in words */
|
10000, /* Stack size in words */
|
||||||
NULL, /* Task input parameter */
|
NULL, /* Task input parameter */
|
||||||
1, /* Priority of the task */
|
1, /* Priority of the task */
|
||||||
NULL, /* Task handle. */
|
&xCoreTaskHandle, /* Task handle. */
|
||||||
taskCore); /* Core where the task should run */
|
taskCore); /* Core where the task should run */
|
||||||
Log.trace(F("ZgatewayBT multicore ESP32 setup done " CR));
|
Log.trace(F("ZgatewayBT multicore ESP32 setup done " CR));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user