removed SicsWait
This commit is contained in:
87
tecsdriv.c
87
tecsdriv.c
@ -57,6 +57,7 @@
|
|||||||
#include "tecsdriv.h"
|
#include "tecsdriv.h"
|
||||||
#include "servlog.h"
|
#include "servlog.h"
|
||||||
#include "sicsvar.h"
|
#include "sicsvar.h"
|
||||||
|
#include "tecs/coc_util.h"
|
||||||
#include "tecs/tecs_cli.h"
|
#include "tecs/tecs_cli.h"
|
||||||
#include "tecs/str_util.h"
|
#include "tecs/str_util.h"
|
||||||
#include "tecs/err_handling.h"
|
#include "tecs/err_handling.h"
|
||||||
@ -85,7 +86,9 @@
|
|||||||
int iRet;
|
int iRet;
|
||||||
pEVDriver pD;
|
pEVDriver pD;
|
||||||
pTecsDriv pMe;
|
pTecsDriv pMe;
|
||||||
char *dev;
|
char *result;
|
||||||
|
double fNum;
|
||||||
|
float fVal;
|
||||||
|
|
||||||
self = (pEVControl)pData;
|
self = (pEVControl)pData;
|
||||||
assert(self);
|
assert(self);
|
||||||
@ -97,39 +100,37 @@
|
|||||||
return EVControlWrapper(pCon,pSics,pData,argc,argv);
|
return EVControlWrapper(pCon,pSics,pData,argc,argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
strtolower(argv[1]);
|
strcpy(pBueffel, " ");
|
||||||
if (strcmp(argv[1],"device") == 0)
|
strcat(pBueffel, argv[1]);
|
||||||
{
|
strcat(pBueffel, " ");
|
||||||
if(argc > 2) /* set case */
|
strtolower(pBueffel);
|
||||||
{
|
if ( NULL==strstr(" log send list tolerance access errorhandler interrupt ", pBueffel)
|
||||||
pD=self->pDriv; assert(pD);
|
&& NULL==strstr(" upperlimit lowerlimit safevalue currentvalue targetvalue ", pBueffel)
|
||||||
pMe=pD->pPrivate; assert(pMe);
|
) {
|
||||||
iRet=TeccSetDev(pMe->pData,argv[2]);
|
|
||||||
if (iRet<0) {
|
pD=self->pDriv; assert(pD);
|
||||||
sprintf(pBueffel,"ERROR: %s",ErrMessage);
|
pMe=pD->pPrivate; assert(pMe);
|
||||||
SCWrite(pCon,pBueffel,eError);
|
if(argc > 2) { /* set case */
|
||||||
return 0;
|
iRet=TeccSetPar(pMe->pData,argv[1],argv[2]);
|
||||||
}
|
if (iRet<0) {
|
||||||
return 1;
|
sprintf(pBueffel,"ERROR: %s",ErrMessage);
|
||||||
}
|
SCWrite(pCon,pBueffel,eError);
|
||||||
else /* get case */
|
return 0;
|
||||||
{
|
}
|
||||||
pD=self->pDriv; assert(pD);
|
return 1;
|
||||||
pMe=pD->pPrivate; assert(pMe);
|
} else { /* get case */
|
||||||
dev=TeccGetDev(pMe->pData);
|
result=TeccGetPar(pMe->pData,argv[1]);
|
||||||
if (dev==NULL) {
|
if (result==NULL) {
|
||||||
sprintf(pBueffel,"ERROR: %s",ErrMessage);
|
sprintf(pBueffel,"ERROR: %s",ErrMessage);
|
||||||
SCWrite(pCon,pBueffel,eError);
|
SCWrite(pCon,pBueffel,eError);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
sprintf(pBueffel,"%s.%s = %s\n",self->pName,
|
sprintf(pBueffel,"%s.%s = %s\n",self->pName,
|
||||||
argv[1],dev);
|
argv[1],result);
|
||||||
SCWrite(pCon,pBueffel,eValue);
|
SCWrite(pCon,pBueffel,eValue);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return EVControlWrapper(pCon,pSics,pData,argc,argv);
|
return EVControlWrapper(pCon,pSics,pData,argc,argv);
|
||||||
}
|
}
|
||||||
/* not reached */
|
/* not reached */
|
||||||
@ -148,20 +149,30 @@
|
|||||||
assert(pMe);
|
assert(pMe);
|
||||||
|
|
||||||
time(&now);
|
time(&now);
|
||||||
if (now>lastGet) {
|
if (now!=lastGet) { /* TecsGet was not yet called within this second */
|
||||||
lastGet=now;
|
lastGet=now;
|
||||||
} else {
|
} else {
|
||||||
SicsWait(1); /* avoid extensive network traffic */
|
CocDelay(500); /* wait 0.5 sec. (seems that SICS has nothing else to do then reading temperatures) */
|
||||||
|
printf("usleep %d\n", now);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get temperature */
|
/* get temperature */
|
||||||
iRet = TeccGet(pMe->pData, fPos);
|
iRet = TeccGet(pMe->pData, fPos);
|
||||||
if(iRet < 0 )
|
if (iRet > 1) {
|
||||||
{
|
if (pMe->iLastError==2) {
|
||||||
|
iRet=TeccWait(pMe->pData);
|
||||||
|
} else {
|
||||||
|
pMe->lastError = "configuring controller";
|
||||||
|
pMe->iLastError=2; /* fixable */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(iRet < 0) {
|
||||||
pMe->lastError = ErrMessage;
|
pMe->lastError = ErrMessage;
|
||||||
pMe->iLastError=1; /* severe */
|
pMe->iLastError=1; /* severe */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
pMe->lastError=0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
|
Reference in New Issue
Block a user