Compare commits

..

No commits in common. "a578569b6cb4748ca620b59a8f5e849824eeb0cc" and "7e7ec1a6e04b14f1f5df5dc3ec381588c062a03d" have entirely different histories.

View File

@ -24,6 +24,10 @@ 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
* *
@ -39,7 +43,7 @@ T svGetV(const String & name, int * result = nullptr)
{ {
T rv{}; T rv{};
int res; int res;
JsonDocument doc; DynamicJsonDocument doc(SYSVAR_DOCUMENT_SIZE);
File f; File f;
f = USEDFS.open(F(SYSVAR_FILE), "r"); f = USEDFS.open(F(SYSVAR_FILE), "r");
@ -79,7 +83,7 @@ T svGetV(const String & name, int * result, const String & fname)
{ {
T rv{}; T rv{};
int res; int res;
JsonDocument doc; DynamicJsonDocument doc(SYSVAR_DOCUMENT_SIZE);
File f; File f;
f = USEDFS.open(fname, "r"); f = USEDFS.open(fname, "r");
@ -117,7 +121,7 @@ template <typename T>
int svSetV(const String & name, T value) int svSetV(const String & name, T value)
{ {
int res; int res;
JsonDocument doc; DynamicJsonDocument doc(SYSVAR_DOCUMENT_SIZE);
File f; File f;
f = USEDFS.open(F(SYSVAR_FILE), "r"); f = USEDFS.open(F(SYSVAR_FILE), "r");
@ -155,7 +159,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;
JsonDocument doc; DynamicJsonDocument doc(SYSVAR_DOCUMENT_SIZE);
File f; File f;
f = USEDFS.open(fname, "r"); f = USEDFS.open(fname, "r");