From d583adb958e0b20ee7859557751db9f33de32119 Mon Sep 17 00:00:00 2001 From: cschwinne Date: Fri, 16 Oct 2020 23:59:34 +0200 Subject: [PATCH] New quota calculation --- wled00/file.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wled00/file.cpp b/wled00/file.cpp index f32000ae..65b1bbc8 100644 --- a/wled00/file.cpp +++ b/wled00/file.cpp @@ -12,9 +12,6 @@ #define FS_BUFSIZE 256 -//allow presets to be added until this percentage of FS space is used -#define FS_QUOTA 75 - /* * Structural requirements for files managed by writeObjectToFile() and readObjectFromFile() utilities: * 1. File must be a string representation of a valid JSON object @@ -214,7 +211,10 @@ bool appendObjectToFile(const char* key, JsonDocument* content, uint32_t s, uint //not enough space, append at end - if ((fsBytesUsed*100)/fsBytesTotal > FS_QUOTA) { //permitted space for presets exceeded + //permitted space for presets exceeded + updateFSInfo(); + + if (f.size() + 9000 > (fsBytesTotal - fsBytesUsed)) { //make sure there is enough space to at least copy the file once errorFlag = ERR_FS_QUOTA; doCloseFile = true; return false;