From e306e02dce8de2eb3f00fb72594d2d69d036ee89 Mon Sep 17 00:00:00 2001 From: pe-jot Date: Thu, 12 Sep 2024 20:36:57 +0200 Subject: [PATCH] Fix deprecated warnings from ArduinoJson library --- src/configuration.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/configuration.cpp b/src/configuration.cpp index dc9f572..95a9eb2 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -26,7 +26,7 @@ Configuration ConfigurationManagement::readConfiguration() { logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, "Configuration", "Failed to open file for reading..."); return Configuration(); } - DynamicJsonDocument data(2048); + JsonDocument data; DeserializationError error = deserializeJson(data, file); if (error) { @@ -94,11 +94,11 @@ void ConfigurationManagement::writeConfiguration(Configuration conf) { logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, "Configuration", "Failed to open file for writing..."); return; } - DynamicJsonDocument data(2048); + JsonDocument data; - JsonArray beacons = data.createNestedArray("beacons"); + JsonArray beacons = data["beacons"].to(); for (Configuration::Beacon beacon : conf.beacons) { - JsonObject v = beacons.createNestedObject(); + JsonObject v = beacons.add(); v["callsign"] = beacon.callsign; v["path"] = beacon.path; v["message"] = beacon.message;