Custom upload task for different upload_protocol

Hello all! I’m struggling to understand if it is at all possible to have separate (and selectable) build tasks for a different upload_protocol.

To be specific, I’m developing against an ESP board and I upload my firmware via OTA. Invariably, when I hopelessly break things and the OTA loop hasn’t had a chance to run, I need to revert back to the serial flashing, which means, modifying platformio.ini, uploading the changes and switching back to OTA.

Is it possible to have two separate tasks, one for OTA upload and one for Serial?

Thanks!

Just create two environments with different upload_protocol and upload for the correct environment?

See Redirecting...

In VScode you should then see the new environment’s tasks: Redirecting...

3 Likes

Thanks Max , I’ll give this a go.

That’s all I do for my projects… especially as I usually only need the serial task for the first load, or if something goes wrong, and then I collapse that one, and use the OTA env instead.

@maxgerhardt that worked like a charm, thank you very much!