Command to wait for cyclestart button is pressed?

Post anything you want to discuss with others about the software.

Command to wait for cyclestart button is pressed?

Postby 86bg » Sat May 23, 2020 5:28 pm

My tool change macro waits for the user to press a messagebox OK on the screen. With a wireless pendant this is unnecessary and could be resumed with the press of the cycle start button before doing the automatic tool height probing routine. Not sure hich API method or property to access to wait for this to happen or if it's even a good button to use...
86bg
 
Posts: 27
Joined: Fri Feb 28, 2020 7:21 pm

Re: Command to wait for cyclestart button is pressed?

Postby dezsoe » Sat May 23, 2020 5:46 pm

Give some CPU time for other parts of the program too:

Code: Select all
while (!exec.GetLED(54)) Thread.Sleep(20);

Be sure that the cycle is stopped before you try to wait for the start. If needed, stop the cycle:

Code: Select all
exec.Stop();
while (exec.IsMoving());
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Command to wait for cyclestart button is pressed?

Postby 86bg » Sat May 23, 2020 5:56 pm

Code: Select all
exec.Stop();
while (exec.IsMoving());
exec.AddStatusmessage("Insert tool number " + toolNumber);
while (!AS3.GetLED(54)) {Thread.Sleep(20);}


Does not work. It was the first thing I tried. I think these buttons are locked out during macro operation?
86bg
 
Posts: 27
Joined: Fri Feb 28, 2020 7:21 pm

Re: Command to wait for cyclestart button is pressed?

Postby dezsoe » Sat May 23, 2020 8:55 pm

In the past 4 years it worked fine and also do work now. You do something else that may prevent it from working, but I don't see your full environment and macros, so I don't know what's the problem. However, it may not work if you call other macros from M6 and you use one of the 1.21xx versions of UCCNC.
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Command to wait for cyclestart button is pressed?

Postby 86bg » Sun May 24, 2020 6:39 am

1.2113

The M6 macro is not calling other macros.

Are you saying the combination of the two of them doesn't work or either one of them causes it not to work?
86bg
 
Posts: 27
Joined: Fri Feb 28, 2020 7:21 pm

Re: Command to wait for cyclestart button is pressed?

Postby dezsoe » Sun May 24, 2020 11:01 am

In some of the first 1.21xx versions there was a change in managing macros and this change has a side effect that if a macro calls another macro then you cannot use the cycle start button this way.

Can you upload the full tool change macro to find the problem?
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Command to wait for cyclestart button is pressed?

Postby ger21 » Sun May 24, 2020 1:36 pm

Which is correct?
Code: Select all
while (!exec.GetLED(54)) Thread.Sleep(20);


Code: Select all
while (!AS3.GetLED(54)) {Thread.Sleep(20);}
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2714
Joined: Sat Sep 03, 2016 2:17 am

Re: Command to wait for cyclestart button is pressed?

Postby dezsoe » Sun May 24, 2020 3:59 pm

Both. In this case the {} is unnecessary, but correct, because these commands like while, for, if, etc. executes the next command, which can be a block of commands in {}.
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Command to wait for cyclestart button is pressed?

Postby Robertspark » Sun May 24, 2020 4:12 pm

It's the exec or as3 I think he is asking about

AS3 is correct imo
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: Command to wait for cyclestart button is pressed?

Postby dezsoe » Sun May 24, 2020 4:19 pm

It gives the same result. I think, originally it was AS3 (or ASjog), but the LEDs are global. You can use any of them with the same result. (I think, exec. shows the concept better.)
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Next

Return to General discussion about the UCCNC software

Who is online

Users browsing this forum: Bing [Bot] and 5 guests