From 85880be56520b3205f102bd44d64b89c3539ee84 Mon Sep 17 00:00:00 2001 From: koennecke Date: Tue, 26 May 2009 09:36:59 +0000 Subject: [PATCH] - Fixed a bug in countersec.c which prevented counting in monitor mode - Fixes to make the second generation velocity selector driver work - Modified obpar.c to allow parameter changes while running. This makes it possible to collect data at TRICS while cooling down. --- countersec.c | 2 +- devser.c | 1 + exeman.c | 6 +++++- motor.c | 10 +++++----- obpar.c | 7 +++---- scriptcontext.c | 4 ++-- sctdriveobj.c | 3 +-- singlex.c | 2 +- velosec.c | 9 +++++---- 9 files changed, 24 insertions(+), 20 deletions(-) diff --git a/countersec.c b/countersec.c index a8e08d7b..12459ee5 100644 --- a/countersec.c +++ b/countersec.c @@ -228,7 +228,7 @@ static int SecCtrSetMode(pCounter self, CounterMode eNew) v = MakeHdbText("timer"); break; case ePreset: - v = MakeHdbText("timer"); + v = MakeHdbText("monitor"); break; } return SetHipadabaPar(node,v,NULL); diff --git a/devser.c b/devser.c index b76e41b0..008acc8e 100644 --- a/devser.c +++ b/devser.c @@ -243,6 +243,7 @@ int DevQueue(DevSer * devser, void *actionData, DevPrio prio, prio = NullPRIO + 1; if (prio >= NumberOfPRIO) prio = NumberOfPRIO - 1; + ptr2Last = &devser->actions; for (action = devser->actions; action != NULL && action->prio >= prio; action = action->next) { diff --git a/exeman.c b/exeman.c index ba9ab642..b74ca142 100644 --- a/exeman.c +++ b/exeman.c @@ -515,7 +515,11 @@ static int handleBatchPath(pExeMan self, SConnection * pCon, int argc, free(self->batchPath); } self->batchPath = strdup(argv[2]); - SCSendOK(pCon); + if(self->batchPath[0] != '/'){ + SCPrintf(pCon,eLog, "WARNING: batchpath %s not an absolute path", argv[2]); + } else { + SCSendOK(pCon); + } SCparChange(pCon); return 1; } else { diff --git a/motor.c b/motor.c index 78899356..6dc9433c 100644 --- a/motor.c +++ b/motor.c @@ -992,7 +992,7 @@ int MotorCreate(SConnection * pCon, SicsInterp * pSics, void *pData, /* a first check */ if (argc < 3) { - SCWrite(pCon, "Insufficient arguments for motor creation", eError); + SCWrite(pCon, "Insufficient arguments for motor creation", eLogError); return 0; } @@ -1009,7 +1009,7 @@ int MotorCreate(SConnection * pCon, SicsInterp * pSics, void *pData, pNew = MotorInit("SIM", argv[1], pDriver); if (!pNew) { sprintf(pBueffel, "Failure to create motor %s", argv[1]); - SCWrite(pCon, pBueffel, eError); + SCWrite(pCon, pBueffel, eLogError); return 0; } } else if (strcmp(argv[2], "tclmot") == 0) { @@ -1021,7 +1021,7 @@ int MotorCreate(SConnection * pCon, SicsInterp * pSics, void *pData, pNew = MotorInit("TCLMOT", argv[1], pDriver); if (!pNew) { sprintf(pBueffel, "Failure to create motor %s", argv[1]); - SCWrite(pCon, pBueffel, eError); + SCWrite(pCon, pBueffel, eLogError); return 0; } } else if (strcmp(argv[2], "regress") == 0) { @@ -1033,7 +1033,7 @@ int MotorCreate(SConnection * pCon, SicsInterp * pSics, void *pData, pNew = MotorInit("regress", argv[1], pDriver); if (!pNew) { sprintf(pBueffel, "Failure to create motor %s", argv[1]); - SCWrite(pCon, pBueffel, eError); + SCWrite(pCon, pBueffel, eLogError); return 0; } } else { @@ -1044,7 +1044,7 @@ int MotorCreate(SConnection * pCon, SicsInterp * pSics, void *pData, if (pNew == NULL) { sprintf(pBueffel, "Motor Type %s not recognized for motor %s", argv[2], argv[1]); - SCWrite(pCon, pBueffel, eError); + SCWrite(pCon, pBueffel, eLogError); return 0; } } diff --git a/obpar.c b/obpar.c index 20ece3e1..fe246344 100644 --- a/obpar.c +++ b/obpar.c @@ -39,12 +39,12 @@ #include #include #include -#include "Scommon.h" +#include "sics.h" #include "fortify.h" #include "conman.h" #include "status.h" #include "obpar.h" - +#include "devexec.h" /*------------------------------------------------------------------------*/ int ObParLength(ObPar * self) @@ -175,8 +175,7 @@ int ObParSet(ObPar * self, char *obname, char *name, float fVal, } /* are we running? */ - eStat = GetStatus(); - if (!((eStat == eEager) || (eStat == eBatch))) { + if(DevExecLevelRunning(pServ->pExecutor, RUNDRIVE)){ sprintf(pBueffel, "ERROR: Cannot change parameter while running"); SCWrite(pCon, pBueffel, eError); return 0; diff --git a/scriptcontext.c b/scriptcontext.c index 2bcffc12..2404e7b4 100644 --- a/scriptcontext.c +++ b/scriptcontext.c @@ -520,7 +520,7 @@ static int SctMatchNode(void *vNode, void *vData) } /* - * This is the read callback for nodes particpating in the + * This is the read callback for nodes participating in the * scriptcontext system */ static hdbCallbackReturn SctMainCallback(Hdb * node, void *userData, @@ -967,7 +967,7 @@ void SctQueueNode(SctController * controller, Hdb * node, SctData *data; hdbCallback *cb; - if (!FindHdbCallbackData(node, controller)) { + if (!FindHdbCallbackData(node, controller) && strcmp(action,"read") == 0) { cb = MakeHipadabaCallback(SctMainCallback, controller, NULL); assert(cb); AppendHipadabaCallback(node, cb); diff --git a/sctdriveobj.c b/sctdriveobj.c index ebc9ba37..ee777843 100644 --- a/sctdriveobj.c +++ b/sctdriveobj.c @@ -149,8 +149,7 @@ static long SCTDRIVSetValue(void *data, SConnection * pCon, float val) StopByData(pServ->pExecutor, data); - v.dataType = HIPFLOAT; - v.v.doubleValue = (double) val; + v = MakeHdbFloat(val); SetHdbProperty(self->objectNode, "writestatus", "start"); status = SetHipadabaPar(self->objectNode, v, pCon); if (status == 1) { diff --git a/singlex.c b/singlex.c index 03e0d391..e9f8964b 100644 --- a/singlex.c +++ b/singlex.c @@ -121,7 +121,7 @@ static int ConfigureCmd(pSICSOBJ self, SConnection * pCon, GetHipadabaPar(par[1], &v, pCon); mot = (pMotor) FindCommandData(pServ->pSics, v.v.text, "Motor"); if (mot == NULL) { - SCPrintf(pCon, eError, "ERROR: fialed to locate motor %s", v.v.text); + SCPrintf(pCon, eLogError, "ERROR: failed to locate motor %s", v.v.text); return 0; } switch (mf) { diff --git a/velosec.c b/velosec.c index 5c369afd..2e7ed43b 100644 --- a/velosec.c +++ b/velosec.c @@ -42,8 +42,9 @@ static hdbCallbackReturn tiltCallback(pHdb node, void *userData, val = tilt->pDrivInt->GetValue(tilt,pServ->dummyCon); } node->value.v.doubleValue = val; + return hdbContinue; } - if((set = GetHdbGetMessage(message)) != NULL){ + if((set = GetHdbSetMessage(message)) != NULL){ if(set->callData != NULL){ pCon = (SConnection *)set->callData; } else { @@ -98,7 +99,7 @@ int MakeSecNVS(SConnection * pCon, SicsInterp * pSics, { pMotor tilt = NULL; pSICSOBJ pNew = NULL; - SctController *sct = NULL; + pSICSOBJ sct = NULL; pHdb node = NULL, tilli; int status; @@ -115,7 +116,7 @@ int MakeSecNVS(SConnection * pCon, SicsInterp * pSics, return 0; } - sct = (SctController *)FindCommandData(pSics, argv[3],"ScriptContext"); + sct = (pSICSOBJ)FindCommandData(pSics, argv[3],"SctController"); if(sct == NULL){ SCPrintf(pCon,eError, "ERROR: scriptcontext %s not found", argv[3]); return 0; @@ -125,7 +126,7 @@ int MakeSecNVS(SConnection * pCon, SicsInterp * pSics, SetHdbProperty(node,"sicsdev",argv[1]); SetHdbProperty(node,"priv", "user"); - pNew = MakeSctDriveObj(node, "NVS", sct, 0); + pNew = MakeSctDriveObj(node, "NVS", sct->pPrivate, 0); if(pNew == NULL || node == NULL){ SCWrite(pCon,"ERROR: failed to create NVS, out of memory?", eError);