From b9f658b1118c9b1b76e485d4a37c80be4a2271cf Mon Sep 17 00:00:00 2001 From: Marcel Peterkau Date: Sun, 28 Aug 2022 23:26:09 +0200 Subject: [PATCH] FlashFS now gzip-Updatefiles & FS-Versioning imp. --- Software/data_src/index.htm | 2 +- Software/data_src/version | 2 +- Software/prepare_littlefs.py | 10 ++++++++++ Software/src/common.h | 2 +- Software/src/webui.cpp | 3 +-- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Software/data_src/index.htm b/Software/data_src/index.htm index a9bd44c..a24023a 100644 --- a/Software/data_src/index.htm +++ b/Software/data_src/index.htm @@ -534,7 +534,7 @@
+ accept=".fw.bin,.fs.gz" required />
diff --git a/Software/data_src/version b/Software/data_src/version index 96aeaa6..ea710ab 100644 --- a/Software/data_src/version +++ b/Software/data_src/version @@ -1 +1 @@ -1.01 \ No newline at end of file +1.2 \ No newline at end of file diff --git a/Software/prepare_littlefs.py b/Software/prepare_littlefs.py index 346b464..7ab9722 100644 --- a/Software/prepare_littlefs.py +++ b/Software/prepare_littlefs.py @@ -100,7 +100,17 @@ def gzip_webfiles(source, target, env): print('GZIP: Failure/Incomplete.\n') else: print('GZIP: Compressed correctly.\n') + + return +def gzip_binffiles(source, target, env): + littlefsbin = target[0].get_abspath() + targetbin = os.path.join(os.path.dirname(littlefsbin), 'filesystem.fs') + shutil.copyfile(littlefsbin, targetbin) + gzip_file(targetbin, os.path.join(str(targetbin) + '.gz')) + os.remove(targetbin) + return # IMPORTANT, this needs to be added to call the routine env.AddPreAction('$BUILD_DIR/littlefs.bin', gzip_webfiles) +env.AddPostAction('$BUILD_DIR/littlefs.bin', gzip_binffiles) diff --git a/Software/src/common.h b/Software/src/common.h index ebc391c..35611f4 100644 --- a/Software/src/common.h +++ b/Software/src/common.h @@ -29,7 +29,7 @@ #define SW_VERSION_MAJOR 1 #define SW_VERSION_MINOR 1 -#define FLASH_FS_VERSION 1.1 +#define FLASH_FS_VERSION 1.2 #ifndef OTA_DELAY #define OTA_DELAY 50 // ticks -> 10ms / tick diff --git a/Software/src/webui.cpp b/Software/src/webui.cpp index ab77904..13b8c9c 100644 --- a/Software/src/webui.cpp +++ b/Software/src/webui.cpp @@ -22,7 +22,7 @@ void initWebUI() GetFlashVersion(globals.FlashVersion, sizeof(globals.FlashVersion)); - if (!strcmp(globals.FlashVersion, QUOTE(FLASH_FS_VERSION))) + if (strcmp(globals.FlashVersion, QUOTE(FLASH_FS_VERSION))) { MaintainDTC(DTC_FLASHFS_VERSION_ERROR, DTC_WARN, true); } @@ -361,7 +361,6 @@ void WebserverFirmwareUpdate_Callback(AsyncWebServerRequest *request, const Stri { Serial.println("Update"); size_t content_len = request->contentLength(); - // if filename includes spiffs, update the spiffs partition int cmd = (filename.indexOf(".fs") > -1) ? U_FS : U_FLASH; Update.runAsync(true); if (!Update.begin(content_len, cmd))