#include "KMotionDef.h"
#include "MySpindleDefs.h"
// desired speed is passed from KMotionCNC in variable KMVAR
// save in user variable STATEVAR whether it was off, CW, or CCW (0,1,-1)
// save in user variable SPEEDVAR the last desired speed
main()
{
// spin down
Jog(SPINDLEAXIS,0);
printf("Jogging Spindle Stop\n");
persist.UserData[STATEVAR] = 0; // remember we are Off
while (!CheckDone(SPINDLEAXIS)) ;
DisableAxis(SPINDLEAXIS);
}
#include "KMotionDef.h"
#include "MySpindleDefs.h"
// desired speed is passed from KMotionCNC in variable KMVAR
// save in user variable STATEVAR whether it was off, CW, or CCW (0,1,-1)
// save in user variable SPEEDVAR the last desired speed
main()
{
// spin down
Jog(SPINDLEAXIS,0);
printf("Jogging Spindle Stop\n");
persist.UserData[STATEVAR] = 0; // remember we are Off
while (!CheckDone(SPINDLEAXIS)) ;
if (CS0_axis_a == -1) // is A axis not defined in the Coordinate System?
DisableAxis(2); // yes, disable the axis, otherwise leave it enabled
}
Correct. That should work, but the way you indented the lines hurts my eyes. Your formatting style implies that the 'if' is inside the 'while' and the DisableAxis is not conditioned by the 'if'. Both incorrect. To an experienced C programmer its like reading a book with line breaks in the middle of sentences and no breaks where they should be. Please read this.
works great like all your additions to my machine.
i am trying to get better at all this stuff but it is pretty hard for a high skhool drop out.
i will study up on your link and watch the video
thanks matt