Upravy pro ArduinoJson 7 (>= 7.0.3)

This commit is contained in:
Pavel Brychta 2024-02-06 17:20:23 +01:00
parent 7e7ec1a6e0
commit 06bbd7a874
1 changed files with 4 additions and 8 deletions

View File

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