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 IMPOSSIBLE_LIM_SW -14
#define BGFAIL -15 // NOT SET #define BGFAIL -15 // NOT SET
#define BLOCKED -16 #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 STATUSMOVING 128 /* Motor is moving */
#define STATUSERRORLIMIT 64 /* Number of errorss exceed limit */ #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 Motion Control is off, report HWFault */
if (DMC2280MotionControl != 1) { if (DMC2280MotionControl != 1) {
self->errorCode = MOTIONCONTROL; if (DMC2280MotionControl == 0)
self->errorCode = MOTIONCONTROLOFF;
else
self->errorCode = MOTIONCONTROLUNK;
return HWFault; return HWFault;
} }
@@ -893,7 +898,10 @@ static int DMC2280Status(void *pData){
int iRet; int iRet;
/* If Motion Control is off, report HWFault */ /* If Motion Control is off, report HWFault */
if (DMC2280MotionControl != 1) { if (DMC2280MotionControl != 1) {
self->errorCode = MOTIONCONTROL; if (DMC2280MotionControl == 0)
self->errorCode = MOTIONCONTROLOFF;
else
self->errorCode = MOTIONCONTROLUNK;
return HWFault; return HWFault;
} }
/* If pos hasn't changed since last /* 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 BADMEMORY:
case INCOMPLETE: case INCOMPLETE:
getRS232Error(*iCode, error, errLen); getRS232Error(*iCode, error, errLen);
case MOTCMDTMO:
strncpy(error, "Command Timeout", (size_t)errLen);
break; break;
case BADADR: case BADADR:
strncpy(error,"Bad address",(size_t)errLen); strncpy(error,"Bad address",(size_t)errLen);
@@ -1088,8 +1098,11 @@ static void DMC2280Error(void *pData, int *iCode, char *error, int errLen){
case BLOCKED: case BLOCKED:
strncpy(error,"STOPPING MOTOR, MOTION SEEMS TO BE BLOCKED", (size_t)errLen); strncpy(error,"STOPPING MOTOR, MOTION SEEMS TO BE BLOCKED", (size_t)errLen);
break; break;
case MOTIONCONTROL: case MOTIONCONTROLOFF:
strncpy(error,"MOTION CONTROL SEEMS TO BE DISABLED", (size_t)errLen); 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; break;
default: default:
/* FIXME What's the default */ /* FIXME What's the default */
@@ -1121,7 +1134,9 @@ static int DMC2280Fix(void *pData, int iCode,/*@unused@*/ float fValue){
//case TIMEOUT: //case TIMEOUT:
case BADPAR: case BADPAR:
case BLOCKED: case BLOCKED:
case MOTIONCONTROL: case MOTIONCONTROLOFF:
case MOTIONCONTROLUNK:
case MOTCMDTMO:
return MOTFAIL; return MOTFAIL;
case POSFAULT: case POSFAULT:
case BADSEND: case BADSEND: