- Implemented defpos for multiple motors
- Implemented automatic backup on parameter change - Implemented silent restore - Cleaned a couple of unused flags from connection object
This commit is contained in:
48
Makefile
48
Makefile
@ -16,12 +16,12 @@ FORTIFYOBJ = fortify.o strdup.o
|
|||||||
|
|
||||||
#==========================================================================
|
#==========================================================================
|
||||||
# assign if the National Instrument GPIB driver is available
|
# assign if the National Instrument GPIB driver is available
|
||||||
NI= -DHAVENI
|
#NI= -DHAVENI
|
||||||
NIOBJ= nigpib.o
|
#NIOBJ= nigpib.o
|
||||||
NILIB=-lgpibenet
|
#NILIB=-lgpibenet
|
||||||
#NI=
|
NI=
|
||||||
#NIOBJ=
|
NIOBJ=
|
||||||
#NILIB=
|
NILIB=
|
||||||
|
|
||||||
#----- comment or uncomment if a difrac version is required
|
#----- comment or uncomment if a difrac version is required
|
||||||
# Do not forget to remove or add comments to ofac.c as well if changes
|
# Do not forget to remove or add comments to ofac.c as well if changes
|
||||||
@ -72,18 +72,18 @@ VELOOBJ = velo.o velosim.o velodorn.o velodornier.o
|
|||||||
#----- comment or uncomment the following according to operating system
|
#----- comment or uncomment the following according to operating system
|
||||||
|
|
||||||
#------------- for Digital Unix
|
#------------- for Digital Unix
|
||||||
#BINTARGET = bin
|
BINTARGET = bin
|
||||||
#HDFROOT=/data/lnslib
|
HDFROOT=/data/lnslib
|
||||||
#CC=cc
|
CC=cc
|
||||||
#EXTRA=
|
EXTRA=
|
||||||
#CFLAGS = -I$(HDFROOT)/include -Ihardsup -DHDF4 -DHDF5 -I. -std1 \
|
#CFLAGS = -I$(HDFROOT)/include -Ihardsup -DHDF4 -DHDF5 -I. -std1 \
|
||||||
# -g -warnprotos -c
|
# -g -warnprotos -c
|
||||||
#CFLAGS = -I$(HDFROOT)/include -DFORTIFY -DHDF4 -DHDF5 -Ihardsup -g \
|
CFLAGS = -I$(HDFROOT)/include -DFORTIFY -DHDF4 -DHDF5 -Ihardsup -g \
|
||||||
# -std1 -warnprotos -c
|
-std1 -warnprotos -c
|
||||||
#LIBS = -L$(HDFROOT)/lib -Lhardsup -lhlib -Lmatrix -lmatrix -Ltecs \
|
LIBS = -L$(HDFROOT)/lib -Lhardsup -lhlib -Lmatrix -lmatrix -Ltecs \
|
||||||
# -ltecsl -ltcl8.0 -lfor $(HDFROOT)/lib/libhdf5.a \
|
-ltecsl -ltcl8.0 -lfor $(HDFROOT)/lib/libhdf5.a \
|
||||||
# $(HDFROOT)/lib/libmfhdf.a $(HDFROOT)/lib/libdf.a \
|
$(HDFROOT)/lib/libmfhdf.a $(HDFROOT)/lib/libdf.a \
|
||||||
# $(HDFROOT)/lib/libjpeg.a -lz -lm -ll -lc
|
$(HDFROOT)/lib/libjpeg.a -lz -lm -ll -lc
|
||||||
|
|
||||||
#------- for cygnus
|
#------- for cygnus
|
||||||
#HDFROOT=../HDF411
|
#HDFROOT=../HDF411
|
||||||
@ -94,16 +94,16 @@ VELOOBJ = velo.o velosim.o velodorn.o velodornier.o
|
|||||||
# -lmfhdf -ldf -ljpeg -lz -lm
|
# -lmfhdf -ldf -ljpeg -lz -lm
|
||||||
|
|
||||||
#---------- for linux
|
#---------- for linux
|
||||||
BINTARGET=../../bin
|
#BINTARGET=../../bin
|
||||||
HDFROOT=$(SINQDIR)/linux
|
#HDFROOT=$(SINQDIR)/linux
|
||||||
CC=gcc
|
#CC=gcc
|
||||||
#CFLAGS = -I$(HDFROOT)/include -DHDF4 -DHDF5 $(NI) -Ihardsup \
|
#CFLAGS = -I$(HDFROOT)/include -DHDF4 -DHDF5 $(NI) -Ihardsup \
|
||||||
# -fwritable-strings -DCYGNUS -DNONINTF -g -c
|
# -fwritable-strings -DCYGNUS -DNONINTF -g -c
|
||||||
CFLAGS = -I$(HDFROOT)/include -DFORTIFY -DHDF4 -DHDF5 $(NI) -Ihardsup \
|
#CFLAGS = -I$(HDFROOT)/include -DFORTIFY -DHDF4 -DHDF5 $(NI) -Ihardsup \
|
||||||
-fwritable-strings -DCYGNUS -DNONINTF -g -c
|
# -fwritable-strings -DCYGNUS -DNONINTF -g -c
|
||||||
LIBS= -L$(HDFROOT)/lib -Lhardsup -Ltecs -ltecsl -Lmatrix -lmatrix -lhlib \
|
#LIBS= -L$(HDFROOT)/lib -Lhardsup -Ltecs -ltecsl -Lmatrix -lmatrix -lhlib \
|
||||||
$(NILIB) -ltcl -lhdf5 -lmfhdf -ldf -ljpeg -lz -lm -lg2c -ldl
|
# $(NILIB) -ltcl -lhdf5 -lmfhdf -ldf -ljpeg -lz -lm -lg2c -ldl
|
||||||
EXTRA=nintf.o
|
#EXTRA=nintf.o
|
||||||
#---------------------------------
|
#---------------------------------
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
|
11
SCinter.c
11
SCinter.c
@ -222,15 +222,8 @@ extern char *SkipSpace(char *pPtr);
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(!pCon->iDummy)
|
printf("Executing -> %s <- from dummy socket\n", pText);
|
||||||
{
|
SICSLogWrite(pBueffel,eCommand);
|
||||||
printf("Executing -> %s <- from dummy socket\n", pText);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sprintf(pBueffel,"Executing -> %s <- from sicscron",pText);
|
|
||||||
SICSLogWrite(pBueffel,eCommand);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* convert to argc, argv */
|
/* convert to argc, argv */
|
||||||
|
154
conman.c
154
conman.c
@ -130,7 +130,6 @@ extern pServer pServ;
|
|||||||
pRes->pSics = pSics;
|
pRes->pSics = pSics;
|
||||||
pRes->eInterrupt = eContinue;
|
pRes->eInterrupt = eContinue;
|
||||||
pRes->lMagic = CONMAGIC;
|
pRes->lMagic = CONMAGIC;
|
||||||
pRes->iDummy = 0;
|
|
||||||
pRes->iLogin = 0;
|
pRes->iLogin = 0;
|
||||||
pRes->conStart = time(NULL);
|
pRes->conStart = time(NULL);
|
||||||
pRes->write = SCNormalWrite;
|
pRes->write = SCNormalWrite;
|
||||||
@ -216,7 +215,6 @@ extern pServer pServ;
|
|||||||
pRes->pSics = pSics;
|
pRes->pSics = pSics;
|
||||||
pRes->lMagic = CONMAGIC;
|
pRes->lMagic = CONMAGIC;
|
||||||
pRes->eInterrupt = eContinue;
|
pRes->eInterrupt = eContinue;
|
||||||
pRes->iDummy = 0;
|
|
||||||
pRes->iLogin = 0;
|
pRes->iLogin = 0;
|
||||||
pRes->conStart = time(NULL);
|
pRes->conStart = time(NULL);
|
||||||
pRes->write = SCNormalWrite;
|
pRes->write = SCNormalWrite;
|
||||||
@ -546,6 +544,24 @@ extern pServer pServ;
|
|||||||
}
|
}
|
||||||
return self->write(self,pBuffer,iOut);
|
return self->write(self,pBuffer,iOut);
|
||||||
}
|
}
|
||||||
|
/*-------------------------------------------------------------------------*/
|
||||||
|
writeFunc SCGetWriteFunc(SConnection *self)
|
||||||
|
{
|
||||||
|
if(!VerifyConnection(self))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return self->write;
|
||||||
|
}
|
||||||
|
/*-------------------------------------------------------------------------*/
|
||||||
|
void SCSetWriteFunc(SConnection *self, writeFunc x)
|
||||||
|
{
|
||||||
|
if(!VerifyConnection(self))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
self->write = x;
|
||||||
|
}
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
static int SCNormalWrite(SConnection *self, char *buffer, int iOut)
|
static int SCNormalWrite(SConnection *self, char *buffer, int iOut)
|
||||||
{
|
{
|
||||||
@ -658,6 +674,95 @@ extern pServer pServ;
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
int SCOnlySockWrite(SConnection *self, char *buffer, int iOut)
|
||||||
|
{
|
||||||
|
int i, iPtr, iRet;
|
||||||
|
char pBueffel[80];
|
||||||
|
|
||||||
|
if(!VerifyConnection(self))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* log it for any case */
|
||||||
|
if(self->pSock)
|
||||||
|
{
|
||||||
|
iRet = self->pSock->sockid;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
iRet = 0;
|
||||||
|
}
|
||||||
|
sprintf(pBueffel,"Next line intended for socket: %d",iRet);
|
||||||
|
SICSLogWrite(pBueffel,eInternal);
|
||||||
|
SICSLogWrite(buffer,iOut);
|
||||||
|
|
||||||
|
/* put it into the interpreter if present */
|
||||||
|
if(SCinMacro(self))
|
||||||
|
{
|
||||||
|
InterpWrite(self->pSics,buffer);
|
||||||
|
}
|
||||||
|
else /* not in interpreter, normal logic */
|
||||||
|
{
|
||||||
|
/* is this really to be printed ? */
|
||||||
|
if(iOut < self->iOutput)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* the socket */
|
||||||
|
if(self->pSock)
|
||||||
|
{
|
||||||
|
if(self->iTelnet)
|
||||||
|
{
|
||||||
|
iRet = TelnetWrite(self->pSock,buffer);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
iRet = NETWrite(self->pSock,buffer,strlen(buffer));
|
||||||
|
if(!HasNL(buffer))
|
||||||
|
{
|
||||||
|
iRet = NETWrite(self->pSock,"\n",sizeof("\n"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!iRet)
|
||||||
|
{
|
||||||
|
SCnoSock(self);
|
||||||
|
WriteToCommandLog("SYS> ","Send broken to connection");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("%s \n",buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
int SCNotWrite(SConnection *self, char *buffer, int iOut)
|
||||||
|
{
|
||||||
|
int i, iPtr, iRet;
|
||||||
|
char pBueffel[80];
|
||||||
|
|
||||||
|
if(!VerifyConnection(self))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* log it for any case */
|
||||||
|
if(self->pSock)
|
||||||
|
{
|
||||||
|
iRet = self->pSock->sockid;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
iRet = 0;
|
||||||
|
}
|
||||||
|
sprintf(pBueffel,"Next line intended for socket: %d",iRet);
|
||||||
|
SICSLogWrite(pBueffel,eInternal);
|
||||||
|
SICSLogWrite(buffer,iOut);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
/*--------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------
|
||||||
This version writes only to configured log files but not to sockets.
|
This version writes only to configured log files but not to sockets.
|
||||||
Used for automatic file execution for the WWW interface
|
Used for automatic file execution for the WWW interface
|
||||||
@ -1176,33 +1281,13 @@ extern pServer pServ;
|
|||||||
|
|
||||||
return self->eInterrupt;
|
return self->eInterrupt;
|
||||||
}
|
}
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
void SCSetError(SConnection *self, int eCode)
|
|
||||||
{
|
|
||||||
if(!VerifyConnection(self))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
self->iErrCode = eCode;
|
|
||||||
}
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
int SCGetError(SConnection *self)
|
|
||||||
{
|
|
||||||
if(!VerifyConnection(self))
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return self->iErrCode;
|
|
||||||
}
|
|
||||||
/* --------------------------------------------------------------------------*/
|
/* --------------------------------------------------------------------------*/
|
||||||
int SCInvoke(SConnection *self, SicsInterp *pInter, char *pCommand)
|
int SCInvoke(SConnection *self, SicsInterp *pInter, char *pCommand)
|
||||||
{
|
{
|
||||||
int iRet;
|
int iRet;
|
||||||
long lLen;
|
long lLen;
|
||||||
const char *pResult = NULL;
|
const char *pResult = NULL;
|
||||||
char *pBuffer = NULL;
|
char *pBuffer = NULL, *pFile = NULL;
|
||||||
char pBueffel[80];
|
char pBueffel[80];
|
||||||
int i, iSpace;
|
int i, iSpace;
|
||||||
|
|
||||||
@ -1238,8 +1323,20 @@ extern pServer pServ;
|
|||||||
/* invoke */
|
/* invoke */
|
||||||
self->inUse++;
|
self->inUse++;
|
||||||
self->eInterrupt = eContinue;
|
self->eInterrupt = eContinue;
|
||||||
self->iErrCode = OKOK;
|
self->parameterChange = 0;
|
||||||
iRet = InterpExecute(pInter,self,pCommand);
|
iRet = InterpExecute(pInter,self,pCommand);
|
||||||
|
if(self->parameterChange == 1)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
automatically save changed parameters
|
||||||
|
*/
|
||||||
|
pFile = IFindOption(pSICSOptions,"statusfile");
|
||||||
|
if(pFile != NULL)
|
||||||
|
{
|
||||||
|
WriteSicsStatus(pInter,pFile,0);
|
||||||
|
self->parameterChange = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
self->inUse--;
|
self->inUse--;
|
||||||
return iRet;
|
return iRet;
|
||||||
}
|
}
|
||||||
@ -1701,3 +1798,12 @@ extern pServer pServ;
|
|||||||
self->iGrab = 1;
|
self->iGrab = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*-----------------------------------------------------------------------*/
|
||||||
|
void SCparChange(SConnection *self)
|
||||||
|
{
|
||||||
|
if(!VerifyConnection(self))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
self->parameterChange = 1;
|
||||||
|
}
|
||||||
|
22
conman.h
22
conman.h
@ -22,6 +22,9 @@
|
|||||||
|
|
||||||
#define MAXLOGFILES 10
|
#define MAXLOGFILES 10
|
||||||
|
|
||||||
|
typedef int (*writeFunc)(struct __SConnection *pCon,
|
||||||
|
char *pMessage, int iCode);
|
||||||
|
|
||||||
typedef struct __SConnection {
|
typedef struct __SConnection {
|
||||||
/* object basics */
|
/* object basics */
|
||||||
pObjectDescriptor pDes;
|
pObjectDescriptor pDes;
|
||||||
@ -35,8 +38,7 @@
|
|||||||
int iTelnet;
|
int iTelnet;
|
||||||
int iOutput;
|
int iOutput;
|
||||||
int iFiles;
|
int iFiles;
|
||||||
int (*write)(struct __SConnection *pCon,
|
writeFunc write;
|
||||||
char *pMessage, int iCode);
|
|
||||||
mkChannel *pDataSock;
|
mkChannel *pDataSock;
|
||||||
char *pDataComp;
|
char *pDataComp;
|
||||||
int iDataPort;
|
int iDataPort;
|
||||||
@ -45,11 +47,12 @@
|
|||||||
int eInterrupt;
|
int eInterrupt;
|
||||||
int iUserRights;
|
int iUserRights;
|
||||||
int inUse;
|
int inUse;
|
||||||
int iDummy;
|
|
||||||
int iGrab;
|
int iGrab;
|
||||||
int iErrCode;
|
|
||||||
SicsInterp *pSics;
|
SicsInterp *pSics;
|
||||||
|
|
||||||
|
/* flag for parameter change */
|
||||||
|
int parameterChange;
|
||||||
|
|
||||||
/* a FIFO */
|
/* a FIFO */
|
||||||
pCosta pStack;
|
pCosta pStack;
|
||||||
|
|
||||||
@ -88,19 +91,22 @@
|
|||||||
int SCnoSock(SConnection *pCon);
|
int SCnoSock(SConnection *pCon);
|
||||||
int SCWriteUUencoded(SConnection *pCon, char *pName, void *iData, int iLen);
|
int SCWriteUUencoded(SConnection *pCon, char *pName, void *iData, int iLen);
|
||||||
int SCWriteZipped(SConnection *pCon, char *pName, void *pData, int iDataLen);
|
int SCWriteZipped(SConnection *pCon, char *pName, void *pData, int iDataLen);
|
||||||
|
writeFunc SCGetWriteFunc(SConnection *pCon);
|
||||||
|
void SCSetWriteFunc(SConnection *pCon, writeFunc x);
|
||||||
|
int SCOnlySockWrite(SConnection *self, char *buffer, int iOut);
|
||||||
|
int SCNotWrite(SConnection *self, char *buffer, int iOut);
|
||||||
/************************* CallBack *********************************** */
|
/************************* CallBack *********************************** */
|
||||||
int SCRegister(SConnection *pCon, SicsInterp *pSics,
|
int SCRegister(SConnection *pCon, SicsInterp *pSics,
|
||||||
void *pInter, long lID);
|
void *pInter, long lID);
|
||||||
int SCUnregister(SConnection *pCon, void *pInter);
|
int SCUnregister(SConnection *pCon, void *pInter);
|
||||||
/******************************* Error **************************************/
|
/******************************* Interrupt *********************************/
|
||||||
void SCSetInterrupt(SConnection *self, int eCode);
|
void SCSetInterrupt(SConnection *self, int eCode);
|
||||||
int SCGetInterrupt(SConnection *self);
|
int SCGetInterrupt(SConnection *self);
|
||||||
void SCSetError(SConnection *pCon, int iCode);
|
|
||||||
int SCGetError(SConnection *pCon);
|
|
||||||
/****************************** Macro ***************************************/
|
/****************************** Macro ***************************************/
|
||||||
int SCinMacro(SConnection *pCon);
|
int SCinMacro(SConnection *pCon);
|
||||||
int SCsetMacro(SConnection *pCon, int iMode);
|
int SCsetMacro(SConnection *pCon, int iMode);
|
||||||
|
/************************** parameters changed ? **************************/
|
||||||
|
void SCparChange(SConnection *pCon);
|
||||||
/* *************************** Info *************************************** */
|
/* *************************** Info *************************************** */
|
||||||
int SCGetRights(SConnection *self);
|
int SCGetRights(SConnection *self);
|
||||||
int SCSetRights(SConnection *pCon, int iNew);
|
int SCSetRights(SConnection *pCon, int iNew);
|
||||||
|
10
counter.c
10
counter.c
@ -230,7 +230,6 @@
|
|||||||
{
|
{
|
||||||
SCWrite(pCon,"ERROR: Cannot fix counter problem, aborting",eError);
|
SCWrite(pCon,"ERROR: Cannot fix counter problem, aborting",eError);
|
||||||
SCSetInterrupt(pCon,eAbortBatch);
|
SCSetInterrupt(pCon,eAbortBatch);
|
||||||
SCSetError(pCon,eCt);
|
|
||||||
return eCt;
|
return eCt;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -795,6 +794,7 @@
|
|||||||
if(isAuthorised(pCon,usUser))
|
if(isAuthorised(pCon,usUser))
|
||||||
{
|
{
|
||||||
iRet2 = SetCounterPreset(self,PaRes.Arg[0].fVal);
|
iRet2 = SetCounterPreset(self,PaRes.Arg[0].fVal);
|
||||||
|
SCparChange(pCon);
|
||||||
if(iRet2)
|
if(iRet2)
|
||||||
SCSendOK(pCon);
|
SCSendOK(pCon);
|
||||||
return iRet2;
|
return iRet2;
|
||||||
@ -823,12 +823,14 @@
|
|||||||
if(strcmp(PaRes.Arg[0].text,"timer") == 0)
|
if(strcmp(PaRes.Arg[0].text,"timer") == 0)
|
||||||
{
|
{
|
||||||
SetCounterMode(self,eTimer);
|
SetCounterMode(self,eTimer);
|
||||||
|
SCparChange(pCon);
|
||||||
SCSendOK(pCon);
|
SCSendOK(pCon);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if(strcmp(PaRes.Arg[0].text,"monitor") == 0)
|
else if(strcmp(PaRes.Arg[0].text,"monitor") == 0)
|
||||||
{
|
{
|
||||||
SetCounterMode(self,ePreset);
|
SetCounterMode(self,ePreset);
|
||||||
|
SCparChange(pCon);
|
||||||
SCSendOK(pCon);
|
SCSendOK(pCon);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -869,6 +871,7 @@
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
self->iExponent = PaRes.Arg[0].iVal;
|
self->iExponent = PaRes.Arg[0].iVal;
|
||||||
|
SCparChange(pCon);
|
||||||
SCSendOK(pCon);
|
SCSendOK(pCon);
|
||||||
return 1;
|
return 1;
|
||||||
case 8: /* GetExponent */
|
case 8: /* GetExponent */
|
||||||
@ -960,6 +963,7 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
SCparChange(pCon);
|
||||||
SCSendOK(pCon);
|
SCSendOK(pCon);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -982,12 +986,14 @@
|
|||||||
if(strcmp(PaRes.Arg[0].text,"timer") == 0)
|
if(strcmp(PaRes.Arg[0].text,"timer") == 0)
|
||||||
{
|
{
|
||||||
SetCounterMode(self,eTimer);
|
SetCounterMode(self,eTimer);
|
||||||
|
SCparChange(pCon);
|
||||||
SCSendOK(pCon);
|
SCSendOK(pCon);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if(strcmp(PaRes.Arg[0].text,"monitor") == 0)
|
else if(strcmp(PaRes.Arg[0].text,"monitor") == 0)
|
||||||
{
|
{
|
||||||
SetCounterMode(self,ePreset);
|
SetCounterMode(self,ePreset);
|
||||||
|
SCparChange(pCon);
|
||||||
SCSendOK(pCon);
|
SCSendOK(pCon);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1025,6 +1031,7 @@
|
|||||||
iRet2 = SetCounterPreset(self,PaRes.Arg[0].fVal);
|
iRet2 = SetCounterPreset(self,PaRes.Arg[0].fVal);
|
||||||
if(iRet2)
|
if(iRet2)
|
||||||
SCSendOK(pCon);
|
SCSendOK(pCon);
|
||||||
|
SCparChange(pCon);
|
||||||
return iRet2;
|
return iRet2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1069,6 +1076,7 @@
|
|||||||
PaRes.Arg[1].iVal, PaRes.Arg[2].fVal);
|
PaRes.Arg[1].iVal, PaRes.Arg[2].fVal);
|
||||||
if(iRet == 1)
|
if(iRet == 1)
|
||||||
{
|
{
|
||||||
|
SCparChange(pCon);
|
||||||
SCSendOK(pCon);
|
SCSendOK(pCon);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -196,7 +196,6 @@
|
|||||||
if(!pNew)
|
if(!pNew)
|
||||||
{
|
{
|
||||||
SCWrite(pCon,"ERROR: memory exhausted in Device Executor ",eError);
|
SCWrite(pCon,"ERROR: memory exhausted in Device Executor ",eError);
|
||||||
SCSetError(pCon,NOMEMORY);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,7 +239,6 @@
|
|||||||
{
|
{
|
||||||
sprintf(pBueffel,"ERROR: cannot start device %s",name);
|
sprintf(pBueffel,"ERROR: cannot start device %s",name);
|
||||||
SCWrite(pCon,pBueffel,eError);
|
SCWrite(pCon,pBueffel,eError);
|
||||||
SCSetError(self->pOwner,iRet);
|
|
||||||
DeleteDevEntry(pNew);
|
DeleteDevEntry(pNew);
|
||||||
if(LLDcheck(self->iList) >= LIST_EMPTY)
|
if(LLDcheck(self->iList) >= LIST_EMPTY)
|
||||||
{
|
{
|
||||||
@ -398,7 +396,6 @@
|
|||||||
self->iStatus = DEVDONE;
|
self->iStatus = DEVDONE;
|
||||||
break;
|
break;
|
||||||
case HWFault: /* real HW error: burning, no net etc.. */
|
case HWFault: /* real HW error: burning, no net etc.. */
|
||||||
SCSetError(self->pOwner,iRet);
|
|
||||||
DeleteDevEntry(pDev);
|
DeleteDevEntry(pDev);
|
||||||
LLDnodeDelete(self->iList);
|
LLDnodeDelete(self->iList);
|
||||||
self->iStatus = DEVERROR;
|
self->iStatus = DEVERROR;
|
||||||
@ -442,7 +439,6 @@
|
|||||||
self->iStatus = DEVBUSY;
|
self->iStatus = DEVBUSY;
|
||||||
break;
|
break;
|
||||||
case HWPosFault: /* cannot get somewhere... */
|
case HWPosFault: /* cannot get somewhere... */
|
||||||
SCSetError(self->pOwner,eCode);
|
|
||||||
DeleteDevEntry(pDev);
|
DeleteDevEntry(pDev);
|
||||||
LLDnodeDelete(self->iList);
|
LLDnodeDelete(self->iList);
|
||||||
self->iStatus = DEVERROR;
|
self->iStatus = DEVERROR;
|
||||||
|
@ -63,6 +63,77 @@ number of the motor in the EL734DC motor controller.
|
|||||||
<dd>Creates a piezo electric positioning device. Again the controller is a
|
<dd>Creates a piezo electric positioning device. Again the controller is a
|
||||||
Physik Instrumente controller. pararray has the same meaning as for the
|
Physik Instrumente controller. pararray has the same meaning as for the
|
||||||
C804 controller given above.
|
C804 controller given above.
|
||||||
|
<dt>Motor name ecb ecbcontroller ecb-number lowerlimit upperlimit
|
||||||
|
<dd>This creates a motor which is controlled through the Risoe ECB
|
||||||
|
electronic. The parameters:
|
||||||
|
<dl>
|
||||||
|
<dt>ecbcontroller
|
||||||
|
<dd>The ECB controller to which this motor is connected to. See below
|
||||||
|
for more on ECB controllers.
|
||||||
|
<dt>ecb-number
|
||||||
|
<dd>Number of the motor in the ECB system.
|
||||||
|
<dt>lowerlimit
|
||||||
|
<dd>The lower hardware limit for this motors operation
|
||||||
|
<dt>upperlimit
|
||||||
|
<dd>The upper hardware limit for this motors operation
|
||||||
|
</dl>
|
||||||
|
In contrast to normal motors, the ECB motors have quite a number of
|
||||||
|
hardware parameters which must be configured. The general syntax to
|
||||||
|
configure them is: motorname parametername value. The following
|
||||||
|
parameters are available:
|
||||||
|
<dl>
|
||||||
|
<dt>encoder
|
||||||
|
<dd>0 if there is no encoder for this motor, 1-3 for the encoder used
|
||||||
|
for this motor.
|
||||||
|
<dt>control
|
||||||
|
<dd>The control bit flag. This falg determines if the motor sets a
|
||||||
|
control bit in the ECB controller. This control bit can be used to
|
||||||
|
drive air cushions and the like. If required set to 1, else leave at
|
||||||
|
0.
|
||||||
|
<dt>delay
|
||||||
|
<dd>Delay time to wait after setting a control bit.
|
||||||
|
<dt>range
|
||||||
|
<dd>The speed range for the motor: 0 for slow, 1 for fast
|
||||||
|
<dt>multi
|
||||||
|
<dd>The ECB controller supports up to 24 motors. In some instances
|
||||||
|
this is not enough. Then one ECB channel can be multiplexed into
|
||||||
|
several motors. This flag (),1) determines if this is the case.
|
||||||
|
<dt>multchan
|
||||||
|
<dd>The multiplexer channel for a multiplexed motor.
|
||||||
|
<dt>port
|
||||||
|
<dd>The ECB port a multiplexed motor is using.
|
||||||
|
<dt>acceleration
|
||||||
|
<dd>The speed with which the motor accelerates to its final speed.
|
||||||
|
<dt>rotation_dir
|
||||||
|
<dd>Rotation direction of the motor.
|
||||||
|
<dt>startspeed
|
||||||
|
<dd>Starting speed of the motor.
|
||||||
|
<dt>maxspeed
|
||||||
|
<dd>The maximum speed for this motor.
|
||||||
|
<dt>auto
|
||||||
|
<dd>Speed in automatic mode
|
||||||
|
<dt>manuell
|
||||||
|
<dd>Speed used when driving the motor through the manual control box.
|
||||||
|
<dt>offset
|
||||||
|
<dd>When using an encoder: the offset between the motor zero and the
|
||||||
|
encoder zero.
|
||||||
|
<dt>dtolerance
|
||||||
|
<dd>hardware tolerance of the motor.
|
||||||
|
<dt>step2dig
|
||||||
|
<dd>conversion factor from encoder steps to physical values.
|
||||||
|
<dt>step2deg
|
||||||
|
<dd>Conversion factor from motor pseudo encoder steps to physical
|
||||||
|
values.
|
||||||
|
<dt>backlash
|
||||||
|
<dd>In order to correct for backlash, Risoe motors always approach a
|
||||||
|
target position from the same direction. In order to do this the motor
|
||||||
|
has to overshoot and drive back when driving in the wrong
|
||||||
|
direction. The parameter backlash determines how much to overshoot.
|
||||||
|
</dl>
|
||||||
|
ECB motors have another quirck: 8 motors in a rack share a power
|
||||||
|
supply! This has the consequence that only one of the 8 motors can run
|
||||||
|
at any given time. In SICS this is directed through the anticollider
|
||||||
|
module described elsewhere.
|
||||||
</DL>
|
</DL>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -79,6 +150,9 @@ failures. This can be used in a instrument simulation server.
|
|||||||
<DD>This command creates a single
|
<DD>This command creates a single
|
||||||
counter name, using an EL737 driver. The counter is at host host, listening
|
counter name, using an EL737 driver. The counter is at host host, listening
|
||||||
at port port and sits at serial port chan.
|
at port port and sits at serial port chan.
|
||||||
|
<dt> MakeCounter name ecb ecb-controller
|
||||||
|
<dd>Installs a counetr on top of the Risoe ECB hardware. The only
|
||||||
|
parameter is the name of the ECB controller to use.
|
||||||
<DT>MakeHMControl name counter hm1 hm2 hm3
|
<DT>MakeHMControl name counter hm1 hm2 hm3
|
||||||
<dd>At some instruments (for instance TRICS) multiple counters or
|
<dd>At some instruments (for instance TRICS) multiple counters or
|
||||||
histogram memories are controlled by a master counter which watches
|
histogram memories are controlled by a master counter which watches
|
||||||
@ -109,8 +183,9 @@ HM. Histogram memory objects can be created using the command:
|
|||||||
<DT> MakeHM name type
|
<DT> MakeHM name type
|
||||||
<DD> The parameter name specifies the name under which the HM will be
|
<DD> The parameter name specifies the name under which the HM will be
|
||||||
avialable in the system. type specifies which type of driver to use.
|
avialable in the system. type specifies which type of driver to use.
|
||||||
Currently two types of drivers are supported: SIM for a simulated HM and
|
Currently three types of drivers are supported: SIM for a simulated HM
|
||||||
SINQHM for the SINQ histogram memory. Please care to note, that the SINQHM
|
, SINQHM for the SINQ histogram memory and tdc for the Risoe histogram memory.
|
||||||
|
Please care to note, that the SINQHM
|
||||||
requires a EL737 counter box for count control. This counter must have been
|
requires a EL737 counter box for count control. This counter must have been
|
||||||
defined before creating the HM object.
|
defined before creating the HM object.
|
||||||
</DL>
|
</DL>
|
||||||
@ -121,7 +196,7 @@ MakeHM banana SINQHM
|
|||||||
banana configure HistMode Normal
|
banana configure HistMode Normal
|
||||||
banana configure OverFlowMode Ceil
|
banana configure OverFlowMode Ceil
|
||||||
banana configure Rank 1
|
banana configure Rank 1
|
||||||
banana configure Length 400
|
banana configure dim0 400
|
||||||
banana configure BinWidth 4
|
banana configure BinWidth 4
|
||||||
banana preset 100.
|
banana preset 100.
|
||||||
banana CountMode Timer
|
banana CountMode Timer
|
||||||
@ -237,6 +312,122 @@ which the device is connected. This is usally the port number plus 3000.
|
|||||||
To be expanded. Please note, that environment devices such as temperature
|
To be expanded. Please note, that environment devices such as temperature
|
||||||
controllers are dynamically configured into the system at run time.
|
controllers are dynamically configured into the system at run time.
|
||||||
Therefore the necessary commands are described in the user documentation.
|
Therefore the necessary commands are described in the user documentation.
|
||||||
|
</p>
|
||||||
|
<h3>GPIB Controller Access</h3>
|
||||||
|
<p>
|
||||||
|
GPIB is yet another bus system. Up to 30 devices can share the bus and
|
||||||
|
transfer data on it. SICS likest to speak to GPIB devices through the
|
||||||
|
National Instrument ENET-100 TCP/IP bridge. In order for this to work
|
||||||
|
the National Instruments driver software must have been installed on
|
||||||
|
the computer running SICS. SICS has to be compiled with the define
|
||||||
|
HAVENI defined and the proper paths to the header file and library
|
||||||
|
configured. The an GPIB controller can be installed into SICS with the
|
||||||
|
command:
|
||||||
|
<pre>
|
||||||
|
MakeGPIB name drivertype
|
||||||
|
</pre>
|
||||||
|
Name is the name under which the GPIB controller is addressable within
|
||||||
|
SICS afterwards. drivertype is the driver to use for the GPIB
|
||||||
|
device. Supported values are:
|
||||||
|
<dl>
|
||||||
|
<dt>sim
|
||||||
|
<dd>Simulation
|
||||||
|
<dd>ni
|
||||||
|
<>National instruments driver, see above.
|
||||||
|
</dl>
|
||||||
|
The GPIB controller supports a couple of commands for communicating
|
||||||
|
with devices on the GPIB bus directly. Use with extra care because it
|
||||||
|
is very easy to lock things up on the GPIB bus. In the following
|
||||||
|
documantation of the command set it is assumed that a GPIB controller
|
||||||
|
has been configured into the system under the name <b>gpib</>. Please
|
||||||
|
note, that managers privilege is required in order to be allowed to
|
||||||
|
wrestle with this controller.
|
||||||
|
<dL>
|
||||||
|
<dt>
|
||||||
|
</dl>gpib attach controller-no gpib-address gpib-secondary timeout
|
||||||
|
eos eot
|
||||||
|
<dd>This attaches the GPIB controller to a certain device at a certain
|
||||||
|
address for later communication. The return value is an integer
|
||||||
|
handle which will be used later on a s a handle devID when referring
|
||||||
|
to the conenction. The parameters are:
|
||||||
|
<dl>
|
||||||
|
<dt>controller-no
|
||||||
|
<dd>The number of the GPIB controller on the computer. There may be
|
||||||
|
more then one GPIB controllerinstalled on a given system. Usually this
|
||||||
|
is 0.
|
||||||
|
<dt>gpib-address
|
||||||
|
<dd>The GPIB address of the device on the bus.
|
||||||
|
<dt>gpib-secondary
|
||||||
|
<DD>GPIB devices may have a seconadry address. This can be specified
|
||||||
|
with this parameter. Usually this is 0.
|
||||||
|
<dt>timeout
|
||||||
|
<dd>The time to wait for answers on the GPIB bus. 13 is 10 seconds and
|
||||||
|
ussually a good value.
|
||||||
|
<dt>eot
|
||||||
|
<dd>A parameter determining the termination mode on this
|
||||||
|
connection. Consult NI documentation for this or leave at 0.
|
||||||
|
<dt>eoi
|
||||||
|
<dd> A terminator. Set to 1 or understand NI documentation for this
|
||||||
|
parameter.
|
||||||
|
</dt>
|
||||||
|
<dt>gpib detach devID
|
||||||
|
<dd>Breaks the connection described through devID. devID is the return
|
||||||
|
value from attach.
|
||||||
|
<dt>gpib clear devID
|
||||||
|
<dd>Tries to clear the GPIB buffers for the conenction described
|
||||||
|
through devID. Usually in vain.
|
||||||
|
<dt>gpib send devID bal bla bla
|
||||||
|
<dd>sends data to the device at devID.
|
||||||
|
<dt>gpib sendwithterm devID string terminator
|
||||||
|
<dd>Sends string to the device at devID. The terminator character
|
||||||
|
identified through the integer terminator is automatically
|
||||||
|
appended. Use this to send things which require a
|
||||||
|
terminator. Terminators included in strings sent by send get messed up
|
||||||
|
through Tcl!
|
||||||
|
<dt>gpib read devID
|
||||||
|
<dd>Reads data from the device at devID and returns it as a string.
|
||||||
|
<dt>gpib readtillterm devID terminator
|
||||||
|
<dd>Read from teh device devID unti the terminator character described
|
||||||
|
through the interger terminator is read. Then return the data read as
|
||||||
|
a string.
|
||||||
|
</dl>
|
||||||
|
</p>
|
||||||
|
<h3>ECB Controllers</h3>
|
||||||
|
<p>
|
||||||
|
ECB controllers are at the heart of the Risoe data aquisition
|
||||||
|
system. These are essentially Z80 processors wired to the GPIB
|
||||||
|
bus. Functions can be invoked in this processor by sending a function
|
||||||
|
code followed by the contents of 4 8 bit registers. As a result the
|
||||||
|
contents of the registers after the function call are returned. A ECB
|
||||||
|
can be made knwon to SICS through the initialisation command:
|
||||||
|
<pre>
|
||||||
|
MakeECB name gpib-controller gbib-controller-number gpib-address
|
||||||
|
</pre>
|
||||||
|
The parameters:
|
||||||
|
<dl>
|
||||||
|
<dt>name
|
||||||
|
<dd>The name used as a token for this controller later on.
|
||||||
|
<dt>gpib-controller
|
||||||
|
<dd>the name of the GPIB interface to use. See above.
|
||||||
|
<dt>gbib-controller-no
|
||||||
|
<dd>The number of the GPIB board in the system
|
||||||
|
<dt>gpib-address
|
||||||
|
<dd>The GPIB address of the ECB on the GPIB bus.
|
||||||
|
</dl>
|
||||||
|
Once installed, the ECB controller understands a few commands:
|
||||||
|
<dl>
|
||||||
|
<dt>ecb1 func funcode d e bc
|
||||||
|
<dd>Invoke ECB function funcode with the registers d e b c.Returns the
|
||||||
|
contents of the registers d e b c. Function codes and register
|
||||||
|
contents are documented, if at all, in the ECB documentation.
|
||||||
|
<dt>ecb1 clear
|
||||||
|
<dd>Tries, usually in vain, to clear the communications interface to
|
||||||
|
the ECB.
|
||||||
|
<dt>ecb1 toint char
|
||||||
|
<dd>A helper function which converts the character char to an
|
||||||
|
integer. Tcl does not seem to be able to do that.
|
||||||
|
</dl>
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -38,9 +38,7 @@ will not do a trick.
|
|||||||
position name. Afterwards this position can be reached by typing: COP name.
|
position name. Afterwards this position can be reached by typing: COP name.
|
||||||
<DT> COP defpos name mot val mot val ....
|
<DT> COP defpos name mot val mot val ....
|
||||||
<DD> this command defines a named position named name. This must be followed
|
<DD> this command defines a named position named name. This must be followed
|
||||||
by a list of motor names to run and their values. The motor names must be
|
by a list of motor alias names to run and their values.
|
||||||
those listed as <a href = sanslist.htm>SANS motors </a>. (Not yet
|
|
||||||
implemented).
|
|
||||||
<DT> COP drop name
|
<DT> COP drop name
|
||||||
<DD> deletes the named position specified as second parameter.
|
<DD> deletes the named position specified as second parameter.
|
||||||
<DT> COP axis = val axis = val ........
|
<DT> COP axis = val axis = val ........
|
||||||
|
1
drive.c
1
drive.c
@ -131,7 +131,6 @@
|
|||||||
if(SCGetInterrupt(pCon) == eAbortOperation)
|
if(SCGetInterrupt(pCon) == eAbortOperation)
|
||||||
{
|
{
|
||||||
SCSetInterrupt(pCon,eContinue);
|
SCSetInterrupt(pCon,eContinue);
|
||||||
SCSetError(pCon,OKOK);
|
|
||||||
sprintf(pBueffel,"Driving %s aborted at %9.3f",name, fPos);
|
sprintf(pBueffel,"Driving %s aborted at %9.3f",name, fPos);
|
||||||
SCWrite(pCon,pBueffel,eStatus);
|
SCWrite(pCon,pBueffel,eStatus);
|
||||||
}
|
}
|
||||||
|
7
ecb.c
7
ecb.c
@ -14,6 +14,7 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <tcl.h>
|
#include <tcl.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include "fortify.h"
|
#include "fortify.h"
|
||||||
#include "sics.h"
|
#include "sics.h"
|
||||||
#include "ecb.h"
|
#include "ecb.h"
|
||||||
@ -291,8 +292,10 @@ int ECBAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
|||||||
Only managers will be allowed to wrestle directly with ECB
|
Only managers will be allowed to wrestle directly with ECB
|
||||||
controllers.
|
controllers.
|
||||||
*/
|
*/
|
||||||
if(!SCMatchRights(pCon,usMugger)){
|
if(!SCinMacro(pCon)){
|
||||||
return 0;
|
if(!SCMatchRights(pCon,usMugger)){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(argc < 2){
|
if(argc < 2){
|
||||||
|
@ -337,7 +337,6 @@
|
|||||||
if(SCGetInterrupt(pCon) == eAbortOperation)
|
if(SCGetInterrupt(pCon) == eAbortOperation)
|
||||||
{
|
{
|
||||||
SCSetInterrupt(pCon,eContinue);
|
SCSetInterrupt(pCon,eContinue);
|
||||||
SCSetError(pCon,OKOK);
|
|
||||||
SCWrite(pCon,"Driving Aborted",eStatus);
|
SCWrite(pCon,"Driving Aborted",eStatus);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -33,7 +33,7 @@ int GPIBread(pGPIB self, int devID, void *buffer, int bytesToRead){
|
|||||||
}
|
}
|
||||||
/*--------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------*/
|
||||||
char *GPIBreadTillTerm(pGPIB self, int devID, int terminator){
|
char *GPIBreadTillTerm(pGPIB self, int devID, int terminator){
|
||||||
unsigned char buchstabe[2];
|
char buchstabe[2];
|
||||||
Tcl_DString buffer;
|
Tcl_DString buffer;
|
||||||
char *result = NULL;
|
char *result = NULL;
|
||||||
int status;
|
int status;
|
||||||
@ -59,7 +59,7 @@ void GPIBclear(pGPIB self, int devID){
|
|||||||
}
|
}
|
||||||
/*--------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------*/
|
||||||
void GPIBerrorDescription(pGPIB self, int code, char *buffer, int maxBuf){
|
void GPIBerrorDescription(pGPIB self, int code, char *buffer, int maxBuf){
|
||||||
return self->getErrorDescription(code, buffer,maxBuf);
|
self->getErrorDescription(code, buffer,maxBuf);
|
||||||
}
|
}
|
||||||
/*-------------------------------------------------------------------
|
/*-------------------------------------------------------------------
|
||||||
These are void implementations of the functions for simulation
|
These are void implementations of the functions for simulation
|
||||||
@ -83,7 +83,7 @@ static int SIMread(int devID, void *buffer, int bytesToRead){
|
|||||||
}
|
}
|
||||||
/*--------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------*/
|
||||||
static int SIMclear(int devID){
|
static int SIMclear(int devID){
|
||||||
return;
|
return 1;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
static void SIMerror(int code, char *buffer, int maxBuf){
|
static void SIMerror(int code, char *buffer, int maxBuf){
|
||||||
@ -115,10 +115,13 @@ int GPIBAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
|||||||
Only managers will be allowed to wrestle directly with GPIB
|
Only managers will be allowed to wrestle directly with GPIB
|
||||||
controllers.
|
controllers.
|
||||||
*/
|
*/
|
||||||
if(!SCMatchRights(pCon,usMugger)){
|
if(!SCinMacro(pCon)){
|
||||||
return 0;
|
if(!SCMatchRights(pCon,usMugger)){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(argc > 1){
|
if(argc > 1){
|
||||||
strtolower(argv[1]);
|
strtolower(argv[1]);
|
||||||
if(strcmp(argv[1],"attach") == 0){
|
if(strcmp(argv[1],"attach") == 0){
|
||||||
|
@ -310,7 +310,6 @@
|
|||||||
{
|
{
|
||||||
SCWrite(pCon,"ERROR: failed to fix histogram memory problem",eError);
|
SCWrite(pCon,"ERROR: failed to fix histogram memory problem",eError);
|
||||||
SCSetInterrupt(pCon,eAbortBatch);
|
SCSetInterrupt(pCon,eAbortBatch);
|
||||||
SCSetError(pCon,eCt);
|
|
||||||
return eCt;
|
return eCt;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1068,6 +1067,7 @@ static int checkHMEnd(pHistMem self, char *text){
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
iRet = SetHistPreset(self,fVal);
|
iRet = SetHistPreset(self,fVal);
|
||||||
|
SCparChange(pCon);
|
||||||
SCSendOK(pCon);
|
SCSendOK(pCon);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1087,6 +1087,7 @@ static int checkHMEnd(pHistMem self, char *text){
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
self->iExponent = atoi(argv[2]);
|
self->iExponent = atoi(argv[2]);
|
||||||
|
SCparChange(pCon);
|
||||||
SCSendOK(pCon);
|
SCSendOK(pCon);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1122,6 +1123,7 @@ static int checkHMEnd(pHistMem self, char *text){
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
iRet = SetHistCountMode(self,eCount);
|
iRet = SetHistCountMode(self,eCount);
|
||||||
|
SCparChange(pCon);
|
||||||
SCSendOK(pCon);
|
SCSendOK(pCon);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1497,6 +1499,7 @@ static int checkHMEnd(pHistMem self, char *text){
|
|||||||
}
|
}
|
||||||
genTimeBinning(self->pDriv->data,
|
genTimeBinning(self->pDriv->data,
|
||||||
(float)dStart,(float)dStep,iNum);
|
(float)dStart,(float)dStep,iNum);
|
||||||
|
SCparChange(pCon);
|
||||||
SCSendOK(pCon);
|
SCSendOK(pCon);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
2
hkl.c
2
hkl.c
@ -985,7 +985,6 @@ ente:
|
|||||||
if(SCGetInterrupt(pCon) == eAbortOperation)
|
if(SCGetInterrupt(pCon) == eAbortOperation)
|
||||||
{
|
{
|
||||||
SCSetInterrupt(pCon,eContinue);
|
SCSetInterrupt(pCon,eContinue);
|
||||||
SCSetError(pCon,OKOK);
|
|
||||||
SCWrite(pCon,"Driving to HKL Aborted",eStatus);
|
SCWrite(pCon,"Driving to HKL Aborted",eStatus);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -1031,7 +1030,6 @@ ente:
|
|||||||
if(SCGetInterrupt(pCon) == eAbortOperation)
|
if(SCGetInterrupt(pCon) == eAbortOperation)
|
||||||
{
|
{
|
||||||
SCSetInterrupt(pCon,eContinue);
|
SCSetInterrupt(pCon,eContinue);
|
||||||
SCSetError(pCon,OKOK);
|
|
||||||
SCWrite(pCon,"Driving to HKL Aborted",eStatus);
|
SCWrite(pCon,"Driving to HKL Aborted",eStatus);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
5
hmdata.c
5
hmdata.c
@ -25,6 +25,7 @@ pHMdata makeHMData(void) {
|
|||||||
}
|
}
|
||||||
memset(self,0,sizeof(HMdata));
|
memset(self,0,sizeof(HMdata));
|
||||||
self->nTimeChan = 1;
|
self->nTimeChan = 1;
|
||||||
|
self->updateFlag = 1;
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@ -324,6 +325,10 @@ long sumHMDataRectangle(pHistMem hist, SConnection *pCon,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(self->localBuffer == NULL){
|
||||||
|
resizeBuffer(self);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
get an update of the HM if necessary
|
get an update of the HM if necessary
|
||||||
*/
|
*/
|
||||||
|
1
macro.c
1
macro.c
@ -458,7 +458,6 @@
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
SCSetInterrupt(pCon,eContinue);
|
SCSetInterrupt(pCon,eContinue);
|
||||||
SCSetError(pCon,OKOK);
|
|
||||||
}
|
}
|
||||||
Tcl_DStringFree(&command);
|
Tcl_DStringFree(&command);
|
||||||
}
|
}
|
||||||
|
4
motor.c
4
motor.c
@ -149,7 +149,6 @@
|
|||||||
if(iRet != OKOK)
|
if(iRet != OKOK)
|
||||||
{
|
{
|
||||||
fVal = -9999999.99;
|
fVal = -9999999.99;
|
||||||
SCSetError(pCon,iRet);
|
|
||||||
}
|
}
|
||||||
return fVal;
|
return fVal;
|
||||||
}
|
}
|
||||||
@ -546,6 +545,7 @@ extern void KillPiPiezo(void *pData);
|
|||||||
iRet = self->pDriver->SetDriverPar(self->pDriver,pCon,name,fVal);
|
iRet = self->pDriver->SetDriverPar(self->pDriver,pCon,name,fVal);
|
||||||
if(iRet == 1)
|
if(iRet == 1)
|
||||||
{
|
{
|
||||||
|
SCparChange(pCon);
|
||||||
return iRet;
|
return iRet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -570,6 +570,7 @@ extern void KillPiPiezo(void *pData);
|
|||||||
fLimit = ObVal(self->ParArray,SLOW);
|
fLimit = ObVal(self->ParArray,SLOW);
|
||||||
fLimit -= fChange;
|
fLimit -= fChange;
|
||||||
ObParSet(self->ParArray,self->name,"softlowerlim",fLimit,pCon);
|
ObParSet(self->ParArray,self->name,"softlowerlim",fLimit,pCon);
|
||||||
|
SCparChange(pCon);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -591,6 +592,7 @@ extern void KillPiPiezo(void *pData);
|
|||||||
ObParInit(self->ParArray,SZERO,"softzero",ZEROINACTIVE,usUser);
|
ObParInit(self->ParArray,SZERO,"softzero",ZEROINACTIVE,usUser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
SCparChange(pCon);
|
||||||
|
|
||||||
return iRet;
|
return iRet;
|
||||||
}
|
}
|
||||||
|
59
mumo.c
59
mumo.c
@ -161,6 +161,7 @@
|
|||||||
#define POSFIND 11
|
#define POSFIND 11
|
||||||
#define NAMALL 12
|
#define NAMALL 12
|
||||||
#define LIST 13
|
#define LIST 13
|
||||||
|
#define DEFPOS 14
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
static int GetNextToken(psParser self, pMulMot pDings)
|
static int GetNextToken(psParser self, pMulMot pDings)
|
||||||
{
|
{
|
||||||
@ -283,6 +284,11 @@
|
|||||||
self->iCurrentToken = LIST;
|
self->iCurrentToken = LIST;
|
||||||
return LIST;
|
return LIST;
|
||||||
}
|
}
|
||||||
|
else if(strcmp(self->Token,"defpos") ==0)
|
||||||
|
{
|
||||||
|
self->iCurrentToken = DEFPOS;
|
||||||
|
return DEFPOS;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
self->iCurrentToken = SYMBOL;
|
self->iCurrentToken = SYMBOL;
|
||||||
@ -602,7 +608,7 @@
|
|||||||
char pCommand[1064];
|
char pCommand[1064];
|
||||||
char *pPtr;
|
char *pPtr;
|
||||||
|
|
||||||
/* is the user allowe dto do ANYTHING ? */
|
/* is the user allowed to do ANYTHING ? */
|
||||||
iRet = CheckPermission(pCon,self);
|
iRet = CheckPermission(pCon,self);
|
||||||
if(!iRet)
|
if(!iRet)
|
||||||
{
|
{
|
||||||
@ -625,8 +631,56 @@
|
|||||||
}
|
}
|
||||||
return 0; /* not reached */
|
return 0; /* not reached */
|
||||||
}
|
}
|
||||||
|
/*-------------------------------------------------------------------------*/
|
||||||
|
static int ParseDefPos(SicsInterp *pSics,psParser pPP,
|
||||||
|
pMulMot self, SConnection *pCon)
|
||||||
|
{
|
||||||
|
pMotor pMot = NULL;
|
||||||
|
char pError[132], motorName[80], command[1024], namPos[80];
|
||||||
|
int iToken, status;
|
||||||
|
float fVal;
|
||||||
|
|
||||||
|
|
||||||
|
iToken = GetNextToken(pPP,self);
|
||||||
|
if(iToken != SYMBOL) /* we want a name here */
|
||||||
|
{
|
||||||
|
sprintf(pError,"ERROR: Invalid Token %s in ParsePos",pPP->Token);
|
||||||
|
SCWrite(pCon,pError,eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
strncpy(namPos,pPP->Token,79);
|
||||||
|
iToken = GetNextToken(pPP,self);
|
||||||
|
command[0] = '\0';
|
||||||
|
while(iToken != END)
|
||||||
|
{
|
||||||
|
if(iToken != ALIAS)
|
||||||
|
{
|
||||||
|
sprintf(command,"ERROR: expected motor alias, got: %s", pPP->Token);
|
||||||
|
SCWrite(pCon,command,eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
StringDictGet(self->pAlias,pPP->Token,motorName,79);
|
||||||
|
strcat(command, motorName);
|
||||||
|
strcat(command," ");
|
||||||
|
iToken = GetNextToken(pPP,self);
|
||||||
|
if(iToken != NUMBER)
|
||||||
|
{
|
||||||
|
sprintf(command,"ERROR: expected number, got: %s", pPP->Token);
|
||||||
|
SCWrite(pCon,command,eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
strcat(command,pPP->Token);
|
||||||
|
strcat(command," ");
|
||||||
|
iToken = GetNextToken(pPP,self);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The rest of the stuff should be the motors to drive until
|
||||||
|
we are there
|
||||||
|
*/
|
||||||
|
StringDictAddPair(self->pNamPos,namPos,command);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
/*---------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------
|
||||||
MultiWrapper is the user interface to a multi motor unit. It supports the
|
MultiWrapper is the user interface to a multi motor unit. It supports the
|
||||||
following syntax, where DingsBums is the name of the unit:
|
following syntax, where DingsBums is the name of the unit:
|
||||||
@ -727,6 +781,9 @@
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case DEFPOS:
|
||||||
|
return ParseDefPos(pSics,&MyParser,self,pCon);
|
||||||
|
break;
|
||||||
case LIST:
|
case LIST:
|
||||||
pPtr = NULL;
|
pPtr = NULL;
|
||||||
Tcl_DStringInit(&tString);
|
Tcl_DStringInit(&tString);
|
||||||
|
2
mumo.i
2
mumo.i
@ -7,3 +7,5 @@
|
|||||||
pStringDict pNamPos;
|
pStringDict pNamPos;
|
||||||
ObPar *pParam;
|
ObPar *pParam;
|
||||||
} MulMot;
|
} MulMot;
|
||||||
|
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@
|
|||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
static int ParsePos(SicsInterp *pSics,psParser pPP,
|
static int ParsePos(SicsInterp *pSics,psParser pPP,
|
||||||
pMulMot self, SConnection *pCon)
|
pMulMot self, SConnection *pCon)
|
||||||
{
|
{
|
||||||
pMotor pMot = NULL;
|
pMotor pMot = NULL;
|
||||||
char pError[132];
|
char pError[132];
|
||||||
|
@ -578,7 +578,7 @@ static int handlePut(SConnection *pCon, SicsInterp *pSics, pNXScript self,
|
|||||||
defString,buffer);
|
defString,buffer);
|
||||||
if(status != NX_OK){
|
if(status != NX_OK){
|
||||||
sprintf(buffer,"ERROR: failed to write alias %s",
|
sprintf(buffer,"ERROR: failed to write alias %s",
|
||||||
fVal, argv[2]);
|
argv[2]);
|
||||||
SCWrite(pCon,buffer,eError);
|
SCWrite(pCon,buffer,eError);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -84,7 +84,7 @@ proc collimator args {
|
|||||||
}
|
}
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
proc coll args {
|
proc coll args {
|
||||||
return coliimator $args
|
return collimator $args
|
||||||
}
|
}
|
||||||
#======================== Beamstop stuff ==============================
|
#======================== Beamstop stuff ==============================
|
||||||
proc beamstop args {
|
proc beamstop args {
|
||||||
|
5
scan.c
5
scan.c
@ -1869,6 +1869,7 @@ int StoreScanCounts(pScanData self, char *data)
|
|||||||
char *pPtr = NULL, pItem[20];
|
char *pPtr = NULL, pItem[20];
|
||||||
long *lData = NULL;
|
long *lData = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
writeFunc oldWrite;
|
||||||
|
|
||||||
self = (pScanData)pEventData;
|
self = (pScanData)pEventData;
|
||||||
pCon = (SConnection *)pUser;
|
pCon = (SConnection *)pUser;
|
||||||
@ -1905,13 +1906,17 @@ int StoreScanCounts(pScanData self, char *data)
|
|||||||
/* get counts */
|
/* get counts */
|
||||||
GetScanCounts(self,lData,self->iNP);
|
GetScanCounts(self,lData,self->iNP);
|
||||||
/* format a message */
|
/* format a message */
|
||||||
|
|
||||||
strcpy(pPtr,"scan.Counts= ");
|
strcpy(pPtr,"scan.Counts= ");
|
||||||
for(i = 0; i < self->iNP; i++)
|
for(i = 0; i < self->iNP; i++)
|
||||||
{
|
{
|
||||||
sprintf(pItem,"{%d} ",lData[i]);
|
sprintf(pItem,"{%d} ",lData[i]);
|
||||||
strcat(pPtr,pItem);
|
strcat(pPtr,pItem);
|
||||||
}
|
}
|
||||||
|
oldWrite = SCGetWriteFunc(pCon);
|
||||||
|
SCSetWriteFunc(pCon,SCOnlySockWrite);
|
||||||
SCWrite(pCon,pPtr,eWarning);
|
SCWrite(pCon,pPtr,eWarning);
|
||||||
|
SCSetWriteFunc(pCon,oldWrite);
|
||||||
free(lData);
|
free(lData);
|
||||||
free(pPtr);
|
free(pPtr);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -123,7 +123,6 @@
|
|||||||
SCWrite(pCon,"ERROR: out of memory in sicscron",eError);
|
SCWrite(pCon,"ERROR: out of memory in sicscron",eError);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
pNew->pCon->iDummy = 1;
|
|
||||||
pNew->iIntervall = iVal;
|
pNew->iIntervall = iVal;
|
||||||
pNew->pCommand = strdup(pBueffel);
|
pNew->pCommand = strdup(pBueffel);
|
||||||
pNew->tNext = 0;
|
pNew->tNext = 0;
|
||||||
|
1
sicvar.c
1
sicvar.c
@ -630,6 +630,7 @@
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
SCSendOK(pCon);
|
SCSendOK(pCon);
|
||||||
|
SCparChange(pCon);
|
||||||
DeleteTokenList(pList);
|
DeleteTokenList(pList);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#define MAX_CLIENTS 8 /* The maximum number of active clients */
|
#define MAX_CLIENTS 8 /* The maximum number of active clients */
|
||||||
#define MAX_TOF_CNTR 32768 /* The maximum number of individual counters ..
|
#define MAX_TOF_CNTR 32768 /* The maximum number of individual counters ..
|
||||||
** which can be handled in TOF mode */
|
** which can be handled in TOF mode */
|
||||||
#define MAX_PSD_CNTR 1048576 /* maximum number of PSD elements */
|
#define MAX_PSD_CNTR 16777217 /* maximum number of PSD elements */
|
||||||
#define MAX_PSD_ED 3 /* maximum number of additional
|
#define MAX_PSD_ED 3 /* maximum number of additional
|
||||||
single detectors at AMOR
|
single detectors at AMOR
|
||||||
*/
|
*/
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include "fortify.h"
|
#include "fortify.h"
|
||||||
#include "conman.h"
|
#include "conman.h"
|
||||||
#include "servlog.h"
|
#include "servlog.h"
|
||||||
|
11
status.c
11
status.c
@ -354,6 +354,7 @@ static int motorSave = 0;
|
|||||||
int iRights;
|
int iRights;
|
||||||
int iRet;
|
int iRet;
|
||||||
char *pFile = NULL;
|
char *pFile = NULL;
|
||||||
|
writeFunc oldWrite;
|
||||||
|
|
||||||
assert(pSics);
|
assert(pSics);
|
||||||
assert(pCon);
|
assert(pCon);
|
||||||
@ -379,8 +380,18 @@ static int motorSave = 0;
|
|||||||
|
|
||||||
iRights = SCGetRights(pCon);
|
iRights = SCGetRights(pCon);
|
||||||
pCon->iUserRights = usInternal;
|
pCon->iUserRights = usInternal;
|
||||||
|
oldWrite = SCGetWriteFunc(pCon);
|
||||||
|
SCSetWriteFunc(pCon,SCNotWrite);
|
||||||
iRet = InterpExecute(pSics,pCon,pBueffel);
|
iRet = InterpExecute(pSics,pCon,pBueffel);
|
||||||
|
SCSetWriteFunc(pCon,oldWrite);
|
||||||
pCon->iUserRights = iRights;
|
pCon->iUserRights = iRights;
|
||||||
|
/*
|
||||||
|
if we do not override parameterChange here, the backup file
|
||||||
|
would be overwritten after each restore... Not the right thing
|
||||||
|
to do!
|
||||||
|
*/
|
||||||
|
pCon->parameterChange = 0;
|
||||||
|
SCSendOK(pCon);
|
||||||
return iRet;
|
return iRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,7 +296,6 @@ int TASDrive(SConnection *pCon, SicsInterp *pSics, void *pData,
|
|||||||
if(SCGetInterrupt(pCon) == eAbortOperation)
|
if(SCGetInterrupt(pCon) == eAbortOperation)
|
||||||
{
|
{
|
||||||
SCSetInterrupt(pCon,eContinue);
|
SCSetInterrupt(pCon,eContinue);
|
||||||
SCSetError(pCon,OKOK);
|
|
||||||
sprintf(pBueffel,"Driving aborted");
|
sprintf(pBueffel,"Driving aborted");
|
||||||
SCWrite(pCon,pBueffel,eStatus);
|
SCWrite(pCon,pBueffel,eStatus);
|
||||||
}
|
}
|
||||||
|
@ -963,15 +963,18 @@ static int ParseVar(pTASdata pTAS, char *pBueffel, SConnection *pCon)
|
|||||||
{
|
{
|
||||||
VarSetFloat(pTAS->tasPar[lastVar],atof(pToken),
|
VarSetFloat(pTAS->tasPar[lastVar],atof(pToken),
|
||||||
usInternal);
|
usInternal);
|
||||||
|
SCparChange(pCon);
|
||||||
}
|
}
|
||||||
else if(vt == veInt)
|
else if(vt == veInt)
|
||||||
{
|
{
|
||||||
VarSetInt(pTAS->tasPar[lastVar],
|
VarSetInt(pTAS->tasPar[lastVar],
|
||||||
(int)atof(pToken), usInternal);
|
(int)atof(pToken), usInternal);
|
||||||
|
SCparChange(pCon);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pTAS->tasPar[lastVar]->text = strdup(pToken);
|
pTAS->tasPar[lastVar]->text = strdup(pToken);
|
||||||
|
SCparChange(pCon);
|
||||||
}
|
}
|
||||||
lastVar++;
|
lastVar++;
|
||||||
}
|
}
|
||||||
@ -1000,11 +1003,13 @@ static int ParseVar(pTASdata pTAS, char *pBueffel, SConnection *pCon)
|
|||||||
{
|
{
|
||||||
VarSetFloat(pTAS->tasPar[lastVar],atof(pToken),
|
VarSetFloat(pTAS->tasPar[lastVar],atof(pToken),
|
||||||
usInternal);
|
usInternal);
|
||||||
|
SCparChange(pCon);
|
||||||
}
|
}
|
||||||
else if(vt == veInt)
|
else if(vt == veInt)
|
||||||
{
|
{
|
||||||
VarSetInt(pTAS->tasPar[lastVar],
|
VarSetInt(pTAS->tasPar[lastVar],
|
||||||
(int)atof(pToken),usInternal);
|
(int)atof(pToken),usInternal);
|
||||||
|
SCparChange(pCon);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
1
tdchm.c
1
tdchm.c
@ -419,6 +419,7 @@ static int TDCContinue(pHistDriver self, SConnection *pCon){
|
|||||||
/*=======================================================================*/
|
/*=======================================================================*/
|
||||||
static int TDCFree(pHistDriver self){
|
static int TDCFree(pHistDriver self){
|
||||||
free(self->pPriv);
|
free(self->pPriv);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
/*======================================================================*/
|
/*======================================================================*/
|
||||||
static int TDCSetHistogram(pHistDriver self, SConnection *pCon,
|
static int TDCSetHistogram(pHistDriver self, SConnection *pCon,
|
||||||
|
Reference in New Issue
Block a user