[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
@@ -53,8 +53,8 @@ void MeasureINA226() {
if (millis() > (timeINA226 + TimeBetweenReadingINA226)) { //retrieving value of temperature and humidity of the box from DHT every xUL
timeINA226 = millis();
Log.trace(F("Creating INA226 buffer" CR));
StaticJsonDocument<JSON_MSG_BUFFER> jsonBuffer;
JsonObject INA226data = jsonBuffer.to<JsonObject>();
StaticJsonDocument<JSON_MSG_BUFFER> INA226dataBuffer;
JsonObject INA226data = INA226dataBuffer.to<JsonObject>();
// Topic on which we will send data
Log.trace(F("Retrieving electrical data" CR));
// Bus Spannung, read-only, 16Bit, 0...40.96V max., LSB 1.25mV
@@ -72,7 +72,8 @@ void MeasureINA226() {
INA226data["volt"] = volt;
INA226data["current"] = current;
INA226data["power"] = power;
pub(subjectINA226toMQTT, INA226data);
INA226data["origin"] = subjectINA226toMQTT;
enqueueJsonObject(INA226data);
}
}