Retain Custom Settings

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

Retain Custom Settings

Postby Jason » Wed Dec 13, 2023 7:52 pm

Did some searching on this forum, and looked pretty extensively through the documentation, and not sure if I missed something, or if what I want to do is just not possible. I'll give a simple example vs going over all the possibilities I'm potentially considering:

Let's say I have multiple cooling options for my tool: Air sol. #1, air sol #2 and chemical mist. Any combination of these can be used during a job. The screen has (3) toggle buttons to enable or disable each one - let's call them 20100, 20101 and 20102 respectively. When starting a job, my post processor calls for a startup macro. This macro will do an AS3.Getbuttonstate(20100)... for each button and turn on the appropriate output. At the end of the job, a macro clears those outputs. That is all easily workable without issues.

What I am looking for is a method such that those selections persist with a power cycle / reboot of the PC running UCCNC. What 'user' variables / registers / buttonstates / Led's etc. are settable via a macro, and will automatically be retained until they are changed again by the macro? i.e. similar to a system setting like homing speed.

Thanks in advance for any help.
Jason
 
Posts: 4
Joined: Sat Nov 25, 2023 10:50 pm

Re: Retain Custom Settings

Postby ger21 » Wed Dec 13, 2023 9:01 pm

Use the constructor and deconstructor macros to write values to the profile, and read them when UCCNC loads.
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2714
Joined: Sat Sep 03, 2016 2:17 am

Re: Retain Custom Settings

Postby Jason » Wed Dec 13, 2023 9:26 pm

Excellent. Thank you for pointing me in the correct direction.

Constructor macro: M99998
This macro is called on each software startup. Initial actions like user variables loading and startup
settings could be made using and programming this macro.

Destructor macro: M99999
This macro is called on each software shutdown. User variables and DRO values could be saved or
messages could be shown to the user etc. on the software shutdown with programming this macro
Jason
 
Posts: 4
Joined: Sat Nov 25, 2023 10:50 pm


Return to Macros

Who is online

Users browsing this forum: Google [Bot] and 12 guests