Hello Guest it is April 19, 2024, 02:36:43 PM

Author Topic: Safe and reload a Value  (Read 976 times)

0 Members and 1 Guest are viewing this topic.

Safe and reload a Value
« 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
Re: Safe and reload a Value
« Reply #1 on: January 19, 2020, 12:54:46 AM »
registry
Re: Safe and reload a Value
« Reply #2 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. ?
Re: Safe and reload a Value
« Reply #3 on: January 19, 2020, 12:04:59 PM »
Yes, use a register and make sure the 'persistent' is ticked.
Re: Safe and reload a Value
« Reply #4 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..
Re: Safe and reload a Value
« Reply #5 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.
Re: Safe and reload a Value
« Reply #6 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.