Hi,
this is a list of the machine states:
mcStateCheck = {
[0] = "MC_STATE_IDLE",
[1] = "MC_STATE_HOLD",
[2] = "MC_STATE_FRUN_SUB",
[3] = "MC_STATE_MRUN_SUB",
[4] = "MC_STATE_JOG",
[5] = "MC_STATE_DRYRUN",
[6] = "MC_STATE_HOME",
[7] = "MC_STATE_CONFIG",
[100] = "MC_STATE_FRUN",
[101] = "MC_STATE_FRUN_FH",
[102] = "MC_STATE_FRUN_PROBE",
[103] = "MC_STATE_FRUN_PROBE_FH",
[104] = "MC_STATE_FRUN_THREAD",
[105] = "MC_STATE_FRUN_THREAD_FH",
[106] = "MC_STATE_FRUN_FH_JOG",
[107] = "MC_STATE_FRUN_TAP",
[108] = "MC_STATE_FRUN_MACROH",
[109] = "MC_STATE_FRUN_MACROH_JOG",
[110] = "MC_STATE_FRUN_SINGLE_BLOCK",
[111] = "MC_STATE_FRUN_RETRACT",
[112] = "MC_STATE_FRUN_HOMING",
[113] = "MC_STATE_FRUN_SINGLE_BLOCK_HOLD",
[199] = "MC_STATE_FRUN_END",
[200] = "MC_STATE_MRUN",
[201] = "MC_STATE_MRUN_FH",
[202] = "MC_STATE_MRUN_PROBE",
[203] = "MC_STATE_MRUN_PROBE_FH",
[204] = "MC_STATE_MRUN_THREAD",
[205] = "MC_STATE_MRUN_THREAD_FH",
[206] = "MC_STATE_MRUN_TAP",
[207] = "MC_STATE_MRUN_MACROH",
[208] = "MC_STATE_MRUN_MACROH_JOG",
[209] = "MC_STATE_MRUN_RETRACT",
[210] = "MC_STATE_MRUN_HOMING",
[299] = "MC_STATE_MRUN_END",
}
Before you can issue jog commands via the keyboard or MPG the machine MUST be in state "MC_STATE_IDLE" or already in state "MC_STATE_JOG".
You can use:
LUA Syntax:
mcState, rc = mc.mcCntlGetState(
MINSTANCE mInst)
To get the state of the machine prior to trying to issue any jog commands.
When RefAllHome is active, then jogging is not. When jogging is in progress RefAllHome is disabled.
Whenever the machine is idle then either the keyboard OR MPG can issue jog commands.
What is happening is your MPG is seizing control of Mach and not releasing it so other functions can run.
Have a look at Daz-the-Gaz videos on coroutines. It provides a way for an MPG to 'yield' so that other functions can run without
being blocked.
Craig