Prevent one macro from starting while another runs ??

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

Re: Prevent one macro from starting while another runs ??

Postby Derek » Sun May 06, 2018 1:06 am

I'm pretty sure 2 macros can run at the same time if the second one is triggered via external button. At least that is what I experienced when I pushed the tool out button in the middle of a M6 being executed.
Derek
 
Posts: 294
Joined: Mon Sep 05, 2016 9:57 am

Re: Prevent one macro from starting while another runs ??

Postby cncdrive » Sun May 06, 2018 1:58 am

Yes, they can. I forgot to include the button macro calls in my description, I did not think about them, so I did not add them...
Where more then one can't start and run in parallel is the MDI and g-code program calls, because those are one-one threads which one instance can run one time. (on purpose)

And when a macro calls another macro then no new thread is started, but a direct invoke is made to execute the other macro, so they are always kept in syncron in sequential execution.
cncdrive
Site Admin
 
Posts: 2260
Joined: Tue Aug 12, 2014 11:17 pm

Re: Prevent one macro from starting while another runs ??

Postby Vmax549 » Sun May 06, 2018 2:17 am

We ran into teh problem when testing a m6 macro that was running and Derek pressed a button that called another macro into play. It was a STRANGE event with both macros running. Later I repeated it with different buttons as a safety test to see WHAT would happen as Both had axis motion and it got exciting. " NOW " we know what happens :o and need to guard against it.

I was hoping for a simple way out :P IsMacroRunning() would work great BUT there does not appear to be such a critter. I was hoping that if there was a Ismacrostopped() surely there would be an IsMacroRunning() counterpart.

Close but no Cigar

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

Re: Prevent one macro from starting while another runs ??

Postby cncdrive » Sun May 06, 2018 4:20 am

OK, but how would you check if a macro is running or not? Check by macronumber? Or how?
A macro could run by several sources, it could run via the MDI, via g-code, via button call, via plugin.
Macros could even run in several instances if put into more than one slots of macroloops.
So, I think that just providing a flag to check if e.g. macro number 300 is running or not is not a solution because of this.
Or we should provide a flag for button presses? I mean if a macro call button press is still running a macro (by number)?
I don't clearly understand what you want to do and for what problem is a solution needed for, so it is hard to figure it out.
cncdrive
Site Admin
 
Posts: 2260
Joined: Tue Aug 12, 2014 11:17 pm

Re: Prevent one macro from starting while another runs ??

Postby Dan911 » Sun May 06, 2018 10:28 am

Derek wrote:I'm pretty sure 2 macros can run at the same time if the second one is triggered via external button. At least that is what I experienced when I pushed the tool out button in the middle of a M6 being executed.


This is pretty much what I assumed the problem was related to when first read Terry's post and why my immediate thought was to address the macro's that is known will conflict with each other. I thought a
Ismacrorunning() function would cause more problems than help with the many scenarios with macro's running.

Possibly a Ismacrorunning(M6, M123) could help guard against known conflicts.
Dan911
 
Posts: 416
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: Prevent one macro from starting while another runs ??

Postby ger21 » Sun May 06, 2018 11:59 am

Just add an LED and turn it on while the M6 is running, and don't allow the other macro to run if the LED is active?

Seems simple enough?
Gerry
UCCNC 2017 Screenset - http://www.thecncwoodworker.com/2017.html
ger21
 
Posts: 1143
Joined: Sat Sep 03, 2016 2:17 am

Re: Prevent one macro from starting while another runs ??

Postby Dan911 » Sun May 06, 2018 12:20 pm

Not knowing the specifics of the problem and what your trying to accomplish from start can make a thread like this go in many different directions.

I originally was under the impression these macro's were being called from a M6 call and the ATC triggered different switches at certain points that called different macro's/port pins.
Dan911
 
Posts: 416
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: Prevent one macro from starting while another runs ??

Postby Vmax549 » Sun May 06, 2018 12:38 pm

Balazs I would think that IF you flagged macros that ran from Gcode and the MDI it would solve about %90 of all situtations that I can think of.

Those processes are the ways most macros will start

Gcode -automatically
MDI - intentional like wizards, functions,etc
Vmax549
 
Posts: 1297
Joined: Sun Nov 22, 2015 3:25 am
Location: USA

Re: Prevent one macro from starting while another runs ??

Postby Vmax549 » Sun May 06, 2018 12:55 pm

After thinking some more You should set a flag if a macro is running. Teh only exception would be macroloops. They do not require a flag.

That way USERS can chose to use it or not and it applies across all users AND we would ALL use teh same flag universally.

I can solve it simply here BUT that does not help any OTHER user NOR would it work on another system.

Building a universal flag would solve teh problem.
Vmax549
 
Posts: 1297
Joined: Sun Nov 22, 2015 3:25 am
Location: USA

Re: Prevent one macro from starting while another runs ??

Postby ger21 » Sun May 06, 2018 1:41 pm

Vmax549 wrote:Building a universal flag would solve teh problem.


How would that work?
10 different users might have 10 different macros running, with 10 different flags.
What if you want to allow some macros to run, but not others?

Seems like it would be very complex?

You'd probably have to select the macro, then pick the macros you don't want to run when that macro is running. But that also could get very complex, very quickly, for people with a lot of macros.
Gerry
UCCNC 2017 Screenset - http://www.thecncwoodworker.com/2017.html
ger21
 
Posts: 1143
Joined: Sat Sep 03, 2016 2:17 am

PreviousNext

Return to Ask a question from support here

Who is online

Users browsing this forum: beefy and 3 guests