diff --git a/site_ansto/motor_dmc2280.c b/site_ansto/motor_dmc2280.c index c61195c6..937f80de 100644 --- a/site_ansto/motor_dmc2280.c +++ b/site_ansto/motor_dmc2280.c @@ -79,7 +79,6 @@ typedef struct __MoDriv { /* DMC-2280 specific fields */ - /*@observer@*//*@dependent@*/SConnection *pCon; prs232 controller; int errorCode; char units[256]; /**< physical units for axis */ @@ -91,6 +90,7 @@ typedef struct __MoDriv { float maxDecel; /**< physical units per second^2 */ char axisLabel; char lastCmd[1024]; + char dmc2280Error[1024]; float home; /**< home position for axis, default=0 */ int motorHome; /**< motor home position in steps */ int noPowerSave; /**< Flag = 1 to leave motors on after a move */ @@ -227,7 +227,7 @@ static int DMC2280ReadChar(pDMC2280Driv self, /*@out@*/char *reply) { '?' for an invalid command or ':' or space for a valid command */ static int DMC2280Send(pDMC2280Driv self, char *command) { - char cmdValid, pError[ERRLEN], reply[256]; + char cmdValid, reply[256]; char *GetEMsg = "TC 1"; int status; @@ -263,8 +263,7 @@ static int DMC2280Send(pDMC2280Driv self, char *command) { } if (FAILURE == DMC2280Receive(self, reply)) return HWFault; - snprintf(pError, ERRLEN, "DMC2280ERROR: Bad command '%s'", command); - SCWrite(self->pCon, reply, eError); + strncpy(self->dmc2280Error, reply, CMDLEN); SICSLogWrite(reply, eError); self->errorCode = BADCMD; return FAILURE; @@ -581,7 +580,8 @@ static void DMC2280Error(void *pData, int *iCode, char *error, int errLen){ strncpy(error,"Motor still busy",(size_t)errLen); break; case BADCMD: - snprintf(error, (size_t)errLen, "Bad command: '%s'", self->lastCmd); + snprintf(error, (size_t)errLen, "Bad command: '%s'\ndmcError: ", self->lastCmd); + strncat(error, self->dmc2280Error, (size_t)errLen); break; case BADPAR: strncpy(error,"Bad parameter",(size_t)errLen); @@ -976,6 +976,7 @@ static void KillDMC2280(/*@only@*/void *pData){ pNew->name = NULL; pNew->errorCode = 0; pNew->lastCmd[0] = '\0'; + pNew->dmc2280Error[0] = '\0'; pNew->absEncHome = 0; pNew->cntsPerX = 0; /* Get hostname and port from the list of named parameters */ @@ -1008,7 +1009,6 @@ static void KillDMC2280(/*@only@*/void *pData){ return NULL; } strcpy(pNew->name, motor); - pNew->pCon = pCon; pNew->home = 0.0; pNew->fLower = 0.0;//(float)atof(argv[2]); pNew->fUpper = 100.0;//(float)atof(argv[3]);