Underneath the coroutine.yield line you can add something like this
if mc.mcSignalGetState (mc.mcSignalGetHandle mInst, mc.OSIG_MACHINE_ENABLED)) == 1 then
mc.mcSoftLimitSetState(mInst, mc.X_AXIS, mc.MC_ON)
mc.mcSoftLimitSetState(mInst, mc.Y_AXIS, mc.MC_ON)
mc.mcSoftLimitSetState(mInst, mc.Z_AXIS, mc.MC_ON)
wx.wxMessageBox("Machine is Homed and SoftLimits Enabled", "Homing Sequence",4)
else
wx.wxMessageBox("Homing Aborted", "Homing Sequence",4)
end
DazTheGas