diff --git a/slsDetectorSoftware/eigerDetectorServer/FebControl.c b/slsDetectorSoftware/eigerDetectorServer/FebControl.c index 300a92bc9..73496875e 100644 --- a/slsDetectorSoftware/eigerDetectorServer/FebControl.c +++ b/slsDetectorSoftware/eigerDetectorServer/FebControl.c @@ -1073,29 +1073,29 @@ int Feb_Control_AcquisitionInProgress(){ //deactivated should return end of acquisition if(!Feb_Control_activated) - return 0; + return STATUS_IDLE; int ind = Feb_Control_current_index; if(Module_BottomAddressIsValid(&modules[ind])){ if(!(Feb_Control_GetDAQStatusRegister(Module_GetBottomRightAddress(&modules[ind]),&status_reg_r))) - {cprintf(RED,"Error: Trouble reading Status register. bottom right address\n");return 0;} + {cprintf(RED,"Error: Trouble reading Status register. bottom right address\n");return STATUS_ERROR;} if(!(Feb_Control_GetDAQStatusRegister(Module_GetBottomLeftAddress(&modules[ind]),&status_reg_l))) - {cprintf(RED,"Error: Trouble reading Status register. bottom left address\n");return 0;} + {cprintf(RED,"Error: Trouble reading Status register. bottom left address\n");return STATUS_ERROR;} }else{ if(!(Feb_Control_GetDAQStatusRegister(Module_GetTopRightAddress(&modules[ind]),&status_reg_r))) - {cprintf(RED,"Error: Trouble reading Status register. top right address\n");return 0;} + {cprintf(RED,"Error: Trouble reading Status register. top right address\n");return STATUS_ERROR;} if(!(Feb_Control_GetDAQStatusRegister(Module_GetTopLeftAddress(&modules[ind]),&status_reg_l))) - {cprintf(RED,"Error: Trouble reading Status register. top left address\n");return 0;} + {cprintf(RED,"Error: Trouble reading Status register. top left address\n");return STATUS_ERROR;} } //running if((status_reg_r|status_reg_l)&DAQ_STATUS_DAQ_RUNNING) {/*printf("**runningggg\n");*/ - return 1; + return STATUS_RUNNING; } //idle - return 0; + return STATUS_IDLE; } @@ -1132,16 +1132,25 @@ int Feb_Control_AcquisitionStartedBit(){ int Feb_Control_WaitForFinishedFlag(int sleep_time_us){ int is_running = Feb_Control_AcquisitionInProgress(); - while(is_running){ + + int check_error = 0; + + // it will break out if it is idle or if check_error is more than 5 times + while(is_running != STATUS_IDLE){ usleep(sleep_time_us); is_running = Feb_Control_AcquisitionInProgress(); - } - if(is_running!=0){ - printf("\n\nWarning WaitForFinishedFlag comunication problem..\n\n"); - return 0; //communication problem + + // check error only 5 times (ensuring it is not something that happens sometimes) + if (is_running == STATUS_ERROR) { + if (check_error == 5) + break; + check_error++; + }// reset check_error for next time + else check_error = 0; + } - return 1; + return is_running; } @@ -1151,6 +1160,10 @@ int Feb_Control_WaitForStartedFlag(int sleep_time_us, int prev_flag){ if(!Feb_Control_activated) return 1; + //did not start + if(prev_flag == -1) + return 0; + int value = prev_flag; while(value == prev_flag){ usleep(sleep_time_us); diff --git a/slsDetectorSoftware/eigerDetectorServer/FebRegisterDefs.h b/slsDetectorSoftware/eigerDetectorServer/FebRegisterDefs.h index d7c8c012b..9c3bea8fa 100644 --- a/slsDetectorSoftware/eigerDetectorServer/FebRegisterDefs.h +++ b/slsDetectorSoftware/eigerDetectorServer/FebRegisterDefs.h @@ -197,4 +197,7 @@ + + + diff --git a/slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServerv3.0.0.16.9 b/slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServerv3.0.0.16.10 similarity index 71% rename from slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServerv3.0.0.16.9 rename to slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServerv3.0.0.16.10 index 6cbc0d41a..b01f232d9 100755 Binary files a/slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServerv3.0.0.16.9 and b/slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServerv3.0.0.16.10 differ diff --git a/slsDetectorSoftware/eigerDetectorServer/gitInfo.txt b/slsDetectorSoftware/eigerDetectorServer/gitInfo.txt index f66bf01f0..1a4162f53 100644 --- a/slsDetectorSoftware/eigerDetectorServer/gitInfo.txt +++ b/slsDetectorSoftware/eigerDetectorServer/gitInfo.txt @@ -1,9 +1,9 @@ Path: slsDetectorsPackage/slsDetectorSoftware/eigerDetectorServer URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git -Repsitory UUID: 3c1eb747d1930d6d38030a5a607f72d3b58a7a21 -Revision: 301 -Branch: virtualclass +Repsitory UUID: 4c02a99589af6ae56ba5819da50f1e567057393a +Revision: 303 +Branch: 3.0.1 Last Changed Author: Dhanya_Maliakal -Last Changed Rev: 1549 -Last Changed Date: 2017-08-30 15:06:49.000000002 +0200 ./Makefile.virtual +Last Changed Rev: 1572 +Last Changed Date: 2017-10-06 13:01:24.000000002 +0200 ./FebRegisterDefs.h diff --git a/slsDetectorSoftware/eigerDetectorServer/gitInfoEiger.h b/slsDetectorSoftware/eigerDetectorServer/gitInfoEiger.h index 9f01077eb..67ef9f8fc 100644 --- a/slsDetectorSoftware/eigerDetectorServer/gitInfoEiger.h +++ b/slsDetectorSoftware/eigerDetectorServer/gitInfoEiger.h @@ -1,11 +1,11 @@ //#define SVNPATH "" #define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git" //#define SVNREPPATH "" -#define SVNREPUUID "3c1eb747d1930d6d38030a5a607f72d3b58a7a21" -//#define SVNREV 0x1549 +#define SVNREPUUID "4c02a99589af6ae56ba5819da50f1e567057393a" +//#define SVNREV 0x1572 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "Dhanya_Maliakal" -#define SVNREV 0x1549 -#define SVNDATE 0x20170830 +#define SVNREV 0x1572 +#define SVNDATE 0x20171006 // diff --git a/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c b/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c index 44e15b469..1fe43e302 100644 --- a/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c @@ -1139,8 +1139,8 @@ int startStateMachine(){ //wait for acquisition start if(ret == OK){ if(!Feb_Control_WaitForStartedFlag(5000, prev_flag)){ - cprintf(RED,"Error: Acquisition did no start or trouble reading register\n"); - ret = FAIL; + cprintf(RED,"Error: Acquisition did not start or trouble reading register\n"); + return FAIL; } cprintf(GREEN,"***Acquisition started\n"); } @@ -1187,16 +1187,19 @@ int startReadOut(){ enum runStatus getRunStatus(){ - //if(trialMasterMode == IS_MASTER){ + int i = Feb_Control_AcquisitionInProgress(); - if(i== 0){ + switch (i) { + case STATUS_ERROR: + printf("Status: ERROR reading status register\n"); + return ERROR; + case STATUS_IDLE: printf("Status: IDLE\n"); return IDLE; - }else{ + default: printf("Status: RUNNING...\n"); return RUNNING; } - //}else printf("***** not master*** \n"); return IDLE; } @@ -1204,8 +1207,11 @@ enum runStatus getRunStatus(){ void readFrame(int *ret, char *mess){ - if(!Feb_Control_WaitForFinishedFlag(5000)) + if(Feb_Control_WaitForFinishedFlag(5000) == STATUS_ERROR) { cprintf(RED,"Error: Waiting for finished flag\n"); + *ret = FAIL; + return; + } cprintf(GREEN,"Acquisition finished***\n"); if(eiger_storeinmem){ diff --git a/slsDetectorSoftware/eigerDetectorServer/slsDetectorServer_defs.h b/slsDetectorSoftware/eigerDetectorServer/slsDetectorServer_defs.h index 836c3aa9a..88c554f61 100644 --- a/slsDetectorSoftware/eigerDetectorServer/slsDetectorServer_defs.h +++ b/slsDetectorSoftware/eigerDetectorServer/slsDetectorServer_defs.h @@ -14,6 +14,10 @@ #define GOODBYE (-200) #define REQUIRED_FIRMWARE_VERSION (16) +#define STATUS_IDLE 0 +#define STATUS_RUNNING 1 +#define STATUS_ERROR 2 + /* Enums */ enum CLK_SPEED_INDEX {FULL_SPEED, HALF_SPEED, QUARTER_SPEED}; enum DACINDEX {SVP,VTR,VRF,VRS,SVN,VTGSTV,VCMP_LL,VCMP_LR,CAL,VCMP_RL,RXB_RB,RXB_LB,VCMP_RR,VCP,VCN,VIS,VTHRESHOLD}; diff --git a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp index 462ceeb2a..786d24c8b 100644 --- a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp +++ b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp @@ -1911,8 +1911,9 @@ slsDetectorDefs::runStatus multiSlsDetector::getRunStatus() { s1=detectors[i]->getRunStatus(); if(detectors[i]->getErrorMask()) setErrorMask(getErrorMask()|(1<