Merge branch 'development03' into development03

This commit is contained in:
geronet1 2024-05-18 22:12:39 +02:00 committed by GitHub
commit 76b9bd8330
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
47 changed files with 1448 additions and 690 deletions

View file

@ -0,0 +1,55 @@
import os
import subprocess
import shutil
Import("env")
def build_littlefs():
result = subprocess.run(["pio", "run", "--target", "buildfs", "--environment", env['PIOENV']])
if result.returncode != 0:
print("Error building LittleFS:")
exit(1)
else:
print("LittleFS build successful")
def merge_bins():
flash_size = int(env.get("BOARD_FLASH_SIZE", "4MB").replace("MB", ""))
app0_offset = 0x10000
if env['PIOENV'][:7] == "esp8266":
app0_offset = 0
elif env['PIOENV'][:7] == "esp8285":
app0_offset = 0
littlefs_offset = 0x290000
if flash_size == 8:
littlefs_offset = 0x670000
elif flash_size == 16:
littlefs_offset = 0xc90000
# save current wd
start = os.getcwd()
os.chdir('.pio/build/' + env['PIOENV'] + '/')
with open("firmware.bin", "rb") as firmware_file:
firmware_data = firmware_file.read()
with open("littlefs.bin", "rb") as littlefs_file:
littlefs_data = littlefs_file.read()
with open("firmware.factory.bin", "wb") as merged_file:
# fill gap with 0xff
merged_file.write(firmware_data)
if len(firmware_data) < (littlefs_offset - app0_offset):
merged_file.write(b'\xFF' * ((littlefs_offset - app0_offset) - len(firmware_data)))
merged_file.write(littlefs_data)
os.chdir(start)
def main(target, source, env):
build_littlefs()
merge_bins()
# ensure that script is called once firmeware was compiled
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", main)

View file

@ -28,8 +28,8 @@ def applyPatch(libName, patchFile):
# list of patches to apply (relative to /src)
applyPatch("ESPAsyncWebServer-esphome", "../patches/AsyncWeb_Prometheus.patch")
if env['PIOENV'][:13] == "opendtufusion":
applyPatch("GxEPD2", "../patches/GxEPD2_SW_SPI.patch")
if (env['PIOENV'][:5] == "esp32") or (env['PIOENV'][:13] == "opendtufusion"):
applyPatch("GxEPD2", "../patches/GxEPD2_HAL.patch")
if (env['PIOENV'][:13] == "opendtufusion") or (env['PIOENV'][:5] == "esp32"):
applyPatch("RF24", "../patches/RF24_Hal.patch")