changing to random read when no gui at beginnning of acquire

This commit is contained in:
Dhanya Maliakal 2015-11-12 15:05:56 +01:00
parent 816543f358
commit 62c92dd364
3 changed files with 83 additions and 113 deletions

View File

@ -44,8 +44,18 @@ slsDetectorUtils::slsDetectorUtils() {
void slsDetectorUtils::acquire(int delflag){ void slsDetectorUtils::acquire(int delflag){
bool receiver = (setReceiverOnline()==ONLINE_FLAG); bool receiver = (setReceiverOnline()==ONLINE_FLAG);
if(!receiver) if(!receiver){
setDetectorIndex(-1); setDetectorIndex(-1);
}else{
//put receiver read frequency to random if no gui
int ret = setReadReceiverFrequency(0);
if(ret>0 && (acquisition_finished == NULL)){
std::cout << "Error: receiver read frequency is set to " << ret << " but should be > 0 only when using gui." << std::endl;
ret = setReadReceiverFrequency(1,0);
std::cout << "Current receiver read frequency: " << ret << std::endl;
}
}
int nc=setTimer(CYCLES_NUMBER,-1); int nc=setTimer(CYCLES_NUMBER,-1);
int nf=setTimer(FRAME_NUMBER,-1); int nf=setTimer(FRAME_NUMBER,-1);
if (nc==0) nc=1; if (nc==0) nc=1;
@ -53,10 +63,6 @@ void slsDetectorUtils::acquire(int delflag){
int multiframe = nc*nf; int multiframe = nc*nf;
//
if(setDynamicRange() == 32) subframe = 1;
else subframe = 0;
pthread_mutex_lock(&mg); pthread_mutex_lock(&mg);
acquiringDone = 0; acquiringDone = 0;
pthread_mutex_unlock(&mg); pthread_mutex_unlock(&mg);
@ -362,13 +368,6 @@ void slsDetectorUtils::acquire(int delflag){
pthread_mutex_unlock(&mg); pthread_mutex_unlock(&mg);
} }
pthread_mutex_lock(&mg); pthread_mutex_lock(&mg);
/* startReceiverReadout();
while(getReceiverStatus() != RUN_FINISHED){
pthread_mutex_unlock(&mg);
usleep(50000);
pthread_mutex_lock(&mg);
}
*/
stopReceiver(); stopReceiver();
pthread_mutex_unlock(&mg); pthread_mutex_unlock(&mg);
} }

View File

@ -483,16 +483,6 @@ void* postProcessing::processData(int delflag) {
} }
//receiver //receiver
else{ else{
/*
//without gui loop
while(1){
if (checkJoinThread()) break;
usleep(200000);
}
*/
/*if(setReadReceiverFrequency()>0)) ******Not implemented yet ********
* else
*/
int progress = 0; int progress = 0;
@ -509,23 +499,13 @@ void* postProcessing::processData(int delflag) {
std::cout << "receiver read freq:" << nthframe << std::endl; std::cout << "receiver read freq:" << nthframe << std::endl;
#endif #endif
//if nth frame
if(nthframe){
/*newData = true;//unnecessary to read every data, 09.12.2014**/
//and no gui
if(!dataReady){
std::cout << "Error: receiver read freq is set to " << nthframe << " but should be > 0 only when using gui." << std::endl;
nthframe = 0;
std::cout << "Current receiver read frequency: " << nthframe << std::endl;
}
}
//repeat forever until joined by the calling thread //repeat forever until joined by the calling thread
while(1){ while(1){
cout.flush(); cout.flush();
cout<<flush; cout<<flush;
usleep(20000); usleep(20000); //20ms
//get progress //get progress
@ -537,14 +517,7 @@ void* postProcessing::processData(int delflag) {
//updating progress //updating progress
if(currentAcquisitionIndex != -1){ if(currentAcquisitionIndex != -1){
setCurrentProgress(caught); setCurrentProgress(caught);
/*
if(subframe){
pthread_mutex_lock(&mg);
setCurrentProgress(getFramesCaughtByReceiver());
pthread_mutex_unlock(&mg);
}else
setCurrentProgress(currentAcquisitionIndex+1);
*/
} }
#ifdef VERY_VERY_DEBUG #ifdef VERY_VERY_DEBUG
cout << "caught:" << caught << endl; cout << "caught:" << caught << endl;
@ -595,7 +568,7 @@ void* postProcessing::processData(int delflag) {
if(!newData){ if(!newData){
if(caught > progress){ if(caught > progress){
newData = true; newData = true;
/* /*
// keeping acquiringdone at 1 to get more time to get data // keeping acquiringdone at 1 to get more time to get data
if(acquiringDone > 0){cout<<"going to maintain acquiidne"<<endl; if(acquiringDone > 0){cout<<"going to maintain acquiidne"<<endl;
pthread_mutex_lock(&mg); pthread_mutex_lock(&mg);

View File

@ -302,8 +302,6 @@ s
/** set when detector finishes acquiring */ /** set when detector finishes acquiring */
int acquiringDone; int acquiringDone;
/**sub frame*/
int subframe;
/** /**