diff --git a/slsDetectorSoftware/eigerDetectorServer/FebControl.c b/slsDetectorSoftware/eigerDetectorServer/FebControl.c index 69d7cfc0d..dd978d3ba 100644 --- a/slsDetectorSoftware/eigerDetectorServer/FebControl.c +++ b/slsDetectorSoftware/eigerDetectorServer/FebControl.c @@ -694,7 +694,7 @@ int Feb_Control_SendHighVoltage(unsigned int dst_num,float* value){ int Feb_Control_DecodeDACString(char* dac_str, unsigned int* module_index, int* top, int* bottom, unsigned int* dac_ch){ char* local_s = dac_str; char temp[50]; - *module_index = 0; + *module_index = 1; char* p1 = strstr(local_s,"mod");//size_t p1 = local_s.find("mod"); char* p2 = strstr(local_s,"::");//size_t p2 =local_s.find("::"); @@ -729,6 +729,15 @@ int Feb_Control_DecodeDACString(char* dac_str, unsigned int* module_index, int* strcpy(local_s,p1+8); *top=0; } +/* + if(Module_BottomAddressIsValid(&modules[*module_index])) + *top=0; + else + *bottom=0; +printf("*****************top %d bottom %d\n",*top,*bottom); +*/ + + *dac_ch = 0; if(!Feb_Control_GetDACNumber(local_s,dac_ch)){ printf("Error in dac_name: %s (%s)\n",dac_str,local_s); @@ -955,8 +964,8 @@ int Feb_Control_SetTrimbits(unsigned int module_num, unsigned int *trimbits){ } //end row loop - if(!Feb_Interface_WriteMemoryInLoops(Module_GetTopLeftAddress(&modules[0]),0,0,1024,trimbits_to_load_r)|| - !Feb_Interface_WriteMemoryInLoops(Module_GetTopRightAddress(&modules[0]),0,0,1024,trimbits_to_load_l)|| + if(!Feb_Interface_WriteMemoryInLoops(Module_GetTopLeftAddress(&modules[1]),0,0,1024,trimbits_to_load_r)|| + !Feb_Interface_WriteMemoryInLoops(Module_GetTopRightAddress(&modules[1]),0,0,1024,trimbits_to_load_l)|| //if(!Feb_Interface_WriteMemory(Module_GetTopLeftAddress(&modules[0]),0,0,1023,trimbits_to_load_r)|| // !Feb_Interface_WriteMemory(Module_GetTopRightAddress(&modules[0]),0,0,1023,trimbits_to_load_l)|| !Feb_Control_StartDAQOnlyNWaitForFinish(5000)){ @@ -982,11 +991,14 @@ unsigned int* Feb_Control_GetTrimbits(){ unsigned int Feb_Control_AddressToAll(){ if(moduleSize==0) return 0; - if(Module_BottomAddressIsValid(&modules[1])){//printf("************* bottom\n"); - return Module_GetBottomLeftAddress(&modules[1])|Module_GetBottomRightAddress(&modules[1]);} - //printf("************* top\n"); - return Module_GetTopLeftAddress(&modules[1])|Module_GetTopRightAddress(&modules[1]); + if(Module_BottomAddressIsValid(&modules[0])){ + //printf("************* bottom\n"); + return Module_GetBottomLeftAddress(&modules[0])|Module_GetBottomRightAddress(&modules[0]); + } + // printf("************* top\n"); + return Module_GetTopLeftAddress(&modules[0])|Module_GetTopRightAddress(&modules[0]); + } int Feb_Control_SetCommandRegister(unsigned int cmd){ @@ -1035,18 +1047,18 @@ int Feb_Control_AcquisitionInProgress(){ //printf("right:%d\n",Feb_Control_GetDAQStatusRegister(Module_GetTopRightAddress(&modules[1]),&status_reg_r)); //printf("left:%d\n",Feb_Control_GetDAQStatusRegister(Module_GetTopLeftAddress(&modules[1]),&status_reg_l)); - if(Module_BottomAddressIsValid(&modules[0])){ + if(Module_BottomAddressIsValid(&modules[1])){ //printf("************* bottom1\n"); if(!(Feb_Control_GetDAQStatusRegister(Module_GetBottomRightAddress(&modules[1]),&status_reg_r))) - return 0; + {printf("**idle\n");return 0;} }else{ //printf("************* top1\n"); if(!(Feb_Control_GetDAQStatusRegister(Module_GetTopRightAddress(&modules[1]),&status_reg_r))) - return 0; + {printf("**idle\n");return 0;} } - if(status_reg_r&DAQ_STATUS_DAQ_RUNNING) return 1; + if(status_reg_r&DAQ_STATUS_DAQ_RUNNING) {printf("******running\n");return 1;} /* if(!(GetDAQStatusRegister(modules[i]->Module_GetTopLeftAddress(),status_reg_r)&&GetDAQStatusRegister(modules[i]->Module_GetTopRightAddress(),status_reg_l))){ @@ -1057,7 +1069,7 @@ int Feb_Control_AcquisitionInProgress(){ } */ - return 0; //i.e. not running (status_reg_r|status_reg_l)&DAQ_STATUS_DAQ_RUNNING; + printf("**idle\n");return 0; //i.e. not running (status_reg_r|status_reg_l)&DAQ_STATUS_DAQ_RUNNING; } int Feb_Control_Reset(){ @@ -1370,7 +1382,7 @@ int Feb_Control_WriteNRead(char* message, int length, int max_length){ } */ -int Feb_Control_StartAcquisition(){ +int Feb_Control_StartAcquisition(){printf("****** starting acquisition********* \n"); static unsigned int reg_nums[20]; static unsigned int reg_vals[20]; diff --git a/slsDetectorSoftware/eigerDetectorServer/Makefile b/slsDetectorSoftware/eigerDetectorServer/Makefile index f11f09eb1..7920925cb 100755 --- a/slsDetectorSoftware/eigerDetectorServer/Makefile +++ b/slsDetectorSoftware/eigerDetectorServer/Makefile @@ -1,6 +1,6 @@ CC = powerpc-4xx-softfloat-gcc CCX = powerpc-4xx-softfloat-g++ -CFLAGS += -Wall -DDACS_INT -DEIGERD -DSLS_DETECTOR_FUNCTION_LIST -DDACS_INT -DSTOP_SERVER #-DVERBOSE #-DVIRTUAL -DPCCOMPILE +CFLAGS += -Wall -DDACS_INT -DEIGERD -DSLS_DETECTOR_FUNCTION_LIST -DDACS_INT #-DSTOP_SERVER #-DVERBOSE #-DVIRTUAL -DPCCOMPILE LDLIBS += -lm -lstdc++ PROGS = eigerDetectorServer diff --git a/slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServer b/slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServer index 54d45775d..2c2221578 100755 Binary files a/slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServer and b/slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServer differ diff --git a/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c b/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c index 26b9a3046..2f6758ff3 100644 --- a/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c @@ -53,7 +53,8 @@ int dst_requested[32] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 int default_dac_values[16] = {0,2000,2000,1250,700,1278,500,500,2000,500,500,550,550,100,1000,775}; - +enum masterFlags masterMode=NO_MASTER; +enum masterFlags trialMasterMode=NO_MASTER; int initDetector(){ int imod,i,n; @@ -128,9 +129,12 @@ int initDetector(){ setHighVolage(150,0); setIODelay(675,0); setTiming(AUTO_TIMING); + setMaster(GET_MASTER); int enable[2] = {0,1}; setExternalGating(enable);//disable external gating + if(getDetectorNumber() == 0xbeb031) + trialMasterMode = IS_MASTER; return 1; } @@ -453,8 +457,13 @@ enum detectorSettings setSettings(enum detectorSettings sett, int imod){ int startStateMachine(){ printf("Going to start acquisition\n"); - if(Feb_Control_StartAcquisition()){ + + if(trialMasterMode == IS_MASTER) + Feb_Control_StartAcquisition(); + + +printf("requesting images\n"); //RequestImages(); int ret_val = 0; dst_requested[0] = 1; @@ -471,15 +480,19 @@ int startStateMachine(){ return FAIL; else return OK; - } + return FAIL; } int stopStateMachine(){ printf("Going to stop acquisition\n"); - if(Feb_Control_StopAcquisition()) - return OK; + + if(trialMasterMode == IS_MASTER){ + if(Feb_Control_StopAcquisition()) + return OK; + }else return OK; + return FAIL; } @@ -885,7 +898,10 @@ void setExternalGating(int enable[]){ enum masterFlags setMaster(enum masterFlags arg){ - return NO_MASTER; + if(arg != GET_MASTER) + masterMode = arg; + + return arg; } diff --git a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp index 55cb1102a..3d99d8e6a 100644 --- a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp +++ b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp @@ -1198,15 +1198,6 @@ int multiSlsDetector::startAcquisition(){ int i=0; int ret=OK, ret1=OK; - if (detectors[0]) { - ret=detectors[0]->startAcquisition(); - if(detectors[0]->getErrorMask()) - setErrorMask(getErrorMask()|(1<numberOfDetectors; i++) { if (i!=thisMultiDetector->masterPosition) if (detectors[i]) { @@ -1226,7 +1217,7 @@ int multiSlsDetector::startAcquisition(){ if (ret!=OK) ret1=FAIL; } - }*/ + } return ret1; }; @@ -1474,7 +1465,7 @@ int* multiSlsDetector::startAndReadAll(){ if (detectors[id]) { detectors[id]->disconnectControl(); } - } + } } @@ -1515,6 +1506,7 @@ int multiSlsDetector::startAndReadAllNoWait(){ ret1=FAIL; } } + return ret1; } @@ -1536,20 +1528,16 @@ slsDetectorDefs::runStatus multiSlsDetector::getRunStatus() { return s; } - if (detectors[0]){ - s=detectors[0]->getRunStatus(); - if(detectors[0]->getErrorMask()) - setErrorMask(getErrorMask()|(1<<0)); - } - for (int i=1; inumberOfDetectors; i++) { s1=detectors[i]->getRunStatus(); if(detectors[i]->getErrorMask()) setErrorMask(getErrorMask()|(1<