Skip to content

Commit 4a64e6b

Browse files
committed
gzip 8266 firmware for wifi/upload flashing
1 parent 9048f68 commit 4a64e6b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

python/binary_configurator.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from json import JSONEncoder
1111
from random import randint
1212
from os.path import dirname
13+
import gzip
1314

1415
import UnifiedConfiguration
1516
import serials_find
@@ -54,6 +55,9 @@ def upload_wifi(args, mcuType, upload_addr):
5455
upload_addr = [args.port]
5556
try:
5657
if mcuType == MCUType.ESP8266:
58+
with open(args.file.name, 'rb') as f_in:
59+
with gzip.open('firmware.bin.gz', 'wb') as f_out:
60+
shutil.copyfileobj(f_in, f_out)
5761
upload_via_esp8266_backpack.do_upload('firmware.bin.gz', upload_addr, False, {})
5862
else:
5963
upload_via_esp8266_backpack.do_upload(args.file.name, upload_addr, False, {})
@@ -123,7 +127,9 @@ def upload_esp32_passthru(args):
123127

124128
def upload_dir(mcuType, args):
125129
if mcuType == MCUType.ESP8266:
126-
shutil.copy2(args.file.name, args.out)
130+
with open(args.file.name, 'rb') as f_in:
131+
with gzip.open(os.path.join(args.out, 'firmware.bin.gz'), 'wb') as f_out:
132+
shutil.copyfileobj(f_in, f_out)
127133
elif mcuType == MCUType.ESP32:
128134
dir = os.path.dirname(args.file.name)
129135
shutil.copy2(args.file.name, args.out)

0 commit comments

Comments
 (0)