diff --git a/boards/esp32_4M_2APP.json b/boards/esp32_4M_2APP.json index e9dc5635c..e95eb07fd 100644 --- a/boards/esp32_4M_2APP.json +++ b/boards/esp32_4M_2APP.json @@ -31,7 +31,7 @@ "flash_extra_images": [ [ "0x2E0000", - "tasmota32-minicustom.bin" + "variants/tasmota/tasmota32-minicustom.bin" ] ] }, diff --git a/pio-tools/copy_safemode.py b/pio-tools/copy_safemode.py new file mode 100644 index 000000000..1818eb028 --- /dev/null +++ b/pio-tools/copy_safemode.py @@ -0,0 +1,22 @@ +import os +import shutil +from os.path import join +from SCons.Script import DefaultEnvironment + +env = DefaultEnvironment() +platform = env.PioPlatform() + +FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoespressif32") + +safemode_dir = join(env["PROJECT_DIR"], "safemode") +variants_dir = join(FRAMEWORK_DIR, "variants", "tasmota") + +if env["PIOPLATFORM"] == "espressif32": + if os.path.exists(safemode_dir): +# print("safemode.bin dir exists") + if os.path.exists(variants_dir): + print("") # dummy print +# print("variants/tasmota exists") +# os.remove(variants_dir) # todo PermissionError: [Errno 1] Operation not permitted: + else: + shutil.copytree(safemode_dir, variants_dir) diff --git a/platformio_tasmota32.ini b/platformio_tasmota32.ini index 8c604f663..38f17ebd3 100644 --- a/platformio_tasmota32.ini +++ b/platformio_tasmota32.ini @@ -34,6 +34,7 @@ build_flags = ${esp_defaults.build_flags} -Wl,--wrap=panicHandler -Wl,--wrap=xt_unhandled_exception -Wl,--wrap=_Z11analogWritehi ; `analogWrite(unsigned char, int)` use the Tasmota version of analogWrite for deeper integration and phase control extra_scripts = pre:pio-tools/add_c_flags.py + pre:pio-tools/copy_safemode.py post:pio-tools/post_esp32.py ${esp_defaults.extra_scripts} diff --git a/safemode.bin/tasmota32-minicustom.bin b/safemode/tasmota32-minicustom.bin similarity index 100% rename from safemode.bin/tasmota32-minicustom.bin rename to safemode/tasmota32-minicustom.bin