How to run the ESP-IDF serial monitor after every successful build

After a successful build and load of my project (ESP-IDF framework to an ESP32 board within the Atom editor on my iMac) I can start the serial monitor and see the output from my code.
If I then make a change to the code and click the ‘Upload’ button, the code will compile, the monitor stopped, the new code uploaded and the monitor starts again.
However if the compile results in an error then the serial monitor is NOT restarted and I have to do this automatically.
I’m happy for the serial monitor to not restart ofter the failed compile but it really would be convenient if it restarted after the subsequent successful compile.
Is there a setting to provide this behaviour?
If not then how easy would it be to add that is as an option in a future version?

But you start the subsequent compile also with the “Upload and Monitor” project task right so that should automatically happen?

I always use the right-pointing arrow in the toolbar - is that what you are referring to?

No the project tasks as documented.


“Upload and Monitor” will compile (as always before an upload), upload if successful and monitor if successful. Should be exactly what you want, if you use that button all the time.

If you press the “Upload” button in the toolbar (right-pointing arrow) it will also compile and upload if successful.

Thank you for your help Max.

However there must be something fundamental that I’m not understanding. What I see is:
Screen Shot 2020-12-11 at 08.12.34
The right-pointing arrow I’m referring (circled in yellow) to does not look like the one in your picture. Also the menu does not look the same as yours and does not include the ‘Upload and Monitor’ option.
What am I doing wrong?
Is my setup (which was just the default as far as I am aware) not correct?

My bad, I’m referencing the standard recommended VSCode way, you’re on Atom.

Unfortunately Atom has been deprecated for a while now (maybe 2 years now?), so main development is happening in VSCode.

According to the docs I don’t see the standard “Upload and Monitor” target. Thus the only way I see it would be to start a terminal in Atom and manually do a pio run -t upload -t monitor to do the Upload and Monitor.

You can also still try to open a feature request issue in Issues · platformio/platformio-atom-ide · GitHub.

Thanks Max.
I was unaware that the Atom host was deprecated.
After a couple of false starts I’ve got PlatformIO running under VS Code and it has compiled and talked to my board.
I now have almost the opposite problem - when I click on the ‘Upload and Monitor’ button, I get a popup that the ‘upload and Monitor’ task is already active - can this be set to terminate the monitor if it is already running before the build?

Not right now. I’ve opened Auto close serial monitor setting should apply to "Upload and Monitor", too · Issue #2266 · platformio/platformio-vscode-ide · GitHub for that since PlatformIO already has a “autoclose serial monitor before upload” setting (on by default, too), but somehow it doesn’t apply here, only when you press “upload” in the toolbar. Or I’m just not using it correctly, either.

Thank you Max.