- Removed SCStart/EndBuffering as far as possible and fixed an issue with

the capture command in that it not put resluts into the Tcl interpreter.
  This broke scriptcontext scripts in complicated situations.
- Resolved some issues with the TAS calculation and negative scattering sense.
- Fixed a bug which did not reset the state to idle after checking
  reachability in confvirtualmot.c


SKIPPED:
	psi/autowin.c
	psi/eigera2.c
	psi/jvlprot.c
	psi/makefile_linux
	psi/sinqhttpopt.c
	psi/tasscan.c
This commit is contained in:
koennecke
2012-10-29 12:56:29 +00:00
parent d798373fdf
commit 4f560552c4
27 changed files with 599 additions and 129 deletions

View File

@ -262,9 +262,9 @@ void InvokeNewTarget(pExeList self, char *name, float target);
/*--------------------------------------------------------------------------*/
static int startTASMotor(pMotor mot, SConnection * pCon, char *name,
double target, int silent)
double target, int silent, int stopFixed)
{
float val, fixed;
float val, fixed, precision = MOTPREC;
int status = OKOK;
char buffer[132];
pIDrivable pDriv = NULL;
@ -272,18 +272,21 @@ static int startTASMotor(pMotor mot, SConnection * pCon, char *name,
pDynString mes = NULL;
dum = (pDummy)mot;
val = getMotorValue(mot, pCon);
if(strcmp(dum->pDescriptor->name,"Motor") == 0){
val = getMotorValue(mot, pCon);
MotorGetPar(mot, "fixed", &fixed);
if (ABS(fixed - 1.0) < .1) {
snprintf(buffer, 131, "WARNING: %s is FIXED", name);
SCWrite(pCon, buffer, eLog);
return OKOK;
}
MotorGetPar(mot,"precision",&precision);
MotorGetPar(mot, "fixed", &fixed);
if (ABS(fixed - 1.0) < .1) {
if(stopFixed == 0){
snprintf(buffer, 131, "WARNING: %s is FIXED", name);
SCWrite(pCon, buffer, eLog);
}
return OKOK;
}
}
mot->stopped = 0;
if (ABS(val - target) > MOTPREC) {
pDriv = GetDrivableInterface(mot);
if (ABS(val - target) > precision) {
pDriv = GetDrivableInterface(mot);
status = pDriv->SetValue(mot, pCon, (float) target);
if(status != OKOK){
SCPrintf(pCon,eLog,"ERROR: failed to drive %s to %f", name, target);
@ -302,20 +305,21 @@ static int startMotors(ptasMot self, tasAngles angles,
SConnection * pCon, int driveQ, int driveTilt)
{
double curve;
int status, silent;
int status, silent, stopFixed;
silent = self->math->silent;
stopFixed = self->math->stopFixed;
self->math->mustRecalculate = 1;
/*
monochromator
*/
status = startTASMotor(self->math->motors[A1], pCon, "a1",
angles.monochromator_two_theta / 2., silent);
angles.monochromator_two_theta / 2., silent, stopFixed);
if (status != OKOK) {
return status;
}
status = startTASMotor(self->math->motors[A2], pCon, "a2",
angles.monochromator_two_theta, silent);
angles.monochromator_two_theta, silent,stopFixed);
if (status != OKOK) {
return status;
}
@ -324,7 +328,7 @@ static int startMotors(ptasMot self, tasAngles angles,
curve = maCalcVerticalCurvature(self->math->machine.monochromator,
angles.monochromator_two_theta);
status = startTASMotor(self->math->motors[MCV], pCon, "mcv",
curve, silent);
curve, silent,stopFixed);
if (status != OKOK) {
SCWrite(pCon,"WARNING: monochromator vertical curvature motor failed to start", eLog);
SCSetInterrupt(pCon,eContinue);
@ -335,7 +339,7 @@ static int startMotors(ptasMot self, tasAngles angles,
curve = maCalcHorizontalCurvature(self->math->machine.monochromator,
angles.monochromator_two_theta);
status = startTASMotor(self->math->motors[MCH], pCon, "mch",
curve, silent);
curve, silent,stopFixed);
if (status != OKOK) {
SCWrite(pCon,"WARNING: monochromator horizontal curvature motor failed to start", eLog);
SCSetInterrupt(pCon,eContinue);
@ -348,12 +352,12 @@ static int startMotors(ptasMot self, tasAngles angles,
*/
if (self->math->tasMode != ELASTIC) {
status = startTASMotor(self->math->motors[A5], pCon, "a5",
angles.analyzer_two_theta / 2.0, silent);
angles.analyzer_two_theta / 2.0, silent,stopFixed);
if (status != OKOK) {
return status;
}
status = startTASMotor(self->math->motors[A6], pCon, "a6",
angles.analyzer_two_theta, silent);
angles.analyzer_two_theta, silent,stopFixed);
if (status != OKOK) {
return status;
}
@ -362,7 +366,7 @@ static int startMotors(ptasMot self, tasAngles angles,
curve = maCalcVerticalCurvature(self->math->machine.analyzer,
angles.analyzer_two_theta);
status = startTASMotor(self->math->motors[ACV], pCon, "acv",
curve, silent);
curve, silent,stopFixed);
if (status != OKOK) {
SCWrite(pCon,"WARNING: analyzer vertical curvature motor failed to start", eLog);
SCSetInterrupt(pCon,eContinue);
@ -372,7 +376,7 @@ static int startMotors(ptasMot self, tasAngles angles,
curve = maCalcHorizontalCurvature(self->math->machine.analyzer,
angles.analyzer_two_theta);
status = startTASMotor(self->math->motors[ACH], pCon, "ach",
curve, silent);
curve, silent,stopFixed);
if (status != OKOK) {
SCWrite(pCon,"WARNING: analyzer horizontal curvature motor failed to start", eLog);
SCSetInterrupt(pCon,eContinue);
@ -388,24 +392,24 @@ static int startMotors(ptasMot self, tasAngles angles,
crystal
*/
status = startTASMotor(self->math->motors[A3], pCon, "a3",
angles.a3, silent);
angles.a3, silent,stopFixed);
if (status != OKOK) {
return status;
}
status = startTASMotor(self->math->motors[A4], pCon, "a4",
angles.sample_two_theta, silent);
angles.sample_two_theta, silent,stopFixed);
if (status != OKOK) {
return status;
}
if (driveTilt == 1) {
status = startTASMotor(self->math->motors[SGL], pCon, "sgl",
angles.sgl, silent);
angles.sgl, silent,stopFixed);
if (status != OKOK) {
return status;
}
status = startTASMotor(self->math->motors[SGU], pCon, "sgu",
angles.sgu, silent);
angles.sgu, silent,stopFixed);
if (status != OKOK) {
return status;
}
@ -524,6 +528,7 @@ static int calculateAndDrive(ptasMot self, SConnection * pCon)
"WARNING: scattering vector is out of plane and you disallowed me to try to drive there",
eWarning);
}
mat_free(scatteringPlaneNormal);
}
driveTilt = 0;
}
@ -623,19 +628,20 @@ static int startQMMotors(ptasMot self, tasAngles angles,
{
float val;
double curve;
int status, silent;
int status, silent, stopFixed;
silent = self->math->silent;
stopFixed = self->math->stopFixed;
/*
monochromator
*/
status = startTASMotor(self->math->motors[A1], pCon, "a1",
angles.monochromator_two_theta / 2., silent);
angles.monochromator_two_theta / 2., silent,stopFixed);
if (status != OKOK) {
return status;
}
status = startTASMotor(self->math->motors[A2], pCon, "a2",
angles.monochromator_two_theta, silent);
angles.monochromator_two_theta, silent,stopFixed);
if (status != OKOK) {
return status;
}
@ -644,7 +650,7 @@ static int startQMMotors(ptasMot self, tasAngles angles,
curve = maCalcVerticalCurvature(self->math->machine.monochromator,
angles.monochromator_two_theta);
status = startTASMotor(self->math->motors[MCV], pCon, "mcv",
curve, silent);
curve, silent,stopFixed);
if (status != OKOK) {
return status;
}
@ -654,7 +660,7 @@ static int startQMMotors(ptasMot self, tasAngles angles,
curve = maCalcHorizontalCurvature(self->math->machine.monochromator,
angles.monochromator_two_theta);
status = startTASMotor(self->math->motors[MCH], pCon, "mch",
curve, silent);
curve, silent,stopFixed);
if (status != OKOK) {
return status;
}
@ -665,12 +671,12 @@ static int startQMMotors(ptasMot self, tasAngles angles,
analyzer
*/
status = startTASMotor(self->math->motors[A5], pCon, "a5",
angles.analyzer_two_theta / 2.0, silent);
angles.analyzer_two_theta / 2.0, silent,stopFixed);
if (status != OKOK) {
return status;
}
status = startTASMotor(self->math->motors[A6], pCon, "a6",
angles.analyzer_two_theta, silent);
angles.analyzer_two_theta, silent,stopFixed);
if (status != OKOK) {
return status;
}
@ -679,7 +685,7 @@ static int startQMMotors(ptasMot self, tasAngles angles,
curve = maCalcVerticalCurvature(self->math->machine.analyzer,
angles.analyzer_two_theta);
status = startTASMotor(self->math->motors[ACV], pCon, "acv",
curve, silent);
curve, silent,stopFixed);
if (status != OKOK) {
return status;
}
@ -688,7 +694,7 @@ static int startQMMotors(ptasMot self, tasAngles angles,
curve = maCalcHorizontalCurvature(self->math->machine.analyzer,
angles.analyzer_two_theta);
status = startTASMotor(self->math->motors[ACH], pCon, "ach",
curve, silent);
curve, silent,stopFixed);
if (status != OKOK) {
return status;
}
@ -698,7 +704,7 @@ static int startQMMotors(ptasMot self, tasAngles angles,
crystal
*/
status = startTASMotor(self->math->motors[A4], pCon, "a4",
angles.sample_two_theta, silent);
angles.sample_two_theta, silent,stopFixed);
if (status != OKOK) {
return status;
}