From 1812f5f8935b1356a3babfe836a29f1ca77748b8 Mon Sep 17 00:00:00 2001 From: axmtech-net Date: Sat, 1 Jul 2023 21:21:25 +0200 Subject: [PATCH 1/2] Move sketch files (*.ino) to dedicated folders to align with latest Arduino IDE. --- src/{ => MHI-ESP2MQTT}/MHI-ESP2MQTT.ino | 0 src/{ => MHI-SPI2ESP}/MHI-SPI2ESP.ino | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename src/{ => MHI-ESP2MQTT}/MHI-ESP2MQTT.ino (100%) rename src/{ => MHI-SPI2ESP}/MHI-SPI2ESP.ino (100%) diff --git a/src/MHI-ESP2MQTT.ino b/src/MHI-ESP2MQTT/MHI-ESP2MQTT.ino similarity index 100% rename from src/MHI-ESP2MQTT.ino rename to src/MHI-ESP2MQTT/MHI-ESP2MQTT.ino diff --git a/src/MHI-SPI2ESP.ino b/src/MHI-SPI2ESP/MHI-SPI2ESP.ino similarity index 100% rename from src/MHI-SPI2ESP.ino rename to src/MHI-SPI2ESP/MHI-SPI2ESP.ino From 3bb6a3fdbcfb214694a0d94baf1c5b8a16f076cb Mon Sep 17 00:00:00 2001 From: axmtech-net Date: Sat, 1 Jul 2023 21:33:17 +0200 Subject: [PATCH 2/2] ArduinoJson upgrade to 6.7.0. --- src/MHI-ESP2MQTT/MHI-ESP2MQTT.ino | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/MHI-ESP2MQTT/MHI-ESP2MQTT.ino b/src/MHI-ESP2MQTT/MHI-ESP2MQTT.ino index 7111d4e..558022b 100644 --- a/src/MHI-ESP2MQTT/MHI-ESP2MQTT.ino +++ b/src/MHI-ESP2MQTT/MHI-ESP2MQTT.ino @@ -129,11 +129,11 @@ void setup() std::unique_ptr buf(new char[size]); configFile.readBytes(buf.get(), size); - DynamicJsonBuffer jsonBuffer; - JsonObject& json = jsonBuffer.parseObject(buf.get()); + DynamicJsonDocument json(size); + auto error = deserializeJson(json, buf.get()); //json.printTo(Serial); - if (json.success()) + if (error) { //Serial.println("\nParsed json"); strcpy(mqtt_server, json["mqtt_server"]); @@ -305,8 +305,8 @@ void setup() if (shouldSaveConfig) { //Serial.println("Saving config..."); - DynamicJsonBuffer jsonBuffer; - JsonObject& json = jsonBuffer.createObject(); + DynamicJsonDocument jsonDoc(1024); + JsonObject json = jsonDoc.to(); json["mqtt_server"] = mqtt_server; json["mqtt_port"] = mqtt_port; json["mqtt_user"] = mqtt_user; @@ -333,7 +333,7 @@ void setup() } */ //json.printTo(Serial); - json.printTo(configFile); + serializeJson(json, configFile); configFile.close(); }