mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 21:37:13 +02:00
changes for eiger server to return error if error
This commit is contained in:
@ -1073,29 +1073,29 @@ int Feb_Control_AcquisitionInProgress(){
|
|||||||
|
|
||||||
//deactivated should return end of acquisition
|
//deactivated should return end of acquisition
|
||||||
if(!Feb_Control_activated)
|
if(!Feb_Control_activated)
|
||||||
return 0;
|
return STATUS_IDLE;
|
||||||
|
|
||||||
int ind = Feb_Control_current_index;
|
int ind = Feb_Control_current_index;
|
||||||
if(Module_BottomAddressIsValid(&modules[ind])){
|
if(Module_BottomAddressIsValid(&modules[ind])){
|
||||||
|
|
||||||
if(!(Feb_Control_GetDAQStatusRegister(Module_GetBottomRightAddress(&modules[ind]),&status_reg_r)))
|
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)))
|
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{
|
}else{
|
||||||
if(!(Feb_Control_GetDAQStatusRegister(Module_GetTopRightAddress(&modules[ind]),&status_reg_r)))
|
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)))
|
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
|
//running
|
||||||
if((status_reg_r|status_reg_l)&DAQ_STATUS_DAQ_RUNNING) {/*printf("**runningggg\n");*/
|
if((status_reg_r|status_reg_l)&DAQ_STATUS_DAQ_RUNNING) {/*printf("**runningggg\n");*/
|
||||||
return 1;
|
return STATUS_RUNNING;
|
||||||
}
|
}
|
||||||
//idle
|
//idle
|
||||||
return 0;
|
return STATUS_IDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1132,16 +1132,25 @@ int Feb_Control_AcquisitionStartedBit(){
|
|||||||
|
|
||||||
int Feb_Control_WaitForFinishedFlag(int sleep_time_us){
|
int Feb_Control_WaitForFinishedFlag(int sleep_time_us){
|
||||||
int is_running = Feb_Control_AcquisitionInProgress();
|
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);
|
usleep(sleep_time_us);
|
||||||
is_running = Feb_Control_AcquisitionInProgress();
|
is_running = Feb_Control_AcquisitionInProgress();
|
||||||
}
|
|
||||||
if(is_running!=0){
|
// check error only 5 times (ensuring it is not something that happens sometimes)
|
||||||
printf("\n\nWarning WaitForFinishedFlag comunication problem..\n\n");
|
if (is_running == STATUS_ERROR) {
|
||||||
return 0; //communication problem
|
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)
|
if(!Feb_Control_activated)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
//did not start
|
||||||
|
if(prev_flag == -1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
int value = prev_flag;
|
int value = prev_flag;
|
||||||
while(value == prev_flag){
|
while(value == prev_flag){
|
||||||
usleep(sleep_time_us);
|
usleep(sleep_time_us);
|
||||||
|
@ -197,4 +197,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Binary file not shown.
@ -1,9 +1,9 @@
|
|||||||
Path: slsDetectorsPackage/slsDetectorSoftware/eigerDetectorServer
|
Path: slsDetectorsPackage/slsDetectorSoftware/eigerDetectorServer
|
||||||
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
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
|
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||||
Repsitory UUID: 3c1eb747d1930d6d38030a5a607f72d3b58a7a21
|
Repsitory UUID: 4c02a99589af6ae56ba5819da50f1e567057393a
|
||||||
Revision: 301
|
Revision: 303
|
||||||
Branch: virtualclass
|
Branch: 3.0.1
|
||||||
Last Changed Author: Dhanya_Maliakal
|
Last Changed Author: Dhanya_Maliakal
|
||||||
Last Changed Rev: 1549
|
Last Changed Rev: 1572
|
||||||
Last Changed Date: 2017-08-30 15:06:49.000000002 +0200 ./Makefile.virtual
|
Last Changed Date: 2017-10-06 13:01:24.000000002 +0200 ./FebRegisterDefs.h
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
//#define SVNPATH ""
|
//#define SVNPATH ""
|
||||||
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git"
|
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git"
|
||||||
//#define SVNREPPATH ""
|
//#define SVNREPPATH ""
|
||||||
#define SVNREPUUID "3c1eb747d1930d6d38030a5a607f72d3b58a7a21"
|
#define SVNREPUUID "4c02a99589af6ae56ba5819da50f1e567057393a"
|
||||||
//#define SVNREV 0x1549
|
//#define SVNREV 0x1572
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTH "Dhanya_Maliakal"
|
#define SVNAUTH "Dhanya_Maliakal"
|
||||||
#define SVNREV 0x1549
|
#define SVNREV 0x1572
|
||||||
#define SVNDATE 0x20170830
|
#define SVNDATE 0x20171006
|
||||||
//
|
//
|
||||||
|
@ -1139,8 +1139,8 @@ int startStateMachine(){
|
|||||||
//wait for acquisition start
|
//wait for acquisition start
|
||||||
if(ret == OK){
|
if(ret == OK){
|
||||||
if(!Feb_Control_WaitForStartedFlag(5000, prev_flag)){
|
if(!Feb_Control_WaitForStartedFlag(5000, prev_flag)){
|
||||||
cprintf(RED,"Error: Acquisition did no start or trouble reading register\n");
|
cprintf(RED,"Error: Acquisition did not start or trouble reading register\n");
|
||||||
ret = FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
cprintf(GREEN,"***Acquisition started\n");
|
cprintf(GREEN,"***Acquisition started\n");
|
||||||
}
|
}
|
||||||
@ -1187,16 +1187,19 @@ int startReadOut(){
|
|||||||
|
|
||||||
|
|
||||||
enum runStatus getRunStatus(){
|
enum runStatus getRunStatus(){
|
||||||
//if(trialMasterMode == IS_MASTER){
|
|
||||||
int i = Feb_Control_AcquisitionInProgress();
|
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");
|
printf("Status: IDLE\n");
|
||||||
return IDLE;
|
return IDLE;
|
||||||
}else{
|
default:
|
||||||
printf("Status: RUNNING...\n");
|
printf("Status: RUNNING...\n");
|
||||||
return RUNNING;
|
return RUNNING;
|
||||||
}
|
}
|
||||||
//}else printf("***** not master*** \n");
|
|
||||||
|
|
||||||
return IDLE;
|
return IDLE;
|
||||||
}
|
}
|
||||||
@ -1204,8 +1207,11 @@ enum runStatus getRunStatus(){
|
|||||||
|
|
||||||
|
|
||||||
void readFrame(int *ret, char *mess){
|
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");
|
cprintf(RED,"Error: Waiting for finished flag\n");
|
||||||
|
*ret = FAIL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
cprintf(GREEN,"Acquisition finished***\n");
|
cprintf(GREEN,"Acquisition finished***\n");
|
||||||
|
|
||||||
if(eiger_storeinmem){
|
if(eiger_storeinmem){
|
||||||
|
@ -14,6 +14,10 @@
|
|||||||
#define GOODBYE (-200)
|
#define GOODBYE (-200)
|
||||||
#define REQUIRED_FIRMWARE_VERSION (16)
|
#define REQUIRED_FIRMWARE_VERSION (16)
|
||||||
|
|
||||||
|
#define STATUS_IDLE 0
|
||||||
|
#define STATUS_RUNNING 1
|
||||||
|
#define STATUS_ERROR 2
|
||||||
|
|
||||||
/* Enums */
|
/* Enums */
|
||||||
enum CLK_SPEED_INDEX {FULL_SPEED, HALF_SPEED, QUARTER_SPEED};
|
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};
|
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();
|
s1=detectors[i]->getRunStatus();
|
||||||
if(detectors[i]->getErrorMask())
|
if(detectors[i]->getErrorMask())
|
||||||
setErrorMask(getErrorMask()|(1<<i));
|
setErrorMask(getErrorMask()|(1<<i));
|
||||||
if (s1==ERROR)
|
if (s1==ERROR) {
|
||||||
s=ERROR;
|
return ERROR;
|
||||||
|
}
|
||||||
if (s1!=IDLE)
|
if (s1!=IDLE)
|
||||||
s = s1;
|
s = s1;
|
||||||
// if (s1==IDLE && s!=IDLE)
|
// if (s1==IDLE && s!=IDLE)
|
||||||
|
Reference in New Issue
Block a user