From cceb43e8adc1a410f3cf06b22587ba76a8b4ba04 Mon Sep 17 00:00:00 2001 From: Dmitry Borisenko <49808844+DmitryBorisenko33@users.noreply.github.com> Date: Fri, 8 Oct 2021 20:19:25 +0800 Subject: [PATCH] FINAL --- src/Utils/JsonUtils.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Utils/JsonUtils.cpp b/src/Utils/JsonUtils.cpp index feb3681b..32fc64f4 100644 --- a/src/Utils/JsonUtils.cpp +++ b/src/Utils/JsonUtils.cpp @@ -65,29 +65,29 @@ String jsonReadStr(String& json, String name) { DynamicJsonDocument doc(JSON_BUFFER_SIZE); DeserializationError error = deserializeJson(doc, json); - if (error) SerialPrint("E", F("jsonRead"), error.f_str()); + if (error) SerialPrint("EE", F("jsonRead"), error.f_str()); return doc[name].as(); } boolean jsonReadBool(String& json, String name) { DynamicJsonDocument doc(JSON_BUFFER_SIZE); DeserializationError error = deserializeJson(doc, json); - if (error) SerialPrint("E", F("jsonRead"), error.f_str()); + if (error) SerialPrint("EE", F("jsonRead"), error.f_str()); return doc[name].as(); } int jsonReadInt(String& json, String name) { DynamicJsonDocument doc(JSON_BUFFER_SIZE); DeserializationError error = deserializeJson(doc, json); - if (error) SerialPrint("E", F("jsonRead"), error.f_str()); + if (error) SerialPrint("EE", F("jsonRead"), error.f_str()); return doc[name].as(); } //================================================================================= String jsonWriteStr(String& json, String name, String value) { - DynamicJsonDocument doc(json.length()); + DynamicJsonDocument doc(JSON_BUFFER_SIZE); DeserializationError error = deserializeJson(doc, json); - if (error) SerialPrint("E", F("jsonWrite"), error.f_str()); + if (error) SerialPrint("EE", F("jsonWrite"), error.f_str()); doc[name] = value; json = ""; serializeJson(doc, json); @@ -95,9 +95,9 @@ String jsonWriteStr(String& json, String name, String value) { } String jsonWriteBool(String& json, String name, boolean value) { - DynamicJsonDocument doc(json.length()); + DynamicJsonDocument doc(JSON_BUFFER_SIZE); DeserializationError error = deserializeJson(doc, json); - if (error) SerialPrint("E", F("jsonWrite"), error.f_str()); + if (error) SerialPrint("EE", F("jsonWrite"), error.f_str()); doc[name] = value; json = ""; serializeJson(doc, json); @@ -105,9 +105,9 @@ String jsonWriteBool(String& json, String name, boolean value) { } String jsonWriteInt(String& json, String name, int value) { - DynamicJsonDocument doc(json.length()); + DynamicJsonDocument doc(JSON_BUFFER_SIZE); DeserializationError error = deserializeJson(doc, json); - if (error) SerialPrint("E", F("jsonWrite"), error.f_str()); + if (error) SerialPrint("EE", F("jsonWrite"), error.f_str()); doc[name] = value; json = ""; serializeJson(doc, json); @@ -115,9 +115,9 @@ String jsonWriteInt(String& json, String name, int value) { } String jsonWriteFloat(String& json, String name, float value) { - DynamicJsonDocument doc(json.length()); + DynamicJsonDocument doc(JSON_BUFFER_SIZE); DeserializationError error = deserializeJson(doc, json); - if (error) SerialPrint("E", F("jsonWrite"), error.f_str()); + if (error) SerialPrint("EE", F("jsonWrite"), error.f_str()); doc[name] = value; json = ""; serializeJson(doc, json);