There has been a continuous problem that the counter:CheckStatus function
called from the status task messed up count processing. This has now been resolved in this way: - A new function ReadStatus and a lastStatus filed have been added to the countable interface. - CountTaskFunc updates the lastStatus field. - ReadStatus just returns that field. - ReadStatus is now being called by the status task.
This commit is contained in:
14
interface.c
14
interface.c
@ -101,7 +101,16 @@ pIDrivable CreateDrivableInterface(void)
|
||||
pRes->drivableStatus = HWIdle;
|
||||
return pRes;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
static int DefaultReadStatus(void *self, SConnection *pCon)
|
||||
{
|
||||
pICountable pCount = GetCountableInterface(self);
|
||||
if(pCount != NULL){
|
||||
return pCount->lastStatus;
|
||||
} else {
|
||||
return HWFault;
|
||||
}
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
pICountable CreateCountableInterface(void)
|
||||
{
|
||||
@ -113,6 +122,8 @@ pICountable CreateCountableInterface(void)
|
||||
}
|
||||
memset(pRes, 0, sizeof(ICountable));
|
||||
pRes->ID = COUNTID;
|
||||
pRes->lastStatus = HWIdle;
|
||||
pRes->ReadStatus = DefaultReadStatus;
|
||||
return pRes;
|
||||
}
|
||||
|
||||
@ -378,6 +389,7 @@ static int CountTaskFunc(void *data)
|
||||
assert(taskData != NULL);
|
||||
|
||||
status = taskData->pCount->CheckCountStatus(taskData->obj,taskData->pCon);
|
||||
taskData->pCount->lastStatus = status;
|
||||
if(status == HWBusy) {
|
||||
return 1;
|
||||
} else if(status == HWNoBeam){
|
||||
|
@ -62,11 +62,13 @@
|
||||
typedef struct {
|
||||
int ID;
|
||||
int running;
|
||||
int lastStatus;
|
||||
int (*Halt)(void *self);
|
||||
void (*SetCountParameters)(void *self, float fPreset,
|
||||
CounterMode eMode);
|
||||
int (*StartCount)(void *self, SConnection *pCon);
|
||||
int (*CheckCountStatus)(void *self, SConnection *pCon);
|
||||
int (*ReadStatus)(void *self, SConnection *pCon);
|
||||
int (*Pause)(void *self, SConnection *pCon);
|
||||
int (*Continue)(void *self, SConnection *pCon);
|
||||
int (*TransferData)(void *self, SConnection *pCon);
|
||||
|
2
make_gen
2
make_gen
@ -21,7 +21,7 @@ SOBJ = network.o ifile.o conman.o SCinter.o splitter.o passwd.o \
|
||||
danu.o nxdict.o varlog.o stptok.o nread.o trigd.o cell.o\
|
||||
scan.o fitcenter.o telnet.o token.o wwildcard.o hklmot.o\
|
||||
tclev.o hkl.o integrate.o optimise.o dynstring.o nxutil.o \
|
||||
uubuffer.o udpquieck.o fourtable.o \
|
||||
uubuffer.o udpquieck.o fourtable.o hexString.o\
|
||||
rmtrail.o help.o nxupdate.o confvirtualmot.o vector.o\
|
||||
simchop.o choco.o chadapter.o trim.o scaldate.o tasub.o\
|
||||
xytable.o exebuf.o exeman.o ubfour.o ubcalc.o\
|
||||
|
2
status.c
2
status.c
@ -400,7 +400,7 @@ static int CheckCountStatus(void *message, void *userData)
|
||||
for(it = TaskIteratorStart(pServ->pTasker); it != NULL; it = TaskIteratorNext(it)){
|
||||
countTask = (CountTaskData *)GetTaskData(it);
|
||||
if(countTask != NULL && countTask->id == COUNTID){
|
||||
testStatus = countTask->pCount->CheckCountStatus(countTask->obj,pServ->dummyCon);
|
||||
testStatus = countTask->pCount->ReadStatus(countTask->obj,pServ->dummyCon);
|
||||
if(testStatus == HWNoBeam){
|
||||
*status = eOutOfBeam;
|
||||
}
|
||||
|
Reference in New Issue
Block a user