Update to use ArduinoJson 6+ (#1071)
This commit is contained in:
1 parent
149712b573
commit
ed4949f769
30 files changed
+452
-430
No files matched your search
@@ -54,8 +54,8 @@ void setupZsensorBH1750() {
|
||||
void MeasureLightIntensity() {
|
||||
if (millis() > (timebh1750 + TimeBetweenReadingBH1750)) { //retrieving value of Lux, FtCd and Wattsm2 from BH1750
|
||||
Log.trace(F("Creating BH1750 buffer" CR));
|
||||
StaticJsonBuffer<JSON_MSG_BUFFER> jsonBuffer;
|
||||
JsonObject& BH1750data = jsonBuffer.createObject();
|
||||
StaticJsonDocument<JSON_MSG_BUFFER> jsonBuffer;
|
||||
JsonObject BH1750data = jsonBuffer.to<JsonObject>();
|
||||
|
||||
timebh1750 = millis();
|
||||
unsigned int i = 0;
|
||||
@@ -82,21 +82,21 @@ void MeasureLightIntensity() {
|
||||
|
||||
// Generate Lux
|
||||
if (Lux != persistedll || bh1750_always) {
|
||||
BH1750data.set("lux", (unsigned int)Lux);
|
||||
BH1750data["lux"] = (unsigned int)Lux;
|
||||
} else {
|
||||
Log.trace(F("Same lux don't send it" CR));
|
||||
}
|
||||
|
||||
// Generate FtCd
|
||||
if (ftcd != persistedlf || bh1750_always) {
|
||||
BH1750data.set("ftcd", (unsigned int)ftcd);
|
||||
BH1750data["ftcd"] = (unsigned int)ftcd;
|
||||
} else {
|
||||
Log.trace(F("Same ftcd don't send it" CR));
|
||||
}
|
||||
|
||||
// Generate Watts/m2
|
||||
if (Wattsm2 != persistedlw || bh1750_always) {
|
||||
BH1750data.set("wattsm2", (unsigned int)Wattsm2);
|
||||
BH1750data["wattsm2"] = (unsigned int)Wattsm2;
|
||||
} else {
|
||||
Log.trace(F("Same wattsm2 don't send it" CR));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user