Machsupport Forum

Mach Discussion => Mach SDK plugin questions and answers. => Topic started by: FoxtrotBravo on December 03, 2010, 12:44:54 PM

Title: Disabling I/O during file loading
Post by: FoxtrotBravo on December 03, 2010, 12:44:54 PM
When Mach3 loads a file it runs through a simulation of the g-code. What variable can a plug-in check to determine if Mach3 is in this simulation mode? I'm creating a plug-in for an I/O board, and I/O is being executed during program loading, and that's what I will need to prevent.

Thanks.


Title: Re: Disabling I/O during file loading
Post by: poppabear on December 06, 2010, 08:56:51 AM
before your code block that you are loading the g code with, put this:

if( !GetLED(67) ) //if OEM led for offline is NOT on
   DoButton(178);//button press for putting mach offline.

//**** Your load g code, code here********

if( !GetLED(172) ) //G-Code is done loading LED.
    return;
else
   if( GetLED(67) ) //if OEM led for offline IS on
      DoButton(178);//button press for putting mach back online again.
      //advance to your next sequence, switch, or statement.

//scott

Title: Re: Disabling I/O during file loading
Post by: FoxtrotBravo on December 06, 2010, 09:18:16 AM
Thanks.
I'll monitor 67 and 172, it sounds like that's exactly what I needed.

Frank
Title: Re: Disabling I/O during file loading
Post by: BR549 on December 07, 2010, 12:21:56 PM
SCott if you go offline with MACH do you loose positional reference??

Just curious, (;-) TP
Title: Re: Disabling I/O during file loading
Post by: smurph on December 11, 2010, 01:27:09 AM
Mach is generating the tool path at this point, so it's not a true simulation.  MainPlanner->PathGenerate is set to true when the gcode file is loading.  Stick this in your update loop to keep your plugin quiet while loading a file:

Code: [Select]
if (MainPlanner->PathGenerate) {
return;
}