- 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:
29
counter.c
29
counter.c
@ -71,7 +71,19 @@ static int Halt(void *pData)
|
||||
|
||||
return self->pDriv->Halt(self->pDriv);
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
static void SetCounterError(void *pData, char *text)
|
||||
{
|
||||
pCounter self = NULL;
|
||||
|
||||
assert(pData);
|
||||
self = (pCounter) pData;
|
||||
|
||||
if(self->error != NULL){
|
||||
free(self->error);
|
||||
}
|
||||
self->error = strdup(text);
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
static void SetCountParameters(void *pData, float fPreset,
|
||||
CounterMode eMode)
|
||||
@ -103,6 +115,7 @@ static int StartCount(void *pData, SConnection * pCon)
|
||||
return 0;
|
||||
}
|
||||
|
||||
SetCounterError(pData,"None");
|
||||
/* try at least three times to do it */
|
||||
for (i = 0; i < 3; i++) {
|
||||
iRet = self->pDriv->Start(self->pDriv);
|
||||
@ -122,6 +135,7 @@ static int StartCount(void *pData, SConnection * pCon)
|
||||
eError);
|
||||
SCSetInterrupt(pCon, eAbortBatch);
|
||||
ReleaseCountLock(self->pCountInt);
|
||||
SetCounterError(pData,pError);
|
||||
return HWFault;
|
||||
}
|
||||
}
|
||||
@ -233,6 +247,7 @@ static int TransferData(void *pData, SConnection * pCon)
|
||||
SCWrite(pCon, "ERROR: Cannot fix counter problem, aborting",
|
||||
eError);
|
||||
SCSetInterrupt(pCon, eAbortBatch);
|
||||
SetCounterError(pData,pError);
|
||||
return HWFault;
|
||||
}
|
||||
}
|
||||
@ -269,6 +284,7 @@ static int CheckCountStatus(void *pData, SConnection * pCon)
|
||||
SCSetInterrupt(pCon, eAbortBatch);
|
||||
InvokeCallBack(self->pCall, COUNTEND, NULL);
|
||||
ReleaseCountLock(self->pCountInt);
|
||||
SetCounterError(pData,pError);
|
||||
return eCt;
|
||||
} else {
|
||||
return HWBusy;
|
||||
@ -695,7 +711,7 @@ static int isAuthorised(SConnection * pCon, int iCode)
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
static int CounterInterest(int iEvent, void *pEvent, void *pUser)
|
||||
int CounterInterest(int iEvent, void *pEvent, void *pUser)
|
||||
{
|
||||
SConnection *pCon = NULL;
|
||||
pMonEvent pMon = NULL;
|
||||
@ -775,6 +791,7 @@ pCounter CreateCounter(char *name, pCounterDriver pDriv)
|
||||
pRes->isUpToDate = 1;
|
||||
pRes->iExponent = 0;
|
||||
pRes->name = strdup(name);
|
||||
pRes->error = strdup("None");
|
||||
return pRes;
|
||||
}
|
||||
|
||||
@ -816,7 +833,8 @@ int CountAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
{"setpar", 3, {FUPATEXT, FUPAINT, FUPAFLOAT}},
|
||||
{"getpar", 2, {FUPATEXT, FUPAOPT}},
|
||||
{"getnmon", 0, {0, 0}},
|
||||
{"state", 0, {0, 0}}
|
||||
{"state", 0, {0, 0}},
|
||||
{"error", 0, {0, 0}}
|
||||
};
|
||||
char *pMode[] = {
|
||||
"timer",
|
||||
@ -833,7 +851,7 @@ int CountAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
argtolower(argc, argv);
|
||||
argx = &argv[1];
|
||||
iRet =
|
||||
EvaluateFuPa((pFuncTemplate) & ActionTemplate, 24, argc - 1, argx,
|
||||
EvaluateFuPa((pFuncTemplate) & ActionTemplate, 25, argc - 1, argx,
|
||||
&PaRes);
|
||||
if (iRet < 0) {
|
||||
snprintf(pBueffel, 255,"%s", PaRes.pError);
|
||||
@ -1150,6 +1168,11 @@ int CountAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
return 1;
|
||||
break;
|
||||
case 24: /* error */
|
||||
snprintf(pBueffel, 131, "%s.error = %s", argv[0],self->error);
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
return 1;
|
||||
break;
|
||||
default:
|
||||
assert(0); /* internal error */
|
||||
}
|
||||
|
Reference in New Issue
Block a user