- First commit of the new UB based TAS calculation. A milestone has been
reached: it handles one test case correctly back and forth - Fixed oscillation code - Added a feature for switching off automatic updates in nxupdate Autoamtic updates cause problems when scanning...
This commit is contained in:
32
nxupdate.c
32
nxupdate.c
@ -24,6 +24,10 @@ static int UpdateTask(void *pData){
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(self->onOff == 0){
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
update when intervall reached or when end
|
||||
*/
|
||||
@ -48,6 +52,11 @@ static int CountCallback(int iEvent, void *pEventData, void *pUser){
|
||||
|
||||
self = (pNXupdate)pUser;
|
||||
pCon = (SConnection *)pEventData;
|
||||
|
||||
if(self->onOff == 0){
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(iEvent == COUNTSTART){
|
||||
assert(pCon);
|
||||
assert(self);
|
||||
@ -114,6 +123,9 @@ static void printUpdateList(SConnection *pCon, pNXupdate self, char *name){
|
||||
snprintf(pBueffel,255,"%s.updateIntervall = %d",name,
|
||||
self->updateIntervall);
|
||||
SCWrite(pCon,pBueffel,eValue);
|
||||
snprintf(pBueffel,255,"%s.onOff = %d",name,
|
||||
self->onOff);
|
||||
SCWrite(pCon,pBueffel,eValue);
|
||||
}
|
||||
/*--------------------------------------------------------------------*/
|
||||
static int printUpdateParameters(SConnection *pCon, pNXupdate self,
|
||||
@ -139,6 +151,11 @@ static int printUpdateParameters(SConnection *pCon, pNXupdate self,
|
||||
self->updateIntervall);
|
||||
SCWrite(pCon,pBueffel,eValue);
|
||||
return 1;
|
||||
} else if(strcmp(param,"onoff") == 0){
|
||||
snprintf(pBueffel,255,"%s.onoff = %d",name,
|
||||
self->onOff);
|
||||
SCWrite(pCon,pBueffel,eValue);
|
||||
return 1;
|
||||
} else {
|
||||
snprintf(pBueffel,255,"ERROR: parameter %s not known", param);
|
||||
SCWrite(pCon,pBueffel,eValue);
|
||||
@ -182,6 +199,20 @@ static int configureUpdate(SConnection *pCon, pNXupdate self,
|
||||
self->updateIntervall = newUpdate;
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
} else if(strcmp(param,"onoff") == 0){
|
||||
if(Tcl_GetInt(InterpGetTcl(pServ->pSics),value,&newUpdate) != TCL_OK){
|
||||
snprintf(pBueffel,255,
|
||||
"ERROR: %s not an int, cannot set onoff", value);
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
return 0;
|
||||
}
|
||||
if(newUpdate >= 1){
|
||||
self->onOff = 1;
|
||||
} else {
|
||||
self->onOff = 0;
|
||||
}
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
} else {
|
||||
snprintf(pBueffel,255,"ERROR: parameter %s not known", param);
|
||||
SCWrite(pCon,pBueffel,eValue);
|
||||
@ -272,6 +303,7 @@ int UpdateFactory(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
self->updateScript = strdup("UNDEFINED");
|
||||
self->linkScript = strdup("UNDEFINED");
|
||||
self->updateIntervall = 1200; /* 20 min */
|
||||
self->onOff = 1;
|
||||
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user