Hi
Now completed my full
paramsaver component
This component will create up to 32 IN pins and 32 OUT pins of each, of types float, s32 and bit.
The OUT pins can be overwritten by reading from a file, enabling components or widgets attached to those pins
to be initialised to known or saved values.
The IN pins can be connected to any suitable component pin or widget pin
The values received at the IN pins can be saved to file making settings persistent between shutdowns.
This comes into its own if you use my amended pyvcp_widgets
www.linuxcnc.org/index.php/english/forum...nbox-in-hal?start=27
Then you can link say the
hal-pin of a spinbox to
paramsaver.invalueF.00 and the new
param-pin of the spinbox to
paramsaver.outvalueF.00
Set
paramsaver.writetrigger to true and create a file
Set
paramsaver.readtrigger to true and the value will be inserted back into the spinbox.
Commandline switches:-
loadusr -W paramsaver f=NN s=NN b=NN filename=xxxxxxx onstart=0/1 onexit=0/1
f=NN number of float pins to create, one of IN and OUT for each
s=NN number of s32 pins to create, one of IN and OUT for each
b=NN number of bit pins to create, one of IN and OUT for each
filename=xxxxxx filename to save under
If none given will default to
param.sav
Only input filename, not extension or path
Will be created as
/home/username/linuxcnc/xxxxxxxx.sav
onstart=0/1 If set to 1, will load file at startup to populate the OUT pins (defaults to 0)
onexit=0/1 If set to 1 will write to file at shutdown (defaults to 0)
The zip contains a compiled component for 10.04, the C source code and a man page
Compile the source with
comp --install --userspace paramsaver.c
Usual caveats - let me know any bugs - I have tested a fair amount and seems OK.
regards
PS
It could do with making more efficient regards memory allocation, for the reasons Andy was outlining regards not being able easily to have dynamic arrays etc in a file compiled by comp.
Works perfectly well as is, just offends the OCD side of my nature. Next job on the jotter.
See later posts for updated zip