- 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:
68
devexec.c
68
devexec.c
@ -273,14 +273,13 @@ int StartDevice(pExeList self, char *name, pObjectDescriptor pDes,
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
self->pOwner = SCCopyConnection(pCon);
|
||||
}
|
||||
}
|
||||
if (self->iLock == 1) {
|
||||
SCWrite(pCon, "ERROR: instrument is locked", eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SetDevexecStatus(self,DEVDONE);
|
||||
if(self->waitID < 0 && level == RUNDRIVE){
|
||||
self->waitID = GetTaskGroupID(pServ->pTasker);
|
||||
self->iStatus = DEVBUSY;
|
||||
@ -293,7 +292,7 @@ int StartDevice(pExeList self, char *name, pObjectDescriptor pDes,
|
||||
|
||||
if((pDrivInt = pDes->GetInterface(pData,DRIVEID)) != NULL){
|
||||
taskID = StartDriveTask(pData, pCon, name, fNew);
|
||||
if(self->instStatus != eCounting){
|
||||
if(taskID > 0 && self->instStatus != eCounting){
|
||||
self->instStatus = eDriving;
|
||||
SetStatus(eDriving);
|
||||
}
|
||||
@ -305,14 +304,19 @@ int StartDevice(pExeList self, char *name, pObjectDescriptor pDes,
|
||||
}
|
||||
} else if(pDes->GetInterface(pData,COUNTID) != NULL){
|
||||
taskID = StartCountTask(pData,pCon,name);
|
||||
self->instStatus = eCounting;
|
||||
SetStatus(eCounting);
|
||||
if(taskID > 0){
|
||||
self->instStatus = eCounting;
|
||||
SetStatus(eCounting);
|
||||
}
|
||||
} else {
|
||||
SCPrintf(pCon,eLogError, "ERROR: type unkonw, cannot start %s", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(taskID > 0){
|
||||
if(self->pOwner == NULL){
|
||||
self->pOwner = SCCopyConnection(pCon);
|
||||
}
|
||||
self->lastRun = time(NULL);
|
||||
if(level == RUNRUN){
|
||||
AddTaskToGroup(pServ->pTasker, taskID, self->runID);
|
||||
@ -519,10 +523,12 @@ int PauseExecution(pExeList self)
|
||||
|
||||
assert(self);
|
||||
|
||||
|
||||
TaskSignalGroup(self->pTask, IPAUSE, &interrupt, self->waitID);
|
||||
if(IsCounting(self)){
|
||||
TaskSignalGroup(self->pTask, IPAUSE, &interrupt, self->waitID);
|
||||
TaskSignalGroup(self->pTask, IPAUSE, &interrupt, self->runID);
|
||||
SetStatus(ePaused);
|
||||
}
|
||||
|
||||
SetStatus(ePaused);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -546,10 +552,11 @@ int ContinueExecution(pExeList self)
|
||||
int interrupt = 0;
|
||||
assert(self);
|
||||
|
||||
|
||||
TaskSignalGroup(self->pTask, CONTINUE, &interrupt, self->waitID);
|
||||
|
||||
SetStatus(eCounting);
|
||||
if(GetStatus() == ePaused){
|
||||
TaskSignalGroup(self->pTask, CONTINUE, &interrupt, self->waitID);
|
||||
TaskSignalGroup(self->pTask, CONTINUE, &interrupt, self->runID);
|
||||
SetStatus(eCounting);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -715,8 +722,14 @@ int Success(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
level = RUNRUN;
|
||||
}
|
||||
|
||||
while(DevExecLevelRunning(self, level)){
|
||||
if(level == RUNRUN) {
|
||||
while(isTaskIDRunning(self->pTask,self->lTask)){
|
||||
TaskYield(self->pTask);
|
||||
}
|
||||
} else {
|
||||
while(DevExecLevelRunning(self, level)){
|
||||
TaskYield(self->pTask);
|
||||
}
|
||||
}
|
||||
iRet = self->iStatus;
|
||||
if (iRet == DEVINT) {
|
||||
@ -728,10 +741,20 @@ int Success(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
}
|
||||
} else if (iRet == DEVDONE) {
|
||||
SCWrite(pCon, "All done", eValue);
|
||||
self->iRun = 0;
|
||||
iRet = 1;
|
||||
} else if (iRet == DEVERROR) {
|
||||
SCWrite(pCon, "Finished with Problems", eValue);
|
||||
iRet = 1;
|
||||
} else if(iRet == DEVBUSY){
|
||||
/*
|
||||
some other level may still be running
|
||||
*/
|
||||
if(level == RUNRUN){
|
||||
self->iRun = 0;
|
||||
}
|
||||
SCWrite(pCon, "Level done", eValue);
|
||||
iRet = 1;
|
||||
}
|
||||
SetStatus(eEager);
|
||||
return iRet;
|
||||
@ -867,12 +890,20 @@ int DevExecTask(void *pData)
|
||||
*/
|
||||
self->waitID = -1;
|
||||
self->lTask = -1;
|
||||
self->iRun = 0;
|
||||
self->instStatus = eEager;
|
||||
SetStatus(eEager);
|
||||
/*
|
||||
This is sort of unclean. Setting DEVERROR has to be done in the
|
||||
device task function as it is the only one that knows about this.
|
||||
Interrupts always have priority, thus they are dealt with here.
|
||||
*/
|
||||
if(SCGetInterrupt(self->pOwner) != eContinue){
|
||||
self->iStatus = DEVINT;
|
||||
} else {
|
||||
self->iStatus = DEVDONE;
|
||||
if(self->iStatus != DEVERROR){
|
||||
self->iStatus = DEVDONE;
|
||||
}
|
||||
}
|
||||
SCDeleteConnection(self->pOwner);
|
||||
self->pOwner = NULL;
|
||||
@ -925,3 +956,10 @@ void *GetExecutorCallback(pExeList self)
|
||||
{
|
||||
return self->pCall;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
void SetDevexecStatus(pExeList pExe, int code)
|
||||
{
|
||||
if(code >= 0 || code <= DEVBUSY){
|
||||
pExe->iStatus = code;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user