Page 1 of 1

machine reset

PostPosted: Sat Sep 17, 2016 2:10 pm
by Robertspark
can someone tell me how they trigger a machine reset from within a macro?

At present I'm attempting to use:

Code: Select all
 
AS3.Switchbutton(true, 144)
   


(I've tried button codes 512 + 512)

Thing is, the above button code 144 makes the reset flash on screen but the machine does not actually go into reset.... as you can still jog it and enter code via the MDI.

Note, presently running uccnc in demo mode for the UC400ETH, version 1.2022

Its probably me and not a bug, thanks for any guidance (got the complicated part of the macro done, but I'd like to put the machine in reset at the end of it, less likely to accidentally jog something)

Re: machine reset

PostPosted: Sat Sep 17, 2016 2:47 pm
by cncdrive
Robert,

The Switchbutton function changes the visual state only of the buttons.
Use the Callbutton function to execute a button code.

I'm sure you will ask (or at least think) why the hack is there a separate function for calling the button and switching the visual state only.
The reason why we separated these is that you may need a custom function where you creating a custom button and
when that button is pressed you executing some functions, but you have some condition check in your function and if you want to change your button's visual state may depends on that condition check's return value,
so it is not sure that you always want to change your button from on to off and from off to on when the user presses the button.
It is possible that if your condition ckeck returns false then you don't want the button state to change, because then you will for example not turn your function on, because e.g. it can't turn on without that condition being false, so you then don't want your button to visually indicate that the function is on.
So, we left the opportunity on the user to switch the visual state of the buttons from code.

Ofcourse built in functions like the reset visual state are handled internally by the software depending on the state of the reset function,
but for custom buttons which have no internal code attached, you attaching your own code and you have the control to change the visual state of your button whenever you want.

Re: machine reset

PostPosted: Sat Sep 17, 2016 3:10 pm
by Robertspark
Thanks very much for the explanation.

In hindsight I have no idea why I didn't use Callbutton as I'd been using it for plugins only a little over a week ago