fix 4MB PIO script upload regression

This commit is contained in:
Jason2866 2023-07-31 17:43:47 +02:00 committed by GitHub
parent 80617e96e1
commit 222b47627f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 13 deletions

View File

@ -29,15 +29,17 @@ if "upload" in COMMAND_LINE_TARGETS:
old_maximum_size = env.BoardConfig().get("upload.maximum_size")
new_maximum_size = int(size.split("MB")[0]) * 0x100000
extra_flags = env.BoardConfig().get("build.extra_flags").split(" ")
new_flags = ""
for flag in extra_flags:
if flag.startswith("-DESP32"):
flag = f"-DESP32_{size}"
new_flags += flag + " "
env.BoardConfig().update("build.extra_flags",new_flags)
env.BoardConfig().update("upload.flash_size",size)
if new_maximum_size > old_maximum_size:
env.BoardConfig().update("upload.maximum_size", new_maximum_size)
extra_flags = env.BoardConfig().get("build.extra_flags").split(" ")
new_flags = ""
for flag in extra_flags:
if flag.startswith("-DESP32"):
flag = f"-DESP32_{size}"
new_flags += flag + " "
env.BoardConfig().update("build.extra_flags",new_flags)
env.BoardConfig().update("upload.flash_size",size)
env.Replace(TASMOTA_flash_size=size)
env.BoardConfig().update("upload.maximum_size", new_maximum_size)
env.Replace(TASMOTA_flash_size=size)

View File

@ -74,10 +74,11 @@ def patch_partitions_bin(size_string):
def esp32_detect_flashsize():
if not "upload" in COMMAND_LINE_TARGETS:
return "4MB",False
try:
return env.get("TASMOTA_flash_size"),True
except:
size = env.get("TASMOTA_flash_size")
if size == None:
return "4MB",False
else:
return size,True
def esp32_create_chip_string(chip):
tasmota_platform = env.subst("$BUILD_DIR").split(os.path.sep)[-1]