PlatformIO Community

Multiple upload protocols

Hello,

is there a way to define multiple upload protocols in platformio.ini if one of them fails to upload. I want to upload over serial port if a the esp32 is connected and if not then try to do it with espota.

Right now I have multiple envs, but with this I cant really use $PIOENV in my code because it depends on the upload method I used.

[env]
platform = espressif32
framework = arduino
monitor_speed = 115200
monitor_filters = esp32_exception_decoder
lib_deps = Wire, Ethernet
build_flags =
	-D LED_BUILTIN=1
	-D PIOENV=\"$PIOENV\"

[env:arduitouch-test]
board = az-delivery-devkit-v4
build_flags =
	${env.build_flags}
	-D IPADDR=172,16,225,12
	-D SENSOR_DATA_PIN=17
	-D SENSOR_CLOCK_PIN=16
	-D HAS_SCREEN=1

[env:arduitouch-test-ota]
extends = arduitouch-test
upload_protocol = espota
upload_port = 172.16.225.12
upload_flags =
    --port=9123
	--host_port=9123

Such behavior is not implemented afair. File a feature request at https://github.com/platformio/platformio-core/issues/ if you want to see the feature