while(exec.IsMoving()) - can't do anything here?
Posted: Sat Nov 25, 2023 11:22 pm
Is it not possible to execute any macro code during the "while(exec.IsMoving())" evaluation? I've seen this question asked slightly differently before when someone attempts to rewrite the G31 probe function, or wanting to stop the motion based on an input - and the answer never resolves why the attempted method didn't work - just "do this instead".
Having open loop motors, on very rare occasions I may miss a few pulses and I'm "off" by x.xxx inches. Depending upon the job setup, I have numerous "park" positions. A simple version of this would be: default "home" for Y is in the front of the machine. A park position would be at Y=48 inches. A second sensor at the park position would allow for either homing off that sensor, or at least "checking" for out of position. With the additional sensor being wired to a different input than the assigned 'probe' input, homing to that sensor would involve executing an exec.stop if that input become true. This would need to be evaluated and executed during the "while(exec.IsMoving())". The other application is to grab the "Y" value on false to true of a second sensor when the Y axis returns to the park position. Again, this would need to be performed during the "while(exec.IsMoving())" logic.
In the code below, the message never displays, even though the LED is lighting up on the UCCNC screen.
For fun, updated the code to see if I could do anything - and nope, I can't make the macro do anything during the IsMoving:
In the above code, I can replace the exec.addstatusmessage with anything - even exec.StopWithDeccel() - but it will never execute it.
Thanks in advance for any insight.
Having open loop motors, on very rare occasions I may miss a few pulses and I'm "off" by x.xxx inches. Depending upon the job setup, I have numerous "park" positions. A simple version of this would be: default "home" for Y is in the front of the machine. A park position would be at Y=48 inches. A second sensor at the park position would allow for either homing off that sensor, or at least "checking" for out of position. With the additional sensor being wired to a different input than the assigned 'probe' input, homing to that sensor would involve executing an exec.stop if that input become true. This would need to be evaluated and executed during the "while(exec.IsMoving())". The other application is to grab the "Y" value on false to true of a second sensor when the Y axis returns to the park position. Again, this would need to be performed during the "while(exec.IsMoving())" logic.
In the code below, the message never displays, even though the LED is lighting up on the UCCNC screen.
- Code: Select all
exec.Code("G01 G53 X0 Y48); // Move to park1 position
while(exec.IsMoving()){
if(AS3.GetLED(37)) // used the z-probe input to easily test before installing an actual 2nd sensor
{
exec.AddStatusmessage("hi"); // message that never displays
}
}
For fun, updated the code to see if I could do anything - and nope, I can't make the macro do anything during the IsMoving:
- Code: Select all
exec.Code("G01 G53 X0 Y48); // Move to park1 position
while(exec.IsMoving()){
exec.AddStatusmessage("status:" + AS3.GetLED(37)); // should see 100's of messages, but none display
}
In the above code, I can replace the exec.addstatusmessage with anything - even exec.StopWithDeccel() - but it will never execute it.
Thanks in advance for any insight.