Update to use ArduinoJson 6+ (#1071)

This commit is contained in:
h2zero authored and GitHub committed 2021-09-01 19:18:19 -05:00
1 parent 149712b573
commit ed4949f769
30 files changed
+452 -430

No files matched your search

+4 -4
View File
@@ -78,13 +78,13 @@ void MeasureGPIOInput() {
InputState = reading;
Log.trace(F("Creating GPIOInput buffer" CR));
const int JSON_MSG_CALC_BUFFER = JSON_OBJECT_SIZE(1);
StaticJsonBuffer<JSON_MSG_CALC_BUFFER> jsonBuffer;
JsonObject& GPIOdata = jsonBuffer.createObject();
StaticJsonDocument<JSON_MSG_CALC_BUFFER> jsonBuffer;
JsonObject GPIOdata = jsonBuffer.to<JsonObject>();
if (InputState == HIGH) {
GPIOdata.set("gpio", "HIGH");
GPIOdata["gpio"] = "HIGH";
}
if (InputState == LOW) {
GPIOdata.set("gpio", "LOW");
GPIOdata["gpio"] = "LOW";
}
if (GPIOdata.size() > 0)
pub(subjectGPIOInputtoMQTT, GPIOdata);