On Visual Studio Code with PlatformIO when I click on [v] button (PlatformIO:Build) the IDE run following task:
> Executing task: C:\Users\Mary\.platformio\penv\Scripts\platformio.exe run <
Processing d1_mini (platform: espressif8266; board: d1_mini; framework: arduino)
...
...
when I click on [=>] button (PlatformIO:Upload) the IDE run following task:
> Executing task: ~\.platformio\penv\Scripts\platformio.exe run --target upload <
Processing d1_mini (platform: espressif8266; board: d1_mini; framework: arduino)
...
...
Explanation:
https://docs.platformio.org/en/latest/userguide/cmd_run.html
I need to discriminate when the target is run (compile) or target is upload (--target upload) for setting different environmental variable. Something like
[env:specific_defines]
build_flags =
-D MY_VAR=true
because when i compile the project i don't want debug information (for example Serial.println()) that i want when i upload the program via usb with board attached.
I look Build options and Advanced Scripting but i don't find anything that was right for me.
Thanks in advance.