- Extended confvirtmot to allow for sequences of calls
- Extended confvirtmot to have a checkscript - Made sure that targets get updated when calling tasdrive - Fixed some output codes in tasdrive.c - Made tdchm invoke counters event message for Melone - Fixed the ConID inefficiency by caching the host name in asynnet.c - Added a traceActive function to trace SKIPPED: psi/tdchm.c
This commit is contained in:
@ -9,6 +9,22 @@
|
||||
|
||||
Mark Koennecke, August 2004
|
||||
interest added: Ferdi Franceschini, April 2006
|
||||
|
||||
Additions:
|
||||
- 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
|
||||
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
|
||||
writescript sets state to idle again.
|
||||
|
||||
Mark Koennecke, April 2012
|
||||
-------------------------------------------------------------------------*/
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
@ -299,7 +315,7 @@ static void invokeCheckScript(pConfigurableVirtualMotor self,
|
||||
pTcl = InterpGetTcl(pServ->pSics);
|
||||
|
||||
if(self->checkScript != NULL){
|
||||
status = Tcl_Eval(pTcl, self->readScript);
|
||||
status = Tcl_Eval(pTcl, self->checkScript);
|
||||
if (status != TCL_OK) {
|
||||
snprintf(self->scriptError, 510, "ERROR: Tcl subsystem reported %s",
|
||||
Tcl_GetStringResult(pTcl));
|
||||
@ -331,6 +347,10 @@ static int ConfCheckStatus(void *pData, SConnection * pCon)
|
||||
break;
|
||||
case HWFault:
|
||||
case HWPosFault:
|
||||
if(self->state != NULL){
|
||||
free(self->state);
|
||||
self->state = strdup("idle");
|
||||
}
|
||||
return status;
|
||||
break;
|
||||
default:
|
||||
@ -344,10 +364,20 @@ static int ConfCheckStatus(void *pData, SConnection * pCon)
|
||||
}
|
||||
|
||||
if (result == HWIdle) {
|
||||
invokeCheckScript(self,pCon);
|
||||
event.pName = self->name;
|
||||
event.fVal = self->pDriv->GetValue(self, pCon);
|
||||
InvokeCallBack(self->pCall, MOTDRIVE, &event);
|
||||
/*
|
||||
* Do we have to do another step? If so run it.
|
||||
*/
|
||||
if(strstr(self->state,"idle") == NULL){
|
||||
status = ConfSetValue(self,pCon,self->targetValue);
|
||||
if(status == OKOK){
|
||||
result = HWBusy;
|
||||
}
|
||||
} else {
|
||||
invokeCheckScript(self,pCon);
|
||||
event.pName = self->name;
|
||||
event.fVal = self->pDriv->GetValue(self, pCon);
|
||||
InvokeCallBack(self->pCall, MOTDRIVE, &event);
|
||||
}
|
||||
} else if (result == HWBusy) {
|
||||
self->posCount++;
|
||||
if (self->posCount >= 10 /*ObVal(self->ParArray,MOVECOUNT) */ ) {
|
||||
@ -468,6 +498,10 @@ static void KillConfigurableVirtualMotor(void *data)
|
||||
free(self->readScript);
|
||||
self->readScript = NULL;
|
||||
}
|
||||
if(self->state != NULL){
|
||||
free(self->state);
|
||||
self->state = NULL;
|
||||
}
|
||||
free(self);
|
||||
self = NULL;
|
||||
}
|
||||
@ -504,6 +538,7 @@ int MakeConfigurableVirtualMotor(SConnection * pCon, SicsInterp * pSics,
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
pNew->state = strdup("idle");
|
||||
|
||||
/*
|
||||
assign functions
|
||||
@ -613,6 +648,31 @@ int ConfigurableVirtualMotorAction(SConnection * pCon, SicsInterp * pSics,
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
} else if (strcmp(argv[1], "state") == 0) {
|
||||
if (argc > 2) {
|
||||
/* set case */
|
||||
Arg2Text(argc - 2, &argv[2], pBueffel, 510);
|
||||
self->state = strdup(pBueffel);
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
} else {
|
||||
/* inquiry */
|
||||
if (self->state == NULL) {
|
||||
snprintf(pBueffel, 510, "%s.state = UNDEFINED", argv[0]);
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
return 1;
|
||||
} else {
|
||||
snprintf(pBueffel, 510, "%s.state = %s", argv[0],
|
||||
self->state);
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
} else if (strcmp(argv[1], "target") == 0) {
|
||||
/* inquiry */
|
||||
snprintf(pBueffel, 510, "%s.target = %f", argv[0], self->targetValue);
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
return 1;
|
||||
} else if (strcmp(argv[1], "interest") == 0) {
|
||||
pRegInfo = (pRegisteredInfo) malloc(sizeof(RegisteredInfo));
|
||||
if (!pRegInfo) {
|
||||
|
Reference in New Issue
Block a user