Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: Laser on January 18, 2020, 08:16:03 AM

Title: Safe and reload a Value
Post by: Laser on January 18, 2020, 08:16:03 AM
Hallo,
after a long search, I just can't find a solution.
I want to save a value. I added a DRO in the "Probing, Settings" Display. I can save the value in the Machine.ini and also read it back (LUA script). But what does not work - the changed value is not currently in the added field after Mach4 restart. How do the other values that originally exist get their numerical values back?
Greeting
Reinhard
Title: Re: Safe and reload a Value
Post by: KatzYaakov on January 19, 2020, 12:54:46 AM
registry
Title: Re: Safe and reload a Value
Post by: Laser on January 19, 2020, 05:47:53 AM
Thanks, the answer is very short. Do you think I should use a register? iRegs e.g. ?
Title: Re: Safe and reload a Value
Post by: rhtuttle on January 19, 2020, 12:04:59 PM
Yes, use a register and make sure the 'persistent' is ticked.
Title: Re: Safe and reload a Value
Post by: Laser on January 20, 2020, 03:57:10 AM
Of course, that works with the registers. My special question was how the values are saved in the Probing / Settings screen. And: How are the values saved in the Machine.ini read back automatically (!!) when Mach4 is started and entered in the image? Exactly this automatic reloading is not possible for me..
Title: Re: Safe and reload a Value
Post by: SwiftyJ on January 20, 2020, 04:24:52 AM
It looks like the settings are saved to the profile when values are entered into the DRO using the 'On Modify' script. The values are then read using Probing.LoadSettings() function found in the mcProbing module. This is called from the PLC script in the 'PLC First Run' section. It is just manually reading the value saved in the profile and setting the DRO to display it.

In order to read the value you save to the profile for your custom DRO, just add the relevant code to the Probing.LoadSettings() function in the mcProbing module.
Title: Re: Safe and reload a Value
Post by: Laser on January 20, 2020, 05:05:18 AM
Thank you very much. That is the solution. I was looking for this reading function and just couldn't find it.