Page 1 of 3
Command to wait for cyclestart button is pressed?
Posted:
Sat May 23, 2020 5:28 pm
by 86bg
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...
Re: Command to wait for cyclestart button is pressed?
Posted:
Sat May 23, 2020 5:46 pm
by dezsoe
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());
Re: Command to wait for cyclestart button is pressed?
Posted:
Sat May 23, 2020 5:56 pm
by 86bg
- 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?
Re: Command to wait for cyclestart button is pressed?
Posted:
Sat May 23, 2020 8:55 pm
by dezsoe
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.
Re: Command to wait for cyclestart button is pressed?
Posted:
Sun May 24, 2020 6:39 am
by 86bg
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?
Re: Command to wait for cyclestart button is pressed?
Posted:
Sun May 24, 2020 11:01 am
by dezsoe
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?
Re: Command to wait for cyclestart button is pressed?
Posted:
Sun May 24, 2020 1:36 pm
by ger21
Which is correct?
- Code: Select all
while (!exec.GetLED(54)) Thread.Sleep(20);
- Code: Select all
while (!AS3.GetLED(54)) {Thread.Sleep(20);}
Re: Command to wait for cyclestart button is pressed?
Posted:
Sun May 24, 2020 3:59 pm
by dezsoe
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 {}.
Re: Command to wait for cyclestart button is pressed?
Posted:
Sun May 24, 2020 4:12 pm
by Robertspark
It's the exec or as3 I think he is asking about
AS3 is correct imo
Re: Command to wait for cyclestart button is pressed?
Posted:
Sun May 24, 2020 4:19 pm
by dezsoe
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.)