- Removed -fwritable-string

SKIPPED:
	psi/dornier2.c
	psi/ecbdriv.c
	psi/el734hp.c
	psi/libpsi.a
	psi/make_gen
	psi/makefile_linux
	psi/pimotor.c
	psi/pipiezo.c
	psi/sinqhttp.c
	psi/tcpdornier.c
	psi/velodornier.c
This commit is contained in:
koennecke
2006-03-31 15:24:52 +00:00
parent 4081448055
commit 51a60375d6
38 changed files with 1232 additions and 154 deletions

View File

@ -190,9 +190,20 @@ static int TASHalt(void *pData){
}
return 1;
}
/*--------------------------------------------------------------------------*/
static void writeMotPos(SConnection *pCon, char *name,
float val, float target){
char pBueffel[132];
snprintf(pBueffel,131,"Driving %5s from %8.3f to %8.3f",
name, val, target);
SCWrite(pCon,pBueffel,eWarning);
}
/*---------------------------------------------------------------------------*/
static int startMotors(ptasMot self, tasAngles angles,
SConnection *pCon, int driveQ){
SConnection *pCon, int driveQ, int driveTilt){
float val;
double curve;
int status;
@ -209,6 +220,8 @@ static int startMotors(ptasMot self, tasAngles angles,
return status;
}
}
writeMotPos(pCon,"a1",val, angles.monochromator_two_theta/2.);
val = self->math->motors[A2]->pDrivInt->GetValue(self->math->motors[A2],pCon);
if(ABS(val - angles.monochromator_two_theta) > MOTPREC){
status = self->math->motors[A2]->pDrivInt->SetValue(self->math->motors[A2],
@ -218,6 +231,8 @@ static int startMotors(ptasMot self, tasAngles angles,
return status;
}
}
writeMotPos(pCon,"a2",val, angles.monochromator_two_theta);
if(self->math->motors[MCV] != NULL){
curve = maCalcVerticalCurvature(self->math->machine.monochromator,
angles.monochromator_two_theta);
@ -227,10 +242,12 @@ static int startMotors(ptasMot self, tasAngles angles,
pCon,
curve);
if(status != OKOK){
return status;
return status;
}
}
}
writeMotPos(pCon,"mcv",val, curve);
}
if(self->math->motors[MCH] != NULL){
curve = maCalcHorizontalCurvature(self->math->machine.monochromator,
angles.monochromator_two_theta);
@ -243,6 +260,7 @@ static int startMotors(ptasMot self, tasAngles angles,
return status;
}
}
writeMotPos(pCon,"mch",val, curve);
}
/*
@ -259,6 +277,9 @@ static int startMotors(ptasMot self, tasAngles angles,
return status;
}
}
writeMotPos(pCon,self->math->motors[A5]->name,
val, angles.analyzer_two_theta/2.);
val = self->math->motors[A6]->pDrivInt->GetValue(self->math->motors[A6],pCon);
if(ABS(val - angles.analyzer_two_theta) > MOTPREC){
status = self->math->motors[A6]->pDrivInt->SetValue(self->math->motors[A6],
@ -268,6 +289,8 @@ static int startMotors(ptasMot self, tasAngles angles,
return status;
}
}
writeMotPos(pCon,"a6",val, angles.analyzer_two_theta);
if(self->math->motors[ACV] != NULL){
curve = maCalcVerticalCurvature(self->math->machine.analyzer,
angles.analyzer_two_theta);
@ -280,6 +303,7 @@ static int startMotors(ptasMot self, tasAngles angles,
return status;
}
}
writeMotPos(pCon,"acv",val, curve);
}
if(self->math->motors[ACH] != NULL){
curve = maCalcHorizontalCurvature(self->math->machine.analyzer,
@ -295,6 +319,7 @@ static int startMotors(ptasMot self, tasAngles angles,
}
}
}
writeMotPos(pCon,"ach",val, curve);
}
if(driveQ == 0){
@ -313,6 +338,8 @@ static int startMotors(ptasMot self, tasAngles angles,
return status;
}
}
writeMotPos(pCon,"a3",val, angles.a3);
val = self->math->motors[A4]->pDrivInt->GetValue(self->math->motors[A4],pCon);
if(ABS(val - angles.sample_two_theta) > MOTPREC){
status = self->math->motors[A4]->pDrivInt->SetValue(self->math->motors[A4],
@ -322,30 +349,37 @@ static int startMotors(ptasMot self, tasAngles angles,
return status;
}
}
val = self->math->motors[SGL]->pDrivInt->GetValue(self->math->motors[SGL],pCon);
if(ABS(val - angles.sgl) > MOTPREC){
status = self->math->motors[SGL]->pDrivInt->SetValue(self->math->motors[SGL],
pCon,
writeMotPos(pCon,"a4",val, angles.sample_two_theta);
if(driveTilt == 1){
val = self->math->motors[SGL]->pDrivInt->GetValue(self->math->motors[SGL],pCon);
if(ABS(val - angles.sgl) > MOTPREC){
status = self->math->motors[SGL]->pDrivInt->SetValue(self->math->motors[SGL],
pCon,
angles.sgl);
if(status != OKOK){
return status;
if(status != OKOK){
return status;
}
}
}
val = self->math->motors[SGU]->pDrivInt->GetValue(self->math->motors[SGU],pCon);
if(ABS(val - angles.sgu) > MOTPREC){
status = self->math->motors[SGU]->pDrivInt->SetValue(self->math->motors[SGU],
writeMotPos(pCon,"sgl",val, angles.sgl);
val = self->math->motors[SGU]->pDrivInt->GetValue(self->math->motors[SGU],pCon);
if(ABS(val - angles.sgu) > MOTPREC){
status = self->math->motors[SGU]->pDrivInt->SetValue(self->math->motors[SGU],
pCon,
angles.sgu);
if(status != OKOK){
return status;
if(status != OKOK){
return status;
}
}
writeMotPos(pCon,"sgu",val, angles.sgu);
}
self->math->mustDrive = 0;
return OKOK;
}
/*---------------------------------------------------------------------------*/
static int checkQMotorLimits(ptasMot self, SConnection *pCon,
tasAngles angles){
tasAngles angles, int driveTilt){
int status, retVal = 1;
char error[131];
char pBueffel[256];
@ -370,31 +404,34 @@ static int checkQMotorLimits(ptasMot self, SConnection *pCon,
SCWrite(pCon,pBueffel,eError);
}
status = self->math->motors[A3]->pDrivInt->CheckLimits(self->math->motors[SGU],
angles.sgu,
error,
131);
if(status != 1) {
retVal = 0;
snprintf(pBueffel,256,"ERROR: limit violation an SGU: %s", error);
SCWrite(pCon,pBueffel,eError);
}
if(driveTilt == 1){
status = self->math->motors[A3]->pDrivInt->CheckLimits(self->math->motors[SGU],
angles.sgu,
error,
131);
if(status != 1) {
retVal = 0;
snprintf(pBueffel,256,"ERROR: limit violation an SGU: %s", error);
SCWrite(pCon,pBueffel,eError);
}
status = self->math->motors[SGL]->pDrivInt->CheckLimits(self->math->motors[SGL],
angles.sgl,
error,
131);
if(status != 1) {
retVal = 0;
snprintf(pBueffel,256,"ERROR: limit violation an SGL: %s", error);
SCWrite(pCon,pBueffel,eError);
status = self->math->motors[SGL]->pDrivInt->CheckLimits(self->math->motors[SGL],
angles.sgl,
error,
131);
if(status != 1) {
retVal = 0;
snprintf(pBueffel,256,"ERROR: limit violation an SGL: %s", error);
SCWrite(pCon,pBueffel,eError);
}
}
return retVal;
}
/*-----------------------------------------------------------------------------*/
static int calculateAndDrive(ptasMot self, SConnection *pCon){
tasAngles angles;
int status, driveQ = 1;
int status, driveQ = 1, driveTilt = 1;
MATRIX scatteringPlaneNormal = NULL;
if(self->math->ubValid == 0){
SCWrite(pCon,"WARNING: UB matrix invalid",eWarning);
@ -424,14 +461,35 @@ static int calculateAndDrive(ptasMot self, SConnection *pCon){
driveQ = 0;
break;
}
if(!checkQMotorLimits(self,pCon,angles)){
driveQ = 0;
/**
* check out of plane condition and permission
*/
if(self->math->outOfPlaneAllowed != 1){
scatteringPlaneNormal = calcScatteringPlaneNormal(self->math->r1.qe,
self->math->r2.qe);
if(scatteringPlaneNormal == NULL){
SCWrite(pCon,"ERROR: unable to calculate scattering plane normal",eError);
driveQ = 0;
} else {
if(!isInPlane(scatteringPlaneNormal,self->math->target)){
SCWrite(pCon,
"WARNING: scattering vector is out of plane and you disallowed me to try to drive there",
eWarning);
}
}
driveTilt = 0;
}
if(driveQ != 0){
if(!checkQMotorLimits(self,pCon,angles,driveTilt)){
driveQ = 0;
}
}
if(driveQ == 0){
SCWrite(pCon,"WARNING: NOT driving Q-vector because of errors",eError);
}
return startMotors(self,angles,pCon, driveQ);
return startMotors(self,angles,pCon, driveQ,driveTilt);
}
/*-----------------------------------------------------------------------------*/
static int checkMotors(ptasMot self, SConnection *pCon){