mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-08 19:10:42 +02:00
added subframe exposure time settable
This commit is contained in:
parent
95324fc929
commit
cae286941a
@ -10,6 +10,8 @@
|
|||||||
//#include <stdint.h>
|
//#include <stdint.h>
|
||||||
#include "sls_receiver_defs.h"
|
#include "sls_receiver_defs.h"
|
||||||
|
|
||||||
|
#define REQUIRED_FIRMWARE_VERSION 10
|
||||||
|
|
||||||
/** default maximum string length */
|
/** default maximum string length */
|
||||||
#define MAX_SCAN_STEPS 2000
|
#define MAX_SCAN_STEPS 2000
|
||||||
/** maxmimum number of modules per controller*/
|
/** maxmimum number of modules per controller*/
|
||||||
@ -19,6 +21,9 @@
|
|||||||
/** header length for data :gotthard*/
|
/** header length for data :gotthard*/
|
||||||
#define HEADERLENGTH 12
|
#define HEADERLENGTH 12
|
||||||
|
|
||||||
|
#define DEFAULT_SUBFRAME_EXPOSURE_VAL 2621440 /** default value for sub frame value 2.6ms*/
|
||||||
|
#define MAX_SUBFRAME_EXPOSURE_VAL 0x1FFFFFFF /** 29 bit register for max subframe exposure value */
|
||||||
|
|
||||||
/** maximum rois */
|
/** maximum rois */
|
||||||
#define MAX_ROIS 100
|
#define MAX_ROIS 100
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ u_int32_t Beb_GetFirmwareRevision(){
|
|||||||
else{
|
else{
|
||||||
//read revision existing bit
|
//read revision existing bit
|
||||||
value = Beb_Read32(baseaddr, REVISION_EXISTING_OFFSET);
|
value = Beb_Read32(baseaddr, REVISION_EXISTING_OFFSET);
|
||||||
printf("Firmware Revision Read OK\n");
|
//printf("Firmware Revision Read OK\n");
|
||||||
//error reading
|
//error reading
|
||||||
if(!(value&REVISION_EXISTING_BIT)){
|
if(!(value&REVISION_EXISTING_BIT)){
|
||||||
cprintf(BG_RED,"Firmware Revision Number does not exist in this version\n");
|
cprintf(BG_RED,"Firmware Revision Number does not exist in this version\n");
|
||||||
@ -190,8 +190,8 @@ u_int32_t Beb_GetFirmwareRevision(){
|
|||||||
}else{
|
}else{
|
||||||
//read revision number
|
//read revision number
|
||||||
value = Beb_Read32(baseaddr, 0);
|
value = Beb_Read32(baseaddr, 0);
|
||||||
printf("Firmware Revision Number Read OK\n");
|
//printf("Firmware Revision Number Read OK\n");
|
||||||
printf("Rev: 0x%x.%x\n\n",value & REVISION_MASK,value & SUB_REVISION_MASK);
|
//printf("Rev: 0x%x.%x\n\n",value & REVISION_MASK,value & SUB_REVISION_MASK);
|
||||||
value &= REVISION_MASK;
|
value &= REVISION_MASK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,7 @@ unsigned int Feb_Control_photon_energy_eV;
|
|||||||
|
|
||||||
unsigned int Feb_Control_nimages;
|
unsigned int Feb_Control_nimages;
|
||||||
double Feb_Control_exposure_time_in_sec;
|
double Feb_Control_exposure_time_in_sec;
|
||||||
|
int Feb_Control_subframe_exposure_time_in_10nsec;
|
||||||
double Feb_Control_exposure_period_in_sec;
|
double Feb_Control_exposure_period_in_sec;
|
||||||
|
|
||||||
unsigned int Feb_Control_trimbit_size;
|
unsigned int Feb_Control_trimbit_size;
|
||||||
@ -1380,6 +1381,13 @@ int Feb_Control_SetExposureTime(double the_exposure_time_in_sec){
|
|||||||
}
|
}
|
||||||
double Feb_Control_GetExposureTime(){return Feb_Control_exposure_time_in_sec;}
|
double Feb_Control_GetExposureTime(){return Feb_Control_exposure_time_in_sec;}
|
||||||
|
|
||||||
|
int Feb_Control_SetSubFrameExposureTime(int the_subframe_exposure_time_in_10nsec){
|
||||||
|
Feb_Control_subframe_exposure_time_in_10nsec = the_subframe_exposure_time_in_10nsec;
|
||||||
|
printf("Sub Frame Exposure time set to: %d\n",Feb_Control_subframe_exposure_time_in_10nsec);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
int Feb_Control_GetSubFrameExposureTime(){return Feb_Control_subframe_exposure_time_in_10nsec;}
|
||||||
|
|
||||||
int Feb_Control_SetExposurePeriod(double the_exposure_period_in_sec){
|
int Feb_Control_SetExposurePeriod(double the_exposure_period_in_sec){
|
||||||
Feb_Control_exposure_period_in_sec = the_exposure_period_in_sec;
|
Feb_Control_exposure_period_in_sec = the_exposure_period_in_sec;
|
||||||
printf("Exposure period set to: %f\n",Feb_Control_exposure_period_in_sec);
|
printf("Exposure period set to: %f\n",Feb_Control_exposure_period_in_sec);
|
||||||
@ -1542,84 +1550,25 @@ int Feb_Control_PrepareForAcquisition(){//return 1;
|
|||||||
reg_vals[3]=Feb_Control_ConvertTimeToRegister(Feb_Control_exposure_period_in_sec);
|
reg_vals[3]=Feb_Control_ConvertTimeToRegister(Feb_Control_exposure_period_in_sec);
|
||||||
reg_nums[4]=DAQ_REG_CHIP_CMDS;
|
reg_nums[4]=DAQ_REG_CHIP_CMDS;
|
||||||
reg_vals[4]=(Feb_Control_acquireNReadoutMode|Feb_Control_triggerMode|Feb_Control_externalEnableMode|Feb_Control_subFrameMode);
|
reg_vals[4]=(Feb_Control_acquireNReadoutMode|Feb_Control_triggerMode|Feb_Control_externalEnableMode|Feb_Control_subFrameMode);
|
||||||
|
reg_nums[5]=DAQ_REG_SUBFRAME_EXPOSURES;
|
||||||
|
reg_vals[5]= Feb_Control_subframe_exposure_time_in_10nsec; //(1 means 10ns, 100 means 1000ns)
|
||||||
// if(!Feb_Interface_WriteRegisters((Module_GetTopLeftAddress(&modules[1])|Module_GetTopRightAddress(&modules[1])),20,reg_nums,reg_vals,0,0)){
|
// if(!Feb_Interface_WriteRegisters((Module_GetTopLeftAddress(&modules[1])|Module_GetTopRightAddress(&modules[1])),20,reg_nums,reg_vals,0,0)){
|
||||||
if(!Feb_Interface_WriteRegisters(Feb_Control_AddressToAll(),5,reg_nums,reg_vals,0,0)){
|
if(!Feb_Interface_WriteRegisters(Feb_Control_AddressToAll(),6,reg_nums,reg_vals,0,0)){
|
||||||
printf("Trouble starting acquisition....\n");;
|
printf("Trouble starting acquisition....\n");;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//*/
|
|
||||||
|
|
||||||
/* if(!Feb_Control_am_i_master)
|
|
||||||
Feb_Control_StartAcquisition();*/
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int Feb_Control_StartAcquisition(){printf("****** starting acquisition********* \n");
|
int Feb_Control_StartAcquisition(){
|
||||||
|
printf("****** starting acquisition********* \n");
|
||||||
|
|
||||||
static unsigned int reg_nums[20];
|
static unsigned int reg_nums[20];
|
||||||
static unsigned int reg_vals[20];
|
static unsigned int reg_vals[20];
|
||||||
/*
|
|
||||||
Feb_Control_PrintAcquisitionSetup();
|
|
||||||
|
|
||||||
// if(!Reset()||!ResetDataStream()){
|
|
||||||
if(!Feb_Control_Reset()){
|
|
||||||
printf("Trouble reseting daq or data stream...\n");;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!Feb_Control_SetStaticBits1(Feb_Control_staticBits&(DAQ_STATIC_BIT_M4|DAQ_STATIC_BIT_M8))){
|
|
||||||
printf("Trouble setting static bits ...\n");;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!Feb_Control_SendBitModeToBebServer()){
|
|
||||||
printf("Trouble sending static bits to server ...\n");;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!Feb_Control_ResetChipCompletely()){
|
|
||||||
printf("Trouble resetting chips ...\n");;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
reg_nums[0]=DAQ_REG_CTRL;
|
|
||||||
reg_vals[0]=0;
|
|
||||||
reg_nums[1]=DAQ_REG_NEXPOSURES;
|
|
||||||
reg_vals[1]=Feb_Control_nimages;
|
|
||||||
reg_nums[2]=DAQ_REG_EXPOSURE_TIMER;
|
|
||||||
reg_vals[2]=Feb_Control_ConvertTimeToRegister(Feb_Control_exposure_time_in_sec);
|
|
||||||
reg_nums[3]=DAQ_REG_EXPOSURE_REPEAT_TIMER;
|
|
||||||
reg_vals[3]=Feb_Control_ConvertTimeToRegister(Feb_Control_exposure_period_in_sec);
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
reg_nums[4]=DAQ_REG_CHIP_CMDS;
|
|
||||||
reg_vals[4]=(Feb_Control_acquireNReadoutMode|Feb_Control_triggerMode|Feb_Control_externalEnableMode|Feb_Control_subFrameMode);
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
if(!Feb_Interface_WriteRegisters(Feb_Control_AddressToAll(),4,reg_nums,reg_vals,0,0)){
|
|
||||||
printf("Trouble starting acquisition....\n");;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
unsigned int masterHalfModuleMode = 0;
|
|
||||||
reg_nums[0]=DAQ_REG_CHIP_CMDS;
|
|
||||||
reg_vals[0]=(masterHalfModuleMode|Feb_Control_acquireNReadoutMode|Feb_Control_triggerMode|Feb_Control_externalEnableMode|Feb_Control_subFrameMode);
|
|
||||||
if(!Feb_Interface_WriteRegisters(Feb_Control_AddressToAll(),1,reg_nums,reg_vals,0,0)){
|
|
||||||
printf("Trouble writing commands....\n");;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
masterHalfModuleMode = 0x80000000;
|
|
||||||
reg_nums[0]=DAQ_REG_CHIP_CMDS;
|
|
||||||
reg_vals[0]=(masterHalfModuleMode|Feb_Control_acquireNReadoutMode|Feb_Control_triggerMode|Feb_Control_externalEnableMode|Feb_Control_subFrameMode);
|
|
||||||
if(!Feb_Interface_WriteRegisters((Module_GetTopLeftAddress(&modules[1])|Module_GetTopRightAddress(&modules[1])),1,reg_nums,reg_vals,0,0)){
|
|
||||||
printf("Trouble writing commands....\n");;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for(i=0;i<14;i++){
|
for(i=0;i<14;i++){
|
||||||
@ -1633,37 +1582,7 @@ static unsigned int reg_vals[20];
|
|||||||
printf("Trouble starting acquisition....\n");;
|
printf("Trouble starting acquisition....\n");;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
///*
|
|
||||||
int i;
|
|
||||||
for(i=0;i<14;i++){
|
|
||||||
reg_nums[i]=DAQ_REG_CTRL;
|
|
||||||
reg_vals[i]=0;
|
|
||||||
}
|
|
||||||
reg_nums[14]=DAQ_REG_CTRL;
|
|
||||||
reg_vals[14]=ACQ_CTRL_START;
|
|
||||||
|
|
||||||
if(!Feb_Interface_WriteRegisters(Feb_Control_AddressToAll(),15,reg_nums,reg_vals,0,0)){
|
|
||||||
printf("Trouble starting acquisition....\n");;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
//*/
|
|
||||||
/*
|
|
||||||
int i;
|
|
||||||
for(i=5;i<19;i++){
|
|
||||||
reg_nums[i]=DAQ_REG_CTRL;
|
|
||||||
reg_vals[i]=0;
|
|
||||||
}
|
|
||||||
reg_nums[19]=DAQ_REG_CTRL;
|
|
||||||
reg_vals[19]=ACQ_CTRL_START;
|
|
||||||
|
|
||||||
if(!Feb_Interface_WriteRegisters(Feb_Control_AddressToAll(),20,reg_nums,reg_vals,0,0)){
|
|
||||||
printf("Trouble starting acquisition....\n");;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
//*/
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,18 +160,16 @@ int Feb_Control_GetModuleNumber();
|
|||||||
unsigned int Feb_Control_GetNExposures();
|
unsigned int Feb_Control_GetNExposures();
|
||||||
int Feb_Control_SetExposureTime(double the_exposure_time_in_sec);
|
int Feb_Control_SetExposureTime(double the_exposure_time_in_sec);
|
||||||
double Feb_Control_GetExposureTime();
|
double Feb_Control_GetExposureTime();
|
||||||
|
int Feb_Control_SetSubFrameExposureTime(int the_subframe_exposure_time_in_10nsec);
|
||||||
|
int Feb_Control_GetSubFrameExposureTime();
|
||||||
int Feb_Control_SetExposurePeriod(double the_exposure_period_in_sec);
|
int Feb_Control_SetExposurePeriod(double the_exposure_period_in_sec);
|
||||||
double Feb_Control_GetExposurePeriod();
|
double Feb_Control_GetExposurePeriod();
|
||||||
int Feb_Control_SetDynamicRange(unsigned int four_eight_sixteen_or_thirtytwo);
|
int Feb_Control_SetDynamicRange(unsigned int four_eight_sixteen_or_thirtytwo);
|
||||||
unsigned int Feb_Control_GetDynamicRange();
|
unsigned int Feb_Control_GetDynamicRange();
|
||||||
/*int Feb_Control_SetReadoutSpeed(unsigned int readout_speed=0); //0->full,1->half,2->quarter or 3->super_slow*/
|
int Feb_Control_SetReadoutSpeed(unsigned int readout_speed); //0 was default, 0->full,1->half,2->quarter or 3->super_slow
|
||||||
int Feb_Control_SetReadoutSpeed(unsigned int readout_speed); //0->full,1->half,2->quarter or 3->super_slow
|
int Feb_Control_SetReadoutMode(unsigned int readout_mode); ///0 was default,0->parallel,1->non-parallel,2-> safe_mode
|
||||||
/* int Feb_Control_SetReadoutMode(unsigned int readout_mode=0); //0->parallel,1->non-parallel,2-> safe_mode*/
|
int Feb_Control_SetTriggerMode(unsigned int trigger_mode, int polarity);//0 and 1 was default,
|
||||||
int Feb_Control_SetReadoutMode(unsigned int readout_mode); //0->parallel,1->non-parallel,2-> safe_mode
|
int Feb_Control_SetExternalEnableMode(int use_external_enable, int polarity);//0 and 1 was default,
|
||||||
/* int Feb_Control_SetTriggerMode(unsigned int trigger_mode=0, int polarity=1);*/
|
|
||||||
int Feb_Control_SetTriggerMode(unsigned int trigger_mode, int polarity);
|
|
||||||
/*int Feb_Control_SetExternalEnableMode(int use_external_enable=0, int polarity=1);*/
|
|
||||||
int Feb_Control_SetExternalEnableMode(int use_external_enable, int polarity);
|
|
||||||
|
|
||||||
//functions for testing
|
//functions for testing
|
||||||
/*int Feb_Control_SetTestModeVariable(int on=1);*/
|
/*int Feb_Control_SetTestModeVariable(int on=1);*/
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
#define DAQ_REG_NEXPOSURES 3
|
#define DAQ_REG_NEXPOSURES 3
|
||||||
#define DAQ_REG_EXPOSURE_TIMER 4 // == (31 downto 3) * 10^(2 downto 0)
|
#define DAQ_REG_EXPOSURE_TIMER 4 // == (31 downto 3) * 10^(2 downto 0)
|
||||||
#define DAQ_REG_EXPOSURE_REPEAT_TIMER 5 // == (31 downto 3) * 10^(2 downto 0)
|
#define DAQ_REG_EXPOSURE_REPEAT_TIMER 5 // == (31 downto 3) * 10^(2 downto 0)
|
||||||
#define DAQ_REG_STATUS 6 //also pg and fifo status register
|
#define DAQ_REG_SUBFRAME_EXPOSURES 6
|
||||||
|
#define DAQ_REG_STATUS 7 //also pg and fifo status register
|
||||||
|
|
||||||
#define DAQ_CTRL_RESET 0x80000000
|
#define DAQ_CTRL_RESET 0x80000000
|
||||||
#define DAQ_CTRL_START 0x40000000
|
#define DAQ_CTRL_START 0x40000000
|
||||||
|
Binary file not shown.
@ -40,12 +40,10 @@ int eiger_extgating = 0;
|
|||||||
int eiger_extgatingpolarity = 0;
|
int eiger_extgatingpolarity = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int eiger_nexposures = 1;
|
int eiger_nexposures = 1;
|
||||||
int eiger_ncycles = 1;
|
int eiger_ncycles = 1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int send_to_ten_gig = 0;
|
int send_to_ten_gig = 0;
|
||||||
int ndsts_in_use=32;
|
int ndsts_in_use=32;
|
||||||
unsigned int nimages_per_request=1;
|
unsigned int nimages_per_request=1;
|
||||||
@ -65,14 +63,13 @@ int master = 0;
|
|||||||
#define TEN_GIGA_BUFFER_SIZE 4112
|
#define TEN_GIGA_BUFFER_SIZE 4112
|
||||||
#define ONE_GIGA_BUFFER_SIZE 1040
|
#define ONE_GIGA_BUFFER_SIZE 1040
|
||||||
|
|
||||||
|
|
||||||
int initDetector(){
|
int initDetector(){
|
||||||
int imod,i,n;
|
int imod,i,n;
|
||||||
n = getNModBoard(1);
|
n = getNModBoard(1);
|
||||||
|
|
||||||
printf("This is the EIGER Server of revision %llx\n", getDetectorId(DETECTOR_SOFTWARE_VERSION));
|
|
||||||
|
|
||||||
//#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
printf("Board is for %d half modules\n",n);
|
printf("This Server is for 1 Eiger half module\n");
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
|
|
||||||
@ -131,6 +128,7 @@ int initDetector(){
|
|||||||
//setting default measurement parameters
|
//setting default measurement parameters
|
||||||
setTimer(FRAME_NUMBER,1);
|
setTimer(FRAME_NUMBER,1);
|
||||||
setTimer(ACQUISITION_TIME,1E9);
|
setTimer(ACQUISITION_TIME,1E9);
|
||||||
|
setTimer(SUBFRAME_ACQUISITION_TIME,DEFAULT_SUBFRAME_EXPOSURE_VAL);
|
||||||
setTimer(FRAME_PERIOD,1E9);
|
setTimer(FRAME_PERIOD,1E9);
|
||||||
setDynamicRange(16);
|
setDynamicRange(16);
|
||||||
setThresholdEnergy(8000,0);
|
setThresholdEnergy(8000,0);
|
||||||
@ -619,12 +617,22 @@ int64_t setTimer(enum timerIndex ind, int64_t val){
|
|||||||
nimages_per_request = eiger_nexposures * eiger_ncycles;
|
nimages_per_request = eiger_nexposures * eiger_ncycles;
|
||||||
}
|
}
|
||||||
}return eiger_nexposures;
|
}return eiger_nexposures;
|
||||||
|
|
||||||
case ACQUISITION_TIME:
|
case ACQUISITION_TIME:
|
||||||
if(val >= 0){
|
if(val >= 0){
|
||||||
printf(" Setting exp time: %fs\n",val/(1E9));
|
printf(" Setting exp time: %fs\n",val/(1E9));
|
||||||
Feb_Control_SetExposureTime(val/(1E9));
|
Feb_Control_SetExposureTime(val/(1E9));
|
||||||
}
|
}
|
||||||
return (Feb_Control_GetExposureTime()*(1E9));
|
return (Feb_Control_GetExposureTime()*(1E9));
|
||||||
|
|
||||||
|
case SUBFRAME_ACQUISITION_TIME:
|
||||||
|
if(val >= 0){
|
||||||
|
printf(" Setting sub exp time: %dns\n",(int)val/10);
|
||||||
|
Feb_Control_SetSubFrameExposureTime(val/10);
|
||||||
|
}
|
||||||
|
return (Feb_Control_GetSubFrameExposureTime()*10);
|
||||||
|
|
||||||
|
|
||||||
case FRAME_PERIOD:
|
case FRAME_PERIOD:
|
||||||
if(val >= 0){
|
if(val >= 0){
|
||||||
printf(" Setting acq period: %fs\n",val/(1E9));
|
printf(" Setting acq period: %fs\n",val/(1E9));
|
||||||
|
@ -3213,6 +3213,11 @@ int slsDetector::updateDetectorNoWait() {
|
|||||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||||
thisDetector->timerValue[ACQUISITION_TIME]=retval;
|
thisDetector->timerValue[ACQUISITION_TIME]=retval;
|
||||||
|
|
||||||
|
if(thisDetector->myDetectorType!= EIGER){
|
||||||
|
//retval=setSubFrameExposureTime(tns);
|
||||||
|
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||||
|
thisDetector->timerValue[SUBFRAME_ACQUISITION_TIME]=retval;
|
||||||
|
}
|
||||||
//retval=setPeriod(tns);
|
//retval=setPeriod(tns);
|
||||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||||
thisDetector->timerValue[FRAME_PERIOD]=retval;
|
thisDetector->timerValue[FRAME_PERIOD]=retval;
|
||||||
|
@ -369,6 +369,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
|||||||
*/
|
*/
|
||||||
virtual int64_t setTimer(timerIndex index, int64_t t=-1)=0;
|
virtual int64_t setTimer(timerIndex index, int64_t t=-1)=0;
|
||||||
int64_t setExposureTime(int64_t t=-1){return setTimer(ACQUISITION_TIME,t);};
|
int64_t setExposureTime(int64_t t=-1){return setTimer(ACQUISITION_TIME,t);};
|
||||||
|
int64_t setSubFrameExposureTime(int64_t t=-1){return setTimer(SUBFRAME_ACQUISITION_TIME,t);};
|
||||||
int64_t setExposurePeriod(int64_t t=-1){return setTimer(FRAME_PERIOD,t);};
|
int64_t setExposurePeriod(int64_t t=-1){return setTimer(FRAME_PERIOD,t);};
|
||||||
int64_t setDelayAfterTrigger(int64_t t=-1){return setTimer(DELAY_AFTER_TRIGGER,t);};
|
int64_t setDelayAfterTrigger(int64_t t=-1){return setTimer(DELAY_AFTER_TRIGGER,t);};
|
||||||
int64_t setNumberOfGates(int64_t t=-1){return setTimer(GATES_NUMBER,t);};
|
int64_t setNumberOfGates(int64_t t=-1){return setTimer(GATES_NUMBER,t);};
|
||||||
|
@ -733,6 +733,10 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
|||||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimer;
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimer;
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
|
descrToFuncMap[i].m_pFuncName="subexptime"; //
|
||||||
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimer;
|
||||||
|
i++;
|
||||||
|
|
||||||
descrToFuncMap[i].m_pFuncName="period"; //
|
descrToFuncMap[i].m_pFuncName="period"; //
|
||||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimer;
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimer;
|
||||||
i++;
|
i++;
|
||||||
@ -3783,6 +3787,8 @@ string slsDetectorCommand::cmdTimer(int narg, char *args[], int action) {
|
|||||||
|
|
||||||
if (cmd=="exptime")
|
if (cmd=="exptime")
|
||||||
index=ACQUISITION_TIME;
|
index=ACQUISITION_TIME;
|
||||||
|
else if (cmd=="subexptime")
|
||||||
|
index=SUBFRAME_ACQUISITION_TIME;
|
||||||
else if (cmd=="period")
|
else if (cmd=="period")
|
||||||
index=FRAME_PERIOD;
|
index=FRAME_PERIOD;
|
||||||
else if (cmd=="delay")
|
else if (cmd=="delay")
|
||||||
@ -3806,7 +3812,7 @@ string slsDetectorCommand::cmdTimer(int narg, char *args[], int action) {
|
|||||||
;
|
;
|
||||||
else
|
else
|
||||||
return string("cannot scan timer value ")+string(args[1]);
|
return string("cannot scan timer value ")+string(args[1]);
|
||||||
if (index==ACQUISITION_TIME || index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER)
|
if (index==ACQUISITION_TIME || index==SUBFRAME_ACQUISITION_TIME || index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER)
|
||||||
t=(int64_t)(val*1E+9);
|
t=(int64_t)(val*1E+9);
|
||||||
else t=(int64_t)val;
|
else t=(int64_t)val;
|
||||||
}
|
}
|
||||||
@ -3815,7 +3821,7 @@ string slsDetectorCommand::cmdTimer(int narg, char *args[], int action) {
|
|||||||
myDet->setOnline(ONLINE_FLAG);
|
myDet->setOnline(ONLINE_FLAG);
|
||||||
|
|
||||||
ret=myDet->setTimer(index,t);
|
ret=myDet->setTimer(index,t);
|
||||||
if (index==ACQUISITION_TIME || index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER)
|
if (index==ACQUISITION_TIME || index==SUBFRAME_ACQUISITION_TIME || index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER)
|
||||||
rval=(double)ret*1E-9;
|
rval=(double)ret*1E-9;
|
||||||
else rval=ret;
|
else rval=ret;
|
||||||
|
|
||||||
@ -3843,6 +3849,7 @@ string slsDetectorCommand::helpTimer(int narg, char *args[], int action) {
|
|||||||
ostringstream os;
|
ostringstream os;
|
||||||
if (action==PUT_ACTION || action==HELP_ACTION) {
|
if (action==PUT_ACTION || action==HELP_ACTION) {
|
||||||
os << "exptime t \t sets the exposure time in s" << std::endl;
|
os << "exptime t \t sets the exposure time in s" << std::endl;
|
||||||
|
os << "subexptime t \t sets the exposure time of subframe in s" << std::endl;
|
||||||
os << "period t \t sets the frame period in s" << std::endl;
|
os << "period t \t sets the frame period in s" << std::endl;
|
||||||
os << "delay t \t sets the delay after trigger in s" << std::endl;
|
os << "delay t \t sets the delay after trigger in s" << std::endl;
|
||||||
os << "frames t \t sets the number of frames per cycle (e.g. after each trigger)" << std::endl;
|
os << "frames t \t sets the number of frames per cycle (e.g. after each trigger)" << std::endl;
|
||||||
@ -3855,6 +3862,7 @@ string slsDetectorCommand::helpTimer(int narg, char *args[], int action) {
|
|||||||
if (action==GET_ACTION || action==HELP_ACTION) {
|
if (action==GET_ACTION || action==HELP_ACTION) {
|
||||||
|
|
||||||
os << "exptime \t gets the exposure time in s" << std::endl;
|
os << "exptime \t gets the exposure time in s" << std::endl;
|
||||||
|
os << "subexptime \t gets the exposure time of subframe in s" << std::endl;
|
||||||
os << "period \t gets the frame period in s" << std::endl;
|
os << "period \t gets the frame period in s" << std::endl;
|
||||||
os << "delay \t gets the delay after trigger in s" << std::endl;
|
os << "delay \t gets the delay after trigger in s" << std::endl;
|
||||||
os << "frames \t gets the number of frames per cycle (e.g. after each trigger)" << std::endl;
|
os << "frames \t gets the number of frames per cycle (e.g. after each trigger)" << std::endl;
|
||||||
|
@ -37,7 +37,7 @@ using namespace std;
|
|||||||
#include "slsDetectorActions.h"
|
#include "slsDetectorActions.h"
|
||||||
#include "postProcessing.h"
|
#include "postProcessing.h"
|
||||||
|
|
||||||
#define MAX_TIMERS 11
|
//#define MAX_TIMERS 11
|
||||||
#define MAXPOS 50
|
#define MAXPOS 50
|
||||||
|
|
||||||
#define DEFAULT_HOSTNAME "localhost"
|
#define DEFAULT_HOSTNAME "localhost"
|
||||||
|
@ -22,6 +22,9 @@ int main(int argc, char *argv[]){
|
|||||||
int portno, b;
|
int portno, b;
|
||||||
int retval=OK;
|
int retval=OK;
|
||||||
int sd, fd;
|
int sd, fd;
|
||||||
|
|
||||||
|
checkFirmwareCompatibility();
|
||||||
|
|
||||||
#ifdef STOP_SERVER
|
#ifdef STOP_SERVER
|
||||||
char cmd[100];
|
char cmd[100];
|
||||||
#endif
|
#endif
|
||||||
|
@ -42,6 +42,24 @@ int dataBytes = 10;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void checkFirmwareCompatibility(){
|
||||||
|
cprintf(BLUE,"\n\n********************************************************\n"
|
||||||
|
"**********************EIGER Server**********************\n"
|
||||||
|
"********************************************************\n");
|
||||||
|
cprintf(BLUE,"\nFirmware Version: %llx\nSoftware Version: %llx\n\n",
|
||||||
|
getDetectorId(DETECTOR_FIRMWARE_VERSION), getDetectorId(DETECTOR_SOFTWARE_VERSION));
|
||||||
|
|
||||||
|
//check for firmware version compatibility
|
||||||
|
if(getDetectorId(DETECTOR_FIRMWARE_VERSION) < REQUIRED_FIRMWARE_VERSION){
|
||||||
|
cprintf(RED,"FATAL ERROR: This firmware version is incompatible.\n"
|
||||||
|
"Please update it to v%d to be compatible with this server\n\n",
|
||||||
|
REQUIRED_FIRMWARE_VERSION);
|
||||||
|
|
||||||
|
cprintf(RED,"Exiting Server. Goodbye!\n\n");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int init_detector(int b) {
|
int init_detector(int b) {
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
@ -401,6 +419,10 @@ int send_update(int file_des) {
|
|||||||
retval=setTimer(ACQUISITION_TIME,GET_FLAG);
|
retval=setTimer(ACQUISITION_TIME,GET_FLAG);
|
||||||
#endif
|
#endif
|
||||||
n += sendData(file_des,&retval,sizeof(int64_t),INT64);
|
n += sendData(file_des,&retval,sizeof(int64_t),INT64);
|
||||||
|
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||||
|
retval=setTimer(SUBFRAME_ACQUISITION_TIME,GET_FLAG);
|
||||||
|
#endif
|
||||||
|
n += sendData(file_des,&retval,sizeof(int64_t),INT64);
|
||||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||||
retval=setTimer(FRAME_PERIOD,GET_FLAG);
|
retval=setTimer(FRAME_PERIOD,GET_FLAG);
|
||||||
#endif
|
#endif
|
||||||
@ -2428,6 +2450,16 @@ int set_timer(int file_des) {
|
|||||||
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
||||||
} else {
|
} else {
|
||||||
switch(ind) {
|
switch(ind) {
|
||||||
|
#ifdef EIGERD
|
||||||
|
case SUBFRAME_ACQUISITION_TIME:
|
||||||
|
if (tns > MAX_SUBFRAME_EXPOSURE_VAL ){
|
||||||
|
ret=FAIL;
|
||||||
|
strcpy(mess,"Sub Frame exposure time should not exceed 5.368 seconds\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
retval = setTimer(ind,tns);
|
||||||
|
break;
|
||||||
case PROBES_NUMBER:
|
case PROBES_NUMBER:
|
||||||
#ifndef MYTHEND
|
#ifndef MYTHEND
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
@ -2444,7 +2476,7 @@ int set_timer(int file_des) {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
sprintf(mess,"timer index unknown %d\n",ind);
|
sprintf(mess,"timer index unknown for this detector %d\n",ind);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
|
|
||||||
//basic server functions
|
//basic server functions
|
||||||
|
void checkFirmwareCompatibility();
|
||||||
int init_detector(int);
|
int init_detector(int);
|
||||||
int decode_function(int);
|
int decode_function(int);
|
||||||
int function_table();
|
int function_table();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user