BT lockless queue (#867)

* Lockless json queue for ESP32 BT to avoid SYStoMQTT concurrency issue

* BT haRoomPresence handle with lockless queue
This commit is contained in:
Csiki authored and GitHub committed 2021-02-26 14:30:55 -06:00
1 parent 4431af462f
commit 1b7f83c014
3 files changed
+201 -60

No files matched your search

+6 -6
View File
@@ -1250,13 +1250,7 @@ void loop() {
#ifdef ZmqttDiscovery
if (disc) {
if (!connectedOnce) {
# if defined(ZgatewayBT) && defined(ESP32)
stopProcessing(); // Avoid publication concurrency issues on ESP32 BLE
# endif
pubMqttDiscovery(); // at first connection we publish the discovery payloads
# if defined(ZgatewayBT) && defined(ESP32)
startProcessing();
# endif
}
}
#endif
@@ -1328,6 +1322,8 @@ void loop() {
# ifndef ESP32
if (BTtoMQTT())
Log.trace(F("BTtoMQTT OK" CR));
# else
emptyBTQueue();
# endif
#endif
#ifdef ZgatewaySRFB
@@ -1407,6 +1403,10 @@ void stateMeasures() {
# ifdef ZgatewayBT
# ifdef ESP32
SYSdata["lowpowermode"] = (int)lowpowermode;
SYSdata["btqblck"] = btQueueBlocked;
SYSdata["btqsum"] = btQueueLengthSum;
SYSdata["btqsnd"] = btQueueLengthCount;
SYSdata["btqavg"] = (btQueueLengthCount > 0 ? btQueueLengthSum / (float)btQueueLengthCount : 0);
# endif
SYSdata["interval"] = BLEinterval;
SYSdata["scanbcnct"] = BLEscanBeforeConnect;