Cancel a macro

If you have a question about the software please ask it here.

Cancel a macro

Postby Vmax549 » Fri Apr 20, 2018 5:42 pm

Does anyone know of a way to cancel a macro without UCCNC turning off all the outputs ??

I need to cancel a running macro with teh END key and NOT have uccnc turn of all teh outputs that had been set.

(;-) TP
Vmax549
 
Posts: 913
Joined: Sun Nov 22, 2015 3:25 am
Location: USA

Re: Cancel a macro

Postby Robertspark » Fri Apr 20, 2018 6:18 pm

Terry, not sure what you want to do exactly...

Option a) is a reverse macro like m5 is to M3/4

Option b) if you want to do it during motion would be either a input sensed via macro loop which checks if iOS are set and clears them or registers / variables etc

Or b viable hot key and macro loop to clear registers / variables (clear a flag which you set it the macro and then monitor in macro loop which if cleared you clear the macro)
Rob

Einstein ― “If you can't explain it to a six year old, you don't understand it yourself”
UC400eth, UC300eth, UCCNC v1.2104, Neuron Lite.
UCCNC v1.2104 Macro Manual
Robertspark
 
Posts: 682
Joined: Sat Sep 03, 2016 4:27 pm
Location: Nr Liverpool, England

Re: Cancel a macro

Postby Vmax549 » Fri Apr 20, 2018 6:49 pm

Hi Robert. What I need to do is cancel the execution of a running macro from outside of the macro.

I can simply cancel a running macro by pressing the ESC key or the STOP button. BUT in doing so UCCNC turns off all outputs when it stops the execution of the macro.

In this case I need for any output that was turned on to STAY ON and not be turned off.

(;-) TP
Vmax549
 
Posts: 913
Joined: Sun Nov 22, 2015 3:25 am
Location: USA

Re: Cancel a macro

Postby Robertspark » Fri Apr 20, 2018 8:00 pm

Give me an example , what does the macro do?

Code example? (Simple one... )
Rob

Einstein ― “If you can't explain it to a six year old, you don't understand it yourself”
UC400eth, UC300eth, UCCNC v1.2104, Neuron Lite.
UCCNC v1.2104 Macro Manual
Robertspark
 
Posts: 682
Joined: Sat Sep 03, 2016 4:27 pm
Location: Nr Liverpool, England

Re: Cancel a macro

Postby Vmax549 » Fri Apr 20, 2018 8:41 pm

If you hit esc while it is running UCCNC turns OFF teh outputs. The macro I am working on is over 1000 lines of script.



exec.AddStatusmessage("Test Starting");
exec.Setoutpin (4,16);
exec.Setoutpin(5,1);
exec.Wait (20000);
exec.AddStatusmessage("Test Completed");
Vmax549
 
Posts: 913
Joined: Sun Nov 22, 2015 3:25 am
Location: USA

Re: Cancel a macro

Postby Vmax549 » Fri Apr 20, 2018 8:51 pm

If you hit esc while it is running UCCNC turns OFF teh outputs. The macro I am working on is over 1000 lines of script.



exec.AddStatusmessage("Test Starting");
exec.Setoutpin (4,16);
exec.Setoutpin(5,1);
exec.Wait (20000);
exec.AddStatusmessage("Test Part 2");
exec.Clroutpin(4,16);
exec.Clroutpin(5,1);
exec.AddStatusmessage("Test Completed");
Vmax549
 
Posts: 913
Joined: Sun Nov 22, 2015 3:25 am
Location: USA

Re: Cancel a macro

Postby Robertspark » Fri Apr 20, 2018 8:51 pm

Ok, so when you cancel the macro, you want the macros output pins to stay latched?

What about having a macro that checks that outputs are enabled at the time. And keeps them active but ends the macro?
Rob

Einstein ― “If you can't explain it to a six year old, you don't understand it yourself”
UC400eth, UC300eth, UCCNC v1.2104, Neuron Lite.
UCCNC v1.2104 Macro Manual
Robertspark
 
Posts: 682
Joined: Sat Sep 03, 2016 4:27 pm
Location: Nr Liverpool, England

Re: Cancel a macro

Postby Vmax549 » Fri Apr 20, 2018 8:55 pm

Now teh odd part is with this code the outputs stay on when you hit esc

exec.AddStatusmessage("Test Starting");
exec.Setoutpin (4,16);
exec.Setoutpin(5,1);
exec.Wait (20000);
exec.AddStatusmessage("Test Completed");

(;-) TP
Vmax549
 
Posts: 913
Joined: Sun Nov 22, 2015 3:25 am
Location: USA

Re: Cancel a macro

Postby Robertspark » Fri Apr 20, 2018 9:07 pm

Here is a suggestion....

2 macros... (1 macro, 1 X macro loops)

1 with your primary code, when the macro starts it sets a variable, then before the primary macro does anything active it checks a variable to see if it is still set, of it has been cleared it ends the macro (skips to the end / returns... That way your outputs will stay on)

Next a macro loop which checks for a hotkeypess ... If the hotkeypess is pressed it clears the variable.
Rob

Einstein ― “If you can't explain it to a six year old, you don't understand it yourself”
UC400eth, UC300eth, UCCNC v1.2104, Neuron Lite.
UCCNC v1.2104 Macro Manual
Robertspark
 
Posts: 682
Joined: Sat Sep 03, 2016 4:27 pm
Location: Nr Liverpool, England

Re: Cancel a macro

Postby Vmax549 » Sat Apr 21, 2018 12:03 am

The problem that I am seeing is that when cancelling a macro it sets teh output state to the state of the very last output call that is in the macro. Strange :roll:

Weird as one would think that it would simple cancel teh macro script as is OR cancel teh script and reset teh outputs to teh default state (off). AND yes I realise that UCCNC does not know what teh default state of an output is. It could be either way.

The problem with using a macroloop to set a flag is you have to use a macro to set teh flag and you cannot run a macro when a macro is running so how do you set teh flag ? Which leads to a question of how do you cancel a macro thread from another macro thread ??

(;-) TP
Vmax549
 
Posts: 913
Joined: Sun Nov 22, 2015 3:25 am
Location: USA

Next

Return to Ask a question from support here

Who is online

Users browsing this forum: No registered users and 2 guests