From 181dc85f146f80409d8318d379dd6c60f9bb066c Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Wed, 21 Mar 2007 17:36:30 +1100 Subject: [PATCH] Differentiate between motion control off and unknown r1693 | dcl | 2007-03-21 17:36:30 +1100 (Wed, 21 Mar 2007) | 2 lines --- site_ansto/motor_dmc2280.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/site_ansto/motor_dmc2280.c b/site_ansto/motor_dmc2280.c index a69b7fa7..a852638c 100644 --- a/site_ansto/motor_dmc2280.c +++ b/site_ansto/motor_dmc2280.c @@ -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);