- Reworked the connection object and the IO system

- Reworked the support for TRICS
- Added a second generation motor
This commit is contained in:
koennecke
2009-02-03 08:05:39 +00:00
parent f6d595665e
commit 361ee9ebea
119 changed files with 16455 additions and 3674 deletions

View File

@@ -15,6 +15,7 @@
#include "hkl.h"
#include "hkl.i"
#include "hklmot.h"
#include "singlex.h"
/*=================== Object Descriptor Interface ===================================================*/
static void *HKLGetInterface(void *pData, int iID){
pHKLMot self = NULL;
@@ -28,21 +29,15 @@ static void *HKLGetInterface(void *pData, int iID){
}
return NULL;
}
/*--------------------------------------------------------------------------------------------------*/
extern void stopHKLMotors(pHKL hkl);
/*=================== Drivable Interface ============================================================*/
static int HKLHalt(void *pData){
pHKLMot self = NULL;
self = (pHKLMot)pData;
assert(self != NULL);
self->pHkl->pTheta->pDrivInt->Halt(self->pHkl->pTheta);
self->pHkl->pOmega->pDrivInt->Halt(self->pHkl->pOmega);
if(self->pHkl->iNOR == 1){
self->pHkl->pNu->pDrivInt->Halt(self->pHkl->pNu);
} else {
self->pHkl->pChi->pDrivInt->Halt(self->pHkl->pChi);
self->pHkl->pPhi->pDrivInt->Halt(self->pHkl->pPhi);
}
stopHKLMotors(self->pHkl);
return 1;
}
/*-----------------------------------------------------------------------------------------------------*/
@@ -72,26 +67,52 @@ static long HKLSetValue(void *pData, SConnection *pCon, float fVal){
/*---------------------------------------------------------------------------------------------------*/
static int checkMotors(pHKLMot self, SConnection *pCon){
int status;
pMotor pTheta, pOmega, pChi, pPhi, pNu;
pTheta = SXGetMotor(TwoTheta);
pOmega = SXGetMotor(Omega);
pChi = SXGetMotor(Chi);
pPhi = SXGetMotor(Phi);
if(pTheta == NULL || pOmega == NULL){
SCWrite(pCon,"ERROR: configuration problem, stt,om motors not found,",
eError);
return HWFault;
}
status = self->pHkl->pTheta->pDrivInt->CheckStatus(self->pHkl->pTheta, pCon);
status = pTheta->pDrivInt->CheckStatus(pTheta, pCon);
if(status != HWIdle && status != OKOK){
return status;
}
status = self->pHkl->pOmega->pDrivInt->CheckStatus(self->pHkl->pOmega, pCon);
status = pOmega->pDrivInt->CheckStatus(pOmega, pCon);
if(status != HWIdle && status != OKOK){
return status;
}
if(self->pHkl->iNOR == 1){
status = self->pHkl->pNu->pDrivInt->CheckStatus(self->pHkl->pNu, pCon);
if(SXGetMode() == NB){
pNu = SXGetMotor(Nu);
if(pNu == NULL){
SCWrite(pCon,"ERROR: configuration problem, nu motor not found,",
eError);
return HWFault;
}
status = pNu->pDrivInt->CheckStatus(pNu, pCon);
if(status != HWIdle && status != OKOK){
return status;
}
} else {
status = self->pHkl->pChi->pDrivInt->CheckStatus(self->pHkl->pChi, pCon);
pChi = SXGetMotor(Chi);
pPhi = SXGetMotor(Phi);
if(pTheta == NULL || pOmega == NULL){
SCWrite(pCon,"ERROR: configuration problem, chi, phi motors not found,",
eError);
return HWFault;
}
status = pChi->pDrivInt->CheckStatus(pChi, pCon);
if(status != HWIdle && status != OKOK){
return status;
}
status = self->pHkl->pPhi->pDrivInt->CheckStatus(self->pHkl->pPhi, pCon);
status = pPhi->pDrivInt->CheckStatus(pPhi, pCon);
if(status != HWIdle && status != OKOK){
return status;
}
@@ -204,11 +225,11 @@ int HKLMotInstall(SConnection *pCon, SicsInterp *pSics, void *pData, int argc, c
char pBuffer[131];
if(argc < 2){
SCWrite(pCon,"ERROR: Insifficient number of arguments to HKLMotInstall",eError);
return 0;
pHkl = (pHKL)FindCommandData(pSics,"hkl","4-Circle-Calculus");
} else {
strtolower(argv[1]);
pHkl = (pHKL)FindCommandData(pSics,argv[1],"4-Circle-Calculus");
}
strtolower(argv[1]);
pHkl = (pHKL)FindCommandData(pSics,argv[1],"4-Circle-Calculus");
if(pHkl == NULL){
snprintf(pBuffer,131,"ERROR: %s is not present or no HKL object",argv[1]);
SCWrite(pCon,pBuffer,eError);