Go Down

Topic: Prefference file loader (Read 2064 times) previous topic - next topic

Hiddenvision

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.

ballscrewbob

#1
Aug 03, 2019, 03:40 pm Last Edit: Aug 03, 2019, 03:43 pm by ballscrewbob
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

Code: [Select]

{"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
Code: [Select]

{"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.

It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

Hiddenvision

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
Code: [Select]
//#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"




Hiddenvision

#3
Aug 04, 2019, 04:05 am Last Edit: Aug 05, 2019, 08:38 pm by Hiddenvision
Here is a version.

SEE LATER POSTS FOR UPDATE

ballscrewbob

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.
It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

Hiddenvision

#5
Aug 04, 2019, 03:59 pm Last Edit: Aug 04, 2019, 04:10 pm by Hiddenvision
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.


ballscrewbob

#6
Aug 04, 2019, 04:51 pm Last Edit: Aug 04, 2019, 04:56 pm by ballscrewbob
Avast balked at it and sent it off for inspection.
Will let you know later what the result was.

Bob.

EDIT. Came back clean.

It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

Hiddenvision

#7
Aug 04, 2019, 05:19 pm Last Edit: Aug 05, 2019, 08:38 pm by Hiddenvision
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

Robin2

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
Two or three hours spent thinking and reading documentation solves most programming problems.

Hiddenvision

#9
Aug 04, 2019, 06:19 pm Last Edit: Aug 04, 2019, 06:26 pm by Hiddenvision
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.!

Robin2

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
Code: [Select]
// python-build-start
// action, upload
// board, arduino:avr:mega:cpu=atmega2560
// port, /dev/ttyACM0
// ide, 1.8.6
// project, MyBestProject
// python-build-end


...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Hiddenvision

#11
Aug 05, 2019, 08:11 pm Last Edit: Aug 15, 2019, 04:29 pm by Hiddenvision
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.

ballscrewbob

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

Bob.

It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

Hiddenvision

#13
Aug 07, 2019, 02:49 pm Last Edit: Aug 07, 2019, 02:55 pm by Hiddenvision
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.

Hiddenvision

#14
Aug 08, 2019, 11:03 pm Last Edit: Aug 14, 2019, 06:10 am by Hiddenvision
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.

Go Up