fixed rate correction to not include 16 bit dr

This commit is contained in:
Dhanya Maliakal
2016-08-08 15:52:09 +02:00
parent 6a87d9e40a
commit 56aaaaf182
8 changed files with 129 additions and 80 deletions

View File

@ -59,6 +59,8 @@ using namespace std;
#define COULD_NOT_PULSE_CHIP 0x0000000000100000ULL
#define COULD_NOT_SET_RATE_CORRECTION 0x0000000000200000ULL
#define DETECTOR_NETWORK_PARAMETER 0x0000000000400000ULL
#define RATE_CORRECTION_NOT_32BIT 0x0000000000800000ULL
#define RATE_CORRECTION_NO_TAU_PROVIDED 0x0000000000010000ULL
// 0x00000000FFFFFFFFULL
/** @short class returning all error messages for error mask */
@ -190,6 +192,13 @@ public:
if(slsErrorMask&DETECTOR_NETWORK_PARAMETER)
retval.append("Could not set/get detector network parameter\n");
if(slsErrorMask&RATE_CORRECTION_NOT_32BIT)
retval.append("Rate correction Deactivated, must be in 32 bit mode\n");
if(slsErrorMask&RATE_CORRECTION_NO_TAU_PROVIDED)
retval.append("Rate correction Deactivated. No default tau provided in file\n");

View File

@ -50,7 +50,7 @@ extern int differentClients;
extern unsigned int *ram_values;
char *dataretval=NULL;
int nframes, iframes, dataret;
char mess[1000];
char mess[MAX_STR_LENGTH];
int digitalTestBit = 0;

View File

@ -46,7 +46,7 @@ extern int differentClients;
extern unsigned int *ram_values;
char *dataretval=NULL;
int nframes, iframes, dataret;
char mess[1000];
char mess[MAX_STR_LENGTH];
int digitalTestBit = 0;

View File

@ -50,7 +50,7 @@ extern int differentClients;
extern unsigned int *ram_values;
char *dataretval=NULL;
int nframes, iframes, dataret;
char mess[1000];
char mess[MAX_STR_LENGTH];
int digitalTestBit = 0;

View File

@ -37,7 +37,7 @@ extern int differentClients;
extern int *ram_values;
char *dataretval=NULL;
int nframes, iframes, dataret;
char mess[1000];
char mess[MAX_STR_LENGTH];

View File

