Hello Guest it is May 14, 2021, 07:11:02 PM

Author Topic: Mach4 Gcode running or not running  (Read 311 times)

0 Members and 1 Guest are viewing this topic.

Mach4 Gcode running or not running
« 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.
Re: Mach4 Gcode running or not running
« Reply #1 on: July 16, 2019, 10:19:19 AM »
Maybe ?
 :)
Re: Mach4 Gcode running or not running
« Reply #2 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

Offline Chaoticone

*
  • *
  •  5,626 5,626
  • Precision Chaos
    • View Profile
Re: Mach4 Gcode running or not running
« Reply #3 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,
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!