FlashFS now gzip-Updatefiles & FS-Versioning imp.

This commit is contained in:
Marcel Peterkau 2022-08-28 23:26:09 +02:00
parent 4e34aaa24a
commit b9f658b111
5 changed files with 14 additions and 5 deletions

View File

@ -534,7 +534,7 @@
<div class="form-group row">
<div class="custom-file">
<input type="file" name="fw-update-file" class="custom-file-input" id="fw-update-file"
accept=".fw.bin,.fs.bin" required />
accept=".fw.bin,.fs.gz" required />
<label class="custom-file-label" for="fw-update-file">Firmware-Update ausw&auml;hlen</label>
</div>
</div>

View File

@ -1 +1 @@
1.01
1.2

View File

@ -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)

View File

@ -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

View File

@ -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))