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 ger21 » Sun May 06, 2018 8:08 pm

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.


You're assuming that any macro should block all other macros. I wouldn't expect that to be the case when you factor in thousands of users with different needs. They could add a single flag that meets your needs, but not someone else's.

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.


That's just not going to be possible. How is every macro, every macroloop, every plugin, and every screen going to be checked for conflicts with each other. If a user wants to use the power they are given, they have to be responsiblefor whatever may occur.
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2663
Joined: Sat Sep 03, 2016 2:17 am

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

Postby cncdrive » Sun May 06, 2018 9:07 pm

I knew this is a complicated problem. :)
We could easily disable button macro calls while one other is running, but this could be a problem for tasks where one macro starts something and another macro button is used to tell that to stop or to do something else, because in this case 2 buttons with 2 macros has to be able to run the same time, othewise the second button can't do an action to tell the first to stop or to do something else.
So I think that simply letting one macro to run on button calls is not a good solution because it will limit what the programmer can do with the button macros.

My idea is that we could make a boolean array with one item for each button macro codes 20000 to 21999.
When one macro starts running it could set it's own boolean variable, e.g. macrorunning[20000] is set to true when the macro starts running and set to false when it stops running.
The programmer could then check this variable for example at the beginning of the macro, that if the variable is true then return and not run the macro if the task is to keep only one of these macros running.
Also the variable of the other macros could be checked from a macro, e.g. if the requirement for macro 20000 is that when it is running then macro 20001 should not start running then in macro 20001 code the macrorunning[20000] could be checked. The programmer could then have a freedom to make checks on whichever macro or macros running state they want and need to check and then decide in the code what to do when a macro is running when the user tries to run it.
What do you guys think about this idea? Any issues you see about it?
cncdrive
Site Admin
 
Posts: 4695
Joined: Tue Aug 12, 2014 11:17 pm

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

Postby cncdrive » Sun May 06, 2018 9:33 pm

Terry, yes I thought to make the UCCNC to set/reset the variables based on if the macro is running or not.
I will think this through a bit more in depth soon. But if you guys have ideas about it then please post it.
cncdrive
Site Admin
 
Posts: 4695
Joined: Tue Aug 12, 2014 11:17 pm

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

Postby cncdrive » Sun May 06, 2018 9:47 pm

Yes, I can exclude those. I think it could be useful only if the calls from buttons and I/O triggers would set those variables.
Or maybe make 2 arrays one for only the buttons and I/O triggers and one for all calls and runs.
I will think this through in more depts though, because maybe I forgot to think about something now. And if you guys have any ideas about it please let me know.
cncdrive
Site Admin
 
Posts: 4695
Joined: Tue Aug 12, 2014 11:17 pm

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

Postby dezsoe » Mon May 07, 2018 5:08 am

The needs are soooooooo different! :)

I've never missed the state of general macros but the state of macroloops. So, this is the difference: you all want to exclude the state of macroloops from that array and I need only them! :) (A simple example: I have some controls on the screen for my test VFD. All these controls should know if the macroloop which transfers data to/from Modbus plugin is running.)
dezsoe
 
Posts: 2049
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

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

Postby kig23 » Wed May 09, 2018 4:37 pm

dezsoe wrote:The needs are soooooooo different! :)


I completely agree with Dezsoe. The status of macroloop is more useful to me.
kig23
 
Posts: 158
Joined: Sat Mar 31, 2018 6:58 am
Location: Italy

Previous

Return to Ask a question from support here

Who is online

Users browsing this forum: No registered users and 10 guests