Skip to content

Commit

Permalink
Add compressed OTA file
Browse files Browse the repository at this point in the history
change acpeted OTA file to bin.gz
  • Loading branch information
softwarecrash committed Apr 7, 2024
1 parent 8cf8727 commit 1482819
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ custom_prog_version = 2.14.0
build_flags =
-DVERSION=${this.custom_prog_version}
-DPIO_SRC_NAM="Daly2MQTT"
-DESP8266 -DATOMIC_FS_UPDATE
extra_scripts = pre:tools/mini_html.py
pre:tools/pre_compile.py
post:tools/post_compile.py
Expand Down
2 changes: 1 addition & 1 deletion src/webpages/HTML_SETTINGS.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ <h1>Settings</h1>
<div class="d-grid gap-2">
<form id="uploadform">
<div class="input-group">
<input class="form-control" id="uploadformfield" aria-describedby="uploadformfield" aria-label="Upload" type="file" accept=".bin" name="update">
<input class="form-control" id="uploadformfield" aria-describedby="uploadformfield" aria-label="Upload" type="file" accept=".bin.gz" name="update">
<input id="uploadbutton" class="btn btn-outline-secondary" type="button" value="Firmware Update" onclick="postFile()">
</div>
</form>
Expand Down
2 changes: 2 additions & 0 deletions tools/post_compile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Import("env")
import os
import shutil
import gzip

def post_program_action(source, target, env):

Expand All @@ -24,5 +25,6 @@ def post_program_action(source, target, env):
# copy the target file to the destination, if it exist
if os.path.exists(targetfile):
shutil.copy(targetfile, destpath)
with open(destpath+'/'+filename, 'rb') as src, gzip.open(destpath+'/'+os.path.splitext(filename)[0]+'_OTA.bin.gz', 'wb') as dst: dst.writelines(src)

env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", post_program_action)

0 comments on commit 1482819

Please sign in to comment.