From 08162480126e1f332816c87da3133641c894521f Mon Sep 17 00:00:00 2001 From: Martin Mueller Date: Tue, 26 Oct 2021 11:14:02 -0400 Subject: [PATCH 1/5] Added SD Stats to file response --- ESPixelStick/src/FileMgr.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ESPixelStick/src/FileMgr.cpp b/ESPixelStick/src/FileMgr.cpp index 9c1cbd01f..0ba85b667 100644 --- a/ESPixelStick/src/FileMgr.cpp +++ b/ESPixelStick/src/FileMgr.cpp @@ -606,6 +606,15 @@ void c_FileMgr::GetListOfSdFiles (String & Response) break; } + FSInfo fs_info; + SDFS.info (fs_info); + ResponseJsonDoc[F ("totalBytes")] = fs_info.totalBytes; + ResponseJsonDoc[F ("usedBytes")] = fs_info.usedBytes; + ResponseJsonDoc[F ("blockSize")] = fs_info.blockSize; + ResponseJsonDoc[F ("pageSize")] = fs_info.pageSize; + ResponseJsonDoc[F ("maxOpenFiles")] = fs_info.maxOpenFiles; + ResponseJsonDoc[F ("maxPathLength")] = fs_info.maxPathLength; + File dir = SDFS.open ("/", CN_r); while (true) From 109d6f6d4c32d79597ebf3cda9199417eca12f17 Mon Sep 17 00:00:00 2001 From: Martin Mueller Date: Tue, 26 Oct 2021 13:44:48 -0400 Subject: [PATCH 2/5] Added UI display for SD Size and Remaining Size in MB --- ESPixelStick/src/FileMgr.cpp | 14 ++++++++------ html/index.html | 14 ++++++++++++++ html/script.js | 10 ++++++++++ 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/ESPixelStick/src/FileMgr.cpp b/ESPixelStick/src/FileMgr.cpp index 0ba85b667..ed056a05c 100644 --- a/ESPixelStick/src/FileMgr.cpp +++ b/ESPixelStick/src/FileMgr.cpp @@ -606,15 +606,17 @@ void c_FileMgr::GetListOfSdFiles (String & Response) break; } +#ifdef ARDUINO_ARCH_ESP32 + ResponseJsonDoc[F ("totalBytes")] = SDFS.totalBytes (); + ResponseJsonDoc[F ("usedBytes")] = SDFS.usedBytes (); + +#else FSInfo fs_info; SDFS.info (fs_info); - ResponseJsonDoc[F ("totalBytes")] = fs_info.totalBytes; - ResponseJsonDoc[F ("usedBytes")] = fs_info.usedBytes; - ResponseJsonDoc[F ("blockSize")] = fs_info.blockSize; - ResponseJsonDoc[F ("pageSize")] = fs_info.pageSize; - ResponseJsonDoc[F ("maxOpenFiles")] = fs_info.maxOpenFiles; - ResponseJsonDoc[F ("maxPathLength")] = fs_info.maxPathLength; + ResponseJsonDoc[F ("totalBytes")] = fs_info.totalBytes; + ResponseJsonDoc[F ("usedBytes")] = fs_info.usedBytes; +#endif File dir = SDFS.open ("/", CN_r); while (true) diff --git a/html/index.html b/html/index.html index aed5df2d4..9ff6ae2ff 100644 --- a/html/index.html +++ b/html/index.html @@ -349,6 +349,20 @@ Remove Selected File(s) +
+
+ + +
+
+ + +
+
+ + +
+
Files diff --git a/html/script.js b/html/script.js index c96549e11..a2cea61d6 100644 --- a/html/script.js +++ b/html/script.js @@ -377,6 +377,12 @@ function RequestListOfFiles() } // RequestListOfFiles +function BytesToMB(Value) +{ + return (Value / (1024 * 1024)).toFixed(); + +} // BytesToMB + function ProcessGetFileListResponse(JsonConfigData) { // console.info("ProcessGetFileListResponse"); @@ -389,6 +395,10 @@ function ProcessGetFileListResponse(JsonConfigData) $("#li-filemanagement").addClass("hidden"); } + $("#totalBytes").val(BytesToMB (JsonConfigData.totalBytes)); + $("#usedBytes").val(BytesToMB (JsonConfigData.usedBytes)); + $("#remainingBytes").val(BytesToMB (JsonConfigData.totalBytes - JsonConfigData.usedBytes) ); + Fseq_File_List = JsonConfigData; clearTimeout(FseqFileListRequestTimer); From d96f3663043c8e16e31c0e2632a5f18f82eaf033 Mon Sep 17 00:00:00 2001 From: Martin Mueller Date: Tue, 26 Oct 2021 14:28:20 -0400 Subject: [PATCH 3/5] Fixed alignment issues with SD info --- html/index.html | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/html/index.html b/html/index.html index 9ff6ae2ff..96f516834 100644 --- a/html/index.html +++ b/html/index.html @@ -345,24 +345,19 @@