- Removed napi from SICS
- Added error fields to hwardware objects: motor, counter, histmem - Optimised sinqhttpopt - Added haddcheck which adds checks to hipadaba nodes. The current implementation only checks for selctions agaisnt the values property. Expand when more checks are required. SKIPPED: psi/polterwrite.c psi/sinqhttpopt.c psi/tasinit.c
This commit is contained in:
25
motor.c
25
motor.c
@ -81,7 +81,14 @@
|
||||
#define IGNOREFAULT 10
|
||||
#define MOVECOUNT 11
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
static void SetMotorError(pMotor self, char *text)
|
||||
{
|
||||
if(self->error != NULL){
|
||||
free(self->error);
|
||||
}
|
||||
self->error = strdup(text);
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
static void *MotorGetInterface(void *pData, int iID)
|
||||
{
|
||||
@ -378,17 +385,18 @@ static int reportAndFixError(pMotor self, SConnection * pCon)
|
||||
switch (iRet) {
|
||||
case MOTFAIL:
|
||||
snprintf(pBueffel, 255, "ERROR: %s on %s", pError, self->name);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
SCWrite(pCon, pBueffel, eLogError);
|
||||
newStatus = HWFault;
|
||||
SetMotorError(self,pError);
|
||||
break;
|
||||
case MOTREDO:
|
||||
snprintf(pBueffel, 255, "WARNING: %s on %s", pError, self->name);
|
||||
SCWrite(pCon, pBueffel, eWarning);
|
||||
SCWrite(pCon, pBueffel, eLog);
|
||||
newStatus = statusRunTo(self, pCon);
|
||||
break;
|
||||
case MOTOK:
|
||||
snprintf(pBueffel, 255, "WARNING: %s on %s", pError, self->name);
|
||||
SCWrite(pCon, pBueffel, eWarning);
|
||||
SCWrite(pCon, pBueffel, eLog);
|
||||
newStatus = HWIdle;
|
||||
break;
|
||||
default:
|
||||
@ -702,6 +710,7 @@ static long MotorRunImpl(void *sulf, SConnection * pCon, float fNew)
|
||||
SCSetInterrupt(pCon, eAbortBatch);
|
||||
return 0;
|
||||
}
|
||||
SetMotorError(self,"None");
|
||||
|
||||
/* check boundaries first */
|
||||
iRet = MotorCheckBoundaryImpl(self, fNew, &fHard, pError, 131);
|
||||
@ -709,6 +718,7 @@ static long MotorRunImpl(void *sulf, SConnection * pCon, float fNew)
|
||||
snprintf(pBueffel, 511, "ERROR: %s", pError);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
SCSetInterrupt(pCon, eAbortOperation);
|
||||
SetMotorError(self,pError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -731,6 +741,7 @@ static long MotorRunImpl(void *sulf, SConnection * pCon, float fNew)
|
||||
ServerWriteGlobal(pBueffel, eError);
|
||||
SCSetInterrupt(pCon, eAbortBatch);
|
||||
self->pDrivInt->iErrorCount = 0;
|
||||
SetMotorError(self,"Motor ALARM!!!!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -753,6 +764,7 @@ static long MotorRunImpl(void *sulf, SConnection * pCon, float fNew)
|
||||
SCWrite(pCon, pError, eError);
|
||||
SCWrite(pCon, "\n", eError);
|
||||
SCSetInterrupt(pCon, (int) ObVal(self->ParArray, INT));
|
||||
SetMotorError(self,pError);
|
||||
return HWFault;
|
||||
case MOTREDO:
|
||||
iRet = self->pDriver->RunTo(self->pDriver, fHard);
|
||||
@ -821,6 +833,7 @@ pMotor MotorInit(char *drivername, char *name, MotorDriver * pDriv)
|
||||
pM->pDriver = pDriv;
|
||||
pM->drivername = strdup(drivername);
|
||||
pM->name = strdup(name);
|
||||
pM->error = strdup("None");
|
||||
|
||||
|
||||
/* initialise object descriptor */
|
||||
@ -1286,6 +1299,10 @@ int MotorAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
DeleteTokenList(pList);
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
} /* check for error */
|
||||
else if (strcmp(pCurrent->text, "error") == 0) {
|
||||
SCPrintf(pCon,eValue,"%s.error = %s", argv[0], self->error);
|
||||
return 1;
|
||||
} else if (strcmp(pCurrent->text, "interest") == 0) { /* interest */
|
||||
pMoti = (pMotInfo) malloc(sizeof(MotInfo));
|
||||
if (!pMoti) {
|
||||
|
Reference in New Issue
Block a user