Prefference file loader

Hi all,

I was just in the middle of updating my preference file loader a little in the thought I should share it.

It was basically a small exe program that makes it easier to preload a different preference file before you load the project.

Handy if you work on different devices and are fed up having to tinker with the settings every time you change the platform.

Two Simple functions.
1: Save current preference file as a related project file.
2: Double clicking on the list will replace the preference file with a version related to the project and then start the IDE loading the project.

I was going to look thru the IDE source and try to add this functionality natively but I just do not have the focus right now and this old VB project is just easier for me to tinker with.

I've been using it for years and it does just what I need it to.

If you can think of any simple features to include, just shout.

I'll tidy it up and post up a version later for any that wish to try it.

If your project is what I think it is then you might consider looking at the way the preferences are saved using the CREATE online editor which already does a similar thing.

Tying into that would give you something that is compliant with an existing standard.
When you download a sketch from there it saves a preferences file a JSON type CSV format / file.
Example below is for a UNO

{"cpu":{"architecture":"avr","fqbn":"arduino:avr:uno","href":"/v3/boards/arduino:avr:uno","id":"uno","name":"Arduino/Genuino Uno","package":"arduino","plan":"create-free","com_name":"COM3","vid":"0x1A86","pid":"0x7523","unknown":true},"secrets":[]}

This example is for an ESP 13

{"cpu":{"fqbn":"esp8266:esp8266:espduino:ResetMethod=v1,UploadTool=espota,baud=115200,dbg=Disabled,eesz=4M,exception=disabled,ip=hb1,lvl=CORE,vt=flash,wipe=all,xtal=160","name":"ESPDuino (ESP-13 Module)","port":""},"secrets":[]}

Bob.

Hey Bob,
Yes someone had mentioned that the online stuff remembers settings better.
Surprised to see it had not crept thru to the standard IDE.

But anyway, what I created was pretty dumb.
It simply copies the complete preference file as is.
So no real need to know the format or anything really.

I do read some info out of the file like "sketch.folder" and board type but at this point there has been no need to edit or further parse. People can obviously edit the pref files manually

I can also tag the top line of my ino files with a board define and that too will help select the correct pref file. Like //#define board nano

I guess it will only be of interest to people that switch between Boards frequently.
But it may inspire someone to bolt the idea into the IDE itself.

cos it was only used inhouse there was no reason to make it consumer proof.!
Still tweaking it a bit,

With luck it will find the preference file and read the sketch folder from that.
No other setup required

I presume that most peoples preference file is in
"%userprofile%\AppData\Local\Arduino15\preferences.txt"

Here is a version.

SEE LATER POSTS FOR UPDATE

Arduino_Prefs.zip (45.5 KB)

CREATE is often used as a testing ground for the regular IDE.

The improved cache system was from CREATE.
These things are never super fast at getting into the desktop version but we can hope.

I will however link the team to this post on Monday as it may interest them.

Bob.

Hey Bob,

That's great, many thanks.

I realise that I did not give many instruction and there is little help.!!

I guess that if the program has run and it found your ino sketches then all is good.

The saved Preferences files are kept in the prefs folder.
Click on a project and then right click and click "Save Current".
That will create your first related preference file using the current IDE settings.

You can also use that header I mentioned like

//#define board Nano
If that is seen in the first line then it will assign the "/prefs/preferences_Nano.txt"

OR

//#define board ESP32
If that is seen in the first line then it will assign the "/prefs/preferences_Esp32.txt"

Just create or copy those files as you need them.
Best method to create the files is simply configure the IDE how you want, Exit the IDE, use the "save current" menu and then go and rename the filename to what you want.
Hope that makes sense.!!

This was pulled from a larger program that also offered a serial monitor, simple http server and a project versioning with OTA / spiffs updater tool. The program itself was also auto updating.

This Arduino_prefs.exe is just a small part of that tool collection.
Currently it is not auto-updating so any changes will need the exe replacing manually.

If it proves popular I shall continue to post updates.

Avast balked at it and sent it off for inspection.
Will let you know later what the result was.

Bob.

EDIT. Came back clean.

Cheers Bob,

Yer I should hope it's clean

Some little updates.

Humm, I should enable the Autoupdate I thinks.

Just replace the exe if you are updating, nothing else has changed.

SEE LATER POSTS FOR UPDATE

Arduino_Prefs.zip (46.8 KB)

Hiddenvision:
It was basically a small exe program that makes it easier to preload a different preference file before you load the project.

I seem to be slow today. Why would one want to do that?

...R

Hi Robin,

If you use the IDE to develop with multiple platforms or devices then changing from one to the other is annoying cos you have to run thru the various settings again.
Setting up comport, speeds, fuses, options and the like.

This just took away some of that thought process and work load.!

Hiddenvision:
If you use the IDE to develop with multiple platforms or devices then changing from one to the other is annoying cos you have to run thru the various settings again.
Setting up comport, speeds, fuses, options and the like.

I understand and agree.

I have written a short Python program to compile and upload my programs from the Geany editor using the command line IDE and I have a few lines like this at the top of each of .ino files

// python-build-start
// action, upload
// board, arduino:avr:mega:cpu=atmega2560
// port, /dev/ttyACM0
// ide, 1.8.6
// project, MyBestProject
// python-build-end

...R

Thought I would read the font size from the preference file.
That original fontsize was making my eyes think too hard.

This version is not auto updating so does not require those extra VB OCX files.

Arduino_Prefs.zip (40.7 KB)

News from up the hill is that there are no immediate plans to put this type of feature in the regular IDE.

Bob.

Hey Bob,
Darn, that's a shame.
Still I bet they have other more important things to get their head around.

I shall continue to tweak this prog a little,
perhaps I may start to add in some extra features depending on the feedback.
If you have used or are using this, feel free to drop a comment.

Ok, Added in the auto update stuff.
With luck there will be no need to post another update here.

You will need to (if desired) add the update location to your ini file
Either copy and paste from the included file or just replace the ini file in total.

Oh I forgot to add the VB6 OCX files needed.
See Later Post for those.
Your system may already have one or both of them, no need to replace.

Arduino_Prefs.zip (104 KB)

did a few updates. (you click on the version number to autoupdate).

It now saves the menu and search options rather than always defaulting to original.
It also saves a projects.txt file to speed up loading rather than scanning the folders each startup.
I also added a Merge function for merging or replacing static preferences into the mix but I am still working on that bit, I don't need it but I can see it being useful one day.

Um not much else apart from fix all the things I found that nobody has commented about yet.

If you have questions or would like it to do something I had not considered then just shout.

If the program if failing to run due to missing ocx see later post for VB_OCX.zip

Oops,
I forgot to make available the two required VB6 OCX files.

That could bring a halt to the party.

Ocx files are best placed/unziped into the "windows/System32" folder.
However you may ALSO need to put them in windows/SysWOW64 folder.
I am being lazy by not creating an installation package, forgive me.

You can be lazy too and put them in the application folder but it is not good practice.

Then the FIRST time you run Arduino_pref.exe run it as administrator and the OCX files will auto register.

VB6_OCX.zip (556 KB)

Thought I would give this a lift.!

Topic reopened at the request of @monok

Cool, I guess we can talk about it some more