diff --git a/main/ZgatewayBT.ino b/main/ZgatewayBT.ino index d6f06f7..90c1576 100644 --- a/main/ZgatewayBT.ino +++ b/main/ZgatewayBT.ino @@ -68,8 +68,6 @@ struct decompose { bool reverse; }; -unsigned long BLEstarts = 0; - vector BLEactions; vector devices; @@ -107,7 +105,7 @@ void BTConfig_init() { BTConfig.movingTimer = MovingTimer; } -// Watchdog, if there was no change of BLE scanCount, restart BT +// Watchdog, if there was no change of BLE scanCount, restart the ESP void btScanWDG() { static unsigned long previousBtScanCount = 0; static unsigned long lastBtScan = 0; @@ -117,8 +115,7 @@ void btScanWDG() { scanCount != 0 && (now - lastBtScan > BTConfig.BLEinterval)) { Log.error(F("BLE Scan watchdog triggered at : %ds" CR), lastBtScan / 1000); - stopProcessing(); - startProcessing(); + ESPRestart(4); } else { previousBtScanCount = scanCount; lastBtScan = now; @@ -157,7 +154,6 @@ String stateBTMeasures(bool start) { jo["btqavg"] = (btQueueLengthCount > 0 ? btQueueLengthSum / (float)btQueueLengthCount : 0); jo["bletaskstack"] = uxTaskGetStackHighWaterMark(xProcBLETaskHandle); jo["blecoretaskstack"] = uxTaskGetStackHighWaterMark(xCoreTaskHandle); - jo["blestarts"] = BLEstarts; if (start) { Log.notice(F("BT sys: ")); @@ -870,12 +866,6 @@ void stopProcessing() { Log.notice(F("BLE gateway stopped, free heap: %d" CR), ESP.getFreeHeap()); } -void startProcessing() { - ProcessLock = false; - setupBTTasksAndBLE(); - Log.notice(F("BLE gateway started, free heap: %d" CR), ESP.getFreeHeap()); -} - void coreTask(void* pvParameters) { while (true) { if (!ProcessLock) { @@ -993,8 +983,6 @@ void setupBTTasksAndBLE() { 1, /* Priority of the task */ &xCoreTaskHandle, /* Task handle. */ taskCore); /* Core where the task should run */ - - BLEstarts++; } void setupBT() { diff --git a/main/config_BT.h b/main/config_BT.h index ebde35a..6f04652 100644 --- a/main/config_BT.h +++ b/main/config_BT.h @@ -32,7 +32,6 @@ extern void MQTTtoBT(char* topicOri, JsonObject& RFdata); extern void emptyBTQueue(); extern void launchBTDiscovery(bool overrideDiscovery); extern void stopProcessing(); -extern void startProcessing(); extern void lowPowerESP32(); extern String stateBTMeasures(bool);