@ -1261,7 +1261,7 @@ int slsDetector::activate(int const enable){
int fnum = F_ACTIVATE;
int retval = -1;
int arg = enable;
char mess[1000]="";
char mess[MAX_STR_LENGTH]="";
int ret = OK;
#ifdef VERBOSE
if(!enable)
@ -1541,7 +1541,7 @@ int slsDetector::setDetectorType(detectorType const type){
int fnum=F_GET_DETECTOR_TYPE,fnum2=F_GET_RECEIVER_TYPE;
arg=int(type);
detectorType retType=type;
char mess[100];
char mess[MAX_STR_LENGTH]="";
strcpy(mess,"dummy");
@ -1623,7 +1623,7 @@ int slsDetector::setNumberOfModules(int n, dimension d){
int arg[2], retval=1;
int fnum=F_SET_NUMBER_OF_MODULES;
int ret=FAIL;
char mess[100]="dummy";
char mess[MAX_STR_LENGTH]="dummy";
int connect;
int num;
@ -1739,7 +1739,7 @@ int slsDetector::getMaxNumberOfModules(dimension d){
int retval;
int fnum=F_GET_MAX_NUMBER_OF_MODULES;
int ret=FAIL;
char mess[100];
char mess[MAX_STR_LENGTH]="";
if (d<X || d>Y) {
std::cout<< "Get max number of modules in wrong dimension " << d << std::endl;
@ -1808,7 +1808,7 @@ slsDetectorDefs::externalSignalFlag slsDetector::setExternalSignalFlags(external
externalSignalFlag retval;
int ret=FAIL;
int fnum=F_SET_EXTERNAL_SIGNAL_FLAG;
char mess[100];
char mess[MAX_STR_LENGTH]="";
arg[0]=signalindex;
arg[1]=pol;
@ -1878,7 +1878,7 @@ slsDetectorDefs::externalCommunicationMode slsDetector::setExternalCommunication
int arg[1];
externalCommunicationMode retval;
int fnum=F_SET_EXTERNAL_COMMUNICATION_MODE;
char mess[100];
char mess[MAX_STR_LENGTH]="";
arg[0]=pol;
@ -1943,7 +1943,7 @@ int64_t slsDetector::getId( idMode mode, int imod){
int64_t retval=-1;
int fnum=F_GET_ID,fnum2 = F_GET_RECEIVER_ID;
int ret=FAIL;
char mess[100];
char mess[MAX_STR_LENGTH]="";
#ifdef VERBOSE
std::cout<< std::endl;
@ -2022,7 +2022,7 @@ int slsDetector::digitalTest( digitalTestMode mode, int imod){
int retval;
int fnum=F_DIGITAL_TEST;
int ret=FAIL;
char mess[100];
char mess[MAX_STR_LENGTH]="";
#ifdef VERBOSE
std::cout<< std::endl;
@ -2111,7 +2111,7 @@ int slsDetector::writeRegister(int addr, int val){
int fnum=F_WRITE_REGISTER;
int ret=FAIL;
char mess[100];
char mess[MAX_STR_LENGTH]="";
int arg[2];
arg[0]=addr;
@ -2156,7 +2156,7 @@ int slsDetector::writeAdcRegister(int addr, int val){
int fnum=F_WRITE_ADC_REG;
int ret=FAIL;
char mess[100];
char mess[MAX_STR_LENGTH]="";
int arg[2];
arg[0]=addr;
@ -2203,7 +2203,7 @@ int slsDetector::readRegister(int addr){
int fnum=F_READ_REGISTER;
int ret=FAIL;
char mess[100];
char mess[MAX_STR_LENGTH]="";
int arg;
arg=addr;
@ -2266,7 +2266,7 @@ dacs_t slsDetector::setDAC(dacs_t val, dacIndex index, int mV, int imod){
retval[1] = -1;
int fnum=F_SET_DAC;
int ret=FAIL;
char mess[100];
char mess[MAX_STR_LENGTH]="";
int arg[3];
@ -2330,7 +2330,7 @@ dacs_t slsDetector::getADC(dacIndex index, int imod){
dacs_t retval;
int fnum=F_GET_ADC;
int ret=FAIL;
char mess[100];
char mess[MAX_STR_LENGTH]="";
int arg[2];
arg[0]=index;
@ -2429,7 +2429,7 @@ int slsDetector::setChannel(sls_detector_channel chan){
int fnum=F_SET_CHANNEL;
int retval;
int ret=FAIL;
char mess[100];
char mess[MAX_STR_LENGTH]="";
int ichan=chan.chan;
int ichip=chan.chip;
@ -2522,7 +2522,7 @@ slsDetectorDefs::sls_detector_channel slsDetector::getChannel(int ichan, int ic
sls_detector_channel myChan;
int arg[3];
int ret=FAIL;
char mess[100];
char mess[MAX_STR_LENGTH]="";
arg[0]=ichan;
arg[1]=ichip;
arg[2]=imod;
@ -2609,7 +2609,7 @@ int slsDetector::setChip(sls_detector_chip chip){
int fnum=F_SET_CHIP;
int retval;
int ret=FAIL;
char mess[100];
char mess[MAX_STR_LENGTH]="";
int ichi=chip.chip;
int im=chip.module;
@ -2655,7 +2655,7 @@ slsDetectorDefs::sls_detector_chip slsDetector::getChip(int ichip, int imod){
int chanreg[thisDetector->nChans];
int ret=FAIL;
char mess[100];
char mess[MAX_STR_LENGTH]="";
myChip.chip=ichip;
@ -2798,7 +2798,7 @@ int slsDetector::setModule(sls_detector_module module, int* gainval, int* offset
int fnum=F_SET_MODULE;
int retval;
int ret=FAIL;
char mess[100];
char mess[MAX_STR_LENGTH]="";
int imod=module.module;
@ -2828,6 +2828,8 @@ int slsDetector::setModule(sls_detector_module module, int* gainval, int* offset
else {
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
std::cout<< "Detector returned error: " << mess << std::endl;
if(strstr(mess,"default tau")!=NULL)
setErrorMask((getErrorMask())|(RATE_CORRECTION_NO_TAU_PROVIDED));
}
disconnectControl();
if (ret==FORCE_UPDATE)
@ -2922,7 +2924,7 @@ slsDetectorDefs::sls_detector_module *slsDetector::getModule(int imod){
//double dac[thisDetector->nDacs], adc[thisDetector->nAdcs];
int ret=FAIL;
char mess[100];
char mess[MAX_STR_LENGTH]="";
// int n;
#ifdef VERBOSE
@ -3059,7 +3061,7 @@ int slsDetector::getThresholdEnergy(int imod){
int fnum= F_GET_THRESHOLD_ENERGY;
int retval;
int ret=FAIL;
char mess[100];
char mess[MAX_STR_LENGTH]="";
#ifdef VERBOSE
std::cout<< "Getting threshold energy "<< std::endl;
#endif
@ -3090,7 +3092,7 @@ int slsDetector::setThresholdEnergy(int e_eV, int imod, detectorSettings isetti
int fnum= F_SET_THRESHOLD_ENERGY;
int retval;
int ret=FAIL;
char mess[100];
char mess[MAX_STR_LENGTH]="";
#ifdef VERBOSE
std::cout<< "Setting threshold energy "<< std::endl;
#endif
@ -3130,7 +3132,7 @@ slsDetectorDefs::detectorSettings slsDetector::getSettings(int imod){
int fnum=F_SET_SETTINGS;
int ret=FAIL;
char mess[100];
char mess[MAX_STR_LENGTH]="";
int retval;
int arg[2];
arg[0]=GET_SETTINGS;
@ -3547,7 +3549,7 @@ int slsDetector::updateDetectorNoWait() {
int slsDetector::updateDetector() {
int fnum=F_UPDATE_CLIENT;
int ret=OK;
char mess[100];
char mess[MAX_STR_LENGTH]="";
if (thisDetector->onlineFlag==ONLINE_FLAG) {
if (connectControl() == OK){
@ -3574,7 +3576,7 @@ int slsDetector::startAcquisition(){
int fnum=F_START_ACQUISITION;
int ret=FAIL;
char mess[100];
char mess[MAX_STR_LENGTH]="";
#ifdef VERBOSE
std::cout<< "Starting acquisition "<< std::endl;
@ -3603,7 +3605,7 @@ int slsDetector::stopAcquisition(){
int fnum=F_STOP_ACQUISITION;
int ret=FAIL;
char mess[100];
char mess[MAX_STR_LENGTH]="";
#ifdef VERBOSE
std::cout<< "Stopping acquisition "<< std::endl;
@ -3631,7 +3633,7 @@ int slsDetector::startReadOut(){
int fnum=F_START_READOUT;
int ret=FAIL;
char mess[100];
char mess[MAX_STR_LENGTH]="";
#ifdef VERBOSE
std::cout<< "Starting readout "<< std::endl;
@ -3656,7 +3658,7 @@ int slsDetector::startReadOut(){
slsDetectorDefs::runStatus slsDetector::getRunStatus(){
int fnum=F_GET_RUN_STATUS;
int ret=FAIL;
char mess[100];
char mess[MAX_STR_LENGTH]="";
strcpy(mess,"aaaaa");
runStatus retval=ERROR;
//#ifdef VERBOSE
@ -3724,7 +3726,7 @@ int* slsDetector::getDataFromDetector(int *retval){
retval=new int[nel];
int ret=FAIL;
char mess[100]="Nothing";
char mess[MAX_STR_LENGTH]="Nothing";
#ifdef VERBOSE
std::cout<< "getting data "<< thisDetector->dataBytes << " " << nel<< std::endl;
@ -3939,7 +3941,7 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
int fnum=F_SET_TIMER,fnum2=F_SET_RECEIVER_TIMER;
int64_t retval = -1;
int64_t ut = -2;
char mess[100];
char mess[MAX_STR_LENGTH]="";
int ret=OK;
int n=0;
@ -4059,7 +4061,7 @@ int slsDetector::lockServer(int lock) {
int fnum=F_LOCK_SERVER;
int retval=-1;
int ret=OK;
char mess[100];
char mess[MAX_STR_LENGTH]="";
if (thisDetector->onlineFlag==ONLINE_FLAG) {
if (connectControl() == OK){
@ -4088,7 +4090,7 @@ string slsDetector::getLastClientIP() {
int fnum=F_GET_LAST_CLIENT_IP;
char clientName[INET_ADDRSTRLEN];
char mess[100];
char mess[MAX_STR_LENGTH]="";
int ret=OK;
if (thisDetector->onlineFlag==ONLINE_FLAG) {
@ -4117,7 +4119,7 @@ int slsDetector::setPort(portType index, int num){
int fnum=F_SET_PORT, fnum2 = F_SET_RECEIVER_PORT;
int retval;
// uint64_t ut;
char mess[100];
char mess[MAX_STR_LENGTH]="";
int ret=FAIL;
bool online=false;
MySocketTCP *s;
@ -4406,7 +4408,7 @@ int slsDetector::setSpeed(speedVariable sp, int value) {
int fnum=F_SET_SPEED;
int retval=-1;
char mess[100];
char mess[MAX_STR_LENGTH]="";
int ret=OK;
int n=0;
#ifdef VERBOSE
@ -4448,7 +4450,7 @@ int64_t slsDetector::getTimeLeft(timerIndex index){
int fnum=F_GET_TIME_LEFT;
int64_t retval;
char mess[100];
char mess[MAX_STR_LENGTH]="";
int ret=OK;
#ifdef VERBOSE
@ -4484,8 +4486,8 @@ int slsDetector::setDynamicRange(int n){
// cout << "single " << endl;
int fnum=F_SET_DYNAMIC_RANGE,fnum2=F_SET_RECEIVER_DYNAMIC_RANGE;
int retval=-1,retval1;
char mess[100];
int ret=OK;
char mess[MAX_STR_LENGTH]="";
int ret=OK, rateret=OK;
#ifdef VERBOSE
std::cout<< "Setting dynamic range to "<< n << std::endl;
@ -4499,6 +4501,16 @@ int slsDetector::setDynamicRange(int n){
if (connectControl() == OK){
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
controlSocket->SendDataOnly(&n,sizeof(n));
//rate correction is switched off if not 32 bit mode
if(thisDetector->myDetectorType == EIGER){
controlSocket->ReceiveDataOnly(&rateret,sizeof(rateret));
if (rateret==FAIL) {
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
std::cout<< "Detector returned error: " << mess << std::endl;
if(strstr(mess,"Rate Correction")!=NULL)
setErrorMask((getErrorMask())|(RATE_CORRECTION_NOT_32BIT));
}
}
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
if (ret==FAIL) {
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
@ -4605,7 +4617,7 @@ slsDetectorDefs::ROI* slsDetector::getROI(int &n){
int slsDetector::sendROI(int n,ROI roiLimits[]){
int ret=FAIL;
int fnum=F_SET_ROI;
char mess[100];
char mess[MAX_STR_LENGTH]="";
int arg = n;
int retvalsize=0;
ROI retval[MAX_ROIS];
@ -4679,7 +4691,7 @@ int slsDetector::setReadOutFlags(readOutFlags flag){
int fnum=F_SET_READOUT_FLAGS;
readOutFlags retval;
char mess[100];
char mess[MAX_STR_LENGTH]="";
int ret=OK;
#ifdef VERBOSE
@ -4728,7 +4740,7 @@ int slsDetector::executeTrimming(trimMode mode, int par1, int par2, int imod){
int fnum= F_EXECUTE_TRIMMING;
int retval=FAIL;
char mess[100];
char mess[MAX_STR_LENGTH]="";
int ret=OK;
int arg[3];
arg[0]=imod;
@ -5051,7 +5063,7 @@ int slsDetector::setRateCorrection(double t){
if (getDetectorsType() == EIGER){
int fnum=F_SET_RATE_CORRECT;
int ret=FAIL;
char mess[1000]="";
char mess[MAX_STR_LENGTH]="";
int64_t arg = t;
int64_t retval = -1;
#ifdef VERBOSE
@ -5065,7 +5077,12 @@ int slsDetector::setRateCorrection(double t){
if (ret==FAIL) {
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
std::cout<< "Detector returned error: " << mess << std::endl;
setErrorMask((getErrorMask())|(COULD_NOT_SET_RATE_CORRECTION));
if(strstr(mess,"default tau")!=NULL)
setErrorMask((getErrorMask())|(RATE_CORRECTION_NO_TAU_PROVIDED));
if(strstr(mess,"32")!=NULL)
setErrorMask((getErrorMask())|(RATE_CORRECTION_NOT_32BIT));
else
setErrorMask((getErrorMask())|(COULD_NOT_SET_RATE_CORRECTION));
}
disconnectControl();
if (ret==FORCE_UPDATE)
@ -5129,7 +5146,7 @@ double slsDetector::getRateCorrectionTau(){
if(thisDetector->myDetectorType == EIGER){
int fnum=F_GET_RATE_CORRECT;
int ret=FAIL;
char mess[1000]="";
char mess[MAX_STR_LENGTH]="";
int64_t retval = -1;
#ifdef VERBOSE
std::cout<< "Setting Rate Correction to " << arg << endl;
@ -5708,7 +5725,7 @@ int slsDetector::configureMAC(){
int i;
int ret=FAIL;
int fnum=F_CONFIGURE_MAC,fnum2=F_RECEIVER_SHORT_FRAME;
char mess[100];
char mess[MAX_STR_LENGTH]="";
char arg[6][50];
char cword[50]="", *pcword;
string sword;
@ -5942,7 +5959,7 @@ int slsDetector::sendImageToDetector(imageType index,short int imageVals[]){
int ret=FAIL;
int retval;
int fnum=F_LOAD_IMAGE;
char mess[100];
char mess[MAX_STR_LENGTH]="";
#ifdef VERBOSE
std::cout<<"Sending image to detector " <<std::endl;
@ -5972,7 +5989,7 @@ int slsDetector::getCounterBlock(short int arg[],int startACQ){
int ret=FAIL;
int fnum=F_READ_COUNTER_BLOCK;
char mess[100];
char mess[MAX_STR_LENGTH]="";
if (thisDetector->onlineFlag==ONLINE_FLAG) {
if (connectControl() == OK){
@ -6019,7 +6036,7 @@ int slsDetector::resetCounterBlock(int startACQ){
int ret=FAIL;
int fnum=F_RESET_COUNTER_BLOCK;
char mess[100];
char mess[MAX_STR_LENGTH]="";
#ifdef VERBOSE
std::cout<< std::endl<< "Resetting Counter";
@ -6052,7 +6069,7 @@ int slsDetector::setCounterBit(int i){
int fnum=F_SET_COUNTER_BIT;
int ret = FAIL;
int retval=-1;
char mess[100];
char mess[MAX_STR_LENGTH]="";
if(thisDetector->onlineFlag==ONLINE_FLAG){
#ifdef VERBOSE
@ -6435,7 +6452,7 @@ int slsDetector::saveSettingsFile(string fname, int imod) {
int slsDetector::setAllTrimbits(int val, int imod){
int fnum=F_SET_ALL_TRIMBITS;
int retval;
char mess[100];
char mess[MAX_STR_LENGTH]="";
int ret=OK;
#ifdef VERBOSE
@ -6575,7 +6592,7 @@ slsDetectorDefs::masterFlags slsDetector::setMaster(masterFlags flag) {
int fnum=F_SET_MASTER;
masterFlags retval=GET_MASTER;
char mess[100];
char mess[MAX_STR_LENGTH]="";
int ret=OK;
#ifdef VERBOSE
@ -6619,7 +6636,7 @@ slsDetectorDefs::synchronizationMode slsDetector::setSynchronization(synchroniza
int fnum=F_SET_SYNCHRONIZATION_MODE;
synchronizationMode retval=GET_SYNCHRONIZATION_MODE;
char mess[100];
char mess[MAX_STR_LENGTH]="";
int ret=OK;
#ifdef VERBOSE
@ -6946,7 +6963,7 @@ int slsDetector::startReceiver(){
int slsDetector::stopReceiver(){
int fnum=F_STOP_RECEIVER;
int ret = FAIL;
char mess[] = "";
char mess[MAX_STR_LENGTH] = "";
if(thisDetector->myDetectorType != EIGER && thisDetector->myDetectorType != JUNGFRAU)
detectorSendToReceiver(false);
@ -6998,7 +7015,7 @@ int slsDetector::detectorSendToReceiver(bool set){
if(set) fnum=F_START_RECEIVER;
else fnum=F_STOP_RECEIVER;
int ret = FAIL;
char mess[100];
char mess[MAX_STR_LENGTH]="";
if (thisDetector->onlineFlag==ONLINE_FLAG) {
#ifdef VERBOSE
@ -7098,7 +7115,7 @@ int slsDetector::getReceiverCurrentFrameIndex(){
int slsDetector::resetFramesCaught(){
int fnum=F_RESET_RECEIVER_FRAMES_CAUGHT;
int ret = FAIL;
char mess[] = "";
char mess[MAX_STR_LENGTH] = "";
if (setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG) {
#ifdef VERBOSE
@ -7124,7 +7141,7 @@ int* slsDetector::readFrameFromReceiver(char* fName, int &acquisitionIndex, int
int* retval=new int[nel];
int ret=FAIL;
int n;
char mess[100]="Nothing";
char mess[MAX_STR_LENGTH]="Nothing";
if (setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG) {
#ifdef VERBOSE
@ -7257,7 +7274,7 @@ int slsDetector::updateReceiverNoWait() {
int slsDetector::updateReceiver() {
int fnum=F_UPDATE_RECEIVER_CLIENT;
int ret=OK;
char mess[100];
char mess[MAX_STR_LENGTH]="";
if (setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG) {
if (connectData() == OK){
@ -7420,7 +7437,7 @@ int slsDetector::calibratePedestal(int frames){
int ret=FAIL;
int retval=-1;
int fnum=F_CALIBRATE_PEDESTAL;
char mess[100];
char mess[MAX_STR_LENGTH]="";
#ifdef VERBOSE
std::cout<<"Calibrating Pedestal " <<std::endl;
@ -7538,7 +7555,7 @@ int slsDetector::enableTenGigabitEthernet(int i){
int ret=FAIL;
int retval = -1;
int fnum=F_ENABLE_TEN_GIGA,fnum2 = F_ENABLE_RECEIVER_TEN_GIGA;
char mess[100];
char mess[MAX_STR_LENGTH]="";
#ifdef VERBOSE
std::cout<< std::endl<< "Enabling / Disabling 10Gbe" << endl;
@ -7681,7 +7698,7 @@ uint64_t slsDetector::setCTBWord(int addr,uint64_t word) {
int fnum=F_SET_CTB_PATTERN;
int mode=0; //sets word
char mess[100];
char mess[MAX_STR_LENGTH]="";
#ifdef VERBOSE
std::cout<<"Setting CTB word" <<std::endl;
@ -7733,7 +7750,7 @@ int slsDetector::setCTBPatLoops(int level,int &start, int &stop, int &n) {
int fnum=F_SET_CTB_PATTERN;
int mode=1; //sets loop
char mess[100];
char mess[MAX_STR_LENGTH]="";
#ifdef VERBOSE
std::cout<<"Setting CTB word" <<std::endl;
@ -7783,7 +7800,7 @@ int slsDetector::setCTBPatWaitAddr(int level, int addr) {
int fnum=F_SET_CTB_PATTERN;
int mode=2; //sets loop
char mess[100];
char mess[MAX_STR_LENGTH]="";
#ifdef VERBOSE
std::cout<<"Setting CTB word" <<std::endl;
@ -7833,7 +7850,7 @@ int slsDetector::setCTBPatWaitTime(int level, uint64_t t) {
int fnum=F_SET_CTB_PATTERN;
int mode=3; //sets loop
char mess[100];
char mess[MAX_STR_LENGTH]="";
#ifdef VERBOSE
std::cout<<"Setting CTB word" <<std::endl;
@ -7866,7 +7883,7 @@ int slsDetector::setCTBPatWaitTime(int level, uint64_t t) {
int slsDetector::pulsePixel(int n,int x,int y) {
int ret=FAIL;
int fnum=F_PULSE_PIXEL;
char mess[100];
char mess[MAX_STR_LENGTH]="";
int arg[3];
arg[0] = n; arg[1] = x; arg[2] = y;
@ -7897,7 +7914,7 @@ int slsDetector::pulsePixel(int n,int x,int y) {
int slsDetector::pulsePixelNMove(int n,int x,int y) {
int ret=FAIL;
int fnum=F_PULSE_PIXEL_AND_MOVE;
char mess[100];
char mess[MAX_STR_LENGTH]="";
int arg[3];
arg[0] = n; arg[1] = x; arg[2] = y;
@ -7929,7 +7946,7 @@ int slsDetector::pulsePixelNMove(int n,int x,int y) {
int slsDetector::pulseChip(int n) {
int ret=FAIL;
int fnum=F_PULSE_CHIP;
char mess[100];
char mess[MAX_STR_LENGTH]="";
#ifdef VERBOSE

View File

@ -1959,7 +1959,7 @@ int set_module(int file_des) {
if(getRateCorrectionEnable()){
ret = FAIL;
setRateCorrection(0);
strcat(mess," Cannot set Rate correction. No default tau provided. Deactivating Rate Correction\n");
strcat(mess,"Cannot set Rate correction. No default tau provided. Deactivating Rate Correction\n");
cprintf(RED,"%s",mess);
}
}
@ -2762,6 +2762,7 @@ int set_dynamic_range(int file_des) {
int n;
int retval;
int ret=OK,ret1=OK;
int rateret=OK,rateret1=OK;
sprintf(mess,"can't set dynamic range\n");
@ -2784,28 +2785,43 @@ int set_dynamic_range(int file_des) {
}
#endif
}
if(ret == OK)
if(ret == OK){
retval=setDynamicRange(dr);
if (dr>=0 && retval!=dr)
ret=FAIL;
//look at rate correction only if dr change worked
if((ret==OK) && (dr!=32) && (dr!=-1) && (getRateCorrectionEnable())){
setRateCorrection(0);
strcpy(mess,"Switching off Rate Correction. Must be in 32 bit mode\n");
cprintf(RED,"%s",mess);
rateret = FAIL;
}
}
#endif
if (dr>=0 && retval!=dr)
ret=FAIL;
if (ret!=OK) {
sprintf(mess,"set dynamic range failed\n");
} else if (differentClients)
if ((ret==OK) && (differentClients))
ret=FORCE_UPDATE;
#ifdef SLS_DETECTOR_FUNCTION_LIST
if (dr>=0) dataBytes=calculateDataBytes();
#endif
//rate correction ret
//ret could be swapped during sendData
rateret1 = rateret;
n = sendData(file_des,&rateret1,sizeof(rateret),INT32);
if (rateret==FAIL)
n = sendData(file_des,mess,sizeof(mess),OTHER);
//dynamic range ret
//ret could be swapped during sendData
ret1 = ret;
n = sendData(file_des,&ret1,sizeof(ret),INT32);
if (ret==FAIL) {
if (ret==FAIL)
n = sendData(file_des,mess,sizeof(mess),OTHER);
} else {
else
n = sendData(file_des,&retval,sizeof(retval),INT32);
}
return ret;
}
@ -3960,13 +3976,20 @@ int set_rate_correct(int file_des) {
//set rate
else{
int64_t retval = setRateCorrection(tau_ns); //tau_ns will not be -1 here
if(tau_ns != retval){
if(retval == -1)
strcpy(mess,"Rate correction Deactivated, (tau/subexptime) must be < 0.0015\n");
//not 32 bit mode
if((setDynamicRange(-1)!=32) && (tau_ns!=0)){
strcpy(mess,"Rate correction Deactivated, must be in 32 bit mode\n");
cprintf(RED,"%s",mess);
ret=FAIL;
}
//32 bit mode
else{
int64_t retval = setRateCorrection(tau_ns); //tau_ns will not be -1 here
if(tau_ns != retval){
cprintf(RED,"%s",mess);
ret=FAIL;
}
}
}
}
}