From 3ddb19d8a9b654c61bc360b6559c690a752f6219 Mon Sep 17 00:00:00 2001 From: cvs Date: Mon, 14 Jul 2003 11:56:54 +0000 Subject: [PATCH] - Improvements to the chooper driver for the SANS2 chopper - Fixes to the new counter and motor drivers - Updated Linux makefiles to linux_def SKIPPED: psi/dornier2.c psi/el734hp.c psi/el737hpdriv.c psi/makefile_linux psi/psi.c psi/hardsup/makefile_linux psi/tecs/makefile_linux --- fitcenter.c | 22 +++++++++++++--------- makefile_linux | 9 ++------- matrix/makefile_linux | 5 ++--- motor.c | 1 + scan.c | 6 ++++++ scan.h | 5 +---- scan.i | 3 +-- scan.tex | 4 ++++ scan.w | 4 ++++ test.tcl | 4 ++-- userscan.c | 2 +- velo.c | 6 +++++- 12 files changed, 42 insertions(+), 29 deletions(-) diff --git a/fitcenter.c b/fitcenter.c index 0a2d9f20..d05fdb99 100644 --- a/fitcenter.c +++ b/fitcenter.c @@ -102,17 +102,21 @@ GetScanVarName(self->pScan,0,self->pName,131); /* correct fAxis for softzero points and sign - when the scan variable is a motor */ - pMot = FindMotor(pServ->pSics,self->pName); - if(pMot) + when the scan variable is a motor + */ + if(!isScanVarSoft(self->pScan)) { - i = MotorGetPar(pMot,"softzero",&fZero); - i = MotorGetPar(pMot,"sign",&fSign); - assert(i); - for(i = 0; i < self->iNP; i++) + pMot = FindMotor(pServ->pSics,self->pName); + if(pMot) { - self->fAxis[i] -= fZero; - self->fAxis[i] *= fSign; + i = MotorGetPar(pMot,"softzero",&fZero); + i = MotorGetPar(pMot,"sign",&fSign); + assert(i); + for(i = 0; i < self->iNP; i++) + { + self->fAxis[i] -= fZero; + self->fAxis[i] *= fSign; + } } } diff --git a/makefile_linux b/makefile_linux index f47921b2..64a2c25c 100644 --- a/makefile_linux +++ b/makefile_linux @@ -5,23 +5,18 @@ # Mark Koennecke 1996-2001 # Markus Zolliker, March 2003 #========================================================================== -# the following lines only for fortified version -#DFORTIFY=-DFORTIFY -#FORTIFYOBJ=strdup.o fortify.o -#========================================================================== # assign if the National Instrument GPIB driver is available #NI= -DHAVENI #NIOBJ= nigpib.o #NILIB=-lgpibenet -#----------------select proper Makefile -MFLAGS= -f makefile_linux + +include linux_def CC = gcc CFLAGS = -I$(HDFROOT)/include -DHDF4 -DHDF5 $(NI) -Ipsi/hardsup -I. \ -fwritable-strings -DCYGNUS -DNONINTF -g $(DFORTIFY) BINTARGET = bin -HDFROOT=/afs/psi.ch/project/sinq/linux EXTRA=nintf.o SUBLIBS = psi/libpsi.a psi/hardsup/libhlib.a matrix/libmatrix.a \ psi/tecs/libtecsl.a diff --git a/matrix/makefile_linux b/matrix/makefile_linux index 8a3b93cf..2be8fbda 100644 --- a/matrix/makefile_linux +++ b/matrix/makefile_linux @@ -5,9 +5,8 @@ # Mark Koennecke, November 1996 # Markus Zolliker, March 2003 #-------------------------------------------------------------------------- -# the following line only for fortified version -DFORTIFY=-DFORTIFY -#========================================================================== + +include ../linux_def CC = gcc CFLAGS = -g $(DFORTIFY) diff --git a/motor.c b/motor.c index e57c3feb..23912076 100644 --- a/motor.c +++ b/motor.c @@ -213,6 +213,7 @@ static int evaluateStatus(pMotor self, SConnection *pCon) MotorGetSoftPosition(self,pCon,&sCall.fVal); sCall.pName = self->name; InvokeCallBack(self->pCall, MOTEND, &sCall); + MotorGetHardPosition(self,pCon,&fHard); self->fPosition = fHard; if(absf(fHard - self->fTarget) > ObVal(self->ParArray,PREC)) diff --git a/scan.c b/scan.c index 56fae36b..0769858e 100644 --- a/scan.c +++ b/scan.c @@ -557,6 +557,7 @@ extern void SNXFormatTime(char *pBuffer, int iLen); self->ScanDrive = ScanDrive; self->ScanCount = ScanCount; self->CollectScanData = CollectScanData; + self->posSoft = 0; strcpy(self->ext,".dat"); return 1; @@ -1715,6 +1716,10 @@ int StoreScanCounts(pScanData self, char *data) return 0; } } +/*---------------------------------------------------------------------*/ +int isScanVarSoft(pScanData self){ + return self->posSoft; +} /*-------------------------------------------------------------------------*/ int GetScanVarStep(pScanData self, int iWhich, float *fStep) { @@ -2330,6 +2335,7 @@ int StoreScanCounts(pScanData self, char *data) { ResetScanFunctions(self); self->CollectScanData = CollectScanDataJochen; + self->posSoft = 1; SCSendOK(pCon); return 1; } diff --git a/scan.h b/scan.h index 4fe5d97a..5ed7943e 100644 --- a/scan.h +++ b/scan.h @@ -37,6 +37,7 @@ char *pName, int iLength); int GetScanVarStep(pScanData self, int iWhich, float *fStep); + int isScanVarSoft(pScanData self); int GetScanMonitor(pScanData self, int iWhich, long *lData, int iDataLen); int GetScanNP(pScanData self); @@ -78,7 +79,3 @@ #endif - - - - diff --git a/scan.i b/scan.i index 4b059e60..940c928f 100644 --- a/scan.i +++ b/scan.i @@ -51,6 +51,7 @@ (pScanData self, int iP); long lPos; + int posSoft; void *pCounterData; char pCounterName[512]; int iChannel; @@ -62,5 +63,3 @@ void *pSpecial; } ScanData; - - diff --git a/scan.tex b/scan.tex index 48bcd39c..cef6af28 100644 --- a/scan.tex +++ b/scan.tex @@ -79,6 +79,7 @@ $\langle$scandata {\footnotesize ?}$\rangle\equiv$ \mbox{}\verb@ (pScanData self,@\\ \mbox{}\verb@ int iP);@\\ \mbox{}\verb@ long lPos;@\\ +\mbox{}\verb@ int posSoft;@\\ \mbox{}\verb@ void *pCounterData;@\\ \mbox{}\verb@ char pCounterName[512];@\\ \mbox{}\verb@ int iChannel;@\\ @@ -158,6 +159,8 @@ This function together with ScanDrive and the data writing functions allow for \item[CollectScanData] reads all the scan data into the scan's data structures after any scan point. Overload this if a different storage scheme is required especiallay for polarising scans. +\item[posSoft] is a flag which is true if scan variable are stored with + soft position, i.e. with zeropoints applied. \item[pCounterData] is a pointer to a counter structure. This defines the counter to use and is initialized at creation of the scan data structure. \item[pCountername] is the name of the counter used. @@ -210,6 +213,7 @@ $\langle$scaninter {\footnotesize ?}$\rangle\equiv$ \mbox{}\verb@ char *pName, int iLength);@\\ \mbox{}\verb@ int GetScanVarStep(pScanData self, int iWhich, @\\ \mbox{}\verb@ float *fStep);@\\ +\mbox{}\verb@ int isScanVarSoft(pScanData self);@\\ \mbox{}\verb@ int GetScanMonitor(pScanData self, int iWhich, @\\ \mbox{}\verb@ long *lData, int iDataLen);@\\ \mbox{}\verb@ int GetScanNP(pScanData self);@\\ diff --git a/scan.w b/scan.w index d99a931a..41a9ffb2 100644 --- a/scan.w +++ b/scan.w @@ -74,6 +74,7 @@ steps in scan processing which is already partly implemented. (pScanData self, int iP); long lPos; + int posSoft; void *pCounterData; char pCounterName[512]; int iChannel; @@ -146,6 +147,8 @@ This function together with ScanDrive and the data writing functions allow for \item[CollectScanData] reads all the scan data into the scan's data structures after any scan point. Overload this if a different storage scheme is required especiallay for polarising scans. +\item[posSoft] is a flag which is true if scan variable are stored with + soft position, i.e. with zeropoints applied. \item[pCounterData] is a pointer to a counter structure. This defines the counter to use and is initialized at creation of the scan data structure. \item[pCountername] is the name of the counter used. @@ -193,6 +196,7 @@ functions: char *pName, int iLength); int GetScanVarStep(pScanData self, int iWhich, float *fStep); + int isScanVarSoft(pScanData self); int GetScanMonitor(pScanData self, int iWhich, long *lData, int iDataLen); int GetScanNP(pScanData self); diff --git a/test.tcl b/test.tcl index 6f433c4e..b5ef908c 100644 --- a/test.tcl +++ b/test.tcl @@ -18,12 +18,12 @@ set shome /data/koenneck/src #ServerOption RedirectFile $shome/sics/stdout -ServerOption ReadTimeOut 100 +ServerOption ReadTimeOut 10 # timeout when checking for commands. In the main loop SICS checks for # pending commands on each connection with the above timeout, has # PERFORMANCE impact! -ServerOption AcceptTimeOut 100 +ServerOption AcceptTimeOut 10 # timeout when checking for connection req. # Similar to above, but for connections diff --git a/userscan.c b/userscan.c index 5579db35..80f23032 100644 --- a/userscan.c +++ b/userscan.c @@ -48,7 +48,7 @@ static int UserCount(pScanData self, int iPoint) } /* invoke command */ - sprintf(pBueffel,"%s %d",self->pCommand, iPoint); + snprintf(pBueffel,511,"%s %d",self->pCommand, iPoint); status = Tcl_GlobalEval(self->pSics->pTcl,pBueffel); if(status != TCL_OK) { diff --git a/velo.c b/velo.c index e2302c52..0134f155 100644 --- a/velo.c +++ b/velo.c @@ -194,7 +194,11 @@ iRet = self->pDriv->GetStatus(self->pDriv,&iSig,&fVal); InvokeCallBack(self->pCall,iSig,&fVal); - switch(iRet) + if(SCGetInterrupt(pCon) != eContinue) + { + return HWFault; + } + switch(iRet) { case VSACCEL: return HWBusy;