Allow multiple patch directories per environment
This commit is contained in:
parent
2608080708
commit
6556268056
@ -9,7 +9,10 @@ import re
|
|||||||
Import("env")
|
Import("env")
|
||||||
|
|
||||||
def getPatchPath(env):
|
def getPatchPath(env):
|
||||||
return os.path.join(env["PROJECT_DIR"], "patches", env.GetProjectOption('custom_patches'))
|
patchList = []
|
||||||
|
for patch in env.GetProjectOption('custom_patches').split(","):
|
||||||
|
patchList.append(os.path.join(env["PROJECT_DIR"], "patches", patch))
|
||||||
|
return patchList
|
||||||
|
|
||||||
def is_tool(name):
|
def is_tool(name):
|
||||||
"""Check whether `name` is on PATH and marked as executable."""
|
"""Check whether `name` is on PATH and marked as executable."""
|
||||||
@ -44,35 +47,36 @@ def main():
|
|||||||
print('Git not found. Will not apply custom patches!')
|
print('Git not found. Will not apply custom patches!')
|
||||||
return
|
return
|
||||||
|
|
||||||
directory = getPatchPath(env)
|
directories = getPatchPath(env)
|
||||||
if (not os.path.isdir(directory)):
|
for directory in directories:
|
||||||
print('Patch directory not found: ' + directory)
|
if (not os.path.isdir(directory)):
|
||||||
return
|
print('Patch directory not found: ' + directory)
|
||||||
|
return
|
||||||
|
|
||||||
for file in os.listdir(directory):
|
for file in os.listdir(directory):
|
||||||
if (not file.endswith('.patch')):
|
if (not file.endswith('.patch')):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
fullPath = os.path.join(directory, file)
|
fullPath = os.path.join(directory, file)
|
||||||
preparePath = fullPath + '.prepare'
|
preparePath = fullPath + '.prepare'
|
||||||
replaceInFile(fullPath, preparePath, '$$$env$$$', env['PIOENV'])
|
replaceInFile(fullPath, preparePath, '$$$env$$$', env['PIOENV'])
|
||||||
print('Working on patch: ' + fullPath + '... ', end='')
|
print('Working on patch: ' + fullPath + '... ', end='')
|
||||||
|
|
||||||
|
# Check if patch was already applied
|
||||||
|
process = subprocess.run(['git', 'apply', '--reverse', '--check', preparePath], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||||
|
if (process.returncode == 0):
|
||||||
|
print('already applied')
|
||||||
|
os.remove(preparePath)
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Apply patch
|
||||||
|
process = subprocess.run(['git', 'apply', preparePath])
|
||||||
|
if (process.returncode == 0):
|
||||||
|
print('applied')
|
||||||
|
else:
|
||||||
|
print('failed')
|
||||||
|
|
||||||
# Check if patch was already applied
|
|
||||||
process = subprocess.run(['git', 'apply', '--reverse', '--check', preparePath], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
|
||||||
if (process.returncode == 0):
|
|
||||||
print('already applied')
|
|
||||||
os.remove(preparePath)
|
os.remove(preparePath)
|
||||||
continue
|
|
||||||
|
|
||||||
# Apply patch
|
|
||||||
process = subprocess.run(['git', 'apply', preparePath])
|
|
||||||
if (process.returncode == 0):
|
|
||||||
print('applied')
|
|
||||||
else:
|
|
||||||
print('failed')
|
|
||||||
|
|
||||||
os.remove(preparePath)
|
|
||||||
|
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|||||||
476
platformio.ini
476
platformio.ini
@ -1,237 +1,239 @@
|
|||||||
; PlatformIO Project Configuration File
|
; PlatformIO Project Configuration File
|
||||||
;
|
;
|
||||||
; Build options: build flags, source filter
|
; Build options: build flags, source filter
|
||||||
; Upload options: custom upload port, speed and extra flags
|
; Upload options: custom upload port, speed and extra flags
|
||||||
; Library options: dependencies, extra library storages
|
; Library options: dependencies, extra library storages
|
||||||
; Advanced options: extra scripting
|
; Advanced options: extra scripting
|
||||||
;
|
;
|
||||||
; Please visit documentation for the other options and examples
|
; Please visit documentation for the other options and examples
|
||||||
; https://docs.platformio.org/page/projectconf.html
|
; https://docs.platformio.org/page/projectconf.html
|
||||||
|
|
||||||
[platformio]
|
[platformio]
|
||||||
default_envs = generic_esp32
|
default_envs = generic_esp32
|
||||||
extra_configs =
|
extra_configs =
|
||||||
platformio_override.ini
|
platformio_override.ini
|
||||||
|
|
||||||
[env]
|
[env]
|
||||||
; Make sure to NOT add any spaces in the custom_ci_action property
|
; Make sure to NOT add any spaces in the custom_ci_action property
|
||||||
; (also the position in the file is important)
|
; (also the position in the file is important)
|
||||||
custom_ci_action = generic,generic_esp32,generic_esp32s3,generic_esp32s3_usb
|
custom_ci_action = generic,generic_esp32,generic_esp32s3,generic_esp32s3_usb
|
||||||
|
|
||||||
framework = arduino
|
framework = arduino
|
||||||
platform = espressif32@6.5.0
|
platform = espressif32@6.5.0
|
||||||
|
|
||||||
build_flags =
|
build_flags =
|
||||||
-DPIOENV=\"$PIOENV\"
|
-DPIOENV=\"$PIOENV\"
|
||||||
-D_TASK_STD_FUNCTION=1
|
-D_TASK_STD_FUNCTION=1
|
||||||
-D_TASK_THREAD_SAFE=1
|
-D_TASK_THREAD_SAFE=1
|
||||||
-Wall -Wextra -Wunused -Wmisleading-indentation -Wduplicated-cond -Wlogical-op -Wnull-dereference
|
-Wall -Wextra -Wunused -Wmisleading-indentation -Wduplicated-cond -Wlogical-op -Wnull-dereference
|
||||||
; Have to remove -Werror because of
|
; Have to remove -Werror because of
|
||||||
; https://github.com/espressif/arduino-esp32/issues/9044 and
|
; https://github.com/espressif/arduino-esp32/issues/9044 and
|
||||||
; https://github.com/espressif/arduino-esp32/issues/9045
|
; https://github.com/espressif/arduino-esp32/issues/9045
|
||||||
; -Werror
|
; -Werror
|
||||||
-std=c++17
|
-std=c++17
|
||||||
-std=gnu++17
|
-std=gnu++17
|
||||||
build_unflags =
|
build_unflags =
|
||||||
-std=gnu++11
|
-std=gnu++11
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
https://github.com/yubox-node-org/ESPAsyncWebServer
|
https://github.com/yubox-node-org/ESPAsyncWebServer
|
||||||
bblanchon/ArduinoJson @ ^6.21.4
|
bblanchon/ArduinoJson @ ^6.21.4
|
||||||
https://github.com/bertmelis/espMqttClient.git#v1.5.0
|
https://github.com/bertmelis/espMqttClient.git#v1.5.0
|
||||||
nrf24/RF24 @ ^1.4.8
|
nrf24/RF24 @ ^1.4.8
|
||||||
olikraus/U8g2 @ ^2.35.9
|
olikraus/U8g2 @ ^2.35.9
|
||||||
buelowp/sunset @ ^1.1.7
|
buelowp/sunset @ ^1.1.7
|
||||||
https://github.com/arkhipenko/TaskScheduler#testing
|
https://github.com/arkhipenko/TaskScheduler#testing
|
||||||
|
|
||||||
extra_scripts =
|
extra_scripts =
|
||||||
pre:pio-scripts/auto_firmware_version.py
|
pre:pio-scripts/auto_firmware_version.py
|
||||||
pre:pio-scripts/patch_apply.py
|
pre:pio-scripts/patch_apply.py
|
||||||
post:pio-scripts/create_factory_bin.py
|
post:pio-scripts/create_factory_bin.py
|
||||||
|
|
||||||
board_build.partitions = partitions_custom.csv
|
board_build.partitions = partitions_custom.csv
|
||||||
board_build.filesystem = littlefs
|
board_build.filesystem = littlefs
|
||||||
board_build.embed_files =
|
board_build.embed_files =
|
||||||
webapp_dist/index.html.gz
|
webapp_dist/index.html.gz
|
||||||
webapp_dist/zones.json.gz
|
webapp_dist/zones.json.gz
|
||||||
webapp_dist/favicon.ico
|
webapp_dist/favicon.ico
|
||||||
webapp_dist/favicon.png
|
webapp_dist/favicon.png
|
||||||
webapp_dist/js/app.js.gz
|
webapp_dist/js/app.js.gz
|
||||||
webapp_dist/site.webmanifest
|
webapp_dist/site.webmanifest
|
||||||
|
|
||||||
monitor_filters = esp32_exception_decoder, time, log2file, colorize
|
custom_patches =
|
||||||
monitor_speed = 115200
|
|
||||||
upload_protocol = esptool
|
monitor_filters = esp32_exception_decoder, time, log2file, colorize
|
||||||
|
monitor_speed = 115200
|
||||||
; Specify port in platformio_override.ini. Comment out (add ; in front of line) to use auto detection.
|
upload_protocol = esptool
|
||||||
; monitor_port = COM4
|
|
||||||
; upload_port = COM4
|
; Specify port in platformio_override.ini. Comment out (add ; in front of line) to use auto detection.
|
||||||
|
; monitor_port = COM4
|
||||||
|
; upload_port = COM4
|
||||||
[env:generic_esp32]
|
|
||||||
board = esp32dev
|
|
||||||
build_flags = ${env.build_flags}
|
[env:generic_esp32]
|
||||||
|
board = esp32dev
|
||||||
|
build_flags = ${env.build_flags}
|
||||||
[env:generic_esp32c3]
|
|
||||||
board = esp32-c3-devkitc-02
|
|
||||||
custom_patches = esp32c3
|
[env:generic_esp32c3]
|
||||||
build_flags = ${env.build_flags}
|
board = esp32-c3-devkitc-02
|
||||||
|
custom_patches = ${env.custom_patches},esp32c3
|
||||||
|
build_flags = ${env.build_flags}
|
||||||
[env:generic_esp32c3_usb]
|
|
||||||
board = esp32-c3-devkitc-02
|
|
||||||
custom_patches = esp32c3
|
[env:generic_esp32c3_usb]
|
||||||
build_flags = ${env.build_flags}
|
board = esp32-c3-devkitc-02
|
||||||
-DARDUINO_USB_MODE=1
|
custom_patches = ${env.custom_patches},esp32c3
|
||||||
-DARDUINO_USB_CDC_ON_BOOT=1
|
build_flags = ${env.build_flags}
|
||||||
|
-DARDUINO_USB_MODE=1
|
||||||
|
-DARDUINO_USB_CDC_ON_BOOT=1
|
||||||
[env:generic_esp32s3]
|
|
||||||
board = esp32-s3-devkitc-1
|
|
||||||
build_flags = ${env.build_flags}
|
[env:generic_esp32s3]
|
||||||
|
board = esp32-s3-devkitc-1
|
||||||
|
build_flags = ${env.build_flags}
|
||||||
[env:generic_esp32s3_usb]
|
|
||||||
board = esp32-s3-devkitc-1
|
|
||||||
upload_protocol = esp-builtin
|
[env:generic_esp32s3_usb]
|
||||||
build_flags = ${env.build_flags}
|
board = esp32-s3-devkitc-1
|
||||||
-DARDUINO_USB_MODE=1
|
upload_protocol = esp-builtin
|
||||||
-DARDUINO_USB_CDC_ON_BOOT=1
|
build_flags = ${env.build_flags}
|
||||||
|
-DARDUINO_USB_MODE=1
|
||||||
|
-DARDUINO_USB_CDC_ON_BOOT=1
|
||||||
[env:generic]
|
|
||||||
board = esp32dev
|
|
||||||
build_flags = ${env.build_flags}
|
[env:generic]
|
||||||
-DHOYMILES_PIN_MISO=19
|
board = esp32dev
|
||||||
-DHOYMILES_PIN_MOSI=23
|
build_flags = ${env.build_flags}
|
||||||
-DHOYMILES_PIN_SCLK=18
|
-DHOYMILES_PIN_MISO=19
|
||||||
-DHOYMILES_PIN_IRQ=16
|
-DHOYMILES_PIN_MOSI=23
|
||||||
-DHOYMILES_PIN_CE=4
|
-DHOYMILES_PIN_SCLK=18
|
||||||
-DHOYMILES_PIN_CS=5
|
-DHOYMILES_PIN_IRQ=16
|
||||||
|
-DHOYMILES_PIN_CE=4
|
||||||
|
-DHOYMILES_PIN_CS=5
|
||||||
[env:olimex_esp32_poe]
|
|
||||||
; https://www.olimex.com/Products/IoT/ESP32/ESP32-POE/open-source-hardware
|
|
||||||
board = esp32-poe
|
[env:olimex_esp32_poe]
|
||||||
build_flags = ${env.build_flags}
|
; https://www.olimex.com/Products/IoT/ESP32/ESP32-POE/open-source-hardware
|
||||||
-DHOYMILES_PIN_MISO=15
|
board = esp32-poe
|
||||||
-DHOYMILES_PIN_MOSI=2
|
build_flags = ${env.build_flags}
|
||||||
-DHOYMILES_PIN_SCLK=14
|
-DHOYMILES_PIN_MISO=15
|
||||||
-DHOYMILES_PIN_IRQ=13
|
-DHOYMILES_PIN_MOSI=2
|
||||||
-DHOYMILES_PIN_CE=16
|
-DHOYMILES_PIN_SCLK=14
|
||||||
-DHOYMILES_PIN_CS=5
|
-DHOYMILES_PIN_IRQ=13
|
||||||
-DOPENDTU_ETHERNET
|
-DHOYMILES_PIN_CE=16
|
||||||
|
-DHOYMILES_PIN_CS=5
|
||||||
|
-DOPENDTU_ETHERNET
|
||||||
[env:olimex_esp32_evb]
|
|
||||||
; https://www.olimex.com/Products/IoT/ESP32/ESP32-EVB/open-source-hardware
|
|
||||||
board = esp32-evb
|
[env:olimex_esp32_evb]
|
||||||
build_flags = ${env.build_flags}
|
; https://www.olimex.com/Products/IoT/ESP32/ESP32-EVB/open-source-hardware
|
||||||
-DHOYMILES_PIN_MISO=15
|
board = esp32-evb
|
||||||
-DHOYMILES_PIN_MOSI=2
|
build_flags = ${env.build_flags}
|
||||||
-DHOYMILES_PIN_SCLK=14
|
-DHOYMILES_PIN_MISO=15
|
||||||
-DHOYMILES_PIN_IRQ=13
|
-DHOYMILES_PIN_MOSI=2
|
||||||
-DHOYMILES_PIN_CE=16
|
-DHOYMILES_PIN_SCLK=14
|
||||||
-DHOYMILES_PIN_CS=17
|
-DHOYMILES_PIN_IRQ=13
|
||||||
-DOPENDTU_ETHERNET
|
-DHOYMILES_PIN_CE=16
|
||||||
|
-DHOYMILES_PIN_CS=17
|
||||||
|
-DOPENDTU_ETHERNET
|
||||||
[env:d1_mini_esp32]
|
|
||||||
board = wemos_d1_mini32
|
|
||||||
build_flags =
|
[env:d1_mini_esp32]
|
||||||
${env.build_flags}
|
board = wemos_d1_mini32
|
||||||
-DHOYMILES_PIN_MISO=19
|
build_flags =
|
||||||
-DHOYMILES_PIN_MOSI=23
|
${env.build_flags}
|
||||||
-DHOYMILES_PIN_SCLK=18
|
-DHOYMILES_PIN_MISO=19
|
||||||
-DHOYMILES_PIN_IRQ=16
|
-DHOYMILES_PIN_MOSI=23
|
||||||
-DHOYMILES_PIN_CE=17
|
-DHOYMILES_PIN_SCLK=18
|
||||||
-DHOYMILES_PIN_CS=5
|
-DHOYMILES_PIN_IRQ=16
|
||||||
|
-DHOYMILES_PIN_CE=17
|
||||||
|
-DHOYMILES_PIN_CS=5
|
||||||
[env:wt32_eth01]
|
|
||||||
; http://www.wireless-tag.com/portfolio/wt32-eth01/
|
|
||||||
board = wt32-eth01
|
[env:wt32_eth01]
|
||||||
build_flags = ${env.build_flags}
|
; http://www.wireless-tag.com/portfolio/wt32-eth01/
|
||||||
-DHOYMILES_PIN_MISO=4
|
board = wt32-eth01
|
||||||
-DHOYMILES_PIN_MOSI=2
|
build_flags = ${env.build_flags}
|
||||||
-DHOYMILES_PIN_SCLK=32
|
-DHOYMILES_PIN_MISO=4
|
||||||
-DHOYMILES_PIN_IRQ=33
|
-DHOYMILES_PIN_MOSI=2
|
||||||
-DHOYMILES_PIN_CE=14
|
-DHOYMILES_PIN_SCLK=32
|
||||||
-DHOYMILES_PIN_CS=15
|
-DHOYMILES_PIN_IRQ=33
|
||||||
-DOPENDTU_ETHERNET
|
-DHOYMILES_PIN_CE=14
|
||||||
|
-DHOYMILES_PIN_CS=15
|
||||||
|
-DOPENDTU_ETHERNET
|
||||||
[env:esp_s3_12k_kit]
|
|
||||||
; https://www.waveshare.com/wiki/NodeMCU-ESP-S3-12K-Kit
|
|
||||||
board = esp32-s3-devkitc-1
|
[env:esp_s3_12k_kit]
|
||||||
build_flags = ${env.build_flags}
|
; https://www.waveshare.com/wiki/NodeMCU-ESP-S3-12K-Kit
|
||||||
-DHOYMILES_PIN_MISO=16
|
board = esp32-s3-devkitc-1
|
||||||
-DHOYMILES_PIN_MOSI=17
|
build_flags = ${env.build_flags}
|
||||||
-DHOYMILES_PIN_SCLK=18
|
-DHOYMILES_PIN_MISO=16
|
||||||
-DHOYMILES_PIN_IRQ=3
|
-DHOYMILES_PIN_MOSI=17
|
||||||
-DHOYMILES_PIN_CE=4
|
-DHOYMILES_PIN_SCLK=18
|
||||||
-DHOYMILES_PIN_CS=5
|
-DHOYMILES_PIN_IRQ=3
|
||||||
|
-DHOYMILES_PIN_CE=4
|
||||||
|
-DHOYMILES_PIN_CS=5
|
||||||
[env:lolin32_lite]
|
|
||||||
; https://www.makershop.de/plattformen/esp8266/wemos-lolin32/
|
|
||||||
; https://www.az-delivery.de/products/esp32-lolin-lolin32
|
[env:lolin32_lite]
|
||||||
board = lolin32_lite
|
; https://www.makershop.de/plattformen/esp8266/wemos-lolin32/
|
||||||
build_flags = ${env.build_flags}
|
; https://www.az-delivery.de/products/esp32-lolin-lolin32
|
||||||
-DHOYMILES_PIN_MISO=19
|
board = lolin32_lite
|
||||||
-DHOYMILES_PIN_MOSI=23
|
build_flags = ${env.build_flags}
|
||||||
-DHOYMILES_PIN_SCLK=18
|
-DHOYMILES_PIN_MISO=19
|
||||||
-DHOYMILES_PIN_IRQ=16
|
-DHOYMILES_PIN_MOSI=23
|
||||||
-DHOYMILES_PIN_CE=17
|
-DHOYMILES_PIN_SCLK=18
|
||||||
-DHOYMILES_PIN_CS=5
|
-DHOYMILES_PIN_IRQ=16
|
||||||
|
-DHOYMILES_PIN_CE=17
|
||||||
[env:lolin_s2_mini]
|
-DHOYMILES_PIN_CS=5
|
||||||
board = lolin_s2_mini
|
|
||||||
build_flags = ${env.build_flags}
|
[env:lolin_s2_mini]
|
||||||
-DHOYMILES_PIN_MISO=13
|
board = lolin_s2_mini
|
||||||
-DHOYMILES_PIN_MOSI=11
|
build_flags = ${env.build_flags}
|
||||||
-DHOYMILES_PIN_SCLK=12
|
-DHOYMILES_PIN_MISO=13
|
||||||
-DHOYMILES_PIN_CS=10
|
-DHOYMILES_PIN_MOSI=11
|
||||||
-DHOYMILES_PIN_IRQ=4
|
-DHOYMILES_PIN_SCLK=12
|
||||||
-DHOYMILES_PIN_CE=5
|
-DHOYMILES_PIN_CS=10
|
||||||
|
-DHOYMILES_PIN_IRQ=4
|
||||||
|
-DHOYMILES_PIN_CE=5
|
||||||
[env:opendtufusionv1]
|
|
||||||
board = esp32-s3-devkitc-1
|
|
||||||
upload_protocol = esp-builtin
|
[env:opendtufusionv1]
|
||||||
debug_tool = esp-builtin
|
board = esp32-s3-devkitc-1
|
||||||
debug_speed = 12000
|
upload_protocol = esp-builtin
|
||||||
build_flags = ${env.build_flags}
|
debug_tool = esp-builtin
|
||||||
-DHOYMILES_PIN_MISO=48
|
debug_speed = 12000
|
||||||
-DHOYMILES_PIN_MOSI=35
|
build_flags = ${env.build_flags}
|
||||||
-DHOYMILES_PIN_SCLK=36
|
-DHOYMILES_PIN_MISO=48
|
||||||
-DHOYMILES_PIN_IRQ=47
|
-DHOYMILES_PIN_MOSI=35
|
||||||
-DHOYMILES_PIN_CE=38
|
-DHOYMILES_PIN_SCLK=36
|
||||||
-DHOYMILES_PIN_CS=37
|
-DHOYMILES_PIN_IRQ=47
|
||||||
-DLED0=17
|
-DHOYMILES_PIN_CE=38
|
||||||
-DLED1=18
|
-DHOYMILES_PIN_CS=37
|
||||||
-DARDUINO_USB_MODE=1
|
-DLED0=17
|
||||||
|
-DLED1=18
|
||||||
[env:opendtufusionv2]
|
-DARDUINO_USB_MODE=1
|
||||||
board = esp32-s3-devkitc-1
|
|
||||||
upload_protocol = esp-builtin
|
[env:opendtufusionv2]
|
||||||
debug_tool = esp-builtin
|
board = esp32-s3-devkitc-1
|
||||||
debug_speed = 12000
|
upload_protocol = esp-builtin
|
||||||
build_flags = ${env.build_flags}
|
debug_tool = esp-builtin
|
||||||
-DHOYMILES_PIN_MISO=48
|
debug_speed = 12000
|
||||||
-DHOYMILES_PIN_MOSI=35
|
build_flags = ${env.build_flags}
|
||||||
-DHOYMILES_PIN_SCLK=36
|
-DHOYMILES_PIN_MISO=48
|
||||||
-DHOYMILES_PIN_IRQ=47
|
-DHOYMILES_PIN_MOSI=35
|
||||||
-DHOYMILES_PIN_CE=38
|
-DHOYMILES_PIN_SCLK=36
|
||||||
-DHOYMILES_PIN_CS=37
|
-DHOYMILES_PIN_IRQ=47
|
||||||
-DLED0=17
|
-DHOYMILES_PIN_CE=38
|
||||||
-DLED1=18
|
-DHOYMILES_PIN_CS=37
|
||||||
-DCMT_CLK=6
|
-DLED0=17
|
||||||
-DCMT_CS=4
|
-DLED1=18
|
||||||
-DCMT_FCS=21
|
-DCMT_CLK=6
|
||||||
-DCMT_GPIO2=3
|
-DCMT_CS=4
|
||||||
-DCMT_GPIO3=8
|
-DCMT_FCS=21
|
||||||
-DCMT_SDIO=5
|
-DCMT_GPIO2=3
|
||||||
-DARDUINO_USB_MODE=1
|
-DCMT_GPIO3=8
|
||||||
-DARDUINO_USB_CDC_ON_BOOT=1
|
-DCMT_SDIO=5
|
||||||
|
-DARDUINO_USB_MODE=1
|
||||||
|
-DARDUINO_USB_CDC_ON_BOOT=1
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user