- Introduced a state filed into first generation objects
- Fixed some issues with error returns not being properly handled in devexec - Fixed a bug in motorlist which caused limit checks to fail - Fixed an issue with the TDCHM not properly updating the counter values on finish - Readded getHipadabaPar in ChainCallback as this caused a problem in ei - Made tasdrive ignore sgu, sgl when out of plane not allowed SKIPPED: psi/eigermono.c psi/sinqhttp.c psi/tdchm.c
This commit is contained in:
102
counter.c
102
counter.c
@ -205,6 +205,42 @@ static int ContinueCount(void *pData, SConnection * pCon)
|
||||
SCSetInterrupt(pCon, eAbortBatch);
|
||||
return HWFault;
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
static int TransferData(void *pData, SConnection * pCon)
|
||||
{
|
||||
pCounter self = NULL;
|
||||
int i, iRet;
|
||||
char pError[80];
|
||||
char pBueffel[132];
|
||||
int iCode;
|
||||
|
||||
self = (pCounter) pData;
|
||||
assert(self);
|
||||
assert(pCon);
|
||||
|
||||
/* try three times */
|
||||
for (i = 0; i < 3; i++) {
|
||||
iRet = self->pDriv->ReadValues(self->pDriv);
|
||||
if (iRet == OKOK) {
|
||||
self->isUpToDate = 1;
|
||||
return OKOK;
|
||||
} else {
|
||||
self->pDriv->GetError(self->pDriv, &iCode, pError, 79);
|
||||
sprintf(pBueffel, "WARNING: %s", pError);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
iRet = self->pDriv->TryAndFixIt(self->pDriv, iCode);
|
||||
if (iRet == COTERM) {
|
||||
SCWrite(pCon, "ERROR: Cannot fix counter problem, aborting",
|
||||
eError);
|
||||
SCSetInterrupt(pCon, eAbortBatch);
|
||||
return HWFault;
|
||||
}
|
||||
}
|
||||
}
|
||||
SCWrite(pCon, "ERROR: Cannot fix counter problem, aborting", eError);
|
||||
SCSetInterrupt(pCon, eAbortBatch);
|
||||
return HWFault;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
static int CheckCountStatus(void *pData, SConnection * pCon)
|
||||
@ -266,7 +302,8 @@ static int CheckCountStatus(void *pData, SConnection * pCon)
|
||||
notification on finish
|
||||
*/
|
||||
if (eCt == HWIdle) {
|
||||
self->isUpToDate = 0;
|
||||
self->isUpToDate = 0;
|
||||
TransferData(self,pCon);
|
||||
InvokeCallBack(self->pCall, COUNTEND, NULL);
|
||||
ReleaseCountLock(self->pCountInt);
|
||||
}
|
||||
@ -294,42 +331,6 @@ static int SaveCounterStatus(void *pData, char *name, FILE * fd)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
static int TransferData(void *pData, SConnection * pCon)
|
||||
{
|
||||
pCounter self = NULL;
|
||||
int i, iRet;
|
||||
char pError[80];
|
||||
char pBueffel[132];
|
||||
int iCode;
|
||||
|
||||
self = (pCounter) pData;
|
||||
assert(self);
|
||||
assert(pCon);
|
||||
|
||||
/* try three times */
|
||||
for (i = 0; i < 3; i++) {
|
||||
iRet = self->pDriv->ReadValues(self->pDriv);
|
||||
if (iRet == OKOK) {
|
||||
self->isUpToDate = 1;
|
||||
return OKOK;
|
||||
} else {
|
||||
self->pDriv->GetError(self->pDriv, &iCode, pError, 79);
|
||||
sprintf(pBueffel, "WARNING: %s", pError);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
iRet = self->pDriv->TryAndFixIt(self->pDriv, iCode);
|
||||
if (iRet == COTERM) {
|
||||
SCWrite(pCon, "ERROR: Cannot fix counter problem, aborting",
|
||||
eError);
|
||||
SCSetInterrupt(pCon, eAbortBatch);
|
||||
return HWFault;
|
||||
}
|
||||
}
|
||||
}
|
||||
SCWrite(pCon, "ERROR: Cannot fix counter problem, aborting", eError);
|
||||
SCSetInterrupt(pCon, eAbortBatch);
|
||||
return HWFault;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
static void *CounterGetInterface(void *pData, int iID)
|
||||
@ -701,6 +702,9 @@ static int CounterInterest(int iEvent, void *pEvent, void *pUser)
|
||||
char pBueffel[512];
|
||||
int rights;
|
||||
|
||||
pCon = (SConnection *) pUser;
|
||||
pMon = (pMonEvent) pEvent;
|
||||
|
||||
if (pCon == NULL || !SCisConnected(pCon)) {
|
||||
return -1;
|
||||
}
|
||||
@ -709,17 +713,13 @@ static int CounterInterest(int iEvent, void *pEvent, void *pUser)
|
||||
return 0;
|
||||
}
|
||||
|
||||
pCon = (SConnection *) pUser;
|
||||
pMon = (pMonEvent) pEvent;
|
||||
assert(pCon);
|
||||
assert(pMon);
|
||||
snprintf(pBueffel,511, "%s.CountStatus = %f %d", pMon->pName, pMon->fPreset,
|
||||
(int) nintf(pMon->fCurrent));
|
||||
/**
|
||||
* prevent this to be written to log files
|
||||
*/
|
||||
SCSetRights(pCon, usSpy);
|
||||
SCWrite(pCon, pBueffel, eWarning);
|
||||
SCWrite(pCon, pBueffel, eLog);
|
||||
return 1;
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
@ -815,7 +815,8 @@ int CountAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
{"send", 0, {0, 0}},
|
||||
{"setpar", 3, {FUPATEXT, FUPAINT, FUPAFLOAT}},
|
||||
{"getpar", 2, {FUPATEXT, FUPAOPT}},
|
||||
{"getnmon", 0, {0, 0}}
|
||||
{"getnmon", 0, {0, 0}},
|
||||
{"state", 0, {0, 0}}
|
||||
};
|
||||
char *pMode[] = {
|
||||
"timer",
|
||||
@ -832,7 +833,7 @@ int CountAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
argtolower(argc, argv);
|
||||
argx = &argv[1];
|
||||
iRet =
|
||||
EvaluateFuPa((pFuncTemplate) & ActionTemplate, 23, argc - 1, argx,
|
||||
EvaluateFuPa((pFuncTemplate) & ActionTemplate, 24, argc - 1, argx,
|
||||
&PaRes);
|
||||
if (iRet < 0) {
|
||||
snprintf(pBueffel, 255,"%s", PaRes.pError);
|
||||
@ -992,9 +993,9 @@ int CountAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
"ERROR: Insufficient privilege to set threshold", eError);
|
||||
return 0;
|
||||
}
|
||||
if (isInRunMode(pServ->pExecutor)) {
|
||||
if (isRunning(self->pCountInt)) {
|
||||
SCWrite(pCon,
|
||||
"ERROR: cannot change threshold while instrument is active",
|
||||
"ERROR: cannot change threshold while counting",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
@ -1140,6 +1141,15 @@ int CountAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
snprintf(pBueffel, 131, "%s.getnmon = %d", argv[0], GetNMonitor(self));
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
break;
|
||||
case 23: /* state */
|
||||
if(isRunning(self->pCountInt)){
|
||||
snprintf(pBueffel, 131, "%s.state = run", argv[0]);
|
||||
} else {
|
||||
snprintf(pBueffel, 131, "%s.state = idle", argv[0]);
|
||||
}
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
return 1;
|
||||
break;
|
||||
default:
|
||||
assert(0); /* internal error */
|
||||
}
|
||||
|
Reference in New Issue
Block a user