- Fixed a normalisation problem in diffscan when the first value
did not have enough counts - Reduced polling frequency in emon - Fixed a scriptcontext bug which would cause it to dump core in SctTransact on interrupts - Fixed an issue with missing <nl> at the end of batch files - Added a feature which does not call halt when counting stops in hmcontrol.c This is necessary for the BOA CCD - Initalized doNotFree properly in hipadaba.c - Added the travelling salesman reflection measurement algorithm - Added another component to amorset - Removed old SicsWait from nserver.c - Added a means to nxscript to write 16 bit data for BOA - Modified tasub to accept a drivabel as a motor and not only a motor. This became necessary to make EIGER work as A2 on EIGER is a virtual motor SKIPPED: psi/amorcomp.h psi/amordrive.h psi/amorset.c psi/amorset.h psi/amorset.tex psi/amorset.w psi/el734hp.c psi/el737hpdriv.c psi/make_gen psi/pardef.c psi/polterwrite.c psi/psi.c psi/sinqhttpopt.c
This commit is contained in:
75
tasdrive.c
75
tasdrive.c
@ -7,6 +7,10 @@
|
||||
|
||||
In the long run it might be useful to switch all this to the more
|
||||
general motor list driving code.
|
||||
|
||||
Modified to rather use drivables then motors
|
||||
|
||||
Mark Koennecke, September 2011
|
||||
--------------------------------------------------------------------*/
|
||||
#include <assert.h>
|
||||
#include "sics.h"
|
||||
@ -57,12 +61,12 @@ static int readTASMotAngles(ptasUB self, SConnection * pCon,
|
||||
/*
|
||||
Monochromator
|
||||
*/
|
||||
status = MotorGetSoftPosition(self->motors[A1], pCon, &val);
|
||||
status = GetDrivablePosition(self->motors[A1], pCon, &val);
|
||||
if (status == 0) {
|
||||
return status;
|
||||
}
|
||||
theta = val;
|
||||
status = MotorGetSoftPosition(self->motors[A2], pCon, &val);
|
||||
status = GetDrivablePosition(self->motors[A2], pCon, &val);
|
||||
if (status == 0) {
|
||||
return status;
|
||||
}
|
||||
@ -76,12 +80,12 @@ static int readTASMotAngles(ptasUB self, SConnection * pCon,
|
||||
Analyzer
|
||||
*/
|
||||
if (self->tasMode != ELASTIC) {
|
||||
status = MotorGetSoftPosition(self->motors[A5], pCon, &val);
|
||||
status = GetDrivablePosition(self->motors[A5], pCon, &val);
|
||||
if (status == 0) {
|
||||
return status;
|
||||
}
|
||||
theta = val;
|
||||
status = MotorGetSoftPosition(self->motors[A6], pCon, &val);
|
||||
status = GetDrivablePosition(self->motors[A6], pCon, &val);
|
||||
if (status == 0) {
|
||||
return status;
|
||||
}
|
||||
@ -97,22 +101,22 @@ static int readTASMotAngles(ptasUB self, SConnection * pCon,
|
||||
/*
|
||||
crystal
|
||||
*/
|
||||
status = MotorGetSoftPosition(self->motors[A3], pCon, &val);
|
||||
status = GetDrivablePosition(self->motors[A3], pCon, &val);
|
||||
if (status == 0) {
|
||||
return status;
|
||||
}
|
||||
ang->a3 = val;
|
||||
status = MotorGetSoftPosition(self->motors[A4], pCon, &val);
|
||||
status = GetDrivablePosition(self->motors[A4], pCon, &val);
|
||||
if (status == 0) {
|
||||
return status;
|
||||
}
|
||||
ang->sample_two_theta = val;
|
||||
status = MotorGetSoftPosition(self->motors[SGU], pCon, &val);
|
||||
status = GetDrivablePosition(self->motors[SGU], pCon, &val);
|
||||
if (status == 0) {
|
||||
return status;
|
||||
}
|
||||
ang->sgu = val;
|
||||
status = MotorGetSoftPosition(self->motors[SGL], pCon, &val);
|
||||
status = GetDrivablePosition(self->motors[SGL], pCon, &val);
|
||||
if (status == 0) {
|
||||
return status;
|
||||
}
|
||||
@ -205,6 +209,7 @@ static int TASHalt(void *pData)
|
||||
{
|
||||
ptasMot self = (ptasMot) pData;
|
||||
int i, length = 12;
|
||||
pIDrivable pDriv = NULL;
|
||||
|
||||
assert(self);
|
||||
/**
|
||||
@ -215,7 +220,8 @@ static int TASHalt(void *pData)
|
||||
}
|
||||
for (i = 0; i < length; i++) {
|
||||
if (self->math->motors[i] != NULL) {
|
||||
self->math->motors[i]->pDrivInt->Halt(self->math->motors[i]);
|
||||
pDriv = GetDrivableInterface(self->math->motors[i]);
|
||||
pDriv->Halt(self->math->motors[i]);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
@ -239,7 +245,7 @@ static float getMotorValue(pMotor mot, SConnection * pCon)
|
||||
{
|
||||
float val;
|
||||
|
||||
MotorGetSoftPosition(mot, pCon, &val);
|
||||
GetDrivablePosition(mot, pCon, &val);
|
||||
return val;
|
||||
}
|
||||
|
||||
@ -250,17 +256,23 @@ static int startTASMotor(pMotor mot, SConnection * pCon, char *name,
|
||||
float val, fixed;
|
||||
int status = OKOK;
|
||||
char buffer[132];
|
||||
pIDrivable pDriv = NULL;
|
||||
pDummy dum = NULL;
|
||||
|
||||
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, eWarning);
|
||||
return OKOK;
|
||||
dum = (pDummy)mot;
|
||||
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, eWarning);
|
||||
return OKOK;
|
||||
}
|
||||
}
|
||||
mot->stopped = 0;
|
||||
if (ABS(val - target) > MOTPREC) {
|
||||
status = mot->pDrivInt->SetValue(mot, pCon, (float) target);
|
||||
pDriv = GetDrivableInterface(mot);
|
||||
status = pDriv->SetValue(mot, pCon, (float) target);
|
||||
if (status != OKOK) {
|
||||
return status;
|
||||
}
|
||||
@ -390,14 +402,13 @@ static int checkQMotorLimits(ptasMot self, SConnection * pCon,
|
||||
char error[131];
|
||||
char pBueffel[256];
|
||||
float val;
|
||||
pIDrivable pDrivInt = NULL;
|
||||
|
||||
MotorGetPar(self->math->motors[A3], "fixed", &val);
|
||||
if ((int) val != 1) {
|
||||
status =
|
||||
self->math->motors[A3]->pDrivInt->CheckLimits(self->math->
|
||||
motors[A3],
|
||||
angles.a3, error,
|
||||
131);
|
||||
pDrivInt = GetDrivableInterface(self->math->motors[A3]);
|
||||
status = pDrivInt->CheckLimits(self->math->motors[A3],
|
||||
angles.a3, error,131);
|
||||
if (status != 1) {
|
||||
retVal = 0;
|
||||
snprintf(pBueffel, 256, "ERROR: limit violation an a3: %s", error);
|
||||
@ -405,8 +416,8 @@ static int checkQMotorLimits(ptasMot self, SConnection * pCon,
|
||||
}
|
||||
}
|
||||
|
||||
status =
|
||||
self->math->motors[A4]->pDrivInt->CheckLimits(self->math->motors[A4],
|
||||
pDrivInt = GetDrivableInterface(self->math->motors[A4]);
|
||||
status = pDrivInt->CheckLimits(self->math->motors[A4],
|
||||
angles.
|
||||
sample_two_theta,
|
||||
error, 131);
|
||||
@ -417,9 +428,8 @@ static int checkQMotorLimits(ptasMot self, SConnection * pCon,
|
||||
}
|
||||
|
||||
if (driveTilt == 1) {
|
||||
status =
|
||||
self->math->motors[SGU]->pDrivInt->CheckLimits(self->math->
|
||||
motors[SGU],
|
||||
pDrivInt = GetDrivableInterface(self->math->motors[SGU]);
|
||||
status = pDrivInt->CheckLimits(self->math->motors[SGU],
|
||||
angles.sgu, error,
|
||||
131);
|
||||
if (status != 1) {
|
||||
@ -428,9 +438,8 @@ static int checkQMotorLimits(ptasMot self, SConnection * pCon,
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
}
|
||||
|
||||
status =
|
||||
self->math->motors[SGL]->pDrivInt->CheckLimits(self->math->
|
||||
motors[SGL],
|
||||
pDrivInt = GetDrivableInterface(self->math->motors[SGL]);
|
||||
status = pDrivInt->CheckLimits(self->math->motors[SGL],
|
||||
angles.sgl, error,
|
||||
131);
|
||||
if (status != 1) {
|
||||
@ -516,6 +525,7 @@ static int checkMotors(ptasMot self, SConnection * pCon)
|
||||
{
|
||||
int i, status, length = 12;
|
||||
int mask[12];
|
||||
pIDrivable pDrivInt = NULL;
|
||||
|
||||
self->math->mustRecalculate = 1;
|
||||
if (self->math->tasMode == ELASTIC) {
|
||||
@ -532,9 +542,8 @@ static int checkMotors(ptasMot self, SConnection * pCon)
|
||||
|
||||
for (i = 0; i < 12; i++) {
|
||||
if (self->math->motors[i] != NULL && mask[i] != 0) {
|
||||
status =
|
||||
self->math->motors[i]->pDrivInt->CheckStatus(self->math->
|
||||
motors[i], pCon);
|
||||
pDrivInt = GetDrivableInterface(self->math->motors[i]);
|
||||
status = pDrivInt->CheckStatus(self->math->motors[i], pCon);
|
||||
if (status != HWIdle && status != OKOK) {
|
||||
return status;
|
||||
}
|
||||
|
Reference in New Issue
Block a user