You can home with code. See G28.1 in the manual. Homing with G28.1 is the ONLY way to home the machine in automatic mode (not idle).
G28.1 X0 Y0
G00 X1 Y1 (Both X and W will be homed by this point).
If you are homing the machine from a script, you have to start the script from the idle state. Otherwise the home operation will fail and you will wait on a signal forever or timeout. But you would know this if you checked you API function return code, right?
Because the mc.mcAxisHomeAll() function would return mc.MERROR_NOT_NOW if you are not in the idle state.
There are a few ways to check when the home op is done
1. mc.mcSignalWait() for each axis you are interested in.
2. mc.mcAxisIsHomed in a loop for each axis you are interested in.
3. mc.mcCntlGetState() in a loop. Once you start the home operation in the idle state, the state will no longer be idle. So you can wait on the state to go from idle to non-idle and back to idle if you want.
local rc = mc.MERROR_NOERROR
rc = mc.mcAxisHomeAll(inst)
if (rc ~= mc.MERROR_NOERROR) then
-- the mc.mcAxisHomeAll() function failed and we must NOT wait on a signal
return
end
-- now you can use mc.mcSignalWait() or mc.mcCntlGetState() or mc.mcAxisIsHomed() to find when the home operation is finished.
Steve