What is the correct way to wait for motion in macro call?

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

What is the correct way to wait for motion in macro call?

Postby merrick » Fri Aug 25, 2017 6:53 pm

Looking at the shared macros, I've seen them done in a few different ways:

a. exec.Code("G0 X0 Y0");
while (exec.IsMoving ()){}
exec.Wait (200);
Q: why wait after motion is completed?

b. exec.Callbutton(107);
while (exec.IsMoving ()){ exec.Wait(200); }
Q. why wait inside the loop? To avoid empty loop too many times?

c. exec.Code("G0 X0 Y0");
exec.Wait(200);
while (exec.IsMoving ()){}
Q. why wait before the loop? To avoid the next loop finished before the code is inserted into the motion buffer?

So, what's do you recommend and why? Thanks.
merrick
 
Posts: 32
Joined: Fri Aug 18, 2017 8:20 pm

Re: What is the correct way to wait for motion in macro call

Postby ger21 » Fri Aug 25, 2017 7:14 pm

You don't need the wait(200) at all if your just waiting for the motion to stop.
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2714
Joined: Sat Sep 03, 2016 2:17 am

Re: What is the correct way to wait for motion in macro call

Postby merrick » Sun Aug 27, 2017 5:55 pm

So the code:

exec.Callbutton(107);
while (exec.IsMoving ()){}
exec.AddStatusmessage("Motion stopped");


Is guaranteed that the message "Motion stopped" only appear after the motion has stopped?
merrick
 
Posts: 32
Joined: Fri Aug 18, 2017 8:20 pm


Return to Ask a question from support here

Who is online

Users browsing this forum: Google [Bot] and 36 guests