- Changed tabledrive to new MARS driving

- Various fixes to make SLS magnet controller more stable
This commit is contained in:
koennecke
2007-06-22 11:45:19 +00:00
parent a3467cb4ef
commit 3cf163f7f2
2 changed files with 30 additions and 6 deletions

View File

@ -139,6 +139,7 @@ static int communicateSLS(mkChannel *pSock, char msg[6], char reply[6])
if(!pSock)
return NOTCONNECTED;
memset(reply,0,6);
address = (int)msg[1];
iRet = NETWrite(pSock,msg,6);
if(iRet < 0)
@ -924,11 +925,34 @@ static void slsdspCodeToText(int code, char *text, int textlen){
return DEVFAULT;
}
ival = (int)reply[5];
if(ival != 0){
return DEVFAULT;
} else {
if(ival == 0){
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)

View File

@ -57,7 +57,7 @@ static int TableDriveCheckLimits(void *pData, float fVal, char *error,
strncpy(error,"Path Table Not Defined!",25);
return 0;
}
if(fVal < 1. || fVal >= self->tableLength){
if(fVal < 1. || fVal > self->tableLength){
strncpy(error,"Out of Range",25);
return 0;
}
@ -267,7 +267,7 @@ static void tableInfo(pTableDrive self, SConnection *pCon){
MotorGetPar(moti.pMot,"precision",&tolerance);
targetPosition = findTarget(moti,value);
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));
SCWrite(pCon,pBueffel,eValue);
}