diff --git a/slsDetectorSoftware/slsDetectorAnalysis/postProcessing.cpp b/slsDetectorSoftware/slsDetectorAnalysis/postProcessing.cpp index 1620249be..f0465f195 100644 --- a/slsDetectorSoftware/slsDetectorAnalysis/postProcessing.cpp +++ b/slsDetectorSoftware/slsDetectorAnalysis/postProcessing.cpp @@ -495,8 +495,9 @@ void* postProcessing::processData(int delflag) { */ - int progress = -1; + int progress = 0; char currentfName[MAX_STR_LENGTH]=""; + int caught = -1; int currentAcquisitionIndex = -1; int currentFrameIndex = -1; bool newData = false; @@ -529,20 +530,23 @@ void* postProcessing::processData(int delflag) { //get progress pthread_mutex_lock(&mg); if(setReceiverOnline() == ONLINE_FLAG) - currentAcquisitionIndex = getReceiverCurrentFrameIndex(); + caught = getFramesCaughtByReceiver();//getReceiverCurrentFrameIndex(); pthread_mutex_unlock(&mg); //updating progress if(currentAcquisitionIndex != -1){ + setCurrentProgress(caught); + /* if(subframe){ pthread_mutex_lock(&mg); setCurrentProgress(getFramesCaughtByReceiver()); pthread_mutex_unlock(&mg); }else setCurrentProgress(currentAcquisitionIndex+1); + */ } #ifdef VERY_VERY_DEBUG - cout << "currentAcquisitionIndex:" << currentAcquisitionIndex << endl; + cout << "caught:" << caught << endl; #endif @@ -585,70 +589,98 @@ void* postProcessing::processData(int delflag) { - if (dataReady){ + //for random reads, ask only if it has new data if(!newData){ - if(currentAcquisitionIndex > progress) + if(caught > progress){ newData = true; +/* + // keeping acquiringdone at 1 to get more time to get data + if(acquiringDone > 0){cout<<"going to maintain acquiidne"< progress){ +#ifdef VERY_VERY_DEBUG + cout << "GOT data" << endl; +#endif + fdata = decodeData(receiverData); delete [] receiverData; - }else if (currentAcquisitionIndex > progress){ + if ((fdata) && (dataReady)){ + // cout << "DATAREADY 3" << endl; + thisData = new detectorData(fdata,NULL,NULL,getCurrentProgress(),currentfName,getTotalNumberOfChannels()); + dataReady(thisData, currentFrameIndex, pCallbackArg); + delete thisData; + fdata = NULL; + progress = caught; #ifdef VERY_VERY_DEBUG - cout << "GOT data" << endl; + cout << "progress:" << progress << endl; #endif - fdata = decodeData(receiverData); - delete [] receiverData; - if ((fdata) && (dataReady)){ - // cout << "DATAREADY 3" << endl; - thisData = new detectorData(fdata,NULL,NULL,getCurrentProgress(),currentfName,getTotalNumberOfChannels()); - dataReady(thisData, currentFrameIndex, pCallbackArg); - delete thisData; - fdata = NULL; - progress = currentAcquisitionIndex; + newData = false; #ifdef VERY_VERY_DEBUG - cout << "progress:" << progress << endl; -#endif - newData = false; -#ifdef VERY_VERY_DEBUG - cout << "newData set to false" << endl; + cout << "newData set to false" << endl; #endif + } } } } } - } + } }