From 975076043fa2d21b3523824aff02db7aa5a8c4df Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Tue, 2 Jul 2019 13:50:20 +0200 Subject: [PATCH] WIP --- slsDetectorGui/include/qDrawPlot.h | 2 +- slsDetectorGui/src/qDetectorMain.cpp | 4 ++-- slsDetectorGui/src/qDrawPlot.cpp | 4 ++-- slsDetectorGui/src/qTabDeveloper.cpp | 10 +++++----- slsDetectorGui/src/qTabMeasurement.cpp | 4 ++-- slsDetectorSoftware/src/multiSlsDetector.cpp | 9 ++++----- 6 files changed, 16 insertions(+), 17 deletions(-) diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 66d595918..5c424669d 100755 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -145,7 +145,7 @@ class qDrawPlot : public QWidget { unsigned int nHists{1}; double *datax1d{nullptr}; std::vector datay1d; - double *data2d; + double *data2d{nullptr}; //options bool isPlot{true}; diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 038da0f4f..6b139cd12 100755 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -229,6 +229,8 @@ void qDetectorMain::SetUpWidgetWindow() { heightCentralWidget = centralwidget->size().height(); // Default zoom Tool Tip zoomToolTip = dockWidgetPlot->toolTip(); + + Initialization(); } void qDetectorMain::SetUpDetector(const std::string fName, int multiID) { @@ -273,8 +275,6 @@ void qDetectorMain::SetUpDetector(const std::string fName, int multiID) { //FIXME: not needed anymore due to client creating socket each time //myDet->setOnline(slsDetectorDefs::ONLINE_FLAG); //myDet->setReceiverOnline(slsDetectorDefs::ONLINE_FLAG); - - Initialization(); } void qDetectorMain::Initialization() { diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 9c61b9243..af28b6438 100755 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -111,8 +111,8 @@ void qDrawPlot::SetupWidgetWindow() { fileSaveName = "Image"; } - SetupStatistics(); SetupPlots(); + SetupStatistics(); SetDataCallBack(true); myDet->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack), this); myDet->registerProgressCallback(&(GetProgressCallBack), this); @@ -219,7 +219,7 @@ void qDrawPlot::SetupPlots() { plot2d = new SlsQt2DPlotLayout(boxPlot); // default display data if (data2d) - delete[] data2d; + delete [] data2d; data2d = new double[nPixelsY * nPixelsX]; for (unsigned int px = 0; px < nPixelsX; ++px) for (unsigned int py = 0; py < nPixelsY; ++py) diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index 09075aa99..32c4b7146 100755 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -178,11 +178,11 @@ void qTabDeveloper::CreateDACWidgets() { dacLayout = new QGridLayout(boxDacs); for (int i = 0; i < numDACWidgets; ++i) { - lblDacs[i] = new QLabel(QString(dacNames[i].c_str()), boxDacs); - spinDacs[i] = new MyDoubleSpinBox(i, boxDacs); + lblDacs.push_back(new QLabel(QString(dacNames[i].c_str()), boxDacs)); + spinDacs.push_back(new MyDoubleSpinBox(i, boxDacs)); spinDacs[i]->setMinimum(-1); spinDacs[i]->setMaximum(10000); - lblDacsmV[i] = new QLabel("", boxDacs); + lblDacsmV.push_back(new QLabel("", boxDacs)); dacLayout->addWidget(lblDacs[i], (int)(i / 2), ((i % 2) == 0) ? 1 : 5); dacLayout->addWidget(spinDacs[i], (int)(i / 2), ((i % 2) == 0) ? 2 : 6); @@ -210,8 +210,8 @@ void qTabDeveloper::CreateADCWidgets() { QGridLayout *adcLayout = new QGridLayout(boxAdcs); for (int i = 0; i < numADCWidgets; ++i) { - lblAdcs[i] = new QLabel(QString(adcNames[i].c_str()), boxAdcs); - spinAdcs[i] = new QLineEdit(boxAdcs); + lblAdcs.push_back(new QLabel(QString(adcNames[i].c_str()), boxAdcs)); + spinAdcs.push_back(new QLineEdit(boxAdcs)); spinAdcs[i]->setReadOnly(true); adcLayout->addWidget(lblAdcs[i], (int)(i / 2), ((i % 2) == 0) ? 1 : 4); diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 69296decc..98dbeaac8 100755 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -224,7 +224,7 @@ void qTabMeasurement::SetTimingMode(int val) { void qTabMeasurement::GetNumMeasurements() { FILE_LOG(logDEBUG) << "Getting number of measurements"; disconnect(spinNumMeasurements, SIGNAL(valueChanged(int)), this, SLOT(SetNumMeasurements(int))); - spinNumFrames->setValue(myPlot->GetNumMeasurements()); + spinNumMeasurements->setValue(myPlot->GetNumMeasurements()); connect(spinNumMeasurements, SIGNAL(valueChanged(int)), this, SLOT(SetNumMeasurements(int))); } @@ -606,7 +606,7 @@ void qTabMeasurement::Refresh() { GetExposureTime(); GetAcquisitionPeriod(); GetNumTriggers(); - if (delayImplemented) { + if (delayImplemented) {cprintf(BLUE, "Delay implemented\n"); GetDelay(); } if (sampleImplemented) { diff --git a/slsDetectorSoftware/src/multiSlsDetector.cpp b/slsDetectorSoftware/src/multiSlsDetector.cpp index f24d4bb54..f9a6727d9 100755 --- a/slsDetectorSoftware/src/multiSlsDetector.cpp +++ b/slsDetectorSoftware/src/multiSlsDetector.cpp @@ -4185,15 +4185,16 @@ int multiSlsDetector::acquire() { multi_shm()->stoppedFlag = 1; } // let processing thread listen to these packets - sem_post(&sem_newRTAcquisition); + if (multi_shm()->stoppedFlag == 0) + sem_post(&sem_newRTAcquisition); } if (multi_shm()->stoppedFlag == 0) startAndReadAll(); // stop receiver - std::lock_guard lock(mg); if (receiver) { + std::lock_guard lock(mg); if (stopReceiver() == FAIL) { multi_shm()->stoppedFlag = 1; } else { @@ -4203,10 +4204,8 @@ int multiSlsDetector::acquire() { // external process to be // done sending data to gui } + incrementFileIndex(); } - - incrementFileIndex(); - // waiting for the data processing thread to finish! setJoinThreadFlag(true);