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 dezsoe » Sun May 06, 2018 1:58 pm

Hmm.

If you have a flag (or function) that will show that any macro is running, then it will be always true, because that macro is also running, where you check it.

If you want to disable some macros while a tool change is in progress, then check LED 28 (Toolchangeinprogress).
dezsoe
 
Posts: 414
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

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

Postby Dan911 » Sun May 06, 2018 2:44 pm

Hi Dezsoe,

Clever point with a Ismacrorunning() function.

In all fairness the starting/subject of this thread had nothing to do with a M6 or tool change. The question was "How can you stop one macro from starting with another running".

With checking for a certain macro like I previously posted Ismacrorunning(M123) can be useful to some. It was pointed out in this thread 2 macro's running parallel to each other can conflict and cause problems.
Dan911
 
Posts: 302
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

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

Postby dezsoe » Sun May 06, 2018 3:17 pm

Hi Dan,

Derek and Terry wrote that they had problems with input triggered macro while M6 was running. That's why I pointed on LED 28.
dezsoe
 
Posts: 414
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

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

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

Yes, that led made me feel silly...never knew it existed. lol

Dan
Dan911
 
Posts: 302
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 5:38 pm

The flag would be a universal flag that simply indicated that a macro was running. Then you would have teh option to deal with it or not.

Teh question started out with teh M6 problem but it pertains to all macros that are written.

Dezsoe, excellent point ;)

Certainly each macro creating it OWN flag is not a good option universally for all users as my macros may use a certain flag and so may every other macro created so I would still not know IF a macro was running.

Not being privy to teh inner working of UCCNC I do not have a clue HOW it could be done. I just know it would be very handy to have use of.

Is there any ryhme or reason when 2 macros are running motion commands such as G1 X10 as to whick macro takes president and gets to move and teh other NOT or can both macros running motion code at teh same time.

In testing I have seen it go both ways, sometimes one axis only will move and sometimes both move at teh same time. Also if there is a wait loop waiting on motion to stop the loop gets stuck as an endless loop. The more I tested the stranger it got.

I am working on a section now where simple G53 moves are done to move teh machine to a tool change park position. It will move to teh park values then ether rapid back to ZERO and make teh move again OR Move to the park position then RAPID to DOUBLE teh values then move back to teh original positions. AND NONE of that is in teh code :roll:

I can then comment out that G53 section and everything runs as it should stone dependably. Put it back in and it goes goofy again. Write that section back in as a G00 move and it only goes half goofy and only does PART of teh goofy stuff. AND I know that makes no sense but neither does what it is doing. I will eventially narrow it down to teh culprit. BUT it takes a LOT of time and effort to do so.

(;-) TP
Vmax549
 
Posts: 910
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 5:54 pm

HI Dezsoe , YES I had found that LED(28) earlier when LOOKING for a suitable FLAG to use with teh M6 macro running. AND that works for teh M6 situation but NOT for say a macro Wizard situation.

You could assume that a simple is running LED could be assigned and all macros use it. BUT how do know when teh last macros closes and has to turn OFF teh LED.

ALL macros can signal it on
AS3.SetLED(true,555);

but how would you know WHEN to turn it off and which macro would do it.??

exec.IFYouAreTheLastMacroRunnning() { Turn off that darn LED}; :P

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

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

Postby dezsoe » Sun May 06, 2018 6:02 pm

Hi Terry,

I think that turning off the LED when all macro stopped is not so complicated. My problem is, that IsMacroRunning() will always be true when you run a macro to check it. :) The needed function is IsOtherMacroRunning() and this would be very complicated. :)
dezsoe
 
Posts: 414
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

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

Postby Vmax549 » Sun May 06, 2018 6:14 pm

OK what di you have in mind to KNOW when to turn off a flag.

Lets say there are 3 macros running each macro signals teh flag on. Easy so far.

NOW macro 2 ends . HOW does it know that a macro is still running and to NOT turn off teh flag.

NEXT , macro 3 ends. Same problem

Next finally Macro1 ends how will it know it is teh last macro running and to turn off teh flag??

Maybe use a table or list and each macro adds its name to teh list and when it ends remove its name from teh list. Then each macro when it ends checks teh list to see if it is teh last macro running then turns off teh flag.

IF that can be done internally that would work simply enough.

I cannot think of any reason to HAVE more than 1 macro running at a time. Excluding MacroLoops which should run outside and independant of teh main core.

Is there any reason to RUN more than 1 macro at a time ??

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

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

Postby Dan911 » Sun May 06, 2018 7:07 pm

Vmax549 wrote:I cannot think of any reason to HAVE more than 1 macro running at a time. Excluding MacroLoops which should run outside and independant of teh main core.
(;-) TP


So what's the problem than ?? Have macro enable Led on start and off when it ends. Having a macro not start if Led is enabled you will only have 1 macro running at a time. Isn't that the reason for LED??

Am I missing something?
Dan911
 
Posts: 302
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 7:51 pm

HI Dan, IF I were the only one on teh planet running UCCNC it would never be a problem.

For Example. You are running UCCNC and meet a friend from Chicago that gives you a special function. AND it is teh greatest thing since apple pie. You will praise it highly. Then you meet a friend from New York City that gives you another special function and it too is a great function. You praise it highly as well .

THen one rainy day somehow both functions are started and run at the same time. Each macro fights with teh other and breaks tools , ruins parts and cuts the end of your Cats tail off. You would NOT blame Chicago or NYC as you have no idea what happend. BUT you would get on here and BLAST UCCNC to high heaven as IT somehow MADE YOU break tools,ruin parts and cut 6" off your cats tail.

At some point in time UCCNC has to provide a way for macro writters to able to identify when a possble confict may occur and be able to at LEAST warn users of it. OR prevent NYC's macro from running when Chicago's macro is already running. or vise versa.

Being able to create special use macros in UCCNC is a VERY powerfull tool that MOST commercial controllers would NEVER allow you to do.AND for good reason. But with that power comes GREAT responcibility to do no harm to machine or users.

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

PreviousNext

Return to Ask a question from support here

Who is online

Users browsing this forum: No registered users and 1 guest