From 864db79a135fb60dfd0a0a0483224b83f85289f3 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Tue, 2 Jul 2019 17:11:03 +0200 Subject: [PATCH] WIP --- CMakeLists.txt | 3 ++- cmk.sh | 3 ++- slsDetectorGui/include/qCloneWidget.h | 1 - slsDetectorGui/src/qCloneWidget.cpp | 15 +-------------- slsDetectorGui/src/qDetectorMain.cpp | 6 +++--- slsDetectorGui/src/qDrawPlot.cpp | 2 +- slsDetectorGui/src/qTabAdvanced.cpp | 4 ++-- slsDetectorGui/src/qTabDataOutput.cpp | 4 ++-- slsDetectorGui/src/qTabDeveloper.cpp | 16 ++++++++++------ slsDetectorGui/src/qTabMeasurement.cpp | 17 +++++++++-------- slsDetectorGui/src/qTabSettings.cpp | 9 +++++---- .../src/slsReceiverTCPIPInterface.cpp | 2 +- 12 files changed, 38 insertions(+), 44 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f71c21930..bd7f19091 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,7 +103,8 @@ endif() if(SLS_USE_SANITIZER) - target_compile_options(slsProjectOptions INTERFACE -fsanitize=address,undefined) + target_compile_options(slsProjectOptions INTERFACE -fsanitize=address,undefined -fno-omit-frame-pointer) + #target_compile_options(slsProjectOptions INTERFACE -fsanitize=address,undefined) target_link_libraries(slsProjectOptions INTERFACE -fsanitize=address,undefined) # target_compile_options(slsProjectOptions INTERFACE -fsanitize=thread) # target_link_libraries(slsProjectOptions INTERFACE -fsanitize=thread) diff --git a/cmk.sh b/cmk.sh index 964e55b1a..14e67aadb 100755 --- a/cmk.sh +++ b/cmk.sh @@ -181,7 +181,8 @@ fi #Debug if [ $DEBUG -eq 1 ]; then - CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_SANITIZER=ON " + CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug " +# CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_SANITIZER=ON " echo "Debug Option enabled" fi diff --git a/slsDetectorGui/include/qCloneWidget.h b/slsDetectorGui/include/qCloneWidget.h index 2aad84f10..6ce1b821c 100755 --- a/slsDetectorGui/include/qCloneWidget.h +++ b/slsDetectorGui/include/qCloneWidget.h @@ -40,7 +40,6 @@ class qCloneWidget : public QMainWindow { void closeEvent(QCloseEvent *event); private: - char *GetCurrentTimeStamp(); void DisplayStats(bool enable, QString min, QString max, QString sum); diff --git a/slsDetectorGui/src/qCloneWidget.cpp b/slsDetectorGui/src/qCloneWidget.cpp index 31cf43c47..e2709900c 100755 --- a/slsDetectorGui/src/qCloneWidget.cpp +++ b/slsDetectorGui/src/qCloneWidget.cpp @@ -28,7 +28,7 @@ qCloneWidget::qCloneWidget(QWidget *parent, int id, QString title, QString xTitl marker(nullptr), nomarker(nullptr), mainLayout(nullptr), boxPlot(nullptr), lblHistTitle(nullptr) { // Window title char winTitle[300], currTime[50]; - strcpy(currTime, GetCurrentTimeStamp()); + strcpy(currTime, NowTime().c_str()); sprintf(winTitle, "Snapshot:%d - %s", id, currTime); setWindowTitle(QString(winTitle)); @@ -204,19 +204,6 @@ void qCloneWidget::closeEvent(QCloseEvent *event) { event->accept(); } -char *qCloneWidget::GetCurrentTimeStamp() { - char output[30]; - char *result; - - //using sys cmds to get output or str - FILE *sysFile = popen("date", "r"); - fgets(output, sizeof(output), sysFile); - pclose(sysFile); - - result = output + 0; - return result; -} - void qCloneWidget::DisplayStats(bool enable, QString min, QString max, QString sum) { if (enable) { QWidget *widgetStatistics = new QWidget(this); diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 6b139cd12..69f56f0b6 100755 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -284,14 +284,14 @@ void qDetectorMain::Initialization() { connect(tabs,SIGNAL(currentChanged(int)), this, SLOT(Refresh(int)));//( QWidget*))); // Measurement tab connect(tabMeasurement, SIGNAL(StartSignal()), this,SLOT(EnableTabs())); - connect(tabMeasurement, SIGNAL(FileNameChangedSignal(QString)), tabPlot, SLOT(SetSaveFileName(QString))); + connect(tabMeasurement, SIGNAL(FileNameChangedSignal(QString)), myPlot, SLOT(SetSaveFileName(QString))); // Plot tab connect(tabPlot, SIGNAL(DisableZoomSignal(bool)), this, SLOT(SetZoomToolTip(bool))); // Plotting // When the acquisition is finished, must update the meas tab - connect(myPlot, SIGNAL(UpdatingPlotFinished()), this, SLOT(EnableTabs())); - connect(myPlot, SIGNAL(UpdatingPlotFinished()), tabMeasurement, SLOT(UpdateFinished())); + connect(myPlot, SIGNAL(AcquireFinishedSignal()), this, SLOT(EnableTabs())); + connect(myPlot, SIGNAL(AcquireFinishedSignal()), tabMeasurement, SLOT(UpdateFinished())); // menubar // Modes Menu diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index af28b6438..995f9f858 100755 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -122,7 +122,6 @@ void qDrawPlot::SetupWidgetWindow() { void qDrawPlot::Initialization() { connect(this, SIGNAL(AcquireSignal()), this, SLOT(AcquireThread())); - connect(this, SIGNAL(UpdatePlotSignal()), this, SLOT(UpdatePlot())); } void qDrawPlot::SetupStatistics() { @@ -207,6 +206,7 @@ void qDrawPlot::SetupPlots() { // default display data for (unsigned int px = 0; px < nPixelsX; ++px) { datax1d[px] = px; + datay1d[0][px] = 0; } // add a hist DetachHists(); diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index f3f2db572..002c8c2f1 100755 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -100,7 +100,7 @@ void qTabAdvanced::Initialization() { connect(dispRxrZMQIP, SIGNAL(editingFinished()), this, SLOT(SetRxrZMQIP())); // roi - if (gridRoi->isEnabled()) { + if (tab_roi->isEnabled()) { connect(btnAddRoi, SIGNAL(clicked()), this, SLOT(AddROISlot())); connect(btnSetRoi, SIGNAL(clicked()), this, SLOT(SetROI())); connect(btnGetRoi, SIGNAL(clicked()), this, SLOT(GetROI())); @@ -881,7 +881,7 @@ void qTabAdvanced::Refresh() { SetDetector(comboDetector->currentIndex()); // roi - if (gridRoi->isEnabled()) { + if (tab_roi->isEnabled()) { GetROI(); } diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 5ac62f241..58942a86f 100755 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -308,7 +308,7 @@ void qTabDataOutput::SetRateCorrection() { void qTabDataOutput::GetSpeed() { FILE_LOG(logDEBUG) << "Getting Speed"; - disconnect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed())); + disconnect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed(int))); try { int retval = myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER); @@ -327,7 +327,7 @@ void qTabDataOutput::GetSpeed() { } } CATCH_DISPLAY ("Could not get speed.", "qTabDataOutput::GetSpeed") - connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed())); + connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed(int))); } void qTabDataOutput::SetSpeed(int speed) { diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index 32c4b7146..6aa17bd16 100755 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -23,7 +23,6 @@ qTabDeveloper::qTabDeveloper(QWidget *parent, multiSlsDetector *detector) : QWidget(parent), myDet(detector), detType(slsDetectorDefs::GENERIC), numDACWidgets(0), numADCWidgets(0), boxDacs(nullptr), boxAdcs(nullptr), lblHV(nullptr), comboHV(nullptr), spinHV(nullptr), dacLayout(nullptr), comboDetector(nullptr), layout(nullptr) { SetupWidgetWindow(); - Initialization(); FILE_LOG(logDEBUG) << "Developer ready"; } @@ -146,6 +145,8 @@ void qTabDeveloper::SetupWidgetWindow() { layout->addWidget(boxDacs, 1, 0); CreateADCWidgets(); + Initialization(); + Refresh(); } @@ -156,7 +157,8 @@ void qTabDeveloper::Initialization() { connect(spinDacs[i], SIGNAL(editingFinished(int)), this, SLOT(SetDac(int))); if (comboHV != nullptr) { connect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage())); - } else { + } + if (spinHV != nullptr) { connect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage())); } } @@ -338,9 +340,10 @@ void qTabDeveloper::GetHighVoltage() { return; FILE_LOG(logDEBUG) << "Getting High Voltage"; - if (comboHV == nullptr) { + if (spinHV != nullptr) { disconnect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage())); - } else { + } + if (comboHV != nullptr) { disconnect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage())); } @@ -387,9 +390,10 @@ void qTabDeveloper::GetHighVoltage() { } CATCH_DISPLAY ("Could not get high voltage.", "qTabDeveloper::GetHighVoltage") - if (comboHV == nullptr) { + if (spinHV != nullptr) { connect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage())); - } else { + } + if (comboHV != nullptr) { connect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage())); } } diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 98dbeaac8..d4ed4a39b 100755 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -35,20 +35,21 @@ void qTabMeasurement::SetupWidgetWindow() { // timer to update the progress bar progressTimer = new QTimer(this); - delayImplemented = false; sampleImplemented = false; + delayImplemented = true; + // by default, delay is disabled in form + lblDelay->setEnabled(true); + spinDelay->setEnabled(true); + comboDelayUnit->setEnabled(true); // enabling according to det type switch(myDet->getDetectorTypeAsEnum()) { case slsDetectorDefs::MOENCH: - lblNumSamples->setEnabled(false); - spinNumSamples->setEnabled(false); + lblNumSamples->setEnabled(true); + spinNumSamples->setEnabled(true); sampleImplemented = true; break; case slsDetectorDefs::EIGER: - lblDelay->setEnabled(false); - spinDelay->setEnabled(false); - comboDelayUnit->setEnabled(false); - delayImplemented = true; + delayImplemented = false; break; default: break; @@ -606,7 +607,7 @@ void qTabMeasurement::Refresh() { GetExposureTime(); GetAcquisitionPeriod(); GetNumTriggers(); - if (delayImplemented) {cprintf(BLUE, "Delay implemented\n"); + if (delayImplemented) { GetDelay(); } if (sampleImplemented) { diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index 8664c29ad..7adc4ad87 100755 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -205,19 +205,20 @@ void qTabSettings::SetDynamicRange(int index) { void qTabSettings::GetThresholdEnergy() { FILE_LOG(logDEBUG) << "Getting theshold energy"; - disconnect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetThresholdEnergy())); + disconnect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetThresholdEnergy(int))); try { auto retval = myDet->getThresholdEnergy(); - if (retval == -1) { + /*if (retval == -1) { commenting out as default is -1, handle this when API changes qDefs::Message(qDefs::WARNING, "Threshold Energy is inconsistent for all detectors.", "qTabDataOutput::GetThresholdEnergy"); spinThreshold->setValue(-1); } else { spinThreshold->setValue(retval); - } + }*/ + spinThreshold->setValue(retval); } CATCH_DISPLAY ("Could not get threshold energy.", "qTabDataOutput::GetThresholdEnergy") - connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetThresholdEnergy())); + connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetThresholdEnergy(int))); } void qTabSettings::SetThresholdEnergy(int index) { diff --git a/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp b/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp index 7703e5fea..55765cf97 100755 --- a/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp +++ b/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp @@ -218,7 +218,7 @@ int slsReceiverTCPIPInterface::decode_function(Interface &socket) { } else { FILE_LOG(logDEBUG1) << "calling function fnum: " << fnum << " (" << getFunctionNameFromEnum((enum detFuncs)fnum) - << ") located at " << flist[fnum]; + << ")"; ret = (this->*flist[fnum])(socket); FILE_LOG(logDEBUG1) << "Function " << getFunctionNameFromEnum((enum detFuncs)fnum)