diff --git a/A1931.c b/A1931.c
index a0ec221a..b9585513 100644
--- a/A1931.c
+++ b/A1931.c
@@ -12,6 +12,7 @@
#include
#include
#include
+#include
#include "fortify.h"
#include "sics.h"
#include "obpar.h"
@@ -20,13 +21,15 @@
#include "evdriver.i"
#include "gpibcontroller.h"
#include "A1931.h"
+
/*========================== private data structure ====================*/
typedef struct {
int sensor; /* the control sensor */
pGPIB gpib; /* the GPIB interface to use in order to talk to the thing*/
int gpibAddress; /* address on bus */
int devID; /* deviceID of the controller on the GPIB */
- char errorBuffer[132]; /* a buffer for error meesages from the thing*/
+ char errorBuffer[132]; /* a buffer for error messages from the thing*/
+ char commandLine[132]; /* buffer to keep the offending command line */
int errorCode; /* error indicator */
}A1931, *pA1931;
/*============================ defines ================================*/
@@ -263,11 +266,13 @@ static int downloadFile(pA1931 self, FILE *fd){
pPtr = GPIBreadTillTerm(self->gpib,self->devID,10);
if(pPtr[0] == '#'){
self->errorCode = A1931ERROR;
- strcpy(self->errorBuffer,pPtr);
+ strncpy(self->errorBuffer,pPtr,131);
+ strncpy(self->commandLine,buffer,131);
free(pPtr);
return 0;
}
free(pPtr);
+ usleep(50);
}
return 1;
}
@@ -327,6 +332,8 @@ int A1931Action(SConnection *pCon, SicsInterp *pSics, void *pData,
A1931error(pEV->pDriv,&iCode,error,131);
sprintf(buffer,"%s while transfering file", error);
SCWrite(pCon,buffer,eError);
+ sprintf(buffer,"Offending command: %s",self->commandLine);
+ SCWrite(pCon,buffer,eError);
return 0;
}
SCSendOK(pCon);
diff --git a/amorstat.c b/amorstat.c
index 1b2b9d3a..fb422b91 100644
--- a/amorstat.c
+++ b/amorstat.c
@@ -583,7 +583,7 @@
static int SendSingleTOF(pAmorStat self, SConnection *pCon)
{
HistInt *lData = NULL;
- int i, i2, i3, iDim[MAXDIM], iIdx, iSum, status, length;
+ int i, i2, i3, iDim[MAXDIM], iIdx, iSum, status, length, nTime;
pSINQHM pHist;
SinqHMDriv *pTata;
int iMax = -999999;
@@ -593,11 +593,14 @@
/* get size of our problem */
GetHistDim(self->pHM,iDim,&i3);
- assert(i3 == 3);
-
+
/* allocate some data */
- timebin = GetHistTimeBin(self->pHM, &i3);
- length = 1 + 2*i3;
+ timebin = GetHistTimeBin(self->pHM, &nTime);
+ if(nTime < 2) {
+ return 1;
+ }
+
+ length = 1 + 2*nTime;
iData = (HistInt *)malloc(length*sizeof(HistInt));
if(iData == NULL){
SCWrite(pCon,"ERROR: failed to allocate memory in SendSingleTOF",
@@ -607,14 +610,14 @@
memset(iData,0,length*sizeof(int));
/* first number is the length of each single histogram */
- iData[0] = htonl(i3);
+ iData[0] = htonl(nTime);
if(isSINQHMDriv(self->pHM->pDriv))
{
- iStart = iDim[0]*iDim[1]*iDim[2];
+ iStart = iDim[0]*iDim[1]*nTime;
GetHistogramDirect(self->pHM,pCon,0,iStart,
- iStart + 2*iDim[2],&iData[1],2*iDim[2]*sizeof(HistInt));
+ iStart + 2*nTime,&iData[1],2*nTime*sizeof(HistInt));
for(i = 1; i < length; i++)
{
iData[i] = htonl(iData[i]);
@@ -635,10 +638,10 @@
send, with a little trick to do two histograms.
*/
SCWriteUUencoded(pCon,"SING1",iData,
- (iDim[2]+1)*sizeof(int));
- iData[iDim[2]] = htonl(iDim[2]);
- SCWriteUUencoded(pCon,"SING2",&iData[iDim[2]],
- (iDim[2]+1)*sizeof(int));
+ (nTime+1)*sizeof(int));
+ iData[nTime] = htonl(nTime);
+ SCWriteUUencoded(pCon,"SING2",&iData[nTime],
+ (nTime+1)*sizeof(int));
free(iData);
return 1;
}
@@ -651,13 +654,17 @@
{
int iDim[MAXDIM], i, i2, i3, *iSum = NULL, iLang, *iPtr;
HistInt *lData = NULL;
- int iLimit, status;
+ int iLimit, status, nTime;
char pBueffel[132];
pSINQHM pHist;
SinqHMDriv *pTata;
+ const float *fTime;
/* get histogram dimensions */
GetHistDim(self->pHM,iDim,&i3);
+ fTime = GetHistTimeBin(self->pHM,&nTime);
+ iDim[i3] = nTime;
+ i3++;
assert(i3 == 3);
/* check limits */
diff --git a/doc/user/samenv.htm b/doc/user/samenv.htm
index 04bba803..535583eb 100644
--- a/doc/user/samenv.htm
+++ b/doc/user/samenv.htm
@@ -638,12 +638,13 @@ controller is connected to the computer systems through a GPIB bus and
controller. A A1931 temperature controller is configured into SICS
through the command:
-evfactory new temperature-name a1931 gpib-controller-name
+evfactory new temperature-name a1931 gpib-controller-name gpibaddress
This creates a new command temperature-name. gpib-controller-name is
the name of a GPIB controller within SICS. A GPIB controller is
configured into SICS with the command MakeGPIB as described in the
-SICS managers documentation.
+SICS managers documentation. gpibaddress is the address of the A1931 on the
+GPIB bus.
A A1931 temperature device understands a couple of additional commands
diff --git a/ecbcounter.c b/ecbcounter.c
index 5eabad60..ed8b371f 100644
--- a/ecbcounter.c
+++ b/ecbcounter.c
@@ -13,6 +13,7 @@
#include
#include "fortify.h"
#include "sics.h"
+#include "status.h"
#include "ecb.h"
#include "countdriv.h"
@@ -22,6 +23,7 @@ typedef struct {
unsigned char prescaler[8]; /* an array for the prescaler values */
int tfreq; /* timer frequency */
unsigned char control; /* marks the control monitor */
+ int state; /* current counting state */
}ECBCounter, *pECBCounter;
/*----------------- private defines ------------------------------------*/
@@ -33,7 +35,13 @@ typedef struct {
#define STLOAD 156
#define STCPRE 133
#define STARTS 135
+#define SPCSTA 169
+/*------------------ state codes --------------------------------------*/
+#define IDLE 0
+#define COUNT 2
+#define NOBEAM 3
+/*--------------------------------------------------------------------*/
#define MAX_COUNT 4294967295.0
/*------------------ error codes --------------------------------------*/
#define COMMERROR -300
@@ -66,12 +74,79 @@ static int readScaler(pECBCounter pPriv, int scaler, int *count){
return 1;
}
+/*---------------------------------------------------------------------*/
+static int check4Beam(struct __COUNTER *pCter, int *beam){
+ Z80_reg in, out;
+ pECBCounter self = NULL;
+ int status;
+
+ self = (pECBCounter)pCter->pData;
+ assert(self);
+
+ in.c = 1;
+ status = ecbExecute(self->ecb,SPCSTA,in,&out);
+ if(status != 1){
+ pCter->iErrorCode = COMMERROR;
+ return HWFault;
+ }
+ *beam = (int)out.d;
+ return 1;
+}
+/*----------------------------------------------------------------------*/
+static int stopScalers(pECBCounter self){
+ int status;
+ Z80_reg in, out;
+
+ status = ecbExecute(self->ecb,STOPS,in,&out);
+ if(status != 1){
+ return COMMERROR;
+ }
+ return 1;
+}
+/*========================================================================
+ These two functions currently rely on the idea that the ECB stops
+ and starts without clearing counters in between. The sequence of
+ things necessary to start it, suggests this. If this is not the case then
+ this will not work.
+===========================================================================*/
+static int ECBPause(struct __COUNTER *self){
+ int status;
+ pECBCounter pPriv = NULL;
+
+ assert(self);
+ pPriv = (pECBCounter)self->pData;
+ assert(pPriv);
+
+ if((status = stopScalers(pPriv)) <= 0){
+ self->iErrorCode = status;
+ return HWFault;
+ }
+ return OKOK;
+}
+/*=======================================================================*/
+static int ECBContinue(struct __COUNTER *self){
+ int status;
+ pECBCounter pPriv = NULL;
+ Z80_reg in, out;
+
+ assert(self);
+ pPriv = (pECBCounter)self->pData;
+ assert(pPriv);
+
+ status = ecbExecute(pPriv->ecb,STARTS,in,&out);
+ if(status != 1){
+ self->iErrorCode = status;
+ return HWFault;
+ }
+
+ return OKOK;
+}
/*-----------------------------------------------------------------------*/
static int ECBGetStatus(struct __COUNTER *self, float *fControl){
pECBCounter pPriv = (pECBCounter)self->pData;
int status, result, scaler;
Z80_reg in, out;
- int count;
+ int count, beam;
assert(pPriv);
@@ -81,14 +156,36 @@ static int ECBGetStatus(struct __COUNTER *self, float *fControl){
status = ecbExecute(pPriv->ecb,STFRD,in,&out);
if(status != 1){
self->iErrorCode = COMMERROR;
+ pPriv->state = IDLE;
return HWFault;
}
if(out.d == 0){
result = HWIdle;
+ pPriv->state = IDLE;
} else {
result = HWBusy;
}
+ /*
+ check beam status
+ */
+ status = check4Beam(self,&beam);
+ if(status != 1){
+ self->iErrorCode = COMMERROR;
+ return HWFault;
+ }
+ beam &= 1;
+ if(result == HWBusy && pPriv->state == COUNT && beam == 0){
+ ECBPause(self);
+ pPriv->state = NOBEAM;
+ SetStatus(eOutOfBeam);
+ }
+ if(result == HWBusy && pPriv->state == NOBEAM && beam == 1){
+ ECBContinue(self);
+ pPriv->state = COUNT;
+ SetStatus(eCounting);
+ }
+
/*
select which scaler to read
*/
@@ -106,18 +203,7 @@ static int ECBGetStatus(struct __COUNTER *self, float *fControl){
return result;
}
-/*======================================================================*/
-static int stopScalers(pECBCounter self){
- int status;
- Z80_reg in, out;
-
- status = ecbExecute(self->ecb,STOPS,in,&out);
- if(status != 1){
- return COMMERROR;
- }
- return 1;
-}
-/*----------------------------------------------------------------------*/
+/*=====================================================================*/
static int clearScalers(pECBCounter self){
int status;
Z80_reg in, out;
@@ -225,44 +311,7 @@ static int ECBStart(struct __COUNTER *self){
return HWFault;
}
- return OKOK;
-}
-/*========================================================================
- These two functions currently rely on the idea that the ECB stops
- and starts without clearing counters in between. The sequence of
- things necessary to start it, suggests this. If this is not the case then
- this will not work.
-===========================================================================*/
-static int ECBPause(struct __COUNTER *self){
- int status;
- pECBCounter pPriv = NULL;
-
- assert(self);
- pPriv = (pECBCounter)self->pData;
- assert(pPriv);
-
- if((status = stopScalers(pPriv)) <= 0){
- self->iErrorCode = status;
- return HWFault;
- }
- return OKOK;
-}
-/*=======================================================================*/
-static int ECBContinue(struct __COUNTER *self){
- int status;
- pECBCounter pPriv = NULL;
- Z80_reg in, out;
-
- assert(self);
- pPriv = (pECBCounter)self->pData;
- assert(pPriv);
-
- status = ecbExecute(pPriv->ecb,STARTS,in,&out);
- if(status != 1){
- self->iErrorCode = status;
- return HWFault;
- }
-
+ pPriv->state = COUNT;
return OKOK;
}
/*=======================================================================*/
@@ -274,6 +323,7 @@ static int ECBHalt(struct __COUNTER *self){
pPriv = (pECBCounter)self->pData;
assert(pPriv);
+ pPriv->state = IDLE;
if((status = stopScalers(pPriv)) <= 0){
self->iErrorCode = status;
return HWFault;
diff --git a/frame.c b/frame.c
index e9fdb8bb..20ef7293 100644
--- a/frame.c
+++ b/frame.c
@@ -26,14 +26,17 @@
/*======================================================================*/
static int readHMFrame(SConnection *pCon, pHistMem pHM, int nFrame){
HistInt *buffer = NULL;
- int iDim[MAXDIM], rank, length, status, i;
+ int iDim[MAXDIM], rank, length, status, i, noTimeBins;
pSINQHM pHist;
SinqHMDriv *pTata;
+ const float *timeBin;
/*
find dimensions and allocate data
*/
GetHistDim(pHM,iDim,&rank);
+ timeBin = GetHistTimeBin(pHM,&noTimeBins);
+
if(rank < 2){
SCWrite(pCon,"ERROR: no PSD data present, cannot send frame",eError);
return 0;
@@ -52,7 +55,7 @@ static int readHMFrame(SConnection *pCon, pHistMem pHM, int nFrame){
buffer[0] = htonl(iDim[0]);
buffer[1] = htonl(iDim[1]);
- if(isSINQHMDriv(pHM->pDriv) && rank == 3) {
+ if(isSINQHMDriv(pHM->pDriv) && noTimeBins > 2) {
/*
read from HM. The 5 is PROJECT__FRAME in Sinqhm_def.h
Again: be friendly: fix out of range frames
@@ -60,12 +63,12 @@ static int readHMFrame(SConnection *pCon, pHistMem pHM, int nFrame){
if(nFrame < 0){
nFrame = 0;
}
- if(nFrame >= iDim[2]){
- nFrame = iDim[2]-1;
+ if(nFrame >= noTimeBins){
+ nFrame = noTimeBins-1;
}
pTata = (SinqHMDriv *)pHM->pDriv->pPriv;
pHist = (pSINQHM)pTata->pMaster;
- status = SINQHMProject(pHist, 5, 0, nFrame,
+ status = SINQHMProject(pHist, 0x0005, 0, nFrame,
0, iDim[1], buffer+2,length*sizeof(HistInt));
if(status != 1){
SCWrite(pCon,"ERROR: SINQHM refused to deliver frame",eError);
diff --git a/hardsup/makefile_alpha b/hardsup/makefile_alpha
index 7cd80b92..b082b911 100644
--- a/hardsup/makefile_alpha
+++ b/hardsup/makefile_alpha
@@ -6,7 +6,7 @@
# Markus Zolliker, March 2003
#--------------------------------------------------------------------------
# the following line only for fortified version
-#DFORTIFY=-DFORTIFY
+DFORTIFY=-DFORTIFY
#==========================================================================
CC = cc
diff --git a/hardsup/sinqhm.c b/hardsup/sinqhm.c
index 88c389cf..fe2c878e 100644
--- a/hardsup/sinqhm.c
+++ b/hardsup/sinqhm.c
@@ -1229,6 +1229,7 @@ extern int close(int fp);
}
/* swap bytes if necessary */
+ iNoBins = iDataLen/self->iBinWidth;
if ((self->iBinWidth > 0) && (Rply_buff.bigend != 0x12345678))
{
switch (self->iBinWidth)
diff --git a/hmdata.c b/hmdata.c
index 2e4e2f77..9812ad37 100644
--- a/hmdata.c
+++ b/hmdata.c
@@ -1,6 +1,6 @@
/*-----------------------------------------------------------------------
This is a data handling class for histogram memory data.
- For more information see hmdata.tex.
+ For more information see hmdata.tex
copyright: see file COPYRIGHT
diff --git a/make_gen b/make_gen
index bdaa8e08..58ce252a 100644
--- a/make_gen
+++ b/make_gen
@@ -43,7 +43,10 @@ VELOOBJ = velo.o velosim.o velodorn.o velodornier.o
#.c.o:
# $(CC) $(CFLAGS) -c $*.c
-all: $(BINTARGET)/SICServer
+all: $(BINTARGET)/SICServer
+
+full: matrix/libmatrix.a hardsup/libhlib.a tecs/libtecsl.a \
+ $(BINTARGET)/SICServer
$(BINTARGET)/SICServer: $(SOBJ) $(MOTOROBJ) $(COUNTEROBJ) \
$(DMCOBJ) $(VELOOBJ) $(DIFIL) $(EXTRA) \
@@ -73,3 +76,8 @@ Dbg.o: Dbg.c
Dbg_cmd.o: Dbg_cmd.c
+
+
+
+
+
diff --git a/makefile_alpha b/makefile_alpha
index 9fe4012c..b7aac99b 100644
--- a/makefile_alpha
+++ b/makefile_alpha
@@ -6,8 +6,8 @@
# Markus Zolliker, March 2003
#==========================================================================
# the following lines only for fortified version
-#DFORTIFY=-DFORTIFY
-#FORTIFYOBJ=strdup.o fortify.o
+DFORTIFY=-DFORTIFY
+FORTIFYOBJ=strdup.o fortify.o
#==========================================================================
# assign if the National Instrument GPIB driver is available
#NI= -DHAVENI
@@ -22,11 +22,15 @@
#DIFIL= difrac.o
#---------------------------------------------------------------------------
+#----------------select proper Makefile
+MFLAGS= -f makefile_alpha
+
+HDFROOT=/data/lnslib
+
CC = cc
CFLAGS = -I$(HDFROOT)/include $(DFORTIFY) -DHDF4 -DHDF5 -I$(SRC)hardsup -g \
-std1 -warnprotos
BINTARGET = bin
-HDFROOT=/data/lnslib
EXTRA=
LIBS = -L$(HDFROOT)/lib -Lhardsup -lhlib -Lmatrix -lmatrix -Ltecs \
-ltecsl -ltcl8.0 -lfor $(HDFROOT)/lib/libhdf5.a \
@@ -34,3 +38,7 @@ LIBS = -L$(HDFROOT)/lib -Lhardsup -lhlib -Lmatrix -lmatrix -Ltecs \
$(HDFROOT)/lib/libjpeg.a -lz -lm -ll -lc
include make_gen
+
+
+
+
diff --git a/nxamor.c b/nxamor.c
index 0b74a64b..e2c36584 100644
--- a/nxamor.c
+++ b/nxamor.c
@@ -584,6 +584,7 @@ static int WriteTOFDetector(char *name, pHistMem pHM, int *iDim,
/* deal with time binning */
fTime = GetHistTimeBin(pHM,&iLength);
+ iDim[2] = iLength;
fTime2 = (float *)malloc(iLength*sizeof(float));
if(fTime2)
{
diff --git a/nxsans.c b/nxsans.c
index 9e7cd496..3cb67a4c 100644
--- a/nxsans.c
+++ b/nxsans.c
@@ -569,6 +569,17 @@ static int gummiFlag = 0; /* a flag indicating stroboscopic, or gummi mode */
ourselves now. And possibly write time binning information.
*/
GetHistDim(self, iDim,&nDim);
+ /*
+ handle time binning
+ */
+ fTime = GetHistTimeBin(self,&iVal);
+ if(iVal > 2)
+ {
+ NXDputalias(Nfil,pDict,"ddtb",(void *)fTime);
+ nDim = 3;
+ iDim[2] = iVal;
+ }
+
histSize = 1;
for(i = 0; i < nDim; i++)
{
@@ -615,12 +626,7 @@ static int gummiFlag = 0; /* a flag indicating stroboscopic, or gummi mode */
}
NXDputalias(Nfil,pDict,"ddcy",iAxis);
- /* write time binning if appropriate */
- if(nDim == 3)
- {
- fTime = GetHistTimeBin(self,&iVal);
- NXDputalias(Nfil,pDict,"ddtb",(void *)fTime);
- }
+
/*
write gummi monitors when apropriate
@@ -674,7 +680,6 @@ static int gummiFlag = 0; /* a flag indicating stroboscopic, or gummi mode */
iVal = NX_CHAR;
NXgetattr(Nfil,"file_name",pBueffel,&i,&iVal);
SendQuieck(QUIECK,pBueffel);
-
/* close this and go ............. */
NXclose(&Nfil);
return 1;
diff --git a/rs232controller.c b/rs232controller.c
index 1a8fc7ab..8c3b32f6 100644
--- a/rs232controller.c
+++ b/rs232controller.c
@@ -143,6 +143,11 @@ int readRS232(prs232 self, void *data, int *dataLen)
return NOTCONNECTED;
}
+ /*
+ clean our space in order to prevent corrupted stuff
+ */
+ memset(data,0,*dataLen);
+
iRet = NETAvailable(self->pSock,self->timeout);
if(iRet < 0)
{
@@ -395,7 +400,7 @@ int RS232Action(SConnection *pCon, SicsInterp *pSics,
char pError[256];
char pBuffer[8192], pReply[8192];
char *pPtr = NULL;
- int iRet, iRead = 8191;
+ int iRet, iRead = 8191, count, i;
self = (prs232)pData;
assert(self);
@@ -531,6 +536,30 @@ int RS232Action(SConnection *pCon, SicsInterp *pSics,
SCWrite(pCon,pReply,eValue);
return 1;
}
+ else if(strcmp(argv[1],"binwrite") == 0)
+ {
+ count = argc - 2;
+ for(i = 0; i < count; i++)
+ {
+ pBuffer[i] = (char)atoi(argv[i+2]);
+ }
+ if(self->pSock)
+ {
+ iRet = NETWrite(self->pSock,pBuffer,count);
+ }
+ else
+ {
+ iRet = NOTCONNECTED;
+ }
+ if(iRet < 0)
+ {
+ getRS232Error(iRet,pError,255);
+ SCWrite(pCon,pError,eError);
+ return 0;
+ }
+ SCSendOK(pCon);
+ return 1;
+ }
else if(strcmp(argv[1],"init") == 0)
{
iRet = initRS232(self);
diff --git a/scan.c b/scan.c
index 31e3ef8e..c32005c6 100644
--- a/scan.c
+++ b/scan.c
@@ -935,6 +935,11 @@ int StoreScanCounts(pScanData self, char *data)
if(pPtr != NULL)
{
sCount.lCount = atoi(pNumber);
+ }
+ else
+ {
+ SCWrite(self->pCon,"ERROR: No data in StoreScanCounts",eError);
+ return 0;
}
while((pPtr = stptok(pPtr,pNumber,19," \t")) != NULL)
{
diff --git a/scan.h b/scan.h
index 1304f4fe..4fe5d97a 100644
--- a/scan.h
+++ b/scan.h
@@ -78,3 +78,7 @@
#endif
+
+
+
+
diff --git a/sicsstatus.tcl b/sicsstatus.tcl
index de9ddd57..846ec9d3 100644
--- a/sicsstatus.tcl
+++ b/sicsstatus.tcl
@@ -216,9 +216,9 @@ tilt Fixed -1.000000
tilt InterruptMode 0.000000
tilt AccessCode 0.000000
#----- MultiMotor st
-st recovernampos henry d1r 5. d1l -5. d1t 0.
+st recovernampos henry d1r 5. d1l -5. d1t 0.
#----- MultiMotor sampletable
-sampletable recovernampos henry d1r 5. d1l -5. d1t 0.
+sampletable recovernampos henry d1r 5. d1l -5. d1t 0.
# Motor detectorrotation
detectorrotation sign 1.000000
detectorrotation SoftZero 0.000000
diff --git a/sinqhm/SinqHM_srv_filler.c b/sinqhm/SinqHM_srv_filler.c
index 7eba0eff..81ab27a1 100755
--- a/sinqhm/SinqHM_srv_filler.c
+++ b/sinqhm/SinqHM_srv_filler.c
@@ -1005,7 +1005,10 @@
if(middl >= Tof_edges[0]->n_bins){
middl = Tof_edges[0]->n_bins-1;
- printf("WARNING: Fixed bad time bin for single detector!\n");
+ if(Dbg_lev1){
+ printf("WARNING: Fixed bad time bin for single detector!\n");
+ }
+ continue;
}
/*
diff --git a/sinqhm/SinqHM_srv_routines.c b/sinqhm/SinqHM_srv_routines.c
index 834b60b5..a5cb81a3 100755
--- a/sinqhm/SinqHM_srv_routines.c
+++ b/sinqhm/SinqHM_srv_routines.c
@@ -2218,6 +2218,7 @@ static int project_frame(int rw_skt, int pkt_size, int nx){
usint *i2;
uint *i4;
} hm_pntr;
+ long sum;
printf("PROJECT: Trying to retrieve time frame: %d\n", nx);
@@ -2248,10 +2249,12 @@ static int project_frame(int rw_skt, int pkt_size, int nx){
FIX: This works only OK with 4 byte HM data.
*/
hm_pntr.i4 = Hist_base_addr;
- for(i = 0; i < N_hists;i++){
+ for(i = 0, sum = 0; i < N_hists;i++){
buffer[i] = htonl(*(hm_pntr.i4 + (i*N_bins) + nx));
+ sum += *(hm_pntr.i4+(i*N_bins) +nx);
}
+ printf("Frame %d contained %d counts \n",nx,sum);
/*
build reply and send data
*/
@@ -2320,6 +2323,12 @@ static int project_frame(int rw_skt, int pkt_size, int nx){
** The SQHM_PROJECT command is histogram mode dependent. Switch
** accordingly.
*/
+
+ /*
+ printf("\nProject with hm-mode : %d, subcode = %d\n", Hm_mode, sub_code);
+ */
+
+
switch (Hm_mode) {
/*-----------------------------------------------------------*/
case SQHM__HM_DIG: /* SQHM__HM_DIG and SQHM__HRPT are handled the same. */
@@ -2396,7 +2405,7 @@ static int project_frame(int rw_skt, int pkt_size, int nx){
break;
/*-----------------------------------------------------------*/
case SQHM__TOF: /* Time-of-Flight Mode */
- if( (sub_code & PROJECT__FRAME) == 0){
+ if(sub_code == PROJECT__FRAME){
return project_frame(rw_skt,pkt_size,nx);
}
diff --git a/synchronize.c b/synchronize.c
index 270e8095..c6b447a8 100644
--- a/synchronize.c
+++ b/synchronize.c
@@ -26,7 +26,7 @@ static mkChannel *connection = NULL;
static void syncLogin(void)
{
int test, i;
- char pBueffel[1024], pRead[80];
+ char pBueffel[2048], pRead[80];
/*
connect
@@ -51,6 +51,7 @@ static void syncLogin(void)
pBueffel[0] = '\0';
for(i = 0; i < 10; i++)
{
+ memset(pRead,0,80);
test = NETRead(connection,pRead,70,10*1000);
if(test < 0)
{
@@ -69,6 +70,7 @@ static void syncLogin(void)
else
{
test = 1;
+ break;
}
SicsWait(1);
}
@@ -174,14 +176,13 @@ int Synchronize(SConnection *pCon, SicsInterp *pSics, void *pData,
first tell the remote server to backup
*/
SetStatusFixed(eBatch);
- strcpy(pBueffel,"transact backup");
+ strcpy(pBueffel,"transact syncbackup");
if(syncFile != NULL)
{
strcat(pBueffel," ");
strcat(pBueffel,syncFile);
}
strcat(pBueffel,"\n");
-
test = NETWrite(connection,pBueffel,strlen(pBueffel));
if(test != 1)
{
diff --git a/tasinit.c b/tasinit.c
index d5b15be7..c90b56f8 100644
--- a/tasinit.c
+++ b/tasinit.c
@@ -50,6 +50,7 @@ extern char *tasMotorOrder[] = { "a1",
"sgl",
"sgu",
"agl",
+ "atl",
"tt",
"i1" ,
"i2",
@@ -229,13 +230,22 @@ static int TasSaveStatus(void *self, char *name, FILE *fd)
fprintf(fd,"%s hardupperlim %f\n",tasMotorOrder[i], value);
MotorGetPar(pMot,"hardlowerlim",&value);
fprintf(fd,"%s hardlowerlim %f\n",tasMotorOrder[i], value);
+ /*
+ DISABLED: reading all the motors made to much of a delay during
+ normal operation of the instrument. This is mainly due to the
+ sloooooooooowwwwwwwww SINQ hardware
MotorGetSoftPosition(pMot,pCon,&value);
fprintf(fd,"run %s %f\n",tasMotorOrder[i], value);
+ */
}
i++;
}
SCDeleteConnection(pCon);
+ /*
fprintf(fd,"success\n");
+ */
+
+ fprintf(fd,"updateqe\n");
return 1;
}
/*---------------------------------------------------------------------
diff --git a/tasscan.c b/tasscan.c
index e6ec73d5..204d6c31 100644
--- a/tasscan.c
+++ b/tasscan.c
@@ -1494,5 +1494,11 @@ int TASScan(SConnection *pCon, SicsInterp *pSics, void *pData,
*/
ResetScanFunctions(pTAS->pScan);
+ /*
+ print a message for Severian Gvassilja
+ */
+ sprintf(pLine,"Scan finished, data saved to %s", pTAS->pScan->pFile);
+ SCWrite(pCon,pLine,eWarning);
+
return status;
}
diff --git a/tasu.h b/tasu.h
index e9e1c236..1ede56fc 100644
--- a/tasu.h
+++ b/tasu.h
@@ -15,7 +15,7 @@ extern char *tasMotorOrder[];
extern char *tasVariableOrder[];
/* maximum number of motors in the list */
-#define MAXMOT 31
+#define MAXMOT 32
/* offset to the currents, if available */
#define CURMOT (MAXMOT - 11)
diff --git a/tasutil.c b/tasutil.c
index 5bcf2d3c..c6aaea9f 100644
--- a/tasutil.c
+++ b/tasutil.c
@@ -705,6 +705,7 @@ int TASUpdate(pTASdata self, SConnection *pCon)
now call t_update to do the calculation
*/
ier = 0;
+ en = ef = ei = .0;
t_update__(amot, helmCurrent, convH, &lpa, &dm, &da, &isa, &helm,
&f1h, &f1v, &f2h, &f2v, &f, &ei, &aki, &ef, &akf,
qhkl, &en, &hx, &hy, &hz, &if1, &if2, &qm, &ier);
@@ -738,7 +739,10 @@ int TASUpdate(pTASdata self, SConnection *pCon)
self->tasPar[QH]->fVal = qhkl[0];
self->tasPar[QK]->fVal = qhkl[1];
self->tasPar[QL]->fVal = qhkl[2];
+ /*
self->tasPar[EN]->fVal = en;
+ */
+ self->tasPar[EN]->fVal = ei - ef;
self->tasPar[HX]->fVal = hx;
self->tasPar[HY]->fVal = hy;
self->tasPar[HZ]->fVal = hz;
diff --git a/tecs/makefile_alpha b/tecs/makefile_alpha
index 5fcac823..583f1947 100644
--- a/tecs/makefile_alpha
+++ b/tecs/makefile_alpha
@@ -5,8 +5,8 @@
# Markus Zolliker, March 2003
#--------------------------------------------------------------------------
# the following lines only for fortified version
-#DFORTIFY=-DFORTIFY -I$(SRC)..
-#FORTIFYOBJ=../strdup.o ../fortify.o
+DFORTIFY=-DFORTIFY -I$(SRC)..
+FORTIFYOBJ=../strdup.o ../fortify.o
#==========================================================================
diff --git a/ttest.tcl b/ttest.tcl
index 278977e0..1a7daf58 100644
--- a/ttest.tcl
+++ b/ttest.tcl
@@ -70,11 +70,11 @@ User "Daniel_the_Clementine"
# Motor a4 EL734 LNSP22 4000 5 6
# EL734 motor with parameters: hostname PortNumber Channel MotorID
-Motor A2 EL734 lnsp22.psi.ch 4000 5 2 # Monochromator 2Theta
-Motor A3 EL734 lnsp22.psi.ch 4000 5 3 # Sample Omega
+#Motor A2 EL734 lnsp22.psi.ch 4000 5 2 # Monochromator 2Theta
+#Motor A3 EL734 lnsp22.psi.ch 4000 5 3 # Sample Omega
# C O U N T E R S
-MakeCounter counter EL737 lnsp22.psi.ch 4000 4
+#MakeCounter counter EL737 lnsp22.psi.ch 4000 4
MakeDrive
@@ -82,5 +82,12 @@ Publish scan User
Publish otUnknown User
MakeRuenBuffer
-MakeRS232Controller marcel psxtemp 3004
+#MakeRS232Controller marcel psxtemp 3004
+
+MakeRS232Controller pfiff psts227 3009
+pfiff sendterminator 0x0
+pfiff replyterminator 0x10
+
+Publish pfiffread Spy
+source pfiff.tcl