- Reworked the connection object and the IO system
- Reworked the support for TRICS - Added a second generation motor
This commit is contained in:
@ -100,7 +100,14 @@
|
||||
self->start = time(NULL);
|
||||
self->lastt = 0;
|
||||
self->iWarned = 0;
|
||||
self->conn = SCSave(pCon, self->conn);
|
||||
if(self->conn != NULL){
|
||||
SCDeleteConnection(self->conn);
|
||||
}
|
||||
self->conn = SCCopyConnection(pCon);
|
||||
if(self->conn == NULL){
|
||||
SCWrite(pCon,"ERROR: out of memory in EVIDrive", eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* try at least three times to do it */
|
||||
for(i = 0; i < 3; i++)
|
||||
@ -302,7 +309,7 @@
|
||||
{
|
||||
sprintf(pBueffel,"%s inside tolerance, wait %.2f sec to settle",
|
||||
self->pName, (self->lastt + tmo - now)*1.0);
|
||||
SCWrite(pCon,pBueffel,eWarning);
|
||||
SCWrite(pCon,pBueffel,eLog);
|
||||
}
|
||||
notifyStatus(self, pCon, HWBusy);
|
||||
return HWBusy;
|
||||
@ -322,7 +329,7 @@
|
||||
if (tmo > 0) {
|
||||
sprintf(pBueffel,"%s outside tolerance, settling time suspended",
|
||||
self->pName);
|
||||
SCWrite(pCon,pBueffel,eWarning);
|
||||
SCWrite(pCon,pBueffel,eLog);
|
||||
}
|
||||
self->lastt -= now;
|
||||
}
|
||||
@ -376,7 +383,7 @@
|
||||
}
|
||||
|
||||
/*---------------------------- Error Handlers --------------------------------*/
|
||||
static void ErrWrite(char *txt, SCStore *conn)
|
||||
static void ErrWrite(char *txt, SConnection *conn)
|
||||
{
|
||||
pExeList pExe;
|
||||
SConnection *pCon = NULL;
|
||||
@ -386,13 +393,11 @@ static void ErrWrite(char *txt, SCStore *conn)
|
||||
|
||||
if (pCon)
|
||||
{
|
||||
SCWrite(pCon,txt,eWarning);
|
||||
SCWrite(pCon,txt,eLog);
|
||||
}
|
||||
else
|
||||
{
|
||||
pCon = SCStorePush(conn);
|
||||
SCWrite(pCon, txt, eWarning);
|
||||
SCStorePop(conn);
|
||||
SCWrite(conn, txt, eLog);
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------*/
|
||||
@ -436,7 +441,7 @@ static void ErrReport(pEVControl self)
|
||||
pExe = GetExecutor();
|
||||
if(IsCounting(pExe))
|
||||
{
|
||||
SCWrite(GetExeOwner(pExe),"Pausing till OK",eError);
|
||||
SCWrite(GetExeOwner(pExe),"Pausing till OK",eLogError);
|
||||
PauseExecution(pExe);
|
||||
|
||||
/* wait till OK */
|
||||
@ -796,7 +801,10 @@ static void ErrReport(pEVControl self)
|
||||
pRes->pName = strdup(pName);
|
||||
pRes->eMode = EVIdle;
|
||||
pRes->iWarned = 0;
|
||||
pRes->conn = NULL;
|
||||
if(pRes->conn != NULL){
|
||||
SCDeleteConnection(pRes->conn);
|
||||
pRes->conn = NULL;
|
||||
}
|
||||
|
||||
/* a terminal error gives a -1 in iRet */
|
||||
if(iRet < 0)
|
||||
@ -871,7 +879,7 @@ static void ErrReport(pEVControl self)
|
||||
}
|
||||
if (self->conn != NULL)
|
||||
{
|
||||
SCStoreFree(self->conn);
|
||||
SCDeleteConnection(self->conn);
|
||||
}
|
||||
free(self);
|
||||
}
|
||||
@ -1064,17 +1072,21 @@ static void ErrReport(pEVControl self)
|
||||
return 1;
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
static int EVCallBack(int iEvent, void *pEventData, void *pUserData,
|
||||
commandContext cc)
|
||||
static int EVCallBack(int iEvent, void *pEventData, void *pUserData)
|
||||
{
|
||||
char *pBuf = (char *)pEventData;
|
||||
SConnection *pCon = (SConnection *)pUserData;
|
||||
char pBueffel[132];
|
||||
|
||||
if(pCon == NULL || !SCisConnected(pCon))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(iEvent == VALUECHANGE)
|
||||
if(iEvent == VALUECHANGE && pCon != NULL)
|
||||
{
|
||||
pCon->conEventType=POSITION;
|
||||
SCWriteInContext(pCon,pBuf,eEvent,cc);
|
||||
SCWrite(pCon,pBuf,eEvent);
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
@ -1135,16 +1147,15 @@ static void ErrReport(pEVControl self)
|
||||
/* install automatic notification */
|
||||
else if(strcmp(argv[1],"interest") == 0)
|
||||
{
|
||||
lID = RegisterCallback(self->pCall, SCGetContext(pCon),
|
||||
lID = RegisterCallback(self->pCall,
|
||||
VALUECHANGE, EVCallBack,
|
||||
pCon, NULL);
|
||||
SCRegister(pCon,pSics, self->pCall,lID);
|
||||
SCCopyConnection(pCon), SCDeleteConnection);
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
}
|
||||
else if(strcmp(argv[1],"uninterest") == 0)
|
||||
{
|
||||
RemoveCallback2(self->pCall,pCon);
|
||||
RemoveCallbackCon(self->pCall,pCon);
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user