Merge pull request 'Upravy pro ArduinoJson 7 (>= 7.0.3)' (#1) from feature/ArduinoJson7 into master

Reviewed-on: #1
This commit is contained in:
Pavel Brychta 2024-02-27 09:58:51 +01:00
commit a578569b6c

View File

@ -24,10 +24,6 @@ enum {
#define SYSVAR_FILE "/cfg.json" #define SYSVAR_FILE "/cfg.json"
#endif #endif
#if not defined(SYSVAR_DOCUMENT_SIZE)
#define SYSVAR_DOCUMENT_SIZE (4096)
#endif
/** /**
* @brief Get value * @brief Get value
* *
@ -43,7 +39,7 @@ T svGetV(const String & name, int * result = nullptr)
{ {
T rv{}; T rv{};
int res; int res;
DynamicJsonDocument doc(SYSVAR_DOCUMENT_SIZE); JsonDocument doc;
File f; File f;
f = USEDFS.open(F(SYSVAR_FILE), "r"); f = USEDFS.open(F(SYSVAR_FILE), "r");
@ -83,7 +79,7 @@ T svGetV(const String & name, int * result, const String & fname)
{ {
T rv{}; T rv{};
int res; int res;
DynamicJsonDocument doc(SYSVAR_DOCUMENT_SIZE); JsonDocument doc;
File f; File f;
f = USEDFS.open(fname, "r"); f = USEDFS.open(fname, "r");
@ -121,7 +117,7 @@ template <typename T>
int svSetV(const String & name, T value) int svSetV(const String & name, T value)
{ {
int res; int res;
DynamicJsonDocument doc(SYSVAR_DOCUMENT_SIZE); JsonDocument doc;
File f; File f;
f = USEDFS.open(F(SYSVAR_FILE), "r"); f = USEDFS.open(F(SYSVAR_FILE), "r");
@ -159,7 +155,7 @@ template <typename T>
int svSetV(const String & name, T value, const String & fname) int svSetV(const String & name, T value, const String & fname)
{ {
int res = SV_UNSPECIFIED_ERROR; int res = SV_UNSPECIFIED_ERROR;
DynamicJsonDocument doc(SYSVAR_DOCUMENT_SIZE); JsonDocument doc;
File f; File f;
f = USEDFS.open(fname, "r"); f = USEDFS.open(fname, "r");