[SYS] Implement a central queue (#1767)

to avoid concurrency issues when modules or/and gateways want to publish data
This commit is contained in:
Florian authored and GitHub committed 2023-11-08 07:26:21 -06:00
1 parent ca9ef664ab
commit 029409c0c3
39 files changed
+491 -407

No files matched your search

+4 -3
View File
@@ -115,8 +115,8 @@ void IRtoMQTT() {
if (irrecv.decode(&results)) {
Log.trace(F("Creating IR buffer" CR));
StaticJsonDocument<JSON_MSG_BUFFER> jsonBuffer;
JsonObject IRdata = jsonBuffer.to<JsonObject>();
StaticJsonDocument<JSON_MSG_BUFFER> IRdataBuffer;
JsonObject IRdata = IRdataBuffer.to<JsonObject>();
Log.trace(F("Rcv. IR" CR));
# ifdef ESP32
@@ -168,7 +168,8 @@ void IRtoMQTT() {
Log.notice(F("--no pub unknwn prt--" CR));
} else if (!isAduplicateSignal(MQTTvalue) && MQTTvalue != 0) { // conditions to avoid duplications of IR -->MQTT
Log.trace(F("Adv data IRtoMQTT" CR));
pub(subjectIRtoMQTT, IRdata);
IRdata["origin"] = subjectIRtoMQTT;
enqueueJsonObject(IRdata);
Log.trace(F("Store val: %D" CR), MQTTvalue);
storeSignalValue(MQTTvalue);
if (repeatIRwMQTT) {