* Add and remove libs and components for Arduino Core 3 * Arduino Core 3 * Add back Solo1 * Change ESP32-S3 to 4MB build * Update README.md * Fix retain and number of retries * Fix rolling log * Fix defaults * Fix BleScanner on Solo1 * Export settings * Import settings * Fix HA Battery voltage * Change submodule * Update espMqttClient and AsyncTCP * Webserial and MQTT/Network reconnecting * Update nuki_ble --------- Co-authored-by: iranl <iranl@github.com>
45 lines
1.2 KiB
Python
45 lines
1.2 KiB
Python
""" PlatformIO POST script execution to copy updater """
|
|
|
|
Import("env")
|
|
import glob
|
|
import os
|
|
import shutil
|
|
from pathlib import Path
|
|
|
|
def get_board_name(env):
|
|
board = env.get('BOARD_MCU')
|
|
if env.get('BOARD') == 'esp32-solo1':
|
|
board = env.get('BOARD').replace('-', '')
|
|
return board
|
|
|
|
def create_target_dir(env):
|
|
board = get_board_name(env)
|
|
target_dir = env.GetProjectOption("custom_build") + '/' + board
|
|
if not os.path.exists(target_dir):
|
|
os.makedirs(target_dir)
|
|
return target_dir
|
|
|
|
def copy_files(source, target, env):
|
|
file = Path(target[0].get_abspath())
|
|
target_dir = create_target_dir(env)
|
|
board = get_board_name(env)
|
|
|
|
if "firmware" in file.stem:
|
|
shutil.copy(file, f"{target_dir}/updater.bin")
|
|
|
|
def remove_files(source, target, env):
|
|
for f in glob.glob("src/*.cpp"):
|
|
os.remove(f)
|
|
|
|
for f in glob.glob("src/*.h"):
|
|
os.remove(f)
|
|
|
|
for f in glob.glob("src/networkDevices/*.cpp"):
|
|
os.remove(f)
|
|
|
|
for f in glob.glob("src/networkDevices/*.h"):
|
|
os.remove(f)
|
|
|
|
env.AddPostAction("$BUILD_DIR/firmware.bin", copy_files)
|
|
env.AddPostAction("$BUILD_DIR/firmware.bin", remove_files)
|