"remember" IDE configuration on Sketch

I am programming 2 devices (same model but with different settings) at the same time.
One is on COM5 and the other on COM12.

When I close both IDE, I loose one configuration. Some time, when I open it I upload the sketch on the wrong device, since all settings are lost.

Is it possible to save the current settings in the sketch folder? I want for example save the COM port and also the CPU frequency on each sketch, so I don't have to reset them every time I start the IDE.

Thanks.

IDE 2.0 does that. I don't think that there is an option in the older IDEs.

@sterretje really? how? Web Editor has it. but IDE 2 I think doesn't

No idea. This is one for @ptillisch.

It does; I made a screen recording to prove it and found out that I unfortunately can't upload a MP4 here :frowning: Only note to make is that I have both boards (a Mega and a Leonardo) permanently connected to my desktop PC; not sure what happens if they are not connected.

2023-02-16 17-21-54.zip (2.3 MB)

try it with esp8266 board settings. two different sets.
Mega and Leonardo are selected based on usb vid/pid

If I understand it correctly, you can set some preferences for each device.
So, if you change a device, you get the last preferences saved for that device.

I don't know where it is saved... I was hoping I was able to edit the file ".theia/settings.json" in my sketch folder. But I don't know what I should write (I can only change the IDE preferences like font size).

I miss the "preferences.txt" file from the old IDE. On the new one I don't know where it is saved.

There must be something unique to the boards. The IDE will never know if you e.g. swapped ports.

But two identical Megas or Leonardos might indeed pose a problem.

Are you saying that you can swap two ESP8266 boards (e.g. a webserver and a webclient) in the webeditor and it still knows which board it needs to upload the respective codes to?

Note: not familiar with anything outside the normal IDE.

I don't know the exact technical details, but it is stored under this folder:

  • Windows:
    %APPDATA%\arduino-ide\
    
    (e.g., C:\Users\<username>\AppData\Roaming\arduino-ide\)
  • Linux:
    ~/.config/arduino-ide/
    
  • macOS:
    ~/Library/Application Support/arduino-ide/
    

I believe it is a database. I haven't figured out how to take a look at the data in there.

The data is associated with a given sketch path. It is the same system that stores the "workbench layout" (e.g., whether the Serial Monitor view is open) for a given sketch.

Yeah, unfortunately the system doesn't always work as I expect it to. I have never managed to figure out exactly how it is supposed to work. My opinion is that the developers got a bit too "clever" when writing the code:

the sketch (sketch is a folder) should have a settings file with the Tools menu settings

This is what it make it so difficult to understand how the preferences are stored on the disk and restored in the IDE.

A sketch should work on many devices and so I understand that the philosophy is to not store device-specific preferences in the sketch. But on the most personal projects, you want to set them and restore it for that sketch.

I found a workaround, since the preferences are stored for each board:
clone a board (in the board.txt file). It works until a new update is released, but at least I don't need to change the preferences every time I start the IDE.

I really hope to see an option one day to start a sketch with predefined preferences.