safemode refactor

This commit is contained in:
Jason2866 2022-04-26 16:41:35 +02:00
parent 259f716188
commit 54fc04409a
4 changed files with 24 additions and 1 deletions

View File

@ -31,7 +31,7 @@
"flash_extra_images": [
[
"0x2E0000",
"tasmota32-minicustom.bin"
"variants/tasmota/tasmota32-minicustom.bin"
]
]
},

View File

@ -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)

View File

@ -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}