|
10 | 10 | from json import JSONEncoder |
11 | 11 | from random import randint |
12 | 12 | from os.path import dirname |
| 13 | +import gzip |
13 | 14 |
|
14 | 15 | import UnifiedConfiguration |
15 | 16 | import serials_find |
@@ -54,6 +55,9 @@ def upload_wifi(args, mcuType, upload_addr): |
54 | 55 | upload_addr = [args.port] |
55 | 56 | try: |
56 | 57 | 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) |
57 | 61 | upload_via_esp8266_backpack.do_upload('firmware.bin.gz', upload_addr, False, {}) |
58 | 62 | else: |
59 | 63 | upload_via_esp8266_backpack.do_upload(args.file.name, upload_addr, False, {}) |
@@ -123,7 +127,9 @@ def upload_esp32_passthru(args): |
123 | 127 |
|
124 | 128 | def upload_dir(mcuType, args): |
125 | 129 | 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) |
127 | 133 | elif mcuType == MCUType.ESP32: |
128 | 134 | dir = os.path.dirname(args.file.name) |
129 | 135 | shutil.copy2(args.file.name, args.out) |
|
0 commit comments