- fixed a bug in amorstat which resulted in bad scan axis to be sent

- added GetSoftVar to scan module.
- Made sps moddule give up only after three tries to get command through
- Added build script
This commit is contained in:
cvs
2000-09-07 10:09:38 +00:00
parent 1552604aa6
commit 63f8406f52
18 changed files with 192 additions and 38 deletions

View File

@ -943,7 +943,6 @@
/* set modified interface functions */ /* set modified interface functions */
pAOM->pDes->GetInterface = A2TGetInterface; pAOM->pDes->GetInterface = A2TGetInterface;
pAOM->pDriv->Halt = A2THalt; pAOM->pDriv->Halt = A2THalt;
pAOM->pDes->SaveStatus = NULL;
pAOM->pDriv->CheckLimits = ANA2TCheck; pAOM->pDriv->CheckLimits = ANA2TCheck;
pAOM->pDriv->SetValue = ANA2TSetValue; pAOM->pDriv->SetValue = ANA2TSetValue;
pAOM->pDriv->GetValue = ANA2TGetValue; pAOM->pDriv->GetValue = ANA2TGetValue;

View File

@ -85,7 +85,7 @@
return 0; return 0;
} }
iAxis[0] = htonl(iLength); iAxis[0] = htonl(iLength);
GetScanVar(pScan,0,fAxis,iLength); GetSoftScanVar(pScan,0,fAxis,iLength);
GetScanVarName(pScan,0,pName,39); GetScanVarName(pScan,0,pName,39);
sprintf(pBueffel,"arrowaxis_%s",pName); sprintf(pBueffel,"arrowaxis_%s",pName);
for(i = 0 ; i < iLength; i++) for(i = 0 ; i < iLength; i++)

24
build Executable file
View File

@ -0,0 +1,24 @@
#!/bin/sh
#---------------------------------------------------------------------------
# build SICS from Scratch
#
# Mark Koennecke, September 2000
#--------------------------------------------------------------------------
#------- build tecs
cd tecs
make
cd ..
#----- build hardsup
cd hardsup
make
cd ..
#----- build difrac
cd difrac
make
cd ..
#------- finally build SICS
make

View File

@ -1,3 +1,3 @@
7288 7292
NEVER, EVER modify or delete this file NEVER, EVER modify or delete this file
You'll risk eternal damnation and a reincarnation as a cockroach!|n You'll risk eternal damnation and a reincarnation as a cockroach!|n

View File

