***********************************
#include "KMotionDef.h"
//Plugin calls for Mach3 Home (actually Purge) Commands
#define X 0
#define Y 1
#define Z 2
main()
{
int flags = persist.UserData[5]; // Mach3 flags bit0=X, bit1=Y, Bit2=Z, etc...
printf("Mach3 Home Call, flags = %d\n",flags);
if (flags==1)
{
// do x homing here
DisableAxis(X);
Zero(X);
EnableAxisDest(X,0.0);
}
if (flags==2)
{
// do y homing here
DisableAxis(Y);
Zero(Y);
EnableAxisDest(Y,0.0);
}
if (flags==4)
{
// do z homing here
/*DisableAxis(Z);
Zero(Z);
EnableAxisDest(Z,0.0);*/
Jog(Z,1000); // start moving
while (ReadBit(9)) ; // wait for switch (input #15) to change
Jog(Z,0); // StopMotion
while(!CheckDone(Z)) ;
Jog(Z,-300); // start moving
while (!ReadBit(9)) ; // wait for switch (input #15) to change
Jog(Z,0); // StopMotion
while(!CheckDone(Z)) ;
Delay_sec(0.25);
ch2->Dest=0;
ch2->Position=0;
/*DisableAxis(Z);
Zero(Z);
EnableAxisDest(Z,0.0);*/
}
printf("Done\n");
}