If you open serial monitor via Serial Monitor button on the bottom toolbar, PIO IDE should close it automatically.
Nevertheless, we depend on VSCode API from Microsoft
If you use buttons on PIO Toolbar, all should work. Iâve just pressed âmonitorâ button, then âuploadâ and VSCode asked me to terminate existing task. This is a temporary workaround while VSCode does not have proper API to terminate particular task.
Hi all,
New to this tool. I too am struggling with what I surmise to be a monitor serial connection blocking uploads to the device.
error: Failed to open COM7
error: espcomm_open failed
error: espcomm_upload_mem failed
*** [upload] Error 2
The behaviour is very unpredictable and slowing me down quite a bit! My process is write a bit of code. Build (tick icon). Upload (arrow icon). Monitor (plug icon). But if I repeat this, I get the error above⌠Sometimes⌠1 out of 4 times it succeeds. Success through repeated clicking; not changing anything. Is there a secret process running inside VS Code that rolls a dice and perhaps another few processes laughing at me?
I waited a couple of hours before posting this. But it still persists. And I now also have the following error, which fails every time:
espcomm_sync failed
Any chance this is a known error, and a solution is possible. Would love to continue working in this environment all the way to production, but Iâm currently feeling very anxious!
Notes:
Made sure no tasks running by checking the little spanner&screwdriver icon.
Slowed the baud down to 9600.
Checked with a different cable.
Checked with a different USB port (windows actually still set it as COM7)
Opened port OK in teraTerm just to check it wasnât in use. It wasnât!
My design puts the ESP8266 into Deep Sleep. Interestingly, I was getting intermittent failures when I was sleeping for 5 or 10 seconds. Now Iâve upped that to 60 seconds, I canât seem to get it to work hardly at all. Can anyone confirm whether the device being in deep sleep has anything to do with this?
I was careful to close the Teraterm port after using it. I only opened it to test whether there was another unknown application holding it, which there was not. I could connect over teraterm fine. Then closed it. And back to not connecting.
Open the Keyboard Shortcuts editor by goung to File > Preferences > Keyboard Shortcuts
Search for multiCommand.closeTerminalAndUpload
Assign a Keybinding to it
Make sure the chosen Keybinding is not already being used by something else
OR, remove that Keybinding from another command before assigning it
OPTIONAL: You can enable Platformio-ide: Force Upload And Monitor in VS Code settings, this will âForce the platformio-ide-upload command to use the âUpload and Monitorâ taskâ. This will open the Monitor everytime you Upload your code (Both from GUI and Keys Shortcut)
DONE!
Now, everytime you press the chosen Keys Shortcut, the current terminal will close, wait 50 milliseconds and upload the new code.
NOTE:This only works for the chosen Keys Shortcut, this wonât work if you try to upload the code by clicking the upload buttons on the GUI
Iâm using ArduinoOTA to upload firmware, and Iâm annoyed that pressing the upload button automatically closes my serial monitor. (Which of course would make sense if I where uploading the firmware via serial connection, but it should check thatâs the case before closing the serial monitor)
More concrete feature request: Please only close the serial monitor before uploading when platformio.ini doesnât contain the line:
Thanks for this, this helped me. It is all I needed to extend the command needed for VSCode PlatformIO Core v6.1.9 without installing any other extensions.
Base on my version I do not see any options for âForce Upload And Monitorâ option, but only for the âAuto Close Serial Monitorâ which is ticked by default. Unfortunately, it wouldnât close the Serial Monitor when I use the âUpload and Monitorâ action.
To extend the VSCode PlatformIO Toolbar, do the following:
Go to your VSCode settings.
Find the âPlatformio-id: toolbarâ.
Click the âEdit in settings.jsonâ. This will generate a setting for your vscode named âplatformio-ide.toolbarâ, this settings are also shown in your VSCode bottom bar (left side).
Inside of the array, add this object data for the additional setting in your toolbar.
Iâm having a similar problemâŚ
As you say, you can have the serial monitor close automatically when running build and test⌠Now, the thing is that when I try to upload the file system image this fails as the monitor is runningâŚ
Iâd like to know how to turn of the serial monitor so that other uploads work too⌠Simply closing the window does not do the trick.
I had to close the IDE and run upload manually outside of the IDE for it to work.