- Many fixes to the four circle codes during taking the new code into
operation. - Fixed some missing output - Second generation histogram memory and velocity selector objects - Fixed a problem in diffscan
This commit is contained in:
60
countersec.c
60
countersec.c
@ -27,7 +27,7 @@ typedef struct {
|
||||
char *pName;
|
||||
} MonEvent, *pMonEvent;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int SecCtrInvokeFunction(pCounter self, SConnection *pCon, int code)
|
||||
int SecCtrInvokeFunction(pCounter self, SConnection *pCon, int code)
|
||||
{
|
||||
pHdb node = NULL;
|
||||
hdbValue v;
|
||||
@ -149,7 +149,7 @@ static int SecCtrCheckStatus(void *pData, SConnection *pCon)
|
||||
* check for overrun timers
|
||||
*/
|
||||
if(self->getMode(self) == eTimer &&
|
||||
time(NULL) > self->tStart + self->getPreset(self) && self->haltFixFlag == 0){
|
||||
time(NULL) > (self->tStart + (int)self->getPreset(self)) && self->haltFixFlag == 0){
|
||||
SecCtrHalt(self);
|
||||
self->haltFixFlag = 1;
|
||||
}
|
||||
@ -397,27 +397,18 @@ static int ContinueCmd(pSICSOBJ ccmd, SConnection * con,
|
||||
return self->pCountInt->Continue(self,con);
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int MakeSecCter(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
int argc, char *argv[])
|
||||
pCounter CreateSecCounter(SConnection *pCon, char *type, char *name, int length)
|
||||
{
|
||||
pCounter pRes = NULL;
|
||||
int status, length;
|
||||
pHdb node, child;
|
||||
|
||||
if(argc < 3) {
|
||||
SCWrite(pCon,"ERROR: need at least a name and length to create a counter",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
length = atoi(argv[2]);
|
||||
pHdb node = NULL, child = NULL;
|
||||
|
||||
pRes = (pCounter) malloc(sizeof(Counter));
|
||||
if (!pRes) {
|
||||
SCWrite(pCon,"ERROR: out of memory in MakeSecCter", eError);
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
memset(pRes,0,sizeof(Counter));
|
||||
pRes->pDes = CreateDescriptor("SingleCounter");
|
||||
pRes->pDes = CreateDescriptor(type);
|
||||
if (!pRes->pDes) {
|
||||
SCWrite(pCon,"ERROR: out of memory in MakeSecCter", eError);
|
||||
return 0;
|
||||
@ -456,49 +447,48 @@ int MakeSecCter(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
|
||||
pRes->isUpToDate = 1;
|
||||
pRes->iExponent = 0;
|
||||
pRes->name = strdup(argv[1]);
|
||||
|
||||
pRes->name = strdup(name);
|
||||
|
||||
node = MakeHipadabaNode(argv[1],HIPNONE, 0);
|
||||
node = MakeHipadabaNode(name,HIPNONE, 0);
|
||||
pRes->pDes->parNode = node;
|
||||
pRes->objectNode = node;
|
||||
|
||||
child = MakeSICSHdbPar("time", usInternal, MakeHdbFloat(.0));
|
||||
if (child == NULL) {
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
AddHipadabaChild(node, child, NULL);
|
||||
|
||||
child = MakeSICSHdbPar("preset", usUser, MakeHdbFloat(.0));
|
||||
if (child == NULL) {
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
SetHdbProperty(child, "__save", "true");
|
||||
AddHipadabaChild(node, child, NULL);
|
||||
|
||||
child = MakeSICSHdbPar("mode", usUser, MakeHdbText("monitor"));
|
||||
if (child == NULL) {
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
SetHdbProperty(child, "__save", "true");
|
||||
AddHipadabaChild(node, child, NULL);
|
||||
|
||||
child = MakeSICSHdbPar("status", usInternal, MakeHdbText("idle"));
|
||||
if (child == NULL) {
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
AddHipadabaChild(node, child, NULL);
|
||||
|
||||
child = MakeSICSHdbPar("control", usUser, MakeHdbFloat(.0));
|
||||
if (child == NULL) {
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
AddHipadabaChild(node, child, NULL);
|
||||
|
||||
child = MakeSICSHdbPar("values", usInternal,
|
||||
makeHdbValue(HIPINTAR, length));
|
||||
if (child == NULL) {
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
AddHipadabaChild(node, child, NULL);
|
||||
|
||||
@ -511,6 +501,28 @@ int MakeSecCter(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
child = AddSICSHdbPar(node,"stop", usUser, MakeSICSFunc(StopCmd));
|
||||
child = AddSICSHdbPar(node,"pause", usUser, MakeSICSFunc(PauseCmd));
|
||||
child = AddSICSHdbPar(node,"continue", usUser, MakeSICSFunc(ContinueCmd));
|
||||
|
||||
return pRes;
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int MakeSecCter(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
int argc, char *argv[])
|
||||
{
|
||||
pCounter pRes = NULL;
|
||||
int status, length;
|
||||
pHdb node, child;
|
||||
|
||||
if(argc < 3) {
|
||||
SCWrite(pCon,"ERROR: need at least a name and length to create a counter",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
length = atoi(argv[2]);
|
||||
|
||||
pRes = CreateSecCounter(pCon,"SingleCounter", argv[1], length);
|
||||
if(pRes == NULL){
|
||||
return 0;
|
||||
}
|
||||
|
||||
status =
|
||||
AddCommand(pSics, argv[1], InterInvokeSICSOBJ, DeleteCounter,
|
||||
|
Reference in New Issue
Block a user