- 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

193
hkl.c
View File

@ -597,7 +597,7 @@ static MATRIX calculateScatteringVector(pHKL self, float fHKL[3])
return z1;
}
/*---------------------------------------------------------------------*/
static int calculateBisecting(MATRIX z1, pHKL self, SConnection *pCon,
static int calculateBisectingOld(MATRIX z1, pHKL self, SConnection *pCon,
float fSet[4], double myPsi, int iRetry)
{
double stt, om, chi, phi, psi, ompsi, chipsi, phipsi;
@ -674,6 +674,74 @@ static int calculateBisecting(MATRIX z1, pHKL self, SConnection *pCon,
return 0;
}
/*----------------------------------------------------------------------*/
int hklInRange(void *data, float fSet[4], int mask[4])
{
pHKL self = (pHKL)data;
float fHard, fLimit;
char pError[132];
int i, test;
double dTheta;
/* check two theta */
dTheta = fSet[0];
mask[0] = checkTheta(self, &dTheta);
fSet[0] = dTheta;
/* for omega check against the limits +- SCANBORDER in order to allow for
a omega scan
*/
MotorGetPar(self->pOmega,"softlowerlim",&fLimit);
if((float)fSet[1] < fLimit + self->scanTolerance){
mask[1] = 0;
} else {
mask[1] = 1;
MotorGetPar(self->pOmega,"softupperlim",&fLimit);
if((float)fSet[1] > fLimit - self->scanTolerance){
mask[1] = 0;
} else {
mask[1] = 1;
}
}
/* check chi and phi*/
mask[2] = MotorCheckBoundary(self->pChi,fSet[2], &fHard,pError,131);
mask[3] = MotorCheckBoundary(self->pPhi,fSet[3], &fHard,pError,131);
for(i = 0, test = 0; i < 4; i++){
test += mask[i];
}
if(test != 4) {
return 0;
} else {
return 1;
}
}
/*---------------------------------------------------------------------*/
static int calculateBisecting(MATRIX z1, pHKL self, SConnection *pCon,
float fSet[4], double myPsi, int iRetry)
{
double stt, om, chi, phi, psi, ompsi, chipsi, phipsi;
int i, test;
/*
just the plain angle calculation
*/
if(!z1mToBisecting(self->fLambda,z1,&stt,&om,&chi,&phi))
{
return 0;
}
if(iRetry == 1) {
rotatePsi(om,chi,phi,psi,&ompsi,&chipsi,&phipsi);
fSet[1] = ompsi;
fSet[2] = circlify(chipsi);
fSet[3] = circlify(phipsi);
return 1;
} else {
return findAllowedBisecting(self->fLambda, z1, fSet, hklInRange,self);
}
}
/*-----------------------------------------------------------------------*/
static int calculateNormalBeam(MATRIX z1, pHKL self, SConnection *pCon,
float fSet[4], double myPsi, int iRetry)
@ -917,6 +985,68 @@ static void stopHKLMotors(pHKL self)
self->pNu->pDrivInt->Halt(self->pNu);
}
}
/*------------------------------------------------------------------------*/
int startHKLMotors(pHKL self, SConnection *pCon, float fSet[4])
{
char pBueffel[512];
pDummy pDum;
int iRet;
/* start all the motors */
pDum = (pDummy)self->pTheta;
iRet = StartDevice(pServ->pExecutor, "HKL",
pDum->pDescriptor, pDum, pCon,fSet[0]);
if(!iRet)
{
SCWrite(pCon,"ERROR: cannot start two theta motor",eError);
stopHKLMotors(self);
return 0;
}
pDum = (pDummy)self->pOmega;
iRet = StartDevice(pServ->pExecutor, "HKL",
pDum->pDescriptor, pDum, pCon,fSet[1]);
if(!iRet)
{
SCWrite(pCon,"ERROR: cannot start omega motor",eError);
stopHKLMotors(self);
return 0;
}
/* special case: normal beam */
if(self->iNOR)
{
pDum = (pDummy)self->pNu;
iRet = StartDevice(pServ->pExecutor, "HKL",
pDum->pDescriptor, pDum, pCon,fSet[2]);
if(!iRet)
{
SCWrite(pCon,"ERROR: cannot start nu motor",eError);
return 0;
}
return 1;
}
pDum = (pDummy)self->pChi;
iRet = StartDevice(pServ->pExecutor, "HKL",
pDum->pDescriptor, pDum, pCon,fSet[2]);
if(!iRet)
{
SCWrite(pCon,"ERROR: cannot start chi motor",eError);
stopHKLMotors(self);
return 0;
}
pDum = (pDummy)self->pPhi;
iRet = StartDevice(pServ->pExecutor, "HKL",
pDum->pDescriptor, pDum, pCon,fSet[3]);
if(!iRet)
{
SCWrite(pCon,"ERROR: cannot start phi",eError);
stopHKLMotors(self);
return 0;
}
return 1;
}
/*-------------------------------------------------------------------------*/
int RunHKL(pHKL self, float fHKL[3],
float fPsi, int iHamil, SConnection *pCon)
@ -934,66 +1064,11 @@ static void stopHKLMotors(pHKL self)
return 0;
}
/* start all the motors */
pDum = (pDummy)self->pTheta;
iRet = StartDevice(pServ->pExecutor, "HKL",
pDum->pDescriptor, pDum, pCon,fSet[0]);
if(!iRet)
{
SCWrite(pCon,"ERROR: cannot start two theta motor",eError);
stopHKLMotors(self);
return 0;
}
pDum = (pDummy)self->pOmega;
iRet = StartDevice(pServ->pExecutor, "HKL",
pDum->pDescriptor, pDum, pCon,fSet[1]);
if(!iRet)
{
SCWrite(pCon,"ERROR: cannot start omega motor",eError);
stopHKLMotors(self);
return 0;
}
/* special case: normal beam */
if(self->iNOR)
{
pDum = (pDummy)self->pNu;
iRet = StartDevice(pServ->pExecutor, "HKL",
pDum->pDescriptor, pDum, pCon,fSet[2]);
if(!iRet)
{
SCWrite(pCon,"ERROR: cannot start nu motor",eError);
return 0;
}
else
{
for(i = 0; i < 3; i++)
{
self->fLastHKL[i] = fHKL[i];
}
return 1;
}
iRet = startHKLMotors(self,pCon,fSet);
if(iRet != 1){
return iRet;
}
pDum = (pDummy)self->pChi;
iRet = StartDevice(pServ->pExecutor, "HKL",
pDum->pDescriptor, pDum, pCon,fSet[2]);
if(!iRet)
{
SCWrite(pCon,"ERROR: cannot start chi motor",eError);
stopHKLMotors(self);
return 0;
}
pDum = (pDummy)self->pPhi;
iRet = StartDevice(pServ->pExecutor, "HKL",
pDum->pDescriptor, pDum, pCon,fSet[3]);
if(!iRet)
{
SCWrite(pCon,"ERROR: cannot start phi",eError);
stopHKLMotors(self);
return 0;
}
for(i = 0; i < 3; i++)
{
self->fLastHKL[i] = fHKL[i];