From bdabf9e64920d67c635c0c883a06bb22130cb819 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Tue, 25 Sep 2012 16:08:10 +0000 Subject: [PATCH] bug fix: update measurement index, update index does not use sharedmemory, start run index updated after measurement git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@78 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qTabMeasurement.h | 2 -- slsDetectorGui/src/qDrawPlot.cpp | 21 ++++++++++----------- slsDetectorGui/src/qTabMeasurement.cpp | 10 ++++------ 3 files changed, 14 insertions(+), 19 deletions(-) diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h index 10497eab9..a77b31664 100644 --- a/slsDetectorGui/include/qTabMeasurement.h +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -163,8 +163,6 @@ private: enum{None, Auto, Trigger_Exp_Series, Trigger_Frame, Trigger_Readout, Gated, Gated_Start, Trigger_Window, NumTimingModes}; /** timer to update the progress*/ QTimer *progressTimer; - /** current measurement */ - int currentMeasurement; /** tool tip variables*/ QString acqPeriodTip; QString errPeriodTip; diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 138171b7e..f2345c516 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -618,7 +618,7 @@ int qDrawPlot::GetData(detectorData *data){ lastImageNumber= currentFrame+1; //title char temp_title[2000]; - sprintf(temp_title,"Image Index %d",fileIOStatic::getFileIndexFromFileName(string(data->fileName))); + sprintf(temp_title,"Image Index %d",currentFileIndex); imageTitle = temp_title; //copy data memcpy(lastImageArray+(currentScanDivLevel*nPixelsX),data->values,nPixelsX*sizeof(double)); @@ -635,12 +635,11 @@ int qDrawPlot::GetData(detectorData *data){ while(1){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ //variables - int currentIndex = fileIOStatic::getFileIndexFromFileName(string(data->fileName)); - if(currentIndex == minPixelsY) currentScanDivLevel = 0; + if(currentFileIndex == minPixelsY) currentScanDivLevel = 0; lastImageNumber= currentFrame+1; //title char temp_title[2000]; - sprintf(temp_title,"Image Index %d",currentIndex); + sprintf(temp_title,"Image Index %d",currentFileIndex); imageTitle = temp_title; //copy data for(unsigned int px=0;pxvalues[px]; @@ -657,8 +656,8 @@ int qDrawPlot::GetData(detectorData *data){ while(1){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ //get scanvariable0 - int currentIndex = 0, p = 0; double cs0 = 0 , cs1 = 0; - fileIOStatic::getVariablesFromFileName(string(data->fileName), currentIndex, p, cs0, cs1); + int ci = 0, p = 0; double cs0 = 0 , cs1 = 0; + fileIOStatic::getVariablesFromFileName(string(data->fileName), ci, p, cs0, cs1); cout<<"currentScanValue:"<values[px]; @@ -685,8 +684,8 @@ int qDrawPlot::GetData(detectorData *data){ while(1){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ //get scanvariable1 - int currentIndex = 0, p = 0; double cs0 = 0 , cs1 = 0; - fileIOStatic::getVariablesFromFileName(string(data->fileName), currentIndex, p, cs0, cs1); + int ci = 0, p = 0; double cs0 = 0 , cs1 = 0; + fileIOStatic::getVariablesFromFileName(string(data->fileName), ci, p, cs0, cs1); //variables if(cs1!=currentScanValue){ if(backwardScanPlot) currentScanDivLevel--; @@ -696,7 +695,7 @@ int qDrawPlot::GetData(detectorData *data){ lastImageNumber= currentFrame+1; //title char temp_title[2000]; - sprintf(temp_title,"Image Index %d",currentIndex); + sprintf(temp_title,"Image Index %d",currentFileIndex); imageTitle = temp_title; //copy data for(unsigned int px=0;pxvalues[px]; @@ -731,7 +730,7 @@ int qDrawPlot::GetData(detectorData *data){ //2d else{ // Titles - sprintf(temp_title,"Image Index %d",fileIOStatic::getFileIndexFromFileName(string(data->fileName))); + sprintf(temp_title,"Image Index %d",currentFileIndex); imageTitle = temp_title; // manufacture data for now for(unsigned int px=0;pxsetText(QString::number(myDet->getFileIndex())); //ly initially progressBar->setValue(0); - currentMeasurement = 0; //timing mode SetupTimingMode(); @@ -301,8 +300,6 @@ void qTabMeasurement::startStopAcquisition(){ btnStartStop->setIcon(*iconStop); Enable(0); progressBar->setValue(0); - //the progress which keeps adding up for all the measurements - currentMeasurement = 0; progressTimer->start(100); emit StartSignal(); @@ -313,6 +310,7 @@ void qTabMeasurement::startStopAcquisition(){ emit StopSignal(); myDet->stopAcquisition(); progressTimer->stop(); + spinIndex->setValue(myPlot->GetFileIndex()); btnStartStop->setText("Start"); btnStartStop->setIcon(*iconStart); btnStartStop->setChecked(false); @@ -333,6 +331,7 @@ void qTabMeasurement::UpdateFinished(){ Enable(1); connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); UpdateProgress(); + spinIndex->setValue(myPlot->GetFileIndex()); progressTimer->stop(); } } @@ -342,8 +341,8 @@ void qTabMeasurement::UpdateFinished(){ void qTabMeasurement::SetCurrentMeasurement(int val){ - currentMeasurement = val; - lblCurrentMeasurement->setText(QString::number(val+1)); + if((val)value()) + lblCurrentMeasurement->setText(QString::number(val+1)); } @@ -352,7 +351,6 @@ void qTabMeasurement::SetCurrentMeasurement(int val){ void qTabMeasurement::UpdateProgress(){ - //progressBar->setValue((int)(((currentMeasurement*100)+(myPlot->GetProgress()))/spinNumMeasurements->value())); progressBar->setValue((int)myPlot->GetProgress()); lblProgressIndex->setText(QString::number(myPlot->GetFileIndex())); }