Cleaned up ANSTO code to merge with sinqdev.sics
This is our new RELEASE-4_0 branch which was taken from ansto/93d9a7c Conflicts: .gitignore SICSmain.c asynnet.c confvirtualmot.c counter.c devexec.c drive.c event.h exebuf.c exeman.c histmem.c interface.h motor.c motorlist.c motorsec.c multicounter.c napi.c napi.h napi4.c network.c nwatch.c nxscript.c nxxml.c nxxml.h ofac.c reflist.c scan.c sicshipadaba.c sicsobj.c site_ansto/docs/Copyright.txt site_ansto/instrument/lyrebird/config/tasmad/sicscommon/nxsupport.tcl site_ansto/instrument/lyrebird/config/tasmad/taspub_sics/tasscript.tcl statusfile.c tasdrive.c tasub.c tasub.h tasublib.c tasublib.h
This commit is contained in:
@ -14,14 +14,14 @@
|
||||
- a checkscript to be run at the end of driving the motor
|
||||
- a means to call the write script multiple times. This is useful if
|
||||
you need to drive to the value in multiple steps. An example is the
|
||||
BOA double crystal monochromator where you first have to pu the baldes to
|
||||
BOA double crystal monochromator where you first have to put the blades to
|
||||
0, then drive the translation and then drive the blades to the real theta.
|
||||
All this to avoid collisions. In order to support this, a state field and
|
||||
and a readable target field has been added. The mode of operation is such
|
||||
that the on first run the, writescript set the state to something different
|
||||
then idle. This causes after the first set of motors finished running the
|
||||
writescript to be called again. This can figure out by lookin at the
|
||||
state variable what to do. This can be doen in repetition until the
|
||||
state variable what to do. This can be done in repetition until the
|
||||
writescript sets state to idle again.
|
||||
|
||||
Mark Koennecke, April 2012
|
||||
@ -51,6 +51,7 @@ typedef struct {
|
||||
pIDrivable pDriv;
|
||||
float value;
|
||||
int running;
|
||||
long taskID;
|
||||
} RealMotor, *pRealMotor;
|
||||
|
||||
/* Data passed by event generating object */
|
||||
@ -183,9 +184,9 @@ static int startMotorList(pConfigurableVirtualMotor self,
|
||||
iRet = LLDnodePtr2First(self->motorList);
|
||||
while (iRet != 0) {
|
||||
LLDnodeDataTo(self->motorList, &tuktuk);
|
||||
status = tuktuk.pDriv->SetValue(tuktuk.data, pCon, tuktuk.value);
|
||||
if (status != 1) {
|
||||
return status;
|
||||
tuktuk.taskID = StartDriveTask(tuktuk.data,pCon,tuktuk.name,tuktuk.value);
|
||||
if (tuktuk.taskID < 0) {
|
||||
return HWFault;
|
||||
}
|
||||
tuktuk.running = 1;
|
||||
LLDnodeDataFrom(self->motorList, &tuktuk);
|
||||
@ -346,28 +347,12 @@ static int ConfCheckStatus(void *pData, SConnection * pCon)
|
||||
while (iRet != 0) {
|
||||
LLDnodeDataTo(self->motorList, &tuktuk);
|
||||
if (tuktuk.running == 1) {
|
||||
status = tuktuk.pDriv->CheckStatus(tuktuk.data, pCon);
|
||||
switch (status) {
|
||||
case HWIdle:
|
||||
tuktuk.running = 0;
|
||||
status = isTaskIDRunning(pServ->pTasker,tuktuk.taskID);
|
||||
if(status == 1){
|
||||
return HWBusy;
|
||||
} else {
|
||||
tuktuk.running = 0;
|
||||
LLDnodeDataFrom(self->motorList, &tuktuk);
|
||||
break;
|
||||
case HWBusy:
|
||||
result = HWBusy;
|
||||
break;
|
||||
case HWFault:
|
||||
case HWPosFault:
|
||||
if(self->state != NULL){
|
||||
free(self->state);
|
||||
self->state = strdup("idle");
|
||||
}
|
||||
return status;
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
this is a programming error and has to be fixed
|
||||
*/
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
iRet = LLDnodePtr2Next(self->motorList);
|
||||
|
Reference in New Issue
Block a user