mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-22 17:47:59 +02:00
merge from 4.0.1
This commit is contained in:
@ -31,6 +31,9 @@ int myport=-1;
|
||||
//struct sockaddr_in address;
|
||||
//#define VERBOSE
|
||||
|
||||
#define BLACKFIN_DRVR_SND_LMT (30000) // rough limit
|
||||
#define BLACKFIN_RSND_PCKT_LOOP (10)
|
||||
#define BLACKFIN_RSND_WAIT_US (1)
|
||||
|
||||
int bindSocket(unsigned short int port_number) {
|
||||
int i;
|
||||
@ -314,13 +317,46 @@ int receiveData(int file_des, void* buf,int length, intType itype){
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int sendDataOnly(int file_des, void* buf,int length) {
|
||||
int sendDataOnly(int file_des, void* buf,int length) {
|
||||
if (!length)
|
||||
return 0;
|
||||
int ret = write(file_des, buf, length); //value of -1 is other end socket crash as sigpipe is ignored
|
||||
if (ret < 0) cprintf(BG_RED, "Error writing to socket. Possible socket crash\n");
|
||||
return ret;
|
||||
|
||||
|
||||
int bytesSent = 0;
|
||||
int retry = 0; // retry index when buffer is blocked (write returns 0)
|
||||
while (bytesSent < length) {
|
||||
|
||||
// setting a max packet size for blackfin driver (and network driver does not do a check if packets sent)
|
||||
int bytesToSend = length - bytesSent;
|
||||
if (bytesToSend > BLACKFIN_DRVR_SND_LMT)
|
||||
bytesToSend = BLACKFIN_DRVR_SND_LMT;
|
||||
|
||||
// send
|
||||
int rc = write(file_des, (char*)((char*)buf + bytesSent), bytesToSend);
|
||||
// error
|
||||
if (rc < 0) {
|
||||
cprintf(BG_RED, "Error writing to socket. Possible socket crash: left=%d rc=%d length=%d sent=%d\n", bytesToSend, rc, length, bytesSent);
|
||||
return bytesSent;
|
||||
}
|
||||
// also error, wrote nothing, buffer blocked up, too fast sending for client
|
||||
if (rc == 0) {
|
||||
cprintf(RED, "Error writing to socket. Buffer full. Retry: %d\n", retry);
|
||||
++retry;
|
||||
// wrote nothing for many loops
|
||||
if (retry >= BLACKFIN_RSND_PCKT_LOOP) {
|
||||
cprintf(BG_RED, "Error writing to socket. Buffer full! Too fast! No more.\n");
|
||||
return bytesSent;
|
||||
}
|
||||
usleep(BLACKFIN_RSND_WAIT_US);
|
||||
}
|
||||
// wrote something, reset retry
|
||||
else {
|
||||
retry = 0;
|
||||
}
|
||||
bytesSent += rc;
|
||||
}
|
||||
|
||||
return bytesSent;
|
||||
}
|
||||
|
||||
|
||||
|
@ -378,6 +378,8 @@ enum dacIndex {
|
||||
M_vIbiasSh, /**< mythen 3 >*/
|
||||
M_vIcin, /**< mythen 3 >*/
|
||||
M_vIpreOut, /**< mythen 3 >*/
|
||||
ZMQ_emin, /**< ZMQ */
|
||||
ZMQ_emax,/**< ZMQ */
|
||||
V_POWER_A = 100, /**new chiptest board */
|
||||
V_POWER_B = 101, /**new chiptest board */
|
||||
V_POWER_C = 102, /**new chiptest board */
|
||||
@ -473,13 +475,28 @@ enum readOutFlags {
|
||||
READ_HITS=0x2, /**< return only the number of the channel which counted ate least one */
|
||||
ZERO_COMPRESSION=0x4,/**< returned data are 0-compressed */
|
||||
PUMP_PROBE_MODE=0x8,/**<pump-probe mode */
|
||||
|
||||
PEDESTAL=0x10,/**< frame mode set to pedestal */
|
||||
FLAT=0x20,/**< frame mode set to flat */
|
||||
NEWPEDESTAL=0x40,/**< frame mode set to pedestal and reset */
|
||||
NEWFLAT=0x80,/**< frame mode set to flat and reset */
|
||||
|
||||
FRAME=0x100, /**< frame mode set to normal frame */
|
||||
ANALOG=0x200, /**<detector working in analog mode */
|
||||
COUNTING=0x400, /**<detector working in counting mode */
|
||||
INTERPOLATING=0x800, /**<detector working in interpolating mode */
|
||||
|
||||
|
||||
|
||||
BACKGROUND_CORRECTIONS=0x1000, /**<background corrections */
|
||||
TOT_MODE=0x2000,/**< pump-probe mode */
|
||||
CONTINOUS_RO=0x4000,/**< pump-probe mode */
|
||||
|
||||
PARALLEL=0x10000,/**< eiger parallel mode */
|
||||
NONPARALLEL=0x20000,/**< eiger serial mode */
|
||||
SAFE=0x40000/**< eiger safe mode */,
|
||||
DIGITAL_ONLY=0x80000, /** chiptest board read only digital bits (not adc values)*/
|
||||
|
||||
ANALOG_AND_DIGITAL=0x100000, /** chiptest board read adc values and digital bits digital bits */
|
||||
DUT_CLK=0x200000, /** chiptest board fifo clock comes from device under test */
|
||||
SHOW_OVERFLOW=0x400000, /** eiger 32 bit mode, show saturated for overflow of single subframes */
|
||||
|
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorsPackage/slsDetectorSoftware
|
||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repsitory UUID: 3c774478681813e451df683e2bc8403b37490323
|
||||
Revision: 2071
|
||||
Branch: 4.0.1
|
||||
Repsitory UUID: 907d1655d1f6cf2bb8cf6ccd7e91e82f479dd2ca
|
||||
Revision: 2076
|
||||
Branch: developer
|
||||
Last Changed Author: Dhanya_Thattil
|
||||
Last Changed Rev: 4084
|
||||
Last Changed Date: 2019-02-08 17:25:57.000000002 +0100 ./threadFiles/ThreadPool.o
|
||||
Last Changed Rev: 4101
|
||||
Last Changed Date: 2019-02-11 14:35:41.000000002 +0100 ./threadFiles/ThreadPool.o
|
||||
|
@ -6,7 +6,7 @@
|
||||
CROSS = bfin-uclinux-
|
||||
CC = $(CROSS)gcc
|
||||
|
||||
CFLAGS += -Wall -DMOENCHD -DMCB_FUNCS -DDACS_INT -DDEBUG -DV1 -DCTB -DOLDVERSION #-DVERBOSE #-DVERYVERBOSE #-DVIRTUAL #-DDACS_INT_CSERVER
|
||||
CFLAGS += -Wall -DMOENCHD -DMCB_FUNCS -DDACS_INT -DDEBUG -DV1 -DCTB
|
||||
|
||||
|
||||
PROGS= jctbDetectorServer
|
||||
@ -24,22 +24,18 @@ OBJS = $(SRCS:%.c=%.o)
|
||||
|
||||
all: clean versioning $(PROGS)
|
||||
|
||||
test: clean jungfrauADCTEst
|
||||
test: clean jungfrauADCTest
|
||||
|
||||
boot: $(OBJS)
|
||||
|
||||
versioning:
|
||||
@echo `tput setaf 6; ./updateGitVersion.sh; tput sgr0;`
|
||||
|
||||
jctbDetectorServerNew: $(OBJS)
|
||||
jctbDetectorServer: $(OBJS)
|
||||
echo $(OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS_$@) $(LDFLAGS_$@)
|
||||
|
||||
jctbDetectorServer: $(OBJS)
|
||||
echo $(OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS_$@) $(LDFLAGS_$@) -DOLDVERSION
|
||||
|
||||
jungfrauADCTEst: $(OBJS)
|
||||
jungfrauADCTest: $(OBJS)
|
||||
echo $(OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS_$@) $(LDFLAGS_$@) -DTESTADC
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "registers_m.h"
|
||||
|
||||
//for memory mapping
|
||||
u_int32_t CSP0BASE;
|
||||
u_int64_t CSP0BASE;
|
||||
|
||||
u_int16_t volatile *values;
|
||||
|
||||
@ -43,8 +43,8 @@ int mapCSP0(void) {
|
||||
}
|
||||
printf("/dev/mem opened\n");
|
||||
|
||||
CSP0BASE = (u_int32_t)mmap(0, MEM_SIZE, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fd, CSP0);
|
||||
if (CSP0BASE == (u_int32_t)MAP_FAILED) {
|
||||
CSP0BASE = mmap(0, MEM_SIZE, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fd, CSP0);
|
||||
if (CSP0BASE == MAP_FAILED) {
|
||||
printf("\nCan't map memmory area!!\n");
|
||||
return FAIL;
|
||||
}
|
||||
@ -61,8 +61,8 @@ int mapCSP0(void) {
|
||||
return FAIL;
|
||||
}
|
||||
#endif
|
||||
printf("CSPObase is 0x%08x \n",CSP0BASE);
|
||||
printf("CSPOBASE=from %08x to %08x\n",CSP0BASE,CSP0BASE+MEM_SIZE);
|
||||
printf("CSPObase is 0x%08llx \n",CSP0BASE);
|
||||
printf("CSPOBASE=from %08llx to %08llx\n",CSP0BASE,CSP0BASE+MEM_SIZE);
|
||||
|
||||
u_int32_t address;
|
||||
address = FIFO_DATA_REG;//_OFF;
|
||||
@ -73,12 +73,24 @@ int mapCSP0(void) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
u_int16_t bus_r16(u_int32_t offset){
|
||||
|
||||
|
||||
|
||||
u_int16_t a_bus_r16(u_int32_t offset){
|
||||
volatile u_int16_t *ptr1;
|
||||
ptr1=(u_int16_t*)(CSP0BASE+offset*2);
|
||||
return *ptr1;
|
||||
}
|
||||
|
||||
u_int16_t bus_r16(u_int32_t offset){
|
||||
u_int16_t r= a_bus_r16(offset);
|
||||
/* #ifndef OLDVERSION */
|
||||
/* while (r!=a_bus_r16(offset)) */
|
||||
/* r=a_bus_r16(offset); */
|
||||
/* #endif */
|
||||
return r;
|
||||
}
|
||||
|
||||
u_int16_t bus_w16(u_int32_t offset, u_int16_t data) {
|
||||
volatile u_int16_t *ptr1;
|
||||
ptr1=(u_int16_t*)(CSP0BASE+offset*2);
|
||||
@ -97,12 +109,21 @@ u_int32_t bus_w(u_int32_t offset, u_int32_t data) {
|
||||
}
|
||||
|
||||
|
||||
u_int32_t bus_r(u_int32_t offset) {
|
||||
u_int32_t a_bus_r(u_int32_t offset) {
|
||||
volatile u_int32_t *ptr1;
|
||||
ptr1=(u_int32_t*)(CSP0BASE+offset*2);
|
||||
return *ptr1;
|
||||
}
|
||||
|
||||
u_int32_t bus_r(u_int32_t offset){
|
||||
u_int32_t r= a_bus_r(offset);
|
||||
/* #ifndef OLDVERSION */
|
||||
/* while (r!=a_bus_r(offset)) */
|
||||
/* r=a_bus_r(offset); */
|
||||
/* #endif */
|
||||
return r;
|
||||
}
|
||||
|
||||
// program dacq settings
|
||||
|
||||
int64_t set64BitReg(int64_t value, int aLSB, int aMSB){
|
||||
|
@ -75,7 +75,8 @@ typedef struct ip_header_struct {
|
||||
|
||||
struct timeval tss,tse,tsss; //for timing
|
||||
|
||||
|
||||
#define MAXDAC 32
|
||||
u_int32_t dac[MAXDAC];
|
||||
|
||||
FILE *debugfp, *datafp;
|
||||
|
||||
@ -890,107 +891,33 @@ int setTiming(int ti) {
|
||||
|
||||
|
||||
int ret=GET_EXTERNAL_COMMUNICATION_MODE;
|
||||
|
||||
int val;
|
||||
int g=-1, t=-1, rot=-1;
|
||||
|
||||
int i;
|
||||
|
||||
val=bus_r(EXT_SIGNAL_REG);
|
||||
switch (ti) {
|
||||
case AUTO_TIMING:
|
||||
timingMode=ti;
|
||||
// disable all gates/triggers in except if used for master/slave synchronization
|
||||
for (i=0; i<4; i++) {
|
||||
if (getFPGASignal(i)>0 && getFPGASignal(i)<GATE_OUT_ACTIVE_HIGH && signals[i]!=MASTER_SLAVE_SYNCHRONIZATION)
|
||||
setFPGASignal(i,SIGNAL_OFF);
|
||||
}
|
||||
bus_w(EXT_SIGNAL_REG,val&~(0x1));
|
||||
break;
|
||||
|
||||
case TRIGGER_EXPOSURE:
|
||||
timingMode=ti;
|
||||
// if one of the signals is configured to be trigger, set it and unset possible gates
|
||||
for (i=0; i<4; i++) {
|
||||
if (signals[i]==TRIGGER_IN_RISING_EDGE || signals[i]==TRIGGER_IN_FALLING_EDGE)
|
||||
setFPGASignal(i,signals[i]);
|
||||
else if (signals[i]==GATE_IN_ACTIVE_HIGH || signals[i]==GATE_IN_ACTIVE_LOW)
|
||||
setFPGASignal(i,SIGNAL_OFF);
|
||||
else if (signals[i]==RO_TRIGGER_IN_RISING_EDGE || signals[i]==RO_TRIGGER_IN_FALLING_EDGE)
|
||||
setFPGASignal(i,SIGNAL_OFF);
|
||||
|
||||
}
|
||||
bus_w(EXT_SIGNAL_REG,val|(0x1));
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case TRIGGER_READOUT:
|
||||
timingMode=ti;
|
||||
// if one of the signals is configured to be trigger, set it and unset possible gates
|
||||
for (i=0; i<4; i++) {
|
||||
if (signals[i]==RO_TRIGGER_IN_RISING_EDGE || signals[i]==RO_TRIGGER_IN_FALLING_EDGE)
|
||||
setFPGASignal(i,signals[i]);
|
||||
else if (signals[i]==GATE_IN_ACTIVE_HIGH || signals[i]==GATE_IN_ACTIVE_LOW)
|
||||
setFPGASignal(i,SIGNAL_OFF);
|
||||
else if (signals[i]==TRIGGER_IN_RISING_EDGE || signals[i]==TRIGGER_IN_FALLING_EDGE)
|
||||
setFPGASignal(i,SIGNAL_OFF);
|
||||
}
|
||||
break;
|
||||
|
||||
case GATE_FIX_NUMBER:
|
||||
timingMode=ti;
|
||||
// if one of the signals is configured to be trigger, set it and unset possible gates
|
||||
for (i=0; i<4; i++) {
|
||||
if (signals[i]==RO_TRIGGER_IN_RISING_EDGE || signals[i]==RO_TRIGGER_IN_FALLING_EDGE)
|
||||
setFPGASignal(i,SIGNAL_OFF);
|
||||
else if (signals[i]==GATE_IN_ACTIVE_HIGH || signals[i]==GATE_IN_ACTIVE_LOW)
|
||||
setFPGASignal(i,signals[i]);
|
||||
else if (signals[i]==TRIGGER_IN_RISING_EDGE || signals[i]==TRIGGER_IN_FALLING_EDGE)
|
||||
setFPGASignal(i,SIGNAL_OFF);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case GATE_WITH_START_TRIGGER:
|
||||
timingMode=ti;
|
||||
for (i=0; i<4; i++) {
|
||||
if (signals[i]==RO_TRIGGER_IN_RISING_EDGE || signals[i]==RO_TRIGGER_IN_FALLING_EDGE)
|
||||
setFPGASignal(i,SIGNAL_OFF);
|
||||
else if (signals[i]==GATE_IN_ACTIVE_HIGH || signals[i]==GATE_IN_ACTIVE_LOW)
|
||||
setFPGASignal(i,signals[i]);
|
||||
else if (signals[i]==TRIGGER_IN_RISING_EDGE || signals[i]==TRIGGER_IN_FALLING_EDGE)
|
||||
setFPGASignal(i,signals[i]);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (i=0; i<4; i++) {
|
||||
if (signals[i]!=MASTER_SLAVE_SYNCHRONIZATION) {
|
||||
if (getFPGASignal(i)==RO_TRIGGER_IN_RISING_EDGE || getFPGASignal(i)==RO_TRIGGER_IN_FALLING_EDGE)
|
||||
rot=i;
|
||||
else if (getFPGASignal(i)==GATE_IN_ACTIVE_HIGH || getFPGASignal(i)==GATE_IN_ACTIVE_LOW)
|
||||
g=i;
|
||||
else if (getFPGASignal(i)==TRIGGER_IN_RISING_EDGE || getFPGASignal(i)==TRIGGER_IN_FALLING_EDGE)
|
||||
t=i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (g>=0 && t>=0 && rot<0) {
|
||||
ret=GATE_WITH_START_TRIGGER;
|
||||
} else if (g<0 && t>=0 && rot<0) {
|
||||
if (bus_r(EXT_SIGNAL_REG)&0x1)
|
||||
ret=TRIGGER_EXPOSURE;
|
||||
} else if (g>=0 && t<0 && rot<0) {
|
||||
ret=GATE_FIX_NUMBER;
|
||||
} else if (g<0 && t<0 && rot>0) {
|
||||
ret=TRIGGER_READOUT;
|
||||
} else if (g<0 && t<0 && rot<0) {
|
||||
else
|
||||
ret=AUTO_TIMING;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// timingMode=ret;
|
||||
|
||||
@ -1671,22 +1598,28 @@ int initHighVoltage(int val, int imod){
|
||||
codata=((dacvalue)&0xff);
|
||||
|
||||
|
||||
valw=bus_r(offw)&0x7fff; //switch off HV
|
||||
valw=(bus_r(offw) & 0x7fff) | 0x00ff;
|
||||
|
||||
bus_w(offw,(valw)); // start point
|
||||
valw=((valw&(~(0x1<<csdx))));bus_w(offw,valw); //chip sel bar down
|
||||
|
||||
for (i=0;i<8;i++) {
|
||||
valw=(valw&(~(0x1<<cdx)));bus_w(offw,valw); //cldwn
|
||||
valw=((valw&(~(0x1<<ddx)))+(((codata>>(7-i))&0x1)<<ddx));bus_w(offw,valw);//write data (i)
|
||||
valw=((valw&(~(0x1<<cdx)))+(0x1<<cdx));bus_w(offw,valw);//clkup
|
||||
valw=(valw&(~(0x1<<cdx)));bus_w(offw,valw); //cldwn
|
||||
valw=((valw&(~(0x1<<ddx)))+(((codata>>(7-i))&0x1)<<ddx));bus_w(offw,valw);//write data (i)
|
||||
valw=((valw&(~(0x1<<cdx)))+(0x1<<cdx));bus_w(offw,valw);//clkup
|
||||
}
|
||||
valw=((valw&(~(0x1<<csdx)))+(0x1<<csdx));bus_w(offw,valw); //csup
|
||||
|
||||
valw=(valw&(~(0x1<<cdx)));bus_w(offw,valw); //cldwn
|
||||
|
||||
|
||||
|
||||
if (dacvalue>=0) {
|
||||
valw=bus_r(offw)|0xff00;; //switch on HV
|
||||
if (val>=0) {
|
||||
valw=bus_r(offw) | 0x8000;; //switch on HV
|
||||
printf("switch on HV in CTB4 %x\n");
|
||||
} else {
|
||||
valw=bus_r(offw)&0x7fff;//switch off HV
|
||||
valw=bus_r(offw) & 0x7fff;//switch off HV
|
||||
printf("switch off HV in CTB4\n");
|
||||
}
|
||||
|
||||
|
||||
@ -1695,6 +1628,22 @@ int initHighVoltage(int val, int imod){
|
||||
|
||||
bus_w(HV_REG,val);
|
||||
|
||||
|
||||
//added for CTB5!
|
||||
|
||||
// valw=bus_r(POWER_ON_REG);
|
||||
if (val>=0) {
|
||||
i=bus_r(POWER_ON_REG) | 0x80000000;; //switch on HV
|
||||
printf("switch on HV in CTB5 %08x\n", i);
|
||||
} else {
|
||||
i=bus_r(POWER_ON_REG) & 0x7fffffff;//switch off HV
|
||||
printf("switch off HV in CTB5 %08x\n", i);
|
||||
}
|
||||
|
||||
bus_w(POWER_ON_REG,i);
|
||||
|
||||
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
@ -2003,7 +1952,7 @@ int startStateMachine(){
|
||||
bus_w16(CONTROL_REG, FIFO_RESET_BIT);
|
||||
bus_w16(CONTROL_REG, 0x0);
|
||||
bus_w16(CONTROL_REG, START_ACQ_BIT | START_EXPOSURE_BIT);
|
||||
// usleep(20);
|
||||
usleep(20);
|
||||
bus_w16(CONTROL_REG, 0x0);
|
||||
//verify
|
||||
/* if(bus_r(STATUS_REG) & RUN_BUSY_BIT) */
|
||||
@ -2128,48 +2077,42 @@ u_int16_t* fifo_read_event(int ns)
|
||||
a=bus_r16(LOOK_AT_ME_REG);
|
||||
while(a==0) {
|
||||
if (runBusy()==0) {
|
||||
usleep(100);
|
||||
a = bus_r(LOOK_AT_ME_REG);
|
||||
if (a==0) {
|
||||
printf("no frame found and acquisition finished - exiting\n");
|
||||
printf("%08x %08x\n", runState(), bus_r(LOOK_AT_ME_REG));
|
||||
return NULL;
|
||||
printf("no frame found and acquisition finished - exiting\n");
|
||||
printf("%08x %08x\n", runState(), bus_r(LOOK_AT_ME_REG));
|
||||
return NULL;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
a = bus_r(LOOK_AT_ME_REG);
|
||||
//#ifdef VERBOSE
|
||||
//printf(".");
|
||||
//#endif
|
||||
a = bus_r16(LOOK_AT_ME_REG);
|
||||
}
|
||||
/* #ifdef TIMEDBG */
|
||||
/* // tsss=tss; */
|
||||
/* gettimeofday(&tss,NULL); */
|
||||
/* printf("look for data = %ld usec\n", (tss.tv_usec) - (tse.tv_usec)); */
|
||||
|
||||
/* #endif */
|
||||
|
||||
// printf("LAM: %08x\n",a);
|
||||
}
|
||||
|
||||
// printf(".");
|
||||
a = bus_r(LOOK_AT_ME_REG);
|
||||
//a = bus_r16(LOOK_AT_ME_REG);
|
||||
|
||||
if (analogEnable) {
|
||||
printf("*");
|
||||
// printf("*");
|
||||
bus_w16(DUMMY_REG,1<<8); // read strobe to all fifos
|
||||
bus_w16(DUMMY_REG,0);
|
||||
for (i=0; i<32; i++) {
|
||||
if (~(mask&adcDisableMask)) {
|
||||
*((u_int16_t*)now_ptr)=*values;//bus_r16(FIFO_DATA_REG);
|
||||
if (i!=0 || ns!=0) {
|
||||
a=0;
|
||||
while (*((u_int16_t*)now_ptr)==*((u_int16_t*)(now_ptr)-1) && a++<10) {
|
||||
*((u_int16_t*)now_ptr)=*values;
|
||||
}
|
||||
}
|
||||
*((u_int16_t*)now_ptr)=bus_r16(FIFO_DATA_REG);
|
||||
/* if (i!=0 || ns!=0) { */
|
||||
/* a=0; */
|
||||
/* while (*((u_int16_t*)now_ptr)==*((u_int16_t*)(now_ptr)-1) && a++<10 && *((u_int16_t*)now_ptr)!=0 && *((u_int16_t*)now_ptr)!=0x3ff) { */
|
||||
/* printf("%d .",i); */
|
||||
/* *((u_int16_t*)now_ptr)=bus_r16(FIFO_DATA_REG);//\*values; */
|
||||
/* } */
|
||||
/* } */
|
||||
while (*((u_int16_t*)now_ptr)!=bus_r16(FIFO_DATA_REG)) {
|
||||
printf("%d ,",i);
|
||||
*((u_int16_t*)now_ptr)=bus_r16(FIFO_DATA_REG);
|
||||
}
|
||||
now_ptr+=2;
|
||||
}
|
||||
}
|
||||
mask=mask<<1;
|
||||
// if (~(mask&adcDisableMask)
|
||||
bus_w16(DUMMY_REG,i+1);
|
||||
@ -2177,7 +2120,7 @@ u_int16_t* fifo_read_event(int ns)
|
||||
}
|
||||
if (digitalEnable) {
|
||||
printf("+");
|
||||
|
||||
|
||||
bus_w16(DUMMY_REG,1<<9); // read strobe to digital fifo
|
||||
bus_w16(DUMMY_REG,0<<9); // read strobe to digital fifo
|
||||
*((u_int64_t*)now_ptr)=get64BitReg(FIFO_DIGITAL_DATA_LSB_REG,FIFO_DIGITAL_DATA_MSB_REG);
|
||||
@ -2186,17 +2129,17 @@ u_int16_t* fifo_read_event(int ns)
|
||||
now_ptr+=8;
|
||||
|
||||
}
|
||||
// bus_w16(DUMMY_REG,0); //
|
||||
/* #ifdef TIMEDBG */
|
||||
|
||||
/* gettimeofday(&tss,NULL); */
|
||||
/* printf("read data loop = %ld usec\n",(tss.tv_usec) - (tse.tv_usec)); */
|
||||
|
||||
// bus_w16(DUMMY_REG,0); //
|
||||
/* #ifdef TIMEDBG */
|
||||
|
||||
/* gettimeofday(&tss,NULL); */
|
||||
/* printf("read data loop = %ld usec\n",(tss.tv_usec) - (tse.tv_usec)); */
|
||||
|
||||
/* #endif */
|
||||
//#ifdef VERBOSE
|
||||
// printf("*");
|
||||
// printf("*");
|
||||
//#endif
|
||||
// printf("\n");
|
||||
// printf("\n");
|
||||
return ram_values;
|
||||
}
|
||||
|
||||
@ -2213,8 +2156,10 @@ u_int16_t* fifo_read_frame()
|
||||
now_ptr=(char*)ram_values;
|
||||
while(ns<nSamples && fifo_read_event(ns)) {
|
||||
// now_ptr+=dataBytes;
|
||||
// printf("%d %x\n",ns,bus_r16(LOOK_AT_ME_REG));
|
||||
ns++;
|
||||
}
|
||||
// printf("Data in fifo %x\n",bus_r16(LOOK_AT_ME_REG));
|
||||
#ifdef TIMEDBG
|
||||
// usleep(10);
|
||||
gettimeofday(&tss,NULL);
|
||||
@ -3216,12 +3161,22 @@ int setDacRegister(int dacnum,int dacvalue) {
|
||||
/* printf("Dac register %x wrote %08x\n",(DAC_REG_OFF+dacnum/2)<<11,val); */
|
||||
/* bus_w((DAC_REG_OFF+dacnum/2)<<11, val); */
|
||||
|
||||
|
||||
#ifdef CTB4
|
||||
bus_w(DAC_NUM_REG, dacnum);
|
||||
bus_w(DAC_VAL_REG, dacvalue);
|
||||
bus_w(DAC_NUM_REG, dacnum | (1<<16));
|
||||
bus_w(DAC_NUM_REG, dacnum);
|
||||
printf("Wrote dac register value %d address %d\n",bus_r(DAC_VAL_REG),bus_r(DAC_NUM_REG)) ;
|
||||
#endif
|
||||
|
||||
#ifndef CTB4
|
||||
|
||||
if (dacnum<MAXDAC) {
|
||||
printf("dac variable %d set to value %d\n",dacnum, dacvalue) ;
|
||||
dac[dacnum]=dacvalue;
|
||||
} else
|
||||
printf("Bad dac index %d\n", dacnum);
|
||||
#endif
|
||||
return getDacRegister(dacnum);
|
||||
|
||||
|
||||
@ -3229,9 +3184,22 @@ int setDacRegister(int dacnum,int dacvalue) {
|
||||
int getDacRegister(int dacnum) {
|
||||
|
||||
|
||||
#ifdef CTB4
|
||||
bus_w(DAC_NUM_REG, dacnum);
|
||||
printf("READ dac register value %d address %d\n",(int16_t)bus_r(DAC_VAL_OUT_REG),bus_r(DAC_NUM_REG)) ;
|
||||
return (int16_t)bus_r(DAC_VAL_OUT_REG);
|
||||
#endif
|
||||
|
||||
#ifndef CTB4
|
||||
if (dacnum<MAXDAC) {
|
||||
printf("dac variable %d is %d\n",dacnum,dac[dacnum]) ;
|
||||
return dac[dacnum];
|
||||
}else
|
||||
printf("Bad dac index %d\n", dacnum);
|
||||
#endif
|
||||
|
||||
return -1;
|
||||
|
||||
/* #define DAC_VAL_REG 121<<11 */
|
||||
/* #define DAC_NUM_REG 122<<11 */
|
||||
/* #define DAC_VAL_OUT_REG 42<<11 */
|
||||
@ -3537,6 +3505,7 @@ int powerChip(int arg) {
|
||||
|
||||
u_int32_t preg=bus_r(POWER_ON_REG);
|
||||
if (myDetectorType!=JUNGFRAUCTB) {
|
||||
printf("This is not a JCTB!\n");
|
||||
if (arg>=0) {
|
||||
if (arg)
|
||||
bus_w(POWER_ON_REG,preg|0xffff0000);
|
||||
|
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorsPackage/slsDetectorSoftware/jctbDetectorServer
|
||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repsitory UUID: 9ae128961675230ad322ff2867f1862dbe8566a7
|
||||
Revision: 25
|
||||
Repsitory UUID: 9e5ec6a57bf206fe9384260fc4040867a9bbd71c
|
||||
Revision: 33
|
||||
Branch: developer
|
||||
Last Changed Author: Anna_Bergamaschi
|
||||
Last Changed Rev: 3764
|
||||
Last Changed Date: 2018-05-07 14:30:14.000000002 +0200 ./Makefile
|
||||
Last Changed Author: Erik_Frojdh
|
||||
Last Changed Rev: 4065
|
||||
Last Changed Date: 2019-01-30 17:38:35.000000002 +0100 ./firmware_funcs.c
|
||||
|
@ -1,6 +1,6 @@
|
||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||
#define GITREPUUID "9ae128961675230ad322ff2867f1862dbe8566a7"
|
||||
#define GITAUTH "Anna_Bergamaschi"
|
||||
#define GITREV 0x3764
|
||||
#define GITDATE 0x20180507
|
||||
#define GITREPUUID "9e5ec6a57bf206fe9384260fc4040867a9bbd71c"
|
||||
#define GITAUTH "Erik_Frojdh"
|
||||
#define GITREV 0x4065
|
||||
#define GITDATE 0x20190130
|
||||
#define GITBRANCH "developer"
|
||||
|
Binary file not shown.
@ -70,6 +70,8 @@ int N_CHANS=NCHANS;
|
||||
int init_detector(int b, int checkType) {
|
||||
|
||||
int i;
|
||||
int ret;
|
||||
int ii;
|
||||
if (mapCSP0()==FAIL) { printf("Could not map memory\n");
|
||||
exit(1);
|
||||
}
|
||||
@ -81,8 +83,18 @@ int init_detector(int b, int checkType) {
|
||||
for (i=0; i<1000000; i++) {
|
||||
bus_w(SET_DELAY_LSB_REG, i*100);
|
||||
bus_r(FPGA_VERSION_REG);
|
||||
if (i*100!=bus_r(SET_DELAY_LSB_REG))
|
||||
printf("ERROR: wrote 0x%x, read 0x%x\n",i*100,bus_r(SET_DELAY_LSB_REG));
|
||||
//usleep(100);
|
||||
ii=0;
|
||||
// usleep(100);
|
||||
//usleep(100);
|
||||
|
||||
// ret=bus_r(SET_DELAY_LSB_REG);
|
||||
ret=bus_r(SET_DELAY_LSB_REG);
|
||||
while (ret!=i*100 && ii<100) {
|
||||
//if (i*100!=ret)
|
||||
printf("ERROR %d: wrote 0x%x, read 0x%x\n",i, i*100,ret);
|
||||
ret=bus_r(SET_DELAY_LSB_REG);
|
||||
}
|
||||
}
|
||||
printf("Finished\n");
|
||||
}else
|
||||
@ -1865,6 +1877,7 @@ int start_acquisition(int file_des) {
|
||||
ret=FAIL;
|
||||
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
||||
} else {
|
||||
nframes = 0;
|
||||
ret=startStateMachine();
|
||||
}
|
||||
if (ret==FAIL)
|
||||
@ -2045,7 +2058,7 @@ int read_frame(int file_des) {
|
||||
printf("sending pointer %x of size %d\n",(unsigned int)(dataretval),dataBytes);
|
||||
#endif
|
||||
n=sendDataOnly(file_des,dataretval,dataBytes);
|
||||
printf("Sent %d bytes\n",n);
|
||||
printf("Frame %d, Sent %d bytes\n", nframes, n);
|
||||
} else {
|
||||
if (getFrames()>-1) {
|
||||
dataret=FAIL;
|
||||
@ -2110,7 +2123,7 @@ int start_and_read_all(int file_des) {
|
||||
return dataret;
|
||||
|
||||
}
|
||||
|
||||
nframes = 0;
|
||||
startStateMachine();
|
||||
|
||||
/* ret=startStateMachine();
|
||||
|
@ -2382,7 +2382,7 @@ int* multiSlsDetector::startAndReadAll() {
|
||||
while ((retval = getDataFromDetector())) {
|
||||
++i;
|
||||
#ifdef VERBOSE
|
||||
std::cout << i << std::endl;
|
||||
std::cout << i << " " retval << std::endl;
|
||||
#endif
|
||||
dataQueue.push(retval);
|
||||
}
|
||||
@ -2460,7 +2460,7 @@ int* multiSlsDetector::getDataFromDetector() {
|
||||
int nodatadet = -1;
|
||||
int nodatadetectortype = false;
|
||||
detectorType types = getDetectorsType();
|
||||
if (types == EIGER || types == JUNGFRAU || GOTTHARD || PROPIX) {
|
||||
if (types == EIGER || types == JUNGFRAU || types == GOTTHARD || types == PROPIX) {
|
||||
nodatadetectortype = true;
|
||||
}
|
||||
|
||||
@ -3280,6 +3280,7 @@ int multiSlsDetector::setROI(int n, ROI roiLimits[], int imod) {
|
||||
if ((n < 0) || (roiLimits == NULL))
|
||||
return FAIL;
|
||||
|
||||
// cout << "Setting ROI for " << n << "rois:" << endl;
|
||||
//ensures min < max
|
||||
verifyMinMaxROI(n, roiLimits);
|
||||
#ifdef VERBOSE
|
||||
@ -3294,7 +3295,7 @@ int multiSlsDetector::setROI(int n, ROI roiLimits[], int imod) {
|
||||
xmax = roiLimits[i].xmax;
|
||||
ymin = roiLimits[i].ymin;
|
||||
ymax = roiLimits[i].ymax;
|
||||
|
||||
if (getDetectorsType() != JUNGFRAUCTB) {
|
||||
//check roi max values
|
||||
idet = decodeNChannel(xmax, ymax, channelX, channelY);
|
||||
#ifdef VERBOSE
|
||||
@ -3302,7 +3303,8 @@ int multiSlsDetector::setROI(int n, ROI roiLimits[], int imod) {
|
||||
cout << "det:" << idet << "\t" << xmax << "\t" << ymax << "\t"
|
||||
<< channelX << "\t" << channelY << endl;
|
||||
#endif
|
||||
if (idet == -1) {
|
||||
//std::cout << getDetectorsType() << endl;
|
||||
if (idet == -1 ) {
|
||||
cout << "invalid roi" << endl;
|
||||
continue;
|
||||
}
|
||||
@ -3367,6 +3369,17 @@ int multiSlsDetector::setROI(int n, ROI roiLimits[], int imod) {
|
||||
if ((lastChannelX + offsetX) == xmax)
|
||||
xmin = xmax + 1;
|
||||
}
|
||||
}else {
|
||||
idet=0;
|
||||
nroi[idet]=n;
|
||||
index = 0;
|
||||
allroi[idet][index].xmin = xmin;
|
||||
allroi[idet][index].xmax = xmax;
|
||||
allroi[idet][index].ymin = ymin;
|
||||
allroi[idet][index].ymax = ymax;
|
||||
// nroi[idet] = nroi[idet] + 1;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef VERBOSE
|
||||
@ -3415,6 +3428,7 @@ slsDetectorDefs::ROI* multiSlsDetector::getROI(int& n, int imod) {
|
||||
//get each detector's roi array
|
||||
for (unsigned i = 0; i < detectors.size(); ++i) {
|
||||
temp = detectors[i]->getROI(index);
|
||||
// cout << index << endl;
|
||||
if (detectors[i]->getErrorMask())
|
||||
setErrorMask(getErrorMask() | (1 << i));
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||
#define GITREPUUID "3c774478681813e451df683e2bc8403b37490323"
|
||||
#define GITREPUUID "907d1655d1f6cf2bb8cf6ccd7e91e82f479dd2ca"
|
||||
#define GITAUTH "Dhanya_Thattil"
|
||||
#define GITREV 0x4084
|
||||
#define GITDATE 0x20190208
|
||||
#define GITBRANCH "4.0.1"
|
||||
#define GITREV 0x4101
|
||||
#define GITDATE 0x20190211
|
||||
#define GITBRANCH "developer"
|
||||
|
@ -145,7 +145,7 @@ double* slsDetector::decodeData(int *datain, int &nn, double *fdata) {
|
||||
dataout[ichan]=*((u_int16_t*)ptr);
|
||||
ptr+=2;
|
||||
}
|
||||
std::cout<< "decoded "<< ichan << " channels" << std::endl;
|
||||
//std::cout<< "decoded "<< ichan << " channels" << std::endl;
|
||||
} else {
|
||||
switch (nbits) {
|
||||
case 1:
|
||||
@ -1061,14 +1061,18 @@ void slsDetector::disconnectControl() {
|
||||
|
||||
|
||||
int slsDetector::connectData() {
|
||||
//cout << "connect" << endl;
|
||||
if (dataSocket){
|
||||
if (dataSocket->Connect() >= 0)
|
||||
return OK;
|
||||
else{
|
||||
if (dataSocket->Connect() >= 0) {
|
||||
//cout << "ok" << endl;
|
||||
return OK;
|
||||
} else{
|
||||
std::cout << "cannot connect to receiver" << endl;
|
||||
setErrorMask((getErrorMask())|(CANNOT_CONNECT_TO_RECEIVER));
|
||||
//cout << "fail" << endl;
|
||||
return FAIL;}
|
||||
}
|
||||
//cout << "undefined" << endl;
|
||||
return UNDEFINED;
|
||||
}
|
||||
|
||||
@ -2938,6 +2942,30 @@ int slsDetector::getThresholdEnergy(int imod) {
|
||||
updateDetector();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(thisDetector->myDetectorType==JUNGFRAUCTB) {
|
||||
|
||||
|
||||
int en=-1;
|
||||
|
||||
string header=getNetworkParameter(ADDITIONAL_JSON_HEADER);
|
||||
|
||||
|
||||
std::cout<< "Json header: " << header << std::endl;
|
||||
|
||||
//must be in the format '\"label1\":\"value1\",\"label2\":\"value2\"' etc."
|
||||
//
|
||||
size_t pos0;
|
||||
pos0=header.find("\"threshold\"");
|
||||
if (pos0!=std::string::npos) {
|
||||
if (sscanf(header.substr(pos0).c_str(),"\"threshold\":%d", &en))
|
||||
thisDetector->currentThresholdEV=en;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return thisDetector->currentThresholdEV;
|
||||
}
|
||||
|
||||
@ -2981,6 +3009,62 @@ int slsDetector::setThresholdEnergy(int e_eV, int imod, detectorSettings isetti
|
||||
} else {
|
||||
thisDetector->currentThresholdEV=e_eV;
|
||||
}
|
||||
|
||||
/* add threshold to zmq header */
|
||||
|
||||
string header=getNetworkParameter(ADDITIONAL_JSON_HEADER);
|
||||
|
||||
std::cout<< "Old json header: " << header << std::endl;
|
||||
//must be in the format '\"label1\":\"value1\",\"label2\":\"value2\"' etc."
|
||||
//
|
||||
size_t pos0;
|
||||
pos0=header.find(",\"threshold\"");
|
||||
if (pos0==std::string::npos) {
|
||||
pos0=header.find("\"threshold\"");
|
||||
}
|
||||
if (pos0!=std::string::npos) {
|
||||
// remove old roi
|
||||
// std::cout<< header.substr(0,pos) << std::endl;
|
||||
// size_t pos0=header.find_last_of(",",0,pos);
|
||||
// if (pos0==std::string::npos) {
|
||||
// pos0=pos;
|
||||
// } else
|
||||
// std::cout<< header.substr(pos0) << std::endl;
|
||||
size_t pos1=header.find_first_of(",",pos0+1);
|
||||
// std::cout << pos0 << " " << pos1 << std::endl;
|
||||
std::cout<< "Replacing old threshold: " << header.substr(pos0,pos1-pos0) << std::endl;
|
||||
// if (pos1!=std::string::npos)
|
||||
header.erase(pos0,pos1-pos0);
|
||||
// else
|
||||
// header.erase(pos0);
|
||||
}
|
||||
if (header.length()>0) {
|
||||
if (header.at(0)==',')
|
||||
header.erase(0,1);
|
||||
if (header.length()>0)
|
||||
header.append(",");
|
||||
}
|
||||
// std::cout<< "Left: " << header << std::endl;
|
||||
char h[1000];
|
||||
sprintf(h,"\"threshold\":%d",e_eV);
|
||||
// std::cout<< "new ROI: " << h << std::endl;
|
||||
|
||||
header.append(h);
|
||||
std::cout<< "New json header: " << header << std::endl;
|
||||
setReceiverOnline(ONLINE_FLAG);
|
||||
setNetworkParameter(ADDITIONAL_JSON_HEADER, header);
|
||||
/***** END FOR ZMQ HEADER */
|
||||
ret=OK;
|
||||
|
||||
if (thisDetector->myDetectorType==JUNGFRAUCTB) {
|
||||
thisDetector->currentThresholdEV=e_eV;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return thisDetector->currentThresholdEV;
|
||||
}
|
||||
|
||||
@ -3739,8 +3823,8 @@ int* slsDetector::startAndReadAll() {
|
||||
//#ifdef VERBOSE
|
||||
#ifdef VERBOSE
|
||||
int i=0;
|
||||
#endif
|
||||
//#endif
|
||||
#endif
|
||||
if(thisDetector->myDetectorType == EIGER) {
|
||||
if (prepareAcquisition() == FAIL)
|
||||
return NULL;
|
||||
@ -3750,15 +3834,15 @@ int* slsDetector::startAndReadAll() {
|
||||
// std::cout<< "started" << std::endl;
|
||||
//#endif
|
||||
while ((retval=getDataFromDetector())){
|
||||
#ifdef VERBOSE
|
||||
#ifdef VERBOSE
|
||||
++i;
|
||||
std::cout<< i << std::endl;
|
||||
// std::cout<< i << std::endl;
|
||||
//#else
|
||||
//std::cout<< "-" << flush;
|
||||
#endif
|
||||
#endif
|
||||
dataQueue.push(retval);
|
||||
|
||||
//std::cout<< "pushed" << std::endl;
|
||||
// std::cout<< "pushed" << retval << std::endl;
|
||||
}
|
||||
disconnectControl();
|
||||
|
||||
@ -3766,7 +3850,7 @@ int* slsDetector::startAndReadAll() {
|
||||
std::cout<< "received "<< i<< " frames" << std::endl;
|
||||
//#else
|
||||
// std::cout << std::endl;
|
||||
#endif
|
||||
#endif
|
||||
return dataQueue.front(); // check what we return!
|
||||
/* while ((retval=getDataFromDetectorNoWait()))
|
||||
++i;
|
||||
@ -3810,10 +3894,13 @@ int* slsDetector::getDataFromDetector(int *retval) {
|
||||
|
||||
int nodatadetectortype = false;
|
||||
detectorType types = getDetectorsType();
|
||||
if(types == EIGER || types == JUNGFRAU || GOTTHARD || PROPIX){
|
||||
// cout << types << endl;
|
||||
|
||||
if(types == EIGER || types == JUNGFRAU || types == GOTTHARD || types == PROPIX){
|
||||
nodatadetectortype = true;
|
||||
}
|
||||
|
||||
//cout << "nodata det" << nodatadetectortype << endl;
|
||||
|
||||
if (!nodatadetectortype && retval==NULL)
|
||||
retval=new int[nel];
|
||||
@ -3835,22 +3922,22 @@ int* slsDetector::getDataFromDetector(int *retval) {
|
||||
std::cout<< "Detector returned: " << mess << " " << n << std::endl;
|
||||
} else {
|
||||
;
|
||||
#ifdef VERBOSE
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Detector successfully returned: " << mess << " " << n
|
||||
<< std::endl;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
if ((!nodatadetectortype) && (r==NULL)){
|
||||
delete [] retval;
|
||||
}
|
||||
return NULL;
|
||||
} else if (!nodatadetectortype){
|
||||
// cout <<"??" << endl;
|
||||
n=controlSocket->ReceiveDataOnly(retval,thisDetector->dataBytes);
|
||||
|
||||
n=controlSocket->ReceiveDataOnly(retval,thisDetector->dataBytes);
|
||||
|
||||
#ifdef VERBOSE
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Received "<< n << " data bytes" << std::endl;
|
||||
#endif
|
||||
#endif
|
||||
if (n!=thisDetector->dataBytes) {
|
||||
std::cout<< "wrong data size received from detector: received " <<
|
||||
n << " but expected " << thisDetector->dataBytes << std::endl;
|
||||
@ -3866,7 +3953,8 @@ int* slsDetector::getDataFromDetector(int *retval) {
|
||||
|
||||
|
||||
}
|
||||
// cout << "get data returning " << endl;
|
||||
|
||||
// cout << "get data returning " << retval << endl;
|
||||
// cout << endl;
|
||||
return retval;
|
||||
|
||||
@ -4555,11 +4643,11 @@ int slsDetector::getDataBytesInclGapPixels() {
|
||||
|
||||
|
||||
dacs_t slsDetector::setDAC(dacs_t val, dacIndex index, int mV, int imod) {
|
||||
|
||||
|
||||
|
||||
dacs_t retval[2];
|
||||
retval[0] = -1;
|
||||
retval[1] = -1;
|
||||
if (index!=ZMQ_emin && index!=ZMQ_emax) {
|
||||
int fnum=F_SET_DAC;
|
||||
int ret=FAIL;
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
@ -4620,8 +4708,91 @@ dacs_t slsDetector::setDAC(dacs_t val, dacIndex index, int mV, int imod) {
|
||||
}
|
||||
if(mV)
|
||||
return retval[1];
|
||||
} else if(thisDetector->myDetectorType==JUNGFRAUCTB) {
|
||||
|
||||
string header=getNetworkParameter(ADDITIONAL_JSON_HEADER);
|
||||
|
||||
std::cout<< "Old json header: " << header << std::endl;
|
||||
|
||||
return retval[0];
|
||||
if (index==ZMQ_emin) {
|
||||
|
||||
size_t pos0, pos1;
|
||||
pos0=header.find(",\"eMin\"");
|
||||
if (pos0==std::string::npos) {
|
||||
pos0=header.find("\"eMin\"");
|
||||
} else pos0++;
|
||||
if (pos0!=std::string::npos) {
|
||||
pos1=header.find_first_of(",",pos0);
|
||||
// std::cout << pos0 << " " << pos1 << std::endl;
|
||||
std::cout<< "Replacing old eMin: " << header.substr(pos0,pos1-pos0) << std::endl;
|
||||
// if (pos1!=std::string::npos)
|
||||
if (val>=0)
|
||||
header.erase(pos0,pos1-pos0);
|
||||
// else
|
||||
// header.erase(pos0);
|
||||
}
|
||||
if (val>=0) {
|
||||
if (header.length()>0) {
|
||||
if (header.at(0)==',')
|
||||
header.erase(0,1);
|
||||
if (header.length()>0)
|
||||
header.append(",");
|
||||
}
|
||||
// std::cout<< "Left: " << header << std::endl;
|
||||
char h[1000];
|
||||
sprintf(h,"\"eMin\":%d",val);
|
||||
// std::cout<< "new ROI: " << h << std::endl;
|
||||
|
||||
header.append(h);
|
||||
} else {
|
||||
sscanf(header.substr(pos0,pos1-pos0).c_str(),"\"eMin\":%d",&val);
|
||||
}
|
||||
|
||||
} else if (index==ZMQ_emax) {
|
||||
|
||||
|
||||
size_t pos0, pos1;
|
||||
pos0=header.find(",\"eMax\"");
|
||||
if (pos0==std::string::npos) {
|
||||
pos0=header.find("\"eMax\"");
|
||||
} else pos0++;
|
||||
if (pos0!=std::string::npos) {
|
||||
pos1=header.find_first_of(",",pos0);
|
||||
// std::cout << pos0 << " " << pos1 << std::endl;
|
||||
std::cout<< "Replacing old eMax: " << header.substr(pos0,pos1-pos0) << std::endl;
|
||||
// if (pos1!=std::string::npos)
|
||||
if (val>=0)
|
||||
header.erase(pos0,pos1-pos0);
|
||||
// else
|
||||
// header.erase(pos0);
|
||||
}
|
||||
if (val>=0) {
|
||||
if (header.length()>0) {
|
||||
if (header.at(0)==',')
|
||||
header.erase(0,1);
|
||||
if (header.length()>0)
|
||||
header.append(",");
|
||||
}
|
||||
// std::cout<< "Left: " << header << std::endl;
|
||||
char h[1000];
|
||||
sprintf(h,"\"eMax\":%d",val);
|
||||
// std::cout<< "new ROI: " << h << std::endl;
|
||||
|
||||
header.append(h);
|
||||
} else {
|
||||
sscanf(header.substr(pos0,pos1-pos0).c_str(),"\"eMax\":%d",&val);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
std::cout<< "New json header: " << header << std::endl;
|
||||
setReceiverOnline(ONLINE_FLAG);
|
||||
setNetworkParameter(ADDITIONAL_JSON_HEADER, header);
|
||||
/***** END FOR ZMQ HEADER */
|
||||
retval[0]=val;
|
||||
}
|
||||
|
||||
return retval[0];
|
||||
}
|
||||
|
||||
|
||||
@ -4792,13 +4963,14 @@ int slsDetector::setReadOutFlags(readOutFlags flag) {
|
||||
|
||||
|
||||
int fnum=F_SET_READOUT_FLAGS;
|
||||
readOutFlags retval;
|
||||
//readOutFlags retval;
|
||||
int retval;
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
int ret=OK;
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Setting readout flags to "<< flag << std::endl;
|
||||
#endif
|
||||
//#ifdef VERBOSE
|
||||
std::cout<< "Setting readout flags to "<< hex << flag << dec << std::endl;
|
||||
//#endif
|
||||
|
||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||
if (connectControl() == OK){
|
||||
@ -4811,10 +4983,11 @@ int slsDetector::setReadOutFlags(readOutFlags flag) {
|
||||
setErrorMask((getErrorMask())|(COULD_NOT_SET_READOUT_FLAGS));
|
||||
} else {
|
||||
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||
thisDetector->roFlags=retval;
|
||||
thisDetector->roFlags=(readOutFlags)retval;
|
||||
if (thisDetector->myDetectorType==JUNGFRAUCTB) {
|
||||
|
||||
getTotalNumberOfChannels();
|
||||
int nn=getTotalNumberOfChannels();
|
||||
cout << "Total number of channels is " << nn << endl;
|
||||
//thisDetector->dataBytes=getTotalNumberOfChannels()*
|
||||
//thisDetector->dynamicRange/8*thisDetector->timerValue[SAMPLES_JCTB];
|
||||
}
|
||||
@ -4828,6 +5001,150 @@ int slsDetector::setReadOutFlags(readOutFlags flag) {
|
||||
thisDetector->roFlags=flag;
|
||||
}
|
||||
|
||||
// std::cout<< "***ZMQ: " << hex<< flag << std::endl;
|
||||
|
||||
if (flag & (PEDESTAL | NEWPEDESTAL | NEWFLAT | FLAT | FRAME)) {
|
||||
|
||||
std::cout<< "***frameMode: " << std::endl;
|
||||
string header=getNetworkParameter(ADDITIONAL_JSON_HEADER);
|
||||
|
||||
std::cout<< "Old json header: " << header << std::endl;
|
||||
//must be in the format '\"label1\":\"value1\",\"label2\":\"value2\"' etc."
|
||||
//
|
||||
size_t pos0;
|
||||
pos0=header.find(",\"frameMode\"");
|
||||
if (pos0==std::string::npos) {
|
||||
pos0=header.find("\"frameMode\"");
|
||||
}
|
||||
if (pos0!=std::string::npos) {
|
||||
size_t pos1=header.find_first_of(",",pos0+1);
|
||||
// if (pos1!=std::string::npos)
|
||||
if (flag!=GET_READOUT_FLAGS) {
|
||||
cout << dec<< pos0 << " " << pos1 << endl;
|
||||
std::cout<< "Replacing frame Mode: " << header.substr(pos0,pos1-pos0) << std::endl;
|
||||
header.erase(pos0,pos1-pos0);
|
||||
}
|
||||
else if (header.substr(pos0,pos1+pos0)=="\"frameMode\":\"pedestal\"")
|
||||
retval|=PEDESTAL;
|
||||
else if (header.substr(pos0,pos1+pos0)=="\"frameMode\":\"newPedestal\"")
|
||||
retval|=NEWPEDESTAL;
|
||||
else if (header.substr(pos0,pos1+pos0)=="\"frameMode\":\"flatfield\"")
|
||||
retval|=FLAT;
|
||||
else if (header.substr(pos0,pos1+pos0)=="\"frameMode\":\"newFlatfield\"")
|
||||
retval|=NEWFLAT;
|
||||
else
|
||||
retval|=FRAME;
|
||||
|
||||
|
||||
}
|
||||
char h[1000];
|
||||
switch (flag) {
|
||||
case PEDESTAL:
|
||||
retval|=PEDESTAL;
|
||||
strcpy(h,"\"frameMode\":\"pedestal\"");
|
||||
break;
|
||||
case NEWPEDESTAL:
|
||||
retval|=NEWPEDESTAL;
|
||||
strcpy(h,"\"frameMode\":\"newPedestal\"");
|
||||
break;
|
||||
case FLAT:
|
||||
retval|=FLAT;
|
||||
strcpy(h,"\"frameMode\":\"flatfield\"");
|
||||
break;
|
||||
case NEWFLAT:
|
||||
retval|=NEWFLAT;
|
||||
strcpy(h,"\"frameMode\":\"newFlatfield\"");
|
||||
break;
|
||||
default:
|
||||
retval|=FRAME;
|
||||
strcpy(h,"\"frameMode\":\"frame\"");
|
||||
}
|
||||
if (flag!=GET_READOUT_FLAGS) {
|
||||
if (header.length()>0) {
|
||||
if (header.at(0)==',')
|
||||
header.erase(0,1);
|
||||
if (header.length()>0)
|
||||
header.append(",");
|
||||
}
|
||||
header.append(h);
|
||||
setReceiverOnline(ONLINE_FLAG);
|
||||
setNetworkParameter(ADDITIONAL_JSON_HEADER, header);
|
||||
}
|
||||
std::cout<< "New json header: " << header << std::endl;
|
||||
/***** END FOR ZMQ HEADER */
|
||||
ret=OK;
|
||||
// retval=flag;
|
||||
|
||||
}
|
||||
|
||||
if (flag & (COUNTING | INTERPOLATING | ANALOG)) {
|
||||
|
||||
std::cout<< "***detectorMode: " << std::endl;
|
||||
|
||||
string header=getNetworkParameter(ADDITIONAL_JSON_HEADER);
|
||||
|
||||
std::cout<< "Old json header: " << header << std::endl;
|
||||
//must be in the format '\"label1\":\"value1\",\"label2\":\"value2\"' etc."
|
||||
//
|
||||
size_t pos0;
|
||||
pos0=header.find(",\"detectorMode\"");
|
||||
if (pos0==std::string::npos) {
|
||||
pos0=header.find("\"detectorMode\"");
|
||||
}
|
||||
if (pos0!=std::string::npos) {
|
||||
size_t pos1=header.find_first_of(",",pos0+1);
|
||||
// if (pos1!=std::string::npos)
|
||||
if (flag!=GET_READOUT_FLAGS) {
|
||||
cout << dec<< pos0 << " " << pos1 << endl;
|
||||
std::cout<< "Replacing detector Mode: " << header.substr(pos0,pos1-pos0) << std::endl;
|
||||
header.erase(pos0,pos1-pos0);
|
||||
}
|
||||
else if (header.substr(pos0,pos1+pos0)=="\"detectorMode\":\"counting\"")
|
||||
retval|=COUNTING;
|
||||
else if (header.substr(pos0,pos1+pos0)=="\"detectorMode\":\"interpolating\"")
|
||||
retval|=INTERPOLATING;
|
||||
else
|
||||
retval|=ANALOG;
|
||||
}
|
||||
char h[1000];
|
||||
switch (flag) {
|
||||
case COUNTING:
|
||||
strcpy(h,"\"detectorMode\":\"counting\"");
|
||||
retval|=COUNTING;
|
||||
break;
|
||||
case INTERPOLATING:
|
||||
retval|=INTERPOLATING;
|
||||
strcpy(h,"\"detectorMode\":\"interpolating\"");
|
||||
break;
|
||||
default:
|
||||
retval|=ANALOG;
|
||||
strcpy(h,"\"detectorMode\":\"analog\"");
|
||||
}
|
||||
if (flag!=GET_READOUT_FLAGS) {
|
||||
if (header.length()>0) {
|
||||
if (header.at(0)==',')
|
||||
header.erase(0,1);
|
||||
if (header.length()>0)
|
||||
header.append(",");
|
||||
}
|
||||
header.append(h);
|
||||
setReceiverOnline(ONLINE_FLAG);
|
||||
setNetworkParameter(ADDITIONAL_JSON_HEADER, header);
|
||||
/***** END FOR ZMQ HEADER */
|
||||
// retval=flag;
|
||||
}
|
||||
std::cout<< "New json header: " << header << std::endl;
|
||||
ret=OK;
|
||||
}
|
||||
|
||||
|
||||
if (ret==OK) {
|
||||
|
||||
// thisDetector->roFlags=flag;
|
||||
thisDetector->roFlags=(readOutFlags)retval;
|
||||
}
|
||||
|
||||
std::cout<< retval << std::endl;
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Readout flag set to "<< retval << std::endl;
|
||||
#endif
|
||||
@ -5571,12 +5888,14 @@ string slsDetector::setAdditionalJsonHeader(string jsonheader) {
|
||||
strcpy(arg, jsonheader.c_str());
|
||||
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Sending additional json header " << arg << std::endl;
|
||||
#endif
|
||||
//#ifdef VERBOSE
|
||||
// std::cout << "* Sending additional json header " << arg << std::endl;
|
||||
//#endif
|
||||
if (connectData() == OK){
|
||||
ret=thisReceiver->sendString(fnum,retval,arg);
|
||||
disconnectData();
|
||||
|
||||
// std::cout << "** Sending additional json header " << arg << std::endl;
|
||||
ret=thisReceiver->sendString(fnum,retval,arg);
|
||||
disconnectData();
|
||||
}
|
||||
if(ret==FAIL) {
|
||||
setErrorMask((getErrorMask())|(COULDNOT_SET_NETWORK_PARAMETER));
|
||||
@ -6027,6 +6346,70 @@ int slsDetector::setROI(int n,ROI roiLimits[], int imod) {
|
||||
//sort ascending order
|
||||
int temp;
|
||||
|
||||
/***** NEW PART FOR ZMQ HEADER */
|
||||
//std::cout<< "******* ROI" << std::endl;
|
||||
|
||||
// char header[1000];
|
||||
string header=getNetworkParameter(ADDITIONAL_JSON_HEADER);
|
||||
|
||||
std::cout<< "Old json header: " << header << std::endl;
|
||||
//must be in the format '\"label1\":\"value1\",\"label2\":\"value2\"' etc."
|
||||
//
|
||||
size_t pos0;
|
||||
pos0=header.find(",\"roi\"");
|
||||
if (pos0==std::string::npos) {
|
||||
pos0=header.find("\"roi\"");
|
||||
}
|
||||
if (pos0!=std::string::npos) {
|
||||
// remove old roi
|
||||
// std::cout<< header.substr(0,pos) << std::endl;
|
||||
// size_t pos0=header.find_last_of(",",0,pos);
|
||||
// if (pos0==std::string::npos) {
|
||||
// pos0=pos;
|
||||
// } else
|
||||
// std::cout<< header.substr(pos0) << std::endl;
|
||||
size_t pos1=header.find_first_of("]",pos0+1);
|
||||
// std::cout << pos0 << " " << pos1 << std::endl;
|
||||
std::cout<< "Replacing old ROI: " << header.substr(pos0,pos1-pos0+1) << std::endl;
|
||||
// if (pos1!=std::string::npos)
|
||||
header.erase(pos0,pos1-pos0+1);
|
||||
// else
|
||||
// header.erase(pos0);
|
||||
}
|
||||
if (header.length()>0) {
|
||||
if (header.at(0)==',')
|
||||
header.erase(0,1);
|
||||
if (header.length()>0)
|
||||
header.append(",");
|
||||
}
|
||||
// std::cout<< "Left: " << header << std::endl;
|
||||
char h[1000];
|
||||
if (n) {
|
||||
sprintf(h,"\"roi\":[%d, %d, %d, %d]",roiLimits[0].xmin, roiLimits[0].xmax, roiLimits[0].ymin, roiLimits[0].ymax);
|
||||
// std::cout<< "new ROI: " << h << std::endl;
|
||||
} else {
|
||||
sprintf(h,"\"roi\":[%d, %d, %d, %d]",-1, -1, -1, -1);
|
||||
}
|
||||
header.append(h);
|
||||
std::cout<< "New json header: " << header << std::endl;
|
||||
setReceiverOnline(ONLINE_FLAG);
|
||||
setNetworkParameter(ADDITIONAL_JSON_HEADER, header);
|
||||
/***** END FOR ZMQ HEADER */
|
||||
ret=OK;
|
||||
|
||||
if(thisDetector->myDetectorType==JUNGFRAUCTB) {
|
||||
|
||||
thisDetector->nROI = n;
|
||||
thisDetector->roiLimits[0].xmin=roiLimits[0].xmin;
|
||||
thisDetector->roiLimits[0].xmax=roiLimits[0].xmax;
|
||||
thisDetector->roiLimits[0].ymin=roiLimits[0].ymin;
|
||||
thisDetector->roiLimits[0].ymax=roiLimits[0].ymax;
|
||||
// std::cout << "** " << thisDetector->nROI << endl;
|
||||
getTotalNumberOfChannels();
|
||||
// std::cout << "*** " << thisDetector->nROI << endl;
|
||||
return ret;
|
||||
}
|
||||
// if(thisDetector->myDetectorType==JUNGFRAUCTB)
|
||||
for(int i=0;i<n;++i){
|
||||
|
||||
// cout << "*** ROI "<< i << " xmin " << roiLimits[i].xmin << " xmax "
|
||||
@ -6052,16 +6435,51 @@ int slsDetector::setROI(int n,ROI roiLimits[], int imod) {
|
||||
}
|
||||
|
||||
ret = sendROI(n,roiLimits);
|
||||
if(ret==FAIL)
|
||||
setErrorMask((getErrorMask())|(COULDNOT_SET_ROI));
|
||||
|
||||
|
||||
if(thisDetector->myDetectorType==JUNGFRAUCTB) getTotalNumberOfChannels();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
slsDetectorDefs::ROI* slsDetector::getROI(int &n, int imod) {
|
||||
sendROI(-1,NULL);
|
||||
n=thisDetector->nROI;
|
||||
if(thisDetector->myDetectorType==JUNGFRAUCTB) getTotalNumberOfChannels();
|
||||
if(thisDetector->myDetectorType==JUNGFRAUCTB) {
|
||||
|
||||
|
||||
int xmin, xmax, ymin, ymax;
|
||||
|
||||
string header=getNetworkParameter(ADDITIONAL_JSON_HEADER);
|
||||
|
||||
|
||||
std::cout<< "Json header: " << header << std::endl;
|
||||
|
||||
//must be in the format '\"label1\":\"value1\",\"label2\":\"value2\"' etc."
|
||||
//
|
||||
size_t pos0;
|
||||
pos0=header.find("\"roi\"");
|
||||
if (pos0!=std::string::npos) {
|
||||
sscanf(header.substr(pos0).c_str(),"\"roi\":[%d, %d, %d, %d]", &xmin, &xmax, &ymin, &ymax);
|
||||
if (xmin<0 && xmax<0 && ymin<0 && ymax<0)
|
||||
thisDetector->nROI=0;
|
||||
else {
|
||||
thisDetector->nROI=1;
|
||||
thisDetector->roiLimits[0].xmin=xmin;
|
||||
thisDetector->roiLimits[0].xmax=xmax;
|
||||
thisDetector->roiLimits[0].ymin=ymin;
|
||||
thisDetector->roiLimits[0].ymax=ymax;
|
||||
}
|
||||
} else {
|
||||
thisDetector->nROI=0;
|
||||
}
|
||||
|
||||
// cout << thisDetector->nROI << endl;
|
||||
getTotalNumberOfChannels();
|
||||
} else {
|
||||
sendROI(-1,NULL);
|
||||
n=thisDetector->nROI;
|
||||
}
|
||||
return thisDetector->roiLimits;
|
||||
}
|
||||
|
||||
|
@ -176,31 +176,33 @@ int slsDetectorActions::setScan(int iscan, string script, int nvalues, double *v
|
||||
if (par!="")
|
||||
strcpy(scanParameter[iscan],par.c_str());
|
||||
|
||||
if (nvalues>=0) {
|
||||
if (nvalues==0)
|
||||
scanMode[iscan]=noScan;
|
||||
else {
|
||||
nScanSteps[iscan]=nvalues;
|
||||
if (nvalues>=0) {
|
||||
// cout << "nvalues " << nvalues << endl;
|
||||
if (nvalues==0)
|
||||
scanMode[iscan]=noScan;
|
||||
else {
|
||||
nScanSteps[iscan]=nvalues;
|
||||
if (nvalues>MAX_SCAN_STEPS)
|
||||
nScanSteps[iscan]=MAX_SCAN_STEPS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (values && scanMode[iscan]>0 ) {
|
||||
for (int iv=0; iv<nScanSteps[iscan]; iv++) {
|
||||
scanSteps[iscan][iv]=values[iv];
|
||||
}
|
||||
if (values && scanMode[iscan]>0 ) {
|
||||
for (int iv=0; iv<nScanSteps[iscan]; iv++) {
|
||||
scanSteps[iscan][iv]=values[iv];
|
||||
// cout << values[iv] << endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (precision>=0)
|
||||
scanPrecision[iscan]=precision;
|
||||
|
||||
if (scanMode[iscan]>0){
|
||||
if (precision>=0)
|
||||
scanPrecision[iscan]=precision;
|
||||
|
||||
if (scanMode[iscan]>0){
|
||||
*actionMask |= 1<< (iscan+MAX_ACTIONS);
|
||||
} else {
|
||||
*actionMask &= ~(1 << (iscan+MAX_ACTIONS));
|
||||
}
|
||||
|
||||
} else {
|
||||
*actionMask &= ~(1 << (iscan+MAX_ACTIONS));
|
||||
}
|
||||
|
||||
|
||||
|
||||
setTotalProgress();
|
||||
|
@ -1011,9 +1011,12 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdImage;
|
||||
++i;
|
||||
|
||||
|
||||
|
||||
|
||||
/*! \page data
|
||||
- <b>gainimage fn</b> Loads the gain image to the detector from file fn (gain map for translation into number of photons of an analog detector). Cannot get.
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="flatimage"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdImage;
|
||||
++i;
|
||||
|
||||
|
||||
|
||||
@ -1123,7 +1126,19 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
\section settingsdacs DACs
|
||||
commands to configure DACs of detector
|
||||
*/
|
||||
/*! \page settings
|
||||
- <b>emin [i] </b> Sets/gets detector minimum energy threshold for the CTB (soft setting)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="emin"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDAC;
|
||||
++i;
|
||||
|
||||
/*! \page settings
|
||||
- <b>emax [i] </b> Sets/gets detector maximum energy threshold for the CTB (soft setting)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="emax"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDAC;
|
||||
++i;
|
||||
/*! \page settings
|
||||
- <b>vthreshold [i] [mv]</b> Sets/gets detector threshold voltage for single photon counters. Normally in DAC units unless \c mv is specified at the end of the command line. \c Returns \c (int ["mV"])
|
||||
*/
|
||||
@ -4098,7 +4113,6 @@ string slsDetectorCommand::cmdNetworkParameter(int narg, char *args[], int actio
|
||||
t=ADDITIONAL_JSON_HEADER;
|
||||
}
|
||||
else return ("unknown network parameter")+cmd;
|
||||
|
||||
if (action==PUT_ACTION) {
|
||||
myDet->setNetworkParameter(t, args[1]);
|
||||
// switch it back on, if it had been switched on
|
||||
@ -4475,6 +4489,7 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
|
||||
if ((val<0) || (narg!=((val*4)+2)) )
|
||||
return helpDetectorSize(narg,args,action);
|
||||
ROI allroi[val];
|
||||
// pos=1;
|
||||
pos=2;
|
||||
for(i=0;i<val;++i){
|
||||
if ((!sscanf(args[pos++],"%d",&allroi[i].xmin)) ||
|
||||
@ -5248,6 +5263,10 @@ string slsDetectorCommand::cmdDAC(int narg, char *args[], int action) {
|
||||
dac=M_vIbiasSh;
|
||||
else if (cmd== "vIpreOut")
|
||||
dac=M_vIpreOut;
|
||||
else if (cmd== "emin")
|
||||
dac=ZMQ_emin;
|
||||
else if (cmd== "emax")
|
||||
dac=ZMQ_emax;
|
||||
|
||||
else
|
||||
return string("cannot decode dac ")+cmd;
|
||||
@ -5985,29 +6004,45 @@ string slsDetectorCommand::cmdAdvanced(int narg, char *args[], int action) {
|
||||
if (action==PUT_ACTION) {
|
||||
string sval=string(args[1]);
|
||||
if (sval=="none")
|
||||
flag=NORMAL_READOUT;
|
||||
flag=NORMAL_READOUT;
|
||||
else if (sval=="storeinram")
|
||||
flag=STORE_IN_RAM;
|
||||
flag=STORE_IN_RAM;
|
||||
else if (sval=="tot")
|
||||
flag=TOT_MODE;
|
||||
flag=TOT_MODE;
|
||||
else if (sval=="continous")
|
||||
flag=CONTINOUS_RO;
|
||||
flag=CONTINOUS_RO;
|
||||
else if (sval=="parallel")
|
||||
flag=PARALLEL;
|
||||
flag=PARALLEL;
|
||||
else if (sval=="nonparallel")
|
||||
flag=NONPARALLEL;
|
||||
flag=NONPARALLEL;
|
||||
else if (sval=="safe")
|
||||
flag=SAFE;
|
||||
flag=SAFE;
|
||||
else if (sval=="digital")
|
||||
flag=DIGITAL_ONLY;
|
||||
flag=DIGITAL_ONLY;
|
||||
else if (sval=="analog_digital")
|
||||
flag=ANALOG_AND_DIGITAL;
|
||||
flag=ANALOG_AND_DIGITAL;
|
||||
else if (sval=="overflow")
|
||||
flag=SHOW_OVERFLOW;
|
||||
flag=SHOW_OVERFLOW;
|
||||
else if (sval=="nooverflow")
|
||||
flag=NOOVERFLOW;
|
||||
flag=NOOVERFLOW;
|
||||
else if (sval=="pedestal")
|
||||
flag=PEDESTAL;
|
||||
else if (sval=="flatfield")
|
||||
flag=FLAT;
|
||||
else if (sval=="newpedestal")
|
||||
flag=NEWPEDESTAL;
|
||||
else if (sval=="newflatfield")
|
||||
flag=NEWFLAT;
|
||||
else if (sval=="frame")
|
||||
flag=FRAME;
|
||||
else if (sval=="analog")
|
||||
flag=ANALOG;
|
||||
else if (sval=="counting")
|
||||
flag=COUNTING;
|
||||
else if (sval=="interpolating")
|
||||
flag=INTERPOLATING;
|
||||
else
|
||||
return string("could not scan flag ")+string(args[1]);
|
||||
return string("could not scan flag ")+string(args[1]);
|
||||
}
|
||||
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
@ -6038,6 +6073,22 @@ string slsDetectorCommand::cmdAdvanced(int narg, char *args[], int action) {
|
||||
strcat(answer,"overflow ");
|
||||
if (retval & NOOVERFLOW)
|
||||
strcat(answer,"nooverflow ");
|
||||
if (retval & PEDESTAL)
|
||||
strcat(answer,"pedestal ");
|
||||
if (retval & NEWPEDESTAL)
|
||||
strcat(answer,"newpedestal ");
|
||||
if (retval & NEWFLAT)
|
||||
strcat(answer,"newflat ");
|
||||
if (retval & FLAT)
|
||||
strcat(answer,"flatfield ");
|
||||
if (retval & FRAME)
|
||||
strcat(answer,"frame ");
|
||||
if (retval & ANALOG)
|
||||
strcat(answer,"analog ");
|
||||
if (retval & COUNTING)
|
||||
strcat(answer,"counting ");
|
||||
if (retval & INTERPOLATING)
|
||||
strcat(answer,"interpolating ");
|
||||
if(strlen(answer))
|
||||
return string(answer);
|
||||
|
||||
@ -6992,8 +7043,7 @@ string slsDetectorCommand::cmdPattern(int narg, char *args[], int action) {
|
||||
}
|
||||
os << hex << reg << dec;
|
||||
if (myDet->isMultiSlsDetectorClass() && aa != NULL)
|
||||
delete [] aa;
|
||||
|
||||
delete [] aa;
|
||||
|
||||
//os <<" "<< hex << myDet->readRegister(120) << dec;
|
||||
|
||||
|
@ -249,7 +249,7 @@ class slsDetectorUsers
|
||||
int getPositions(double *pos=NULL);
|
||||
|
||||
/**
|
||||
@short sets the detector size (only 1 ROI)
|
||||
@short sets the detector size (only 1 ROI) (not Mythen supported anymore)
|
||||
\param x0 horizontal position origin in channel number (-1 unchanged)
|
||||
\param y0 vertical position origin in channel number (-1 unchanged)
|
||||
\param nx number of channels in horiziontal (-1 unchanged)
|
||||
@ -259,7 +259,7 @@ class slsDetectorUsers
|
||||
int setDetectorSize(int x0=-1, int y0=-1, int nx=-1, int ny=-1);
|
||||
|
||||
/**
|
||||
@short gets detector size (roi size if only one roi)
|
||||
@short gets detector size (roi size if only one roi) (not Mythen supported anymore)
|
||||
\param x0 horizontal position origin in channel number
|
||||
\param y0 vertical position origin in channel number
|
||||
\param nx number of channels in horiziontal
|
||||
|
@ -125,7 +125,7 @@ int fileIO::writeDataFile(void *data, int iframe) {
|
||||
|
||||
|
||||
int fileIO::closeDataFile() {
|
||||
cout << "close file...." << endl;
|
||||
// cout << "close file...." << endl;
|
||||
if (filefd)
|
||||
fclose(filefd);
|
||||
filefd=NULL;
|
||||
|
Reference in New Issue
Block a user