Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: jelle_bos on July 16, 2019, 09:23:13 AM

Title: Mach4 Gcode running or not running
Post by: jelle_bos on July 16, 2019, 09:23:13 AM
Hello People,

I am trying to change the states of some ouputs when mach4 is running an gcode and when it is done/''standby''. I looked in the API file for some variables to set the trigger.

I can't seem to find anything which I can use to see if mach4 is running an gcode or when it is not. Does someone know one? I want to turn 2 outputs on when it is not running an gcode and turn them back off when it is done or when I first turn the machine on.

Thanks in advance.
Title: Re: Mach4 Gcode running or not running
Post by: Overloaded on July 16, 2019, 10:19:19 AM
Maybe ?
 :)
Title: Re: Mach4 Gcode running or not running
Post by: jelle_bos on July 16, 2019, 10:42:53 AM
Oooh :-X think I overlooked something.
Thanks for the response on my stupid question. I thinks this will do the job
Title: Re: Mach4 Gcode running or not running
Post by: Chaoticone on July 16, 2019, 11:21:27 AM
Or

mcState, rc = mc.mcCntlGetState(inst)

These are all the possible return values.

        MC_STATE_IDLE =                   0,
   MC_STATE_HOLD =                   1,
   MC_STATE_FRUN_SUB =               2,
   MC_STATE_MRUN_SUB =               3,
   MC_STATE_JOG =                    4,
   MC_STATE_DRYRUN =                 5,
   MC_STATE_HOME =                   6,
   MC_STATE_CONFIG =                 7,
   MC_STATE_FRUN =                   100,
   MC_STATE_FRUN_FH =                101,
   MC_STATE_FRUN_PROBE =             102,
   MC_STATE_FRUN_PROBE_FH =          103,
   MC_STATE_FRUN_THREAD =            104,
   MC_STATE_FRUN_THREAD_FH =         105,
   MC_STATE_FRUN_FH_JOG =            106,
   MC_STATE_FRUN_TAP =               107,
   MC_STATE_FRUN_MACROH =            108,
   MC_STATE_FRUN_MACROH_JOG =        109,
   MC_STATE_FRUN_SINGLE_BLOCK =      110,
   MC_STATE_FRUN_RETRACT =           111,
   MC_STATE_FRUN_HOMING =            112,
   MC_STATE_FRUN_SINGLE_BLOCK_HOLD = 113,
   MC_STATE_FRUN_END =               199,
   MC_STATE_MRUN =                   200,
   MC_STATE_MRUN_FH =                201,
   MC_STATE_MRUN_PROBE =             202,
   MC_STATE_MRUN_PROBE_FH =          203,
   MC_STATE_MRUN_THREAD =            204,
   MC_STATE_MRUN_THREAD_FH =         205,
   MC_STATE_MRUN_TAP =               206,
   MC_STATE_MRUN_MACROH =            207,
   MC_STATE_MRUN_MACROH_JOG =        208,
   MC_STATE_MRUN_RETRACT =           209,
   MC_STATE_MRUN_HOMING =            210,
   MC_STATE_MRUN_END =               299,