mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-07 02:20:42 +02:00
changed the way gui polls receiver for data for nth frame and otherwise
This commit is contained in:
parent
cdd18182a8
commit
7a2e42d59a
@ -342,7 +342,6 @@ void slsDetectorUtils::acquire(int delflag){
|
|||||||
}
|
}
|
||||||
pthread_mutex_unlock(&mg);
|
pthread_mutex_unlock(&mg);
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
pthread_mutex_lock(&mg);
|
pthread_mutex_lock(&mg);
|
||||||
acquiringDone = 1;
|
acquiringDone = 1;
|
||||||
pthread_mutex_unlock(&mg);
|
pthread_mutex_unlock(&mg);
|
||||||
|
@ -483,7 +483,7 @@ void* postProcessing::processData(int delflag) {
|
|||||||
}
|
}
|
||||||
//receiver
|
//receiver
|
||||||
else{
|
else{
|
||||||
/*
|
/*
|
||||||
//without gui loop
|
//without gui loop
|
||||||
while(1){
|
while(1){
|
||||||
if (checkJoinThread()) break;
|
if (checkJoinThread()) break;
|
||||||
@ -537,7 +537,10 @@ void* postProcessing::processData(int delflag) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/** IF detector acquisition is done, let the acquire() thread know to finish up and force join thread */
|
|
||||||
|
|
||||||
|
|
||||||
|
// IF detector acquisition is done, let the acquire() thread know to finish up and force join thread
|
||||||
if(acquiringDone > 0){
|
if(acquiringDone > 0){
|
||||||
#ifdef VERY_VERY_DEBUG
|
#ifdef VERY_VERY_DEBUG
|
||||||
if(acquiringDone == 1)
|
if(acquiringDone == 1)
|
||||||
@ -550,27 +553,37 @@ void* postProcessing::processData(int delflag) {
|
|||||||
cout << "acquiringDone :" << acquiringDone << endl;
|
cout << "acquiringDone :" << acquiringDone << endl;
|
||||||
#endif
|
#endif
|
||||||
pthread_mutex_unlock(&mg);
|
pthread_mutex_unlock(&mg);
|
||||||
//newData = true;
|
//go through once more to get last nth frame data
|
||||||
if (acquiringDone == 10){//for eiger, it is very slow, have to wait long to get last frame
|
if (acquiringDone >= 2){
|
||||||
|
if((!nthframe) ||(!newData)){
|
||||||
#ifdef VERY_VERY_DEBUG
|
#ifdef VERY_VERY_DEBUG
|
||||||
cout << "gonna post for it to end" << endl;
|
cout << "gonna post for it to end" << endl;
|
||||||
#endif
|
#endif
|
||||||
sem_post(&sem_queue);
|
sem_post(&sem_queue);
|
||||||
#ifdef VERY_VERY_DEBUG
|
#ifdef VERY_VERY_DEBUG
|
||||||
cout << "Sem posted" << endl;
|
cout << "Sem posted" << endl;
|
||||||
#endif
|
#endif
|
||||||
//newData = false;
|
}
|
||||||
}
|
}
|
||||||
}else if (checkJoinThread())
|
}
|
||||||
break;
|
//random reads and for nthframe, checks if there is no new data
|
||||||
|
else if((!nthframe) ||(!newData)){
|
||||||
|
//cout <<"cecking now" << endl;
|
||||||
|
if (checkJoinThread())
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (dataReady){
|
if (dataReady){
|
||||||
|
|
||||||
//for random reads, ask only if it has new data
|
//for random reads, ask only if it has new data
|
||||||
if(!newData){
|
if(!newData){
|
||||||
if(currentfIndex > progress)
|
if(currentfIndex > progress)
|
||||||
newData = true;
|
newData = true;
|
||||||
|
#ifdef VERY_VERY_DEBUG
|
||||||
|
cout << "currentfindex:" << currentfIndex << " progress:" << progress << endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if(newData){
|
if(newData){
|
||||||
@ -594,12 +607,6 @@ void* postProcessing::processData(int delflag) {
|
|||||||
currentfIndex = -1;
|
currentfIndex = -1;
|
||||||
cout<<"****Detector Data returned is NULL***"<<endl;
|
cout<<"****Detector Data returned is NULL***"<<endl;
|
||||||
}
|
}
|
||||||
/*if(nthframe){
|
|
||||||
if((currentfIndex == -1) || (currentfIndex == progress))
|
|
||||||
currentfIndex = -1;
|
|
||||||
else
|
|
||||||
progress = currentfIndex;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
//not garbage frame
|
//not garbage frame
|
||||||
if(currentfIndex < 0){
|
if(currentfIndex < 0){
|
||||||
@ -608,14 +615,14 @@ void* postProcessing::processData(int delflag) {
|
|||||||
#endif
|
#endif
|
||||||
if(receiverData)
|
if(receiverData)
|
||||||
delete [] receiverData;
|
delete [] receiverData;
|
||||||
}else{
|
}else if (currentfIndex > progress){
|
||||||
#ifdef VERY_VERY_DEBUG
|
#ifdef VERY_VERY_DEBUG
|
||||||
cout<<"GOT data"<<endl;
|
cout << "GOT data" << endl;
|
||||||
#endif
|
#endif
|
||||||
fdata = decodeData(receiverData);
|
fdata = decodeData(receiverData);
|
||||||
delete [] receiverData;
|
delete [] receiverData;
|
||||||
if ((fdata) && (dataReady)){
|
if ((fdata) && (dataReady)){
|
||||||
// cout << "DATAREADY 3" << endl;
|
// cout << "DATAREADY 3" << endl;
|
||||||
thisData = new detectorData(fdata,NULL,NULL,getCurrentProgress(),currentfName,getTotalNumberOfChannels());
|
thisData = new detectorData(fdata,NULL,NULL,getCurrentProgress(),currentfName,getTotalNumberOfChannels());
|
||||||
dataReady(thisData, currentfIndex, pCallbackArg);
|
dataReady(thisData, currentfIndex, pCallbackArg);
|
||||||
delete thisData;
|
delete thisData;
|
||||||
@ -624,10 +631,9 @@ void* postProcessing::processData(int delflag) {
|
|||||||
#ifdef VERY_VERY_DEBUG
|
#ifdef VERY_VERY_DEBUG
|
||||||
cout << "progress:" << progress << endl;
|
cout << "progress:" << progress << endl;
|
||||||
#endif
|
#endif
|
||||||
/*if(!nthframe) //unnecessary to read every data, 09.12.2014**/
|
newData = false;
|
||||||
newData = false;
|
|
||||||
#ifdef VERY_VERY_DEBUG
|
#ifdef VERY_VERY_DEBUG
|
||||||
cout << "newData set to false" << endl;
|
cout << "newData set to false" << endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user