Saving parameters after shut down

More
13 years 5 months ago #33960 by ArcEye
That should be quite do-able.

You could either wait for close down or just write to file every time a change in value is detected, which would be easier to manage in a lot of ways.

If all the data is coming from a pyvcp panel, just needs a userspace component which links into the widget signals.

Please Log in or Create an account to join the conversation.

More
13 years 5 months ago #33962 by mariusl
That was my conclusion as well.
I assume that the variables are kept for as long as the component is loaded. So if I write the "old" value in a variable it should stay there until I write to it again?

Regards
Marius


www.bluearccnc.com

Please Log in or Create an account to join the conversation.

More
13 years 5 months ago - 13 years 5 months ago #33964 by ArcEye
Yes, you just save a local copy of the value and then compare it to the widget value.
The local copy is persistent so long as the component is running.

When the widget value changes, it triggers a file write and the new value is entered into the local copy, and so it goes on.

Be aware though that a spinbox for instance might present a swiftly changing set of values as the user goes to the one he wants, so you need to take account of this or you will be
doing numerous file re-writes for just one change.
Last edit: 13 years 5 months ago by ArcEye.

Please Log in or Create an account to join the conversation.

More
13 years 5 months ago #33968 by mariusl
I will use a timer to wait for a while after the first change was detected. That way it will only write very 5 seconds or so.

Regards
Marius


www.bluearccnc.com

Please Log in or Create an account to join the conversation.

More
13 years 5 months ago #33976 by ArcEye
You can use the amended pyvcp spinbox widget and set the value from a pin when you read the file in at startup.

Situations like this were the reason I did the changes

www.linuxcnc.org/index.php/english/forum...-of-a-spinbox-in-hal

regards

Please Log in or Create an account to join the conversation.

More
13 years 5 months ago #33984 by mariusl
Yes I know all about that. I started that thread. I am very happy that you did all that work as I am using a lot of it already. I populate the values from settings in the ini file at startup but the ever changing ones I want to handle in a more elegant manner.

Regards
Marius


www.bluearccnc.com

Please Log in or Create an account to join the conversation.

Time to create page: 0.059 seconds
Powered by Kunena Forum