Skip to content

Commit fc792be

Browse files
committed
Add compressed OTA file
change acpeted OTA file to bin.gz
1 parent 7bd4771 commit fc792be

3 files changed

Lines changed: 4 additions & 1 deletion

File tree

platformio.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ custom_prog_version = 2.2.2
1919
build_flags =
2020
-DVERSION=${this.custom_prog_version}
2121
-DPIO_SRC_NAM="EPEver2MQTT"
22+
-DESP8266 -DATOMIC_FS_UPDATE
2223
extra_scripts = pre:tools/mini_html.py
2324
pre:tools/pre_compile.py
2425
post:tools/post_compile.py

src/webpages/HTML_SETTINGS.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ <h1>Settings</h1>
55
<div class="d-grid gap-2">
66
<form id="uploadform">
77
<div class="input-group">
8-
<input class="form-control" id="uploadformfield" aria-describedby="uploadformfield" aria-label="Upload" accept=".bin"
8+
<input class="form-control" id="uploadformfield" aria-describedby="uploadformfield" aria-label="Upload" accept=".bin.gz"
99
type="file" name="update">
1010
<input id="uploadbutton" class="btn btn-outline-secondary" type="button" value="Firmware Update" onclick="postFile()">
1111
</div>

tools/post_compile.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Import("env")
22
import os
33
import shutil
4+
import gzip
45

56
def post_program_action(source, target, env):
67

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

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

0 commit comments

Comments
 (0)