Multiple bug fixes
- Arrayutil was not summing correctly - Added interest to motorsec in order to support old status clients - core dump because of bad free in devser - fixed transferring of count time in multicounter - added stack debugging to sllinux_def - Modifications to tasdrive to wait for finish of monochromator properly
This commit is contained in:
79
motorsec.c
79
motorsec.c
@@ -47,6 +47,7 @@
|
||||
|
||||
#define ABS(x) (x < 0 ? -(x) : (x))
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
static void SecMotorSetError(pMotor self, char *text)
|
||||
{
|
||||
@@ -655,6 +656,80 @@ static hdbCallbackReturn SecMotorZeroCallback(pHdb node, void *userData,
|
||||
return hdbContinue;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
typedef struct {
|
||||
char *pName;
|
||||
SConnection *pCon;
|
||||
float lastValue;
|
||||
} MotInfo, *pMotInfo;
|
||||
/*--------------------------------------------------------------------------*/
|
||||
static void KillInfo(void *pData)
|
||||
{
|
||||
pMotInfo self = NULL;
|
||||
|
||||
assert(pData);
|
||||
self = (pMotInfo) pData;
|
||||
if (self->pName) {
|
||||
free(self->pName);
|
||||
}
|
||||
if (self->pCon != NULL) {
|
||||
SCDeleteConnection(self->pCon);
|
||||
}
|
||||
free(self);
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
static hdbCallbackReturn InterestCallback(pHdb node, void *userData,
|
||||
pHdbMessage message)
|
||||
{
|
||||
pHdbDataMessage mm = NULL;
|
||||
pMotor self = (pMotor) userData;
|
||||
float fVal;
|
||||
hdbValue v;
|
||||
pMotInfo priv = (pMotInfo)userData;
|
||||
|
||||
|
||||
assert(self != NULL);
|
||||
|
||||
mm = GetHdbUpdateMessage(message);
|
||||
if (mm != NULL) {
|
||||
v = *mm->v;
|
||||
if(!SCisConnected(priv->pCon)){
|
||||
return hdbKill;
|
||||
}
|
||||
if(ABS(v.v.doubleValue - priv->lastValue) > .1) {
|
||||
SCPrintf(priv->pCon,eValue,"%s.position = %f",
|
||||
priv->pName, v.v.doubleValue);
|
||||
priv->lastValue = v.v.doubleValue;
|
||||
}
|
||||
return hdbContinue;
|
||||
}
|
||||
return hdbContinue;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int InterestCmd(pSICSOBJ ccmd, SConnection * con,
|
||||
Hdb * cmdNode, Hdb * par[], int nPar)
|
||||
{
|
||||
pMotInfo priv = NULL;
|
||||
|
||||
priv = malloc(sizeof(MotInfo));
|
||||
if(priv == NULL){
|
||||
SCWrite(con,"ERROR: out of memory registering interest",eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(nPar >= 1 && (strcmp(par[0]->value.v.text,"UNKNOWN") != 0)) {
|
||||
priv->pName = strdup(par[0]->value.v.text);
|
||||
} else {
|
||||
priv->pName = strdup(ccmd->objectNode->name);
|
||||
}
|
||||
priv->lastValue = .0;
|
||||
priv->pCon = SCCopyConnection(con);
|
||||
AppendHipadabaCallback(ccmd->objectNode,
|
||||
MakeHipadabaCallback(InterestCallback,priv,KillInfo));
|
||||
SCSendOK(con);
|
||||
return 1;
|
||||
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
pMotor SecMotorInit(char *name)
|
||||
{
|
||||
@@ -793,6 +868,10 @@ pMotor SecMotorInit(char *name)
|
||||
child = MakeHipadabaNode("error", HIPTEXT, 1);
|
||||
AddHipadabaChild(node, child, NULL);
|
||||
|
||||
child = AddSICSHdbPar(node,"interest", usUser, MakeSICSFunc(InterestCmd));
|
||||
AddSICSHdbPar(child, "name", usUser, MakeHdbText("UNKNOWN"));
|
||||
|
||||
|
||||
pM->endScriptID = 0;
|
||||
|
||||
/* initialise Drivable interface */
|
||||
|
||||
Reference in New Issue
Block a user