- Changed tabledrive to new MARS driving
- Various fixes to make SLS magnet controller more stable
This commit is contained in:
32
slsmagnet.c
32
slsmagnet.c
@ -139,6 +139,7 @@ static int communicateSLS(mkChannel *pSock, char msg[6], char reply[6])
|
|||||||
if(!pSock)
|
if(!pSock)
|
||||||
return NOTCONNECTED;
|
return NOTCONNECTED;
|
||||||
|
|
||||||
|
memset(reply,0,6);
|
||||||
address = (int)msg[1];
|
address = (int)msg[1];
|
||||||
iRet = NETWrite(pSock,msg,6);
|
iRet = NETWrite(pSock,msg,6);
|
||||||
if(iRet < 0)
|
if(iRet < 0)
|
||||||
@ -924,11 +925,34 @@ static void slsdspCodeToText(int code, char *text, int textlen){
|
|||||||
return DEVFAULT;
|
return DEVFAULT;
|
||||||
}
|
}
|
||||||
ival = (int)reply[5];
|
ival = (int)reply[5];
|
||||||
if(ival != 0){
|
if(ival == 0){
|
||||||
return DEVFAULT;
|
|
||||||
} else {
|
|
||||||
return DEVREDO;
|
return DEVREDO;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* OK, clearing the error did not work, I try to reinitialize the
|
||||||
|
* socket because this helps sometimes.
|
||||||
|
*/
|
||||||
|
NETClosePort(pMe->pSock);
|
||||||
|
pMe->pSock = NULL;
|
||||||
|
pMe->pSock = NETConnect(pMe->pHost,pMe->iPort);
|
||||||
|
if(!pMe->pSock)
|
||||||
|
{
|
||||||
|
return DEVFAULT;
|
||||||
|
}
|
||||||
|
sleep(1);
|
||||||
|
msg[0] = DSPREAD;
|
||||||
|
msg[1] = 0x29;
|
||||||
|
iRet = communicateSLS(pMe->pSock,msg,reply);
|
||||||
|
if(iRet < 0)
|
||||||
|
{
|
||||||
|
return DEVFAULT;
|
||||||
|
}
|
||||||
|
ival = (int)reply[5];
|
||||||
|
if(ival == 0){
|
||||||
|
return DEVREDO;
|
||||||
|
} else {
|
||||||
|
return DEVFAULT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(iError)
|
switch(iError)
|
||||||
|
@ -57,7 +57,7 @@ static int TableDriveCheckLimits(void *pData, float fVal, char *error,
|
|||||||
strncpy(error,"Path Table Not Defined!",25);
|
strncpy(error,"Path Table Not Defined!",25);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if(fVal < 1. || fVal >= self->tableLength){
|
if(fVal < 1. || fVal > self->tableLength){
|
||||||
strncpy(error,"Out of Range",25);
|
strncpy(error,"Out of Range",25);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -267,7 +267,7 @@ static void tableInfo(pTableDrive self, SConnection *pCon){
|
|||||||
MotorGetPar(moti.pMot,"precision",&tolerance);
|
MotorGetPar(moti.pMot,"precision",&tolerance);
|
||||||
targetPosition = findTarget(moti,value);
|
targetPosition = findTarget(moti,value);
|
||||||
snprintf(pBueffel,256,"Motor %10s, should: %8.2f, is %8.2f, diff = %8.2f",
|
snprintf(pBueffel,256,"Motor %10s, should: %8.2f, is %8.2f, diff = %8.2f",
|
||||||
moti.motorName, motorPosition, targetPosition,
|
moti.motorName, targetPosition, motorPosition,
|
||||||
ABS(targetPosition - motorPosition));
|
ABS(targetPosition - motorPosition));
|
||||||
SCWrite(pCon,pBueffel,eValue);
|
SCWrite(pCon,pBueffel,eValue);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user