[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 -4
View File
@@ -85,16 +85,16 @@ void MeasureGPIOInput() {
// if the Input state has changed:
if (reading != InputState) {
Log.trace(F("Creating GPIOInput buffer" CR));
StaticJsonDocument<JSON_MSG_BUFFER> jsonBuffer;
JsonObject GPIOdata = jsonBuffer.to<JsonObject>();
StaticJsonDocument<JSON_MSG_BUFFER> GPIOdataBuffer;
JsonObject GPIOdata = GPIOdataBuffer.to<JsonObject>();
if (InputState == HIGH) {
GPIOdata["gpio"] = "HIGH";
}
if (InputState == LOW) {
GPIOdata["gpio"] = "LOW";
}
if (GPIOdata.size() > 0)
pub(subjectGPIOInputtoMQTT, GPIOdata);
GPIOdata["origin"] = subjectGPIOInputtoMQTT;
enqueueJsonObject(GPIOdata);
# if defined(ZactuatorONOFF) && defined(ACTUATOR_TRIGGER)
//Trigger the actuator if we are not at startup