avoid multiple running drive tasks for the same object
This commit is contained in:
@ -279,6 +279,8 @@ int StartDevice(pExeList self, char *name, pObjectDescriptor pDes,
|
||||
return 0;
|
||||
}
|
||||
|
||||
EndDriveTask(pData); /* BEGIN experimental: stop pending drive task for this objects immediately */
|
||||
|
||||
SetDevexecStatus(self,DEVDONE);
|
||||
if(self->waitID < 0 && level == RUNDRIVE){
|
||||
self->waitID = GetTaskGroupID(pServ->pTasker);
|
||||
|
1
event.h
1
event.h
@ -70,6 +70,7 @@ typedef struct {
|
||||
#define TOKENRELEASE 303
|
||||
#define COMLOG 304
|
||||
#define CRONFUNC 305
|
||||
#define ENDDRIVETASK 306
|
||||
|
||||
#line 131 "event.w"
|
||||
|
||||
|
15
interface.c
15
interface.c
@ -224,9 +224,23 @@ static void DriveTaskSignal(void *data, int iSignal, void *pSigData)
|
||||
taskData->pDriv->Halt(taskData->obj);
|
||||
SCSetInterrupt(taskData->pCon,*interrupt);
|
||||
}
|
||||
} else if (iSignal == ENDDRIVETASK) {
|
||||
if (taskData->obj == pSigData) {
|
||||
taskData->pDriv = NULL; /* tell DriveTaskFunc to quit */
|
||||
}
|
||||
}
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
void EndDriveTask(void *obj) {
|
||||
/* End a drive task for obj.
|
||||
Originally in SICS, it was not possible to run an object already running
|
||||
this was relaxed in SEA, but with the downside, that several drive tasks
|
||||
for the same object may be running, removed only when the run succeds.
|
||||
This is called in StartDevice, before creating a new drive task.
|
||||
*/
|
||||
TaskSignal(pServ->pTasker, ENDDRIVETASK, obj);
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
static int DriveTaskFunc(void *data)
|
||||
{
|
||||
DriveTaskData *taskData = (DriveTaskData *)data;
|
||||
@ -234,6 +248,7 @@ static int DriveTaskFunc(void *data)
|
||||
|
||||
assert(taskData != NULL);
|
||||
|
||||
if (!taskData->pDriv) return 0;
|
||||
|
||||
status = taskData->pDriv->CheckStatus(taskData->obj,taskData->pCon);
|
||||
if(status == HWBusy){
|
||||
|
@ -48,6 +48,8 @@
|
||||
float *fPos);
|
||||
|
||||
long StartDriveTask(void *self, SConnection *pCon, char *name, float fTarget);
|
||||
void EndDriveTask(void *data);
|
||||
/* end a drive task replaced by a new one with the same object*/
|
||||
|
||||
|
||||
#line 438 "interface.w"
|
||||
|
Reference in New Issue
Block a user