add option to gz esp32 firmware files (#17379)

* add option to gz esp32 fimrware files

* reverse esp32 gz logic
This commit is contained in:
Jason2866 2022-12-13 16:40:48 +01:00 committed by GitHub
parent 5f581fa7f2
commit e71913ed42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 5 deletions

View File

@ -29,8 +29,7 @@ def map_gzip(source, target, env):
if not tasmotapiolib.is_env_set(tasmotapiolib.DISABLE_MAP_GZ, env):
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [map_gzip])
# gzip only for ESP8266
if env["PIOPLATFORM"] != "espressif32":
if tasmotapiolib.is_env_set(tasmotapiolib.ENABLE_ESP32_GZ, env) or env["PIOPLATFORM"] != "espressif32":
from zopfli.gzip import compress
def bin_gzip(source, target, env):
# create string with location and file names based on variant
@ -50,7 +49,7 @@ if env["PIOPLATFORM"] != "espressif32":
ORG_FIRMWARE_SIZE = bin_file.stat().st_size
GZ_FIRMWARE_SIZE = gzip_file.stat().st_size
if ORG_FIRMWARE_SIZE > 995326:
if ORG_FIRMWARE_SIZE > 995326 and env["PIOPLATFORM"] != "espressif32":
print(
"\u001b[31;1m!!! Tasmota firmware size is too big with {} bytes. Max size is 995326 bytes !!! \u001b[0m".format(
ORG_FIRMWARE_SIZE

View File

@ -25,8 +25,10 @@ import pathlib
import os
# === AVAILABLE OVERRIDES ===
# if set to 1, will not gzip esp8266 bin files
# if set to 1, will not gzip bin files at all
DISABLE_BIN_GZ = "disable_bin_gz"
# if set to 1, will gzip esp32 bin files
ENABLE_ESP32_GZ = "enable_esp32_gz"
# if set, an alternative ptah to put generated .bin files, relative to project directory
BIN_DIR = "bin_dir"
# if set to 1, will not gzip generated .map files

View File

@ -58,8 +58,10 @@ lib_extra_dirs =
;disable_map_gz = 1
; Uncomment and specify a folder where to place the map file(s) (default set to folder build_output)
;map_dir = /tmp/map_files/
; Uncomment if you do NOT want additionally gzipped firmware file(s)
; Uncomment if you do NOT want additionally gzipped firmware file(s) at all
;disable_bin_gz = 1
; Uncomment if you want additionally gzipped esp32x firmware file(s)
;enable_esp32_gz = 1
; Uncomment and specify a folder where to place the firmware file(s) (default set to folder build_output)
;bin_dir = /tmp/bin_files/