{
"text": "$(circuit-board)",
"tooltip": "👽 Upload",
"commands": [
{
"id": "platformio-ide.runPIOCoreCommand",
"args": "pio run -t upload --upload-port ${?}"
}
]
}
The com port will either be set by the platformio.ini or what you have selected in the status bar.
Use this upload command:
{
"text": "$(arrow-right)",
"tooltip": "PlatformIO: Upload",
"commands": "platformio-ide.upload"
},
If you want upload without build:
{
"text": "$(debug-step-out)",
"tooltip": "PlatformIO: Upload without build",
"commands": [
{
"id": "platformio-ide.runPIOCoreCommand",
"args": "pio run -t nobuild -t upload"
}
]
},
After looking at the documentation, I know we can set ${command:platformio-ide.activeEnvironment} to specify the environment. I wish there was a similar way to get the port number
https://docs.platformio.org/en/latest/integration/ide/vscode.html
What is the use case?
If you set a fixed com port in the toolbar setting, it will always be used for all projects and environments.
You can no longer change it per project / per environment in platformio.ini and you cannot select the port in the status bar!
I like to use the serial port number set in the toolbar to perform a customized download process or use other serial port tools for monitoring.
I’m still not getting the use case…
sorry, I didn’t make it clear…
just need a variable or command can get the port number set in the ui, maybe something like ${command:platformio-ide.getCustomPort}
, that’s it.
{
"commands": [
{
"args": "python -c 'import serial\ns=serial.Serial(port=\"${command:platformio-ide.getCustomPort}\")\ns.dtr=False\ns.dtr=True\ns.close()'",
"id": "platformio-ide.runPIOCoreCommand"
}
],
"text": "$(debug-restart)",
"tooltip": "👽 Reboot"
},
After testing, I found that if the port is not explicitly specified, it is in auto mode and will not take the settings in the UI.
{
"commands": [
{
"args": "pio run -t upload -v;",
"id": "platformio-ide.runPIOCoreCommand"
}
],
"text": "$(desktop-download)",
"tooltip": "👽 Upload -v"
},
output
Yes, I still don’t get it. WHY do you need this?
Please let me know a concrete use-case.