mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 15:00:02 +02:00
changes for eiger server to return error if error
This commit is contained in:
parent
2aed12dcb9
commit
44bf4c52ed
@ -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);
|
||||
|
@ -197,4 +197,7 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Binary file not shown.
@ -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
|
||||
|
@ -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
|
||||
//
|
||||
|
@ -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){
|
||||
|
@ -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};
|
||||
|
@ -1911,8 +1911,9 @@ slsDetectorDefs::runStatus multiSlsDetector::getRunStatus() {
|
||||
s1=detectors[i]->getRunStatus();
|
||||
if(detectors[i]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<i));
|
||||
if (s1==ERROR)
|
||||
s=ERROR;
|
||||
if (s1==ERROR) {
|
||||
return ERROR;
|
||||
}
|
||||
if (s1!=IDLE)
|
||||
s = s1;
|
||||
// if (s1==IDLE && s!=IDLE)
|
||||
|
Loading…
x
Reference in New Issue
Block a user