build gz only for ESP8266

This commit is contained in:
Jason2866 2021-01-18 19:21:51 +01:00 committed by GitHub
parent d99ba6992c
commit 1b1b1ed83c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 18 deletions

View File

@ -3,9 +3,15 @@ import os
import shutil
import gzip
OUTPUT_DIR = "build_output{}".format(os.path.sep)
platform = env.PioPlatform()
board = env.BoardConfig()
mcu = board.get("build.mcu", "esp32")
# gzip only for ESP8266
if env["PIOPLATFORM"] != "espressif32":
def bin_gzip(source, target, env):
OUTPUT_DIR = "build_output{}".format(os.path.sep)
def bin_gzip(source, target, env):
variant = str(target[0]).split(os.path.sep)[2]
# create string with location and file names based on variant
@ -25,4 +31,4 @@ def bin_gzip(source, target, env):
print("Compression reduced firmware size by {:.0f}% (was {} bytes, now {} bytes)".format((GZ_FIRMWARE_SIZE / ORG_FIRMWARE_SIZE) * 100, ORG_FIRMWARE_SIZE, GZ_FIRMWARE_SIZE))
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [bin_gzip])
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [bin_gzip])