We are running a homing procedure with ticcmd. We tried to de-energize the motor after the homing is completed with a “wait” command, but de-energize happens quickly before the homing is completed. Means the wait command is not executed.
Is there a way to wait for the homing to be completed before de-energizing? We would rather not use the sleep command.
The Tic will execute the command when it is received; there is no setting to make it wait to execute until it finishes another command first. So, you will need some method of sending the de-energize command after the homing procedure has completed. I’m not sure what reason you have for not wanting to use the sleep command to have your code wait, but another method would be to poll the “Homing active” variable to wait for it to finish. For reference, “Homing active” is bit 4 of “Misc flags 1”, as shown in the “Variable reference” section of the Tic user’s guide.
By the way, please note that de-energizing sets the “Position uncertain” flag, since the Tic doesn’t know if the motor has been moved while it is not energized. So it might make more sense for you to run the homing procedure after energizing the motor instead of de-energizing and losing the known position immediately after homing. Alternatively, if you are sure the motor won’t move while it is de-energized, you can use the “Halt and set position” command after it is energized again to clear the “Position uncertain” flag.