Differentiate between motion control off and unknown

r1693 | dcl | 2007-03-21 17:36:30 +1100 (Wed, 21 Mar 2007) | 2 lines
This commit is contained in:
Douglas Clowes
2007-03-21 17:36:30 +11:00
parent 108d20b2f1
commit 181dc85f14

View File

@@ -132,7 +132,9 @@ int DMC2280MotionControl = 1; /* defaults to enabled */
#define IMPOSSIBLE_LIM_SW -14
#define BGFAIL -15 // NOT SET
#define BLOCKED -16
#define MOTIONCONTROL -17
#define MOTIONCONTROLOFF -17
#define MOTIONCONTROLUNK -18
#define MOTCMDTMO -19 /* Motor Command Timeout */
/*--------------------------------------------------------------------*/
#define STATUSMOVING 128 /* Motor is moving */
#define STATUSERRORLIMIT 64 /* Number of errorss exceed limit */
@@ -668,7 +670,10 @@ static int DMC2280Run(void *pData,float fValue){
/* If Motion Control is off, report HWFault */
if (DMC2280MotionControl != 1) {
self->errorCode = MOTIONCONTROL;
if (DMC2280MotionControl == 0)
self->errorCode = MOTIONCONTROLOFF;
else
self->errorCode = MOTIONCONTROLUNK;
return HWFault;
}
@@ -893,7 +898,10 @@ static int DMC2280Status(void *pData){
int iRet;
/* If Motion Control is off, report HWFault */
if (DMC2280MotionControl != 1) {
self->errorCode = MOTIONCONTROL;
if (DMC2280MotionControl == 0)
self->errorCode = MOTIONCONTROLOFF;
else
self->errorCode = MOTIONCONTROLUNK;
return HWFault;
}
/* If pos hasn't changed since last
@@ -1041,6 +1049,8 @@ static void DMC2280Error(void *pData, int *iCode, char *error, int errLen){
case BADMEMORY:
case INCOMPLETE:
getRS232Error(*iCode, error, errLen);
case MOTCMDTMO:
strncpy(error, "Command Timeout", (size_t)errLen);
break;
case BADADR:
strncpy(error,"Bad address",(size_t)errLen);
@@ -1088,8 +1098,11 @@ static void DMC2280Error(void *pData, int *iCode, char *error, int errLen){
case BLOCKED:
strncpy(error,"STOPPING MOTOR, MOTION SEEMS TO BE BLOCKED", (size_t)errLen);
break;
case MOTIONCONTROL:
strncpy(error,"MOTION CONTROL SEEMS TO BE DISABLED", (size_t)errLen);
case MOTIONCONTROLOFF:
strncpy(error, "MOTION CONTROL SEEMS TO BE DISABLED", (size_t)errLen);
break;
case MOTIONCONTROLUNK:
strncpy(error, "MOTION CONTROL SEEMS TO BE UNKNOWN", (size_t)errLen);
break;
default:
/* FIXME What's the default */
@@ -1121,7 +1134,9 @@ static int DMC2280Fix(void *pData, int iCode,/*@unused@*/ float fValue){
//case TIMEOUT:
case BADPAR:
case BLOCKED:
case MOTIONCONTROL:
case MOTIONCONTROLOFF:
case MOTIONCONTROLUNK:
case MOTCMDTMO:
return MOTFAIL;
case POSFAULT:
case BADSEND:
@@ -1534,7 +1549,7 @@ static void DMC2280List(void *self, char *name, SConnection *pCon){
SCWrite(pCon, buffer, eStatus);
snprintf(buffer, BUFFLEN, "%s.home = %f\n", name, ((pDMC2280Driv)self)->home);
SCWrite(pCon, buffer, eStatus);
snprintf(buffer, BUFFLEN, "%s.units = %s\n", name, ((pDMC2280Driv)self)->units);
snprintf(buffer, BUFFLEN, "%s.units = %s\n", name, ((pDMC2280Driv)self)->units);
SCWrite(pCon, buffer, eStatus);
snprintf(buffer, BUFFLEN, "%s.speed = %f\n", name, ((pDMC2280Driv)self)->speed);
SCWrite(pCon, buffer, eStatus);