Hello Guest it is March 28, 2024, 12:43:59 PM

Author Topic: Advice on how to store RRO between sessions?  (Read 1629 times)

0 Members and 1 Guest are viewing this topic.

Advice on how to store RRO between sessions?
« on: November 21, 2017, 01:31:31 AM »
Still trying to wrap my head around lua programming in Mach4.

So to save my RRO setting between sessions, should I create a register?

Then save the last RRO setting on screen unload?

Then set RRO to the stored rate on first run of the PLC on Mach4 startup?

If anyone has any hints or tips for this it would be greatly appreciated!

I suspect that this is an easy one for many of you.
Re: Advice on how to store RRO between sessions?
« Reply #1 on: November 21, 2017, 01:44:22 AM »
Hi,
I think a register would be a good way to go.

I had a look on Diagnostic/Regfile/
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Advice on how to store RRO between sessions?
« Reply #2 on: November 21, 2017, 01:59:54 AM »
Hi,
sorry misclick...

Diagnostic/Regfile/core-inst shows about 40 register values that Mach records and re-establishes at re-start but RRO is not one of them.

On Configure/Plugins/Regfile instantiate a new register RRO, you can provide an initial value and check it as persistant. Mach will automatically save
it when you shut down and save you from having to code it.

As you know there is a bunch of code which runs just once on the first pass of the PLC script. If you put your code to read the register and update
your RRO DRO that should work. Probably three lines of code.

The only thing I can see that might take a bit of thought is when you change your RRO in a session that the DRO updates the register automatically.
Might have to replace or modify the existing --Up and --Down event scripts.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Advice on how to store RRO between sessions?
« Reply #3 on: November 21, 2017, 02:06:53 AM »
Great - thanks very much for all of that clarification and guidance Craig!

I will give it a go tomorrow when I'm back in the shop.

I never thought to update the register when changing the RRO screen control.  I might try updating on screen unload when Mach4 is closing too, or whichever option I can get working first.

Thanks!
Leo

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: Advice on how to store RRO between sessions?
« Reply #4 on: November 21, 2017, 06:50:16 AM »
The only thing you should have to do is create a register and link the DRO to it in the DRO properties. Set Reg to persistent when you create it. When DRO changes, register changes. When Register changes, DRO will change. Persistent will remember what it was last and start Mach with it set to same value. No scripting required....
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!
Re: Advice on how to store RRO between sessions?
« Reply #5 on: November 21, 2017, 01:14:17 PM »
Ah ok that sounds much easier!

Thanks very much for that.  I will try this method first.

Leo