@ -31,6 +31,10 @@ $\langle$fitinter {\footnotesize ?}$\rangle\equiv$
\mbox{}\verb@ -2 when right FWHM could not be found@\\ \mbox{}\verb@ -2 when right FWHM could not be found@\\
\mbox{}\verb@ 1 on success@\\ \mbox{}\verb@ 1 on success@\\
\mbox{}\verb@ */@\\ \mbox{}\verb@ */@\\
\mbox{}\verb@ int CalculateFitFromData(pFit self, float fAxis[], long lSum[], @\\
\mbox{}\verb@ int iLen);@\\
\mbox{}\verb@ void GetFitResults(pFit self, float *fNewCenter, float *fStdDev,@\\
\mbox{}\verb@ float *FWHM, float *fMax);@\\
\mbox{}\verb@ int DriveCenter(pFit self, SConnection *pCon, SicsInterp *pSics);@\\ \mbox{}\verb@ int DriveCenter(pFit self, SConnection *pCon, SicsInterp *pSics);@\\
\mbox{}\verb@/*-------------------------------------------------------------------------*/@\\ \mbox{}\verb@/*-------------------------------------------------------------------------*/@\\
\mbox{}\verb@ int FitFactory(SConnection *pCon,SicsInterp *pSics, void *pData,@\\ \mbox{}\verb@ int FitFactory(SConnection *pCon,SicsInterp *pSics, void *pData,@\\

View File

@ -1,8 +1,9 @@
\subsection{Chopper Controller} \subsection{Chopper Controller}
Yet another way to deal with a controller has beenn devised for Yet another way to deal with a controller has been devised for
SICS. This uses the concept of a general controller which can have SICS. This uses the concept of a general controller which can have
parameters enquired and set. Furthermore it may have parameters which parameters enquired and set. Furthermore it may have parameters which
may be driven like a motor through a special adapter. This scheme is may be driven like a motor or environment controller through special
adapters . This scheme is
used for the chopper controller for FOCUS. used for the chopper controller for FOCUS.
\begin{itemize} \begin{itemize}
\item A driver for a particular controller which allows to set and get \item A driver for a particular controller which allows to set and get
@ -11,6 +12,7 @@ parameters.
\item An adapter object which allows to drive special parameters in a general \item An adapter object which allows to drive special parameters in a general
controller. Such adapter objects can be configured for each drivable parameter controller. Such adapter objects can be configured for each drivable parameter
in a controller. in a controller.
\item An adapter to an environment controller driver.
\end{itemize} \end{itemize}
The test case for this way of doing things is a controller for running The test case for this way of doing things is a controller for running
choppers. This is why it gets the name. choppers. This is why it gets the name.
@ -85,7 +87,7 @@ fValue. The last is floating point which covers the frequent
occurence of numeric values. occurence of numeric values.
\item[SetPar2] The same as SetPar but uses test string as input for \item[SetPar2] The same as SetPar but uses test string as input for
parameter setting. parameter setting.
\item[GetPar] retrieves the parameter parname formatted as test. The \item[GetPar] retrieves the parameter parname formatted as text. The
value is put into the buffer pBuffer. iBufLen is the maximum number of value is put into the buffer pBuffer. iBufLen is the maximum number of
bytes permissable for pBuffer. bytes permissable for pBuffer.
\item[CheckPar] When parameters are driven a means is needed to find \item[CheckPar] When parameters are driven a means is needed to find
@ -180,7 +182,7 @@ $\langle$chocodata {\footnotesize ?}$\rangle\equiv$
It consists just of the standard SICS object descriptor and a pointer It consists just of the standard SICS object descriptor and a pointer
to the driver. to the driver.
\subsubsection{The Drive Adapter} \subsubsection{The Drive And Environment Adapters}
Most of the work of the drive adaptor is hidden in the functions Most of the work of the drive adaptor is hidden in the functions
implementing the drivable interface. Thus the interface to the implementing the drivable interface. Thus the interface to the
DriveAdapter is fairly simple: DriveAdapter is fairly simple:
@ -199,6 +201,8 @@ $\langle$adapter {\footnotesize ?}$\rangle\equiv$
\mbox{}\verb@ int CHAdapterAction(SConnection *pCon, SicsInterp *pSics, @\\ \mbox{}\verb@ int CHAdapterAction(SConnection *pCon, SicsInterp *pSics, @\\
\mbox{}\verb@ void *pData,@\\ \mbox{}\verb@ void *pData,@\\
\mbox{}\verb@ int argc, char *argv[]);@\\ \mbox{}\verb@ int argc, char *argv[]);@\\
\mbox{}\verb@@\\
\mbox{}\verb@ pEVDriver MakeControllerEnvironmentDriver(int argc, char *argv[]);@\\
\mbox{}\verb@ @\\ \mbox{}\verb@ @\\
\mbox{}\verb@@$\diamond$ \mbox{}\verb@@$\diamond$
\end{list} \end{list}
@ -215,6 +219,8 @@ creating a drive adapter.
\item[CHAdapterAction] is the SICS interpreter function for \item[CHAdapterAction] is the SICS interpreter function for
representing the object in SICS. Just a single action is supported: representing the object in SICS. Just a single action is supported:
request the value of the parameter. request the value of the parameter.
\item[MakeControllerEnvironmentDriver] creates an environment control
driver for a parameter in a general controller object.
\end{description} \end{description}
The data structure for the drive adapter is slightly more interesting: The data structure for the drive adapter is slightly more interesting:
@ -253,8 +259,30 @@ $\langle$adadata {\footnotesize ?}$\rangle\equiv$
this adapter. this adapter.
\end{description} \end{description}
This is the data structure for the private part of the environment
controller driver:
\begin{flushleft} \small \begin{flushleft} \small
\begin{minipage}{\linewidth} \label{scrap6} \begin{minipage}{\linewidth} \label{scrap6}
$\langle$evada {\footnotesize ?}$\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@ typedef struct __CHEV {@\\
\mbox{}\verb@ char *pParName;@\\
\mbox{}\verb@ pCodri pDriv;@\\
\mbox{}\verb@ int iLastError;@\\
\mbox{}\verb@ }CHev, *pCHev;@\\
\mbox{}\verb@@$\diamond$
\end{list}
\vspace{-1ex}
\footnotesize\addtolength{\baselineskip}{-1ex}
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item Macro referenced in scrap ?.
\end{list}
\end{minipage}\\[4ex]
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth} \label{scrap7}
\verb@"codri.h"@ {\footnotesize ? }$\equiv$ \verb@"codri.h"@ {\footnotesize ? }$\equiv$
\vspace{-1ex} \vspace{-1ex}
\begin{list}{}{} \item \begin{list}{}{} \item
@ -281,7 +309,7 @@ this adapter.
\end{minipage}\\[4ex] \end{minipage}\\[4ex]
\end{flushleft} \end{flushleft}
\begin{flushleft} \small \begin{flushleft} \small
\begin{minipage}{\linewidth} \label{scrap7} \begin{minipage}{\linewidth} \label{scrap8}
\verb@"choco.h"@ {\footnotesize ? }$\equiv$ \verb@"choco.h"@ {\footnotesize ? }$\equiv$
\vspace{-1ex} \vspace{-1ex}
\begin{list}{}{} \item \begin{list}{}{} \item
@ -308,7 +336,7 @@ this adapter.
\end{minipage}\\[4ex] \end{minipage}\\[4ex]
\end{flushleft} \end{flushleft}
\begin{flushleft} \small \begin{flushleft} \small
\begin{minipage}{\linewidth} \label{scrap8} \begin{minipage}{\linewidth} \label{scrap9}
\verb@"chadapter.h"@ {\footnotesize ? }$\equiv$ \verb@"chadapter.h"@ {\footnotesize ? }$\equiv$
\vspace{-1ex} \vspace{-1ex}
\begin{list}{}{} \item \begin{list}{}{} \item
@ -327,6 +355,7 @@ this adapter.
\mbox{}\verb@@$\langle$adapter {\footnotesize ?}$\rangle$\verb@@\\ \mbox{}\verb@@$\langle$adapter {\footnotesize ?}$\rangle$\verb@@\\
\mbox{}\verb@#ifdef CHADAINTERNAL@\\ \mbox{}\verb@#ifdef CHADAINTERNAL@\\
\mbox{}\verb@@$\langle$adadata {\footnotesize ?}$\rangle$\verb@@\\ \mbox{}\verb@@$\langle$adadata {\footnotesize ?}$\rangle$\verb@@\\
\mbox{}\verb@@$\langle$evada {\footnotesize ?}$\rangle$\verb@@\\
\mbox{}\verb@#endif@\\ \mbox{}\verb@#endif@\\
\mbox{}\verb@#endif@\\ \mbox{}\verb@#endif@\\
\mbox{}\verb@@$\diamond$ \mbox{}\verb@@$\diamond$

View File

@ -47,6 +47,7 @@ $\langle$VE {\footnotesize ?}$\rangle\equiv$
\mbox{}\verb@#define REFLECTIONDONE 9@\\ \mbox{}\verb@#define REFLECTIONDONE 9@\\
\mbox{}\verb@#define COUNTSTART 10@\\ \mbox{}\verb@#define COUNTSTART 10@\\
\mbox{}\verb@#define COUNTEND 11@\\ \mbox{}\verb@#define COUNTEND 11@\\
\mbox{}\verb@#define FILELOADED 12@\\
\mbox{}\verb@@$\diamond$ \mbox{}\verb@@$\diamond$
\end{list} \end{list}
\vspace{-1ex} \vspace{-1ex}

View File

@ -18,6 +18,7 @@ $\langle$hkldat {\footnotesize ?}$\rangle\equiv$
\mbox{}\verb@ typedef struct __HKL {@\\ \mbox{}\verb@ typedef struct __HKL {@\\
\mbox{}\verb@ pObjectDescriptor pDes;@\\ \mbox{}\verb@ pObjectDescriptor pDes;@\\
\mbox{}\verb@ double fUB[9];@\\ \mbox{}\verb@ double fUB[9];@\\
\mbox{}\verb@ MATRIX UBinv;@\\
\mbox{}\verb@ double fLambda;@\\ \mbox{}\verb@ double fLambda;@\\
\mbox{}\verb@ int iManual;@\\ \mbox{}\verb@ int iManual;@\\
\mbox{}\verb@ double fLastHKL[5];@\\ \mbox{}\verb@ double fLastHKL[5];@\\

View File

@ -133,13 +133,17 @@ $\langle$condat {\footnotesize ?}$\rangle\equiv$
\mbox{}\verb@ int iTelnet;@\\ \mbox{}\verb@ int iTelnet;@\\
\mbox{}\verb@ int iOutput; @\\ \mbox{}\verb@ int iOutput; @\\
\mbox{}\verb@ int iFiles;@\\ \mbox{}\verb@ int iFiles;@\\
\mbox{}\verb@ int (*write)(SConnection *pCon,@\\ \mbox{}\verb@ int (*write)(struct __SConnection *pCon,@\\
\mbox{}\verb@ char *pMessage, int iCode);@\\ \mbox{}\verb@ char *pMessage, int iCode);@\\
\mbox{}\verb@ mkChannel *pDataSock;@\\
\mbox{}\verb@ char *pDataComp;@\\
\mbox{}\verb@ int iDataPort;@\\
\mbox{}\verb@@\\ \mbox{}\verb@@\\
\mbox{}\verb@ /* execution context */@\\ \mbox{}\verb@ /* execution context */@\\
\mbox{}\verb@ int eInterrupt;@\\ \mbox{}\verb@ int eInterrupt;@\\
\mbox{}\verb@ int iUserRights;@\\ \mbox{}\verb@ int iUserRights;@\\
\mbox{}\verb@ int inUse;@\\ \mbox{}\verb@ int inUse;@\\
\mbox{}\verb@ int iDummy;@\\
\mbox{}\verb@ int iGrab;@\\ \mbox{}\verb@ int iGrab;@\\
\mbox{}\verb@ int iErrCode;@\\ \mbox{}\verb@ int iErrCode;@\\
\mbox{}\verb@ SicsInterp *pSics;@\\ \mbox{}\verb@ SicsInterp *pSics;@\\
@ -235,12 +239,14 @@ $\langle$conint {\footnotesize ?}$\rangle\equiv$
\mbox{}\verb@ void SCSignalFunction(void *pCon, int iSignal, void *pSigData);@\\ \mbox{}\verb@ void SCSignalFunction(void *pCon, int iSignal, void *pSigData);@\\
\mbox{}\verb@/* ***************************** I/O ************************************** */@\\ \mbox{}\verb@/* ***************************** I/O ************************************** */@\\
\mbox{}\verb@ int SCAddLogFile(SConnection *self, char *name);@\\ \mbox{}\verb@ int SCAddLogFile(SConnection *self, char *name);@\\
\mbox{}\verb@ int SCDelLogFile(SConnection *pCon, int iFile);@\\
\mbox{}\verb@ void SCSetOutputClass(SConnection *self, int iClass);@\\ \mbox{}\verb@ void SCSetOutputClass(SConnection *self, int iClass);@\\
\mbox{}\verb@ int SCWrite(SConnection *self, char *pBuffer, int iOut);@\\ \mbox{}\verb@ int SCWrite(SConnection *self, char *pBuffer, int iOut);@\\
\mbox{}\verb@ int SCRead(SConnection *self, char *pBuffer, int iBufLen); @\\ \mbox{}\verb@ int SCRead(SConnection *self, char *pBuffer, int iBufLen); @\\
\mbox{}\verb@ int SCPrompt(SConnection *pCon, char *pPrompt, char *pResult, int iLen);@\\ \mbox{}\verb@ int SCPrompt(SConnection *pCon, char *pPrompt, char *pResult, int iLen);@\\
\mbox{}\verb@ int SCSendOK(SConnection *self);@\\ \mbox{}\verb@ int SCSendOK(SConnection *self);@\\
\mbox{}\verb@ int SCnoSock(SConnection *pCon);@\\ \mbox{}\verb@ int SCnoSock(SConnection *pCon);@\\
\mbox{}\verb@ int SCWriteUUencoded(SConnection *pCon, char *pName, void *iData, int iLen);@\\
\mbox{}\verb@/************************* CallBack *********************************** */@\\ \mbox{}\verb@/************************* CallBack *********************************** */@\\
\mbox{}\verb@ int SCRegister(SConnection *pCon, SicsInterp *pSics,@\\ \mbox{}\verb@ int SCRegister(SConnection *pCon, SicsInterp *pSics,@\\
\mbox{}\verb@ void *pInter, long lID);@\\ \mbox{}\verb@ void *pInter, long lID);@\\

View File

@ -141,6 +141,8 @@ The interface to this object looks like this:
\mbox{}\verb@#define SCANABORT -4@\\ \mbox{}\verb@#define SCANABORT -4@\\
\mbox{}\verb@#define SYSERROR -5@\\ \mbox{}\verb@#define SYSERROR -5@\\
\mbox{}\verb@#define DRIVEERROR -6@\\ \mbox{}\verb@#define DRIVEERROR -6@\\
\mbox{}\verb@#define VARREDO -7@\\
\mbox{}\verb@@\\
\mbox{}\verb@@\\ \mbox{}\verb@@\\
\mbox{}\verb@ void OptimiserClear(pOptimise self);@\\ \mbox{}\verb@ void OptimiserClear(pOptimise self);@\\
\mbox{}\verb@ int OptimiserAdd(pOptimise self,@\\ \mbox{}\verb@ int OptimiserAdd(pOptimise self,@\\

View File

@ -200,6 +200,8 @@ $\langle$scaninter {\footnotesize ?}$\rangle\equiv$
\mbox{}\verb@ @\\ \mbox{}\verb@ @\\
\mbox{}\verb@ int GetScanCounts(pScanData self, long *lData, int iDataLen);@\\ \mbox{}\verb@ int GetScanCounts(pScanData self, long *lData, int iDataLen);@\\
\mbox{}\verb@ int GetScanVar(pScanData self, int iWhich, float *fData, int iDataLen);@\\ \mbox{}\verb@ int GetScanVar(pScanData self, int iWhich, float *fData, int iDataLen);@\\
\mbox{}\verb@ int GetSoftScanVar(pScanData self, int iWhich, float *fData, int iDataLen);@\\
\mbox{}\verb@@\\
\mbox{}\verb@ int GetScanVarName(pScanData self, int iWhich, @\\ \mbox{}\verb@ int GetScanVarName(pScanData self, int iWhich, @\\
\mbox{}\verb@ char *pName, int iLength);@\\ \mbox{}\verb@ char *pName, int iLength);@\\
\mbox{}\verb@ int GetScanVarStep(pScanData self, int iWhich, @\\ \mbox{}\verb@ int GetScanVarStep(pScanData self, int iWhich, @\\
@ -262,6 +264,9 @@ standard scans.
scan. Max iDatLen entries will be copied into lData. scan. Max iDatLen entries will be copied into lData.
\item[GetScanVar] retrieves the scan positions for the scan variable \item[GetScanVar] retrieves the scan positions for the scan variable
number i. Max iDatLen entries get copied into fData. number i. Max iDatLen entries get copied into fData.
\item[GetSoftScanVar] retrieves the scan positions for the scan variable
number i. The soft positions are retrieved, not the hard position stored
during the scan.
\item[GetScanVarName] retrieves the name of scan variable i. \item[GetScanVarName] retrieves the name of scan variable i.
\item[GetScanVarStep] gets the step of the scan variable i. \item[GetScanVarStep] gets the step of the scan variable i.
\item[GetScanMonitor] allows to retrieve the monitor counts collected \item[GetScanMonitor] allows to retrieve the monitor counts collected

View File

@ -170,7 +170,7 @@ $\langle$protos2 {\footnotesize ?}$\rangle\equiv$
\vspace{-1ex} \vspace{-1ex}
\begin{list}{}{} \item \begin{list}{}{} \item
\mbox{}\verb@@\\ \mbox{}\verb@@\\
\mbox{}\verb@\*@\\ \mbox{}\verb@/*@\\
\mbox{}\verb@ int VSSetRotation(pVelSel self, SConnection *pCon, float fNew);@\\ \mbox{}\verb@ int VSSetRotation(pVelSel self, SConnection *pCon, float fNew);@\\
\mbox{}\verb@ int VSSetTilt(pVelSel self, SConnection *pCon, float FNewTilt);@\\ \mbox{}\verb@ int VSSetTilt(pVelSel self, SConnection *pCon, float FNewTilt);@\\
\mbox{}\verb@*/@\\ \mbox{}\verb@*/@\\

View File

@ -38,10 +38,25 @@ certain speed has been reached, the command to set the desired
rotation speed can be sent. The necessary mode dependent switching is rotation speed can be sent. The necessary mode dependent switching is
done in the DornierStat function. done in the DornierStat function.
\begin{flushleft} \small \begin{flushleft} \small
\begin{minipage}{\linewidth} \label{scrap1} \begin{minipage}{\linewidth} \label{scrap1}
$\langle$dh {\footnotesize ?}$\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@ int GetDornierStatus(void **pData, pDornierStatus pDornier);@\\
\mbox{}\verb@ int DornierSend(void **pData, char *pCommand, char *pReply, int iLen);@\\
\mbox{}\verb@@$\diamond$
\end{list}
\vspace{-1ex}
\footnotesize\addtolength{\baselineskip}{-1ex}
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item Macro referenced in scrap ?.
\end{list}
\end{minipage}\\[4ex]
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth} \label{scrap2}
\verb@"velodorn.h"@ {\footnotesize ? }$\equiv$ \verb@"velodorn.h"@ {\footnotesize ? }$\equiv$
\vspace{-1ex} \vspace{-1ex}
\begin{list}{}{} \item \begin{list}{}{} \item

42
scan.c
View File

@ -1467,6 +1467,48 @@ extern void SNXFormatTime(char *pBuffer, int iLen);
return 0; return 0;
} }
/* not reached */
assert(0);
}
/*--------------------------------------------------------------------------*/
int GetSoftScanVar(pScanData self, int iWhich, float *fData, int iDataLen)
{
int iEnd, i;
pVarEntry pVar = NULL;
void *pPtr = NULL;
/* does it exist ?*/
if( (iWhich < 0) || (iWhich >= self->iScanVar) )
{
return 0;
}
/* handle iEnd */
if(self->iCounts < iDataLen)
{
iEnd = self->iCounts;
}
else
{
iEnd = iDataLen;
}
DynarGet(self->pScanVar,iWhich,&pPtr);
pVar = (pVarEntry)pPtr;
if(pVar)
{
/* initialise to theoretical values */
for(i = 0; i < self->iNP; i++)
{
fData[i] = pVar->fStart + i * pVar->fStep;
}
return 1;
}
else
{
return 0;
}
/* not reached */ /* not reached */
assert(0); assert(0);
} }

2
scan.h
View File

@ -31,6 +31,8 @@
int GetScanCounts(pScanData self, long *lData, int iDataLen); int GetScanCounts(pScanData self, long *lData, int iDataLen);
int GetScanVar(pScanData self, int iWhich, float *fData, int iDataLen); int GetScanVar(pScanData self, int iWhich, float *fData, int iDataLen);
int GetSoftScanVar(pScanData self, int iWhich, float *fData, int iDataLen);
int GetScanVarName(pScanData self, int iWhich, int GetScanVarName(pScanData self, int iWhich,
char *pName, int iLength); char *pName, int iLength);
int GetScanVarStep(pScanData self, int iWhich, int GetScanVarStep(pScanData self, int iWhich,

View File

@ -200,6 +200,8 @@ $\langle$scaninter {\footnotesize ?}$\rangle\equiv$
\mbox{}\verb@ @\\ \mbox{}\verb@ @\\
\mbox{}\verb@ int GetScanCounts(pScanData self, long *lData, int iDataLen);@\\ \mbox{}\verb@ int GetScanCounts(pScanData self, long *lData, int iDataLen);@\\
\mbox{}\verb@ int GetScanVar(pScanData self, int iWhich, float *fData, int iDataLen);@\\ \mbox{}\verb@ int GetScanVar(pScanData self, int iWhich, float *fData, int iDataLen);@\\
\mbox{}\verb@ int GetSoftScanVar(pScanData self, int iWhich, float *fData, int iDataLen);@\\
\mbox{}\verb@@\\
\mbox{}\verb@ int GetScanVarName(pScanData self, int iWhich, @\\ \mbox{}\verb@ int GetScanVarName(pScanData self, int iWhich, @\\
\mbox{}\verb@ char *pName, int iLength);@\\ \mbox{}\verb@ char *pName, int iLength);@\\
\mbox{}\verb@ int GetScanVarStep(pScanData self, int iWhich, @\\ \mbox{}\verb@ int GetScanVarStep(pScanData self, int iWhich, @\\
@ -262,6 +264,9 @@ standard scans.
scan. Max iDatLen entries will be copied into lData. scan. Max iDatLen entries will be copied into lData.
\item[GetScanVar] retrieves the scan positions for the scan variable \item[GetScanVar] retrieves the scan positions for the scan variable
number i. Max iDatLen entries get copied into fData. number i. Max iDatLen entries get copied into fData.
\item[GetSoftScanVar] retrieves the scan positions for the scan variable
number i. The soft positions are retrieved, not the hard position stored
during the scan.
\item[GetScanVarName] retrieves the name of scan variable i. \item[GetScanVarName] retrieves the name of scan variable i.
\item[GetScanVarStep] gets the step of the scan variable i. \item[GetScanVarStep] gets the step of the scan variable i.
\item[GetScanMonitor] allows to retrieve the monitor counts collected \item[GetScanMonitor] allows to retrieve the monitor counts collected

5
scan.w
View File

@ -183,6 +183,8 @@ functions:
int GetScanCounts(pScanData self, long *lData, int iDataLen); int GetScanCounts(pScanData self, long *lData, int iDataLen);
int GetScanVar(pScanData self, int iWhich, float *fData, int iDataLen); int GetScanVar(pScanData self, int iWhich, float *fData, int iDataLen);
int GetSoftScanVar(pScanData self, int iWhich, float *fData, int iDataLen);
int GetScanVarName(pScanData self, int iWhich, int GetScanVarName(pScanData self, int iWhich,
char *pName, int iLength); char *pName, int iLength);
int GetScanVarStep(pScanData self, int iWhich, int GetScanVarStep(pScanData self, int iWhich,
@ -237,6 +239,9 @@ standard scans.
scan. Max iDatLen entries will be copied into lData. scan. Max iDatLen entries will be copied into lData.
\item[GetScanVar] retrieves the scan positions for the scan variable \item[GetScanVar] retrieves the scan positions for the scan variable
number i. Max iDatLen entries get copied into fData. number i. Max iDatLen entries get copied into fData.
\item[GetSoftScanVar] retrieves the scan positions for the scan variable
number i. The soft positions are retrieved, not the hard position stored
during the scan.
\item[GetScanVarName] retrieves the name of scan variable i. \item[GetScanVarName] retrieves the name of scan variable i.
\item[GetScanVarStep] gets the step of the scan variable i. \item[GetScanVarStep] gets the step of the scan variable i.
\item[GetScanMonitor] allows to retrieve the monitor counts collected \item[GetScanMonitor] allows to retrieve the monitor counts collected

64
sps.c
View File

@ -24,6 +24,7 @@
#include "bit.h" #include "bit.h"
#include "sps.i" #include "sps.i"
#include "sps.h" #include "sps.h"
#include "commandlog.h"
/*--------------------- some internal defines ----------------------------*/ /*--------------------- some internal defines ----------------------------*/
#define SPSOFFLINE -10 #define SPSOFFLINE -10
@ -69,43 +70,56 @@
int iReplyLen) int iReplyLen)
{ {
int iRet, i; int iRet, i;
char pError[132];
assert(self); assert(self);
assert(pCommand); assert(pCommand);
assert(pReply); assert(pReply);
/* Send command. If failure try to reconnect and try again. If /*
still in trouble then, give up try at least three times to get the command through before
*/ giving up
iRet = SerialWriteRead(&self->pData,pCommand,pReply,iReplyLen); */
if(iRet != 1) for(i = 0; i < 3; i++)
{ {
switch(iRet) iRet = SerialWriteRead(&self->pData,pCommand,pReply,iReplyLen);
{ if(iRet != 1)
case TIMEOUT: {
switch(iRet)
{
case TIMEOUT:
self->iLastError = COMMTMO; self->iLastError = COMMTMO;
return 0; continue;
break; break;
default: default:
self->iLastError = iRet; self->iLastError = iRet;
return 0; SerialError(iRet,pError,131);
WriteToCommandLog("SYS: SPS-TROUBLE:",pError);
SerialClose(&self->pData);
iRet = init(self);
if(iRet == 0)
{
return 0;
}
continue;
break; break;
}
}
/* now we may still have a TMO or OFL message */
if(strstr(pReply,"?TMO") != NULL)
{
self->iLastError = COMMTMO;
continue;
} }
} if(strstr(pReply,"?OFL") != NULL)
{
/* now we may still have a TMO or OFL message */ self->iLastError = SPSOFFLINE;
if(strstr(pReply,"?TMO") != NULL) return 0;
{ }
self->iLastError = COMMTMO; return 1;
return 0;
} }
if(strstr(pReply,"?OFL") != NULL) return 0;
{
self->iLastError = SPSOFFLINE;
return 0;
}
return 1;
} }
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
int SPSSetButton(pSPS self, SConnection *pCon, int iByte, int iBit) int SPSSetButton(pSPS self, SConnection *pCon, int iByte, int iBit)