From bb760f32106385ae7ea2d8176fe3d62e690cd67b Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Thu, 6 Jun 2019 15:04:05 +0200 Subject: [PATCH] WIP datatoutput --- slsDetectorGui/forms/form_tab_dataoutput.ui | 162 ++----- slsDetectorGui/include/qDefs.h | 4 +- slsDetectorGui/include/qTabDataOutput.h | 19 +- slsDetectorGui/src/qTabDataOutput.cpp | 432 +++++++----------- .../include/multiSlsDetector.h | 1 + slsDetectorSoftware/include/slsDetector.h | 1 + 6 files changed, 221 insertions(+), 398 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_dataoutput.ui b/slsDetectorGui/forms/form_tab_dataoutput.ui index b34600481..f8751b1b4 100755 --- a/slsDetectorGui/forms/form_tab_dataoutput.ui +++ b/slsDetectorGui/forms/form_tab_dataoutput.ui @@ -48,7 +48,7 @@ 14 21 - 475 + 527 76 @@ -56,95 +56,8 @@ 6 - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 10 - 20 - - - - - - - - false - - - Rate: - - - - - - - false - - - - 0 - 0 - - - - - - - - - 2 - 2 - 2 - - - - - - - - - 0 - 0 - 0 - - - - - - - - - 119 - 119 - 119 - - - - - - - - <nobr> -Directory where one saves the data. -</nobr><br> - #outdir# -<br> - - - - Dead Time: - - - - - + + false @@ -163,39 +76,28 @@ Directory where one saves the data. 200000000 + + 0 + - - + + false - - - 0 - 0 - + + Default Dead Time - - - 16777215 - 30 - - - - <nobr> -Directory where one saves the data. -</nobr><br> - #outdir# -<br> - + + + + + + false - Default - - - - :/icons/images/calculate.png:/icons/images/calculate.png + Rate: @@ -216,6 +118,32 @@ Compression using Root. Available only for Gotthard in Expert Mode. + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + false + + + Custom Dead Time: + + + @@ -226,7 +154,7 @@ Compression using Root. Available only for Gotthard in Expert Mode. 3 92 - 491 + 547 72 @@ -235,7 +163,7 @@ Compression using Root. Available only for Gotthard in Expert Mode. 11 4 - 475 + 527 68 diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index 415c5fa56..580d7af53 100755 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -246,7 +246,7 @@ class qDefs : public QWidget { // executing multiSlsDetector funtion and using return value to set QWidget function // (handling -1 for comboboxes) - template + /*template static void IgnoreNonCriticalExceptionsandMinus1(multiSlsDetector* det, const std::string message, const std::string source, W* wid, void (W::*someQfunc)(WRT), @@ -265,7 +265,7 @@ class qDefs : public QWidget { ExceptionMessage(message, e.what(), source); } }; - +*/ // executing multiSlsDetector funtion and returning its value (integers, where value cannot be -1) /* can easily get out of hand diff --git a/slsDetectorGui/include/qTabDataOutput.h b/slsDetectorGui/include/qTabDataOutput.h index 96f618372..315dc390a 100755 --- a/slsDetectorGui/include/qTabDataOutput.h +++ b/slsDetectorGui/include/qTabDataOutput.h @@ -7,7 +7,7 @@ class multiSlsDetector; #include - +#include /** *@short sets up the DataOutput parameters @@ -69,20 +69,20 @@ public: void SetTenGigaEnable(bool enable); /** - * Set rate correction - * @param deadtime dead time + * Enable rate correction */ - void SetRateCorrection(int deadtime = 0); + void EnableRateCorrection(); /** - * Set default rate correction + * Set rate correction */ - void SetDefaultRateCorrection(); + void SetRateCorrection(); /** * Set speed + * @param speed speed chosen */ - void SetSpeed(); + void SetSpeed(int speed); /** * Set flags @@ -144,15 +144,14 @@ public: /** The sls detector object */ multiSlsDetector *myDet; - /** Palette */ - QPalette red; + /** Button group for radiobuttons for rate*/ + QButtonGroup *btnGroupRate; /** enum for the Eiger clock divider */ enum { FULLSPEED, HALFSPEED, QUARTERSPEED, - SUPERSLOWSPEED, NUMBEROFSPEEDS }; diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index cc2b103b0..dee5f58e9 100755 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -20,15 +20,19 @@ qTabDataOutput::~qTabDataOutput() {} void qTabDataOutput::SetupWidgetWindow() { - // palette - red = QPalette(); - red.setColor(QPalette::Active, QPalette::WindowText, Qt::red); + // button group for rate + btnGroupRate = new QButtonGroup(this); + btnGroupRate->addButton(radioDefaultDeadtime, 0); + btnGroupRate->addButton(radioCustomDeadtime, 1); + // enabling according to det type switch((int)myDet->getDetectorTypeAsEnum()) { case slsDetectorDefs::EIGER: chkTenGiga->setEnabled(true); chkRate->setEnabled(true); + radioDefaultDeadtime->setEnabled(true); + radioCustomDeadtime->setEnabled(true); widgetEiger->setVisible(true); widgetEiger->setEnabled(true); break; @@ -39,22 +43,9 @@ void qTabDataOutput::SetupWidgetWindow() { break; } PopulateDetectors(); - EnableBrowse(); + Initialization(); - GetOutputDir(); - GetFileOverwrite(); - GetFileFormat(); - if (chkRate->isEnabled()) { - GetRateCorrection(); - } - if (chkTenGiga->isEnabled()) { - GetTenGigaEnable(); - } - if (widgetEiger->isEnabled()) { - GetSpeed(); - GetFlags(); - } Refresh(); } @@ -68,12 +59,12 @@ void qTabDataOutput::Initialization() { connect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(SetTenGigaEnable(bool))); } if (chkRate->isEnabled()) { - connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); - connect(btnDefaultRate, SIGNAL(clicked()), this, SLOT(SetDefaultRateCorrection())); - connect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); + connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(EnableRateCorrection())); + connect(btnGroupRate, SIGNAL(buttonClicked(int)), this, SLOT(SetRateCorrection())); + connect(spinCustomDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); } if (widgetEiger->isEnabled()) { - connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed())); + connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed(int))); connect(comboEigerFlags1, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags())); connect(comboEigerFlags2, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags())); } @@ -168,13 +159,23 @@ void qTabDataOutput::GetFileFormat() { FILE_LOG(logDEBUG) << "Getting File Format"; disconnect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFileFormat(int))); - qDefs::IgnoreNonCriticalExceptionsandMinus1( - myDet, - "Could not get file format.", - "qTabDataOutput::GetFileFormat", - comboFileFormat, - &QComboBox::setCurrentIndex, - &multiSlsDetector::getFileFormat, -1); + try { + auto retval = myDet->getFileFormat(); + switch(retval) { + case slsDetectorDefs::GET_FILE_FORMAT: + qDefs::Message(qDefs::WARNING, "File Format is inconsistent for all detectors.", "qTabDataOutput::GetFileFormat"); + break; + case slsDetectorDefs::BINARY: + case slsDetectorDefs::HDF5: + comboFileFormat->setCurrentIndex(static_cast(retval)); + break; + default: + qDefs::Message(qDefs::WARNING, std::string("Unknown file format.") + std::to_string(static_cast(retval)), "qTabDataOutput::GetFileFormat"); + break; + } + } catch (const sls::NonCriticalError &e) { + qDefs::ExceptionMessage("Could not get file format.", e.what(), "qTabDataOutput::GetFileFormat"); + } connect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFileFormat(int))); } @@ -247,250 +248,175 @@ void qTabDataOutput::SetTenGigaEnable(bool enable) { } } - - - - - - -void qTabDataOutput::SetRateCorrection(int deadtime) { - disconnect(btnDefaultRate, SIGNAL(clicked()), this, SLOT(SetDefaultRateCorrection())); - disconnect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); - - FILE_LOG(logDEBUG) << "Entering Set Rate Correction function"; - - if (chkRate->isChecked()) { - if (!btnDefaultRate->isEnabled()) { - btnDefaultRate->setEnabled(true); - lblDeadTime->setEnabled(true); - spinDeadTime->setEnabled(true); - } - - if (deadtime != -1) { - deadtime = (double)spinDeadTime->value(); - FILE_LOG(logINFO) << "Setting rate corrections with custom dead time: " << deadtime << '\n'; - } else { - FILE_LOG(logINFO) << "Setting rate corrections with default dead time" << '\n'; - } - myDet->setRateCorrection(deadtime); - - } //unsetting rate correction - else { - btnDefaultRate->setEnabled(false); - lblDeadTime->setEnabled(false); - spinDeadTime->setEnabled(false); - myDet->setRateCorrection(0); - FILE_LOG(logINFO) << "Unsetting rate correction"; - } - qDefs::checkErrorMessage(myDet, "qTabDataOutput::SetRateCorrection"); - - //update just the value - double rate = (double)myDet->getRateCorrection(); - spinDeadTime->setValue((double)rate); - if (rate == -1) { - qDefs::Message(qDefs::WARNING, "Dead time is inconsistent for all detectors. Returned Value: -1.", "qTabDataOutput::GetRateCorrection"); - QString errorTip = QString("Rate Corrections.
" - " #ratecorr# tau in seconds

") + - QString("" - "Dead time is inconsistent for all detectors."); - chkRate->setToolTip(errorTip); - spinDeadTime->setToolTip(errorTip); - chkRate->setPalette(red); - chkRate->setText("Rate:*"); - } else { - QString normalTip = QString("Rate Corrections.
" - " #ratecorr# tau in seconds

"); - chkRate->setToolTip(normalTip); - spinDeadTime->setToolTip(normalTip); - chkRate->setPalette(lblDeadTime->palette()); - chkRate->setText("Rate:"); - } - - connect(btnDefaultRate, SIGNAL(clicked()), this, SLOT(SetDefaultRateCorrection())); - connect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); -} - - -void qTabDataOutput::SetDefaultRateCorrection() { - SetRateCorrection(-1); -} - - void qTabDataOutput::GetRateCorrection() { - disconnect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); - disconnect(btnDefaultRate, SIGNAL(clicked()), this, SLOT(SetDefaultRateCorrection())); - disconnect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); + FILE_LOG(logDEBUG) << "Getting Rate Correction"; + disconnect(chkRate, SIGNAL(toggled(bool)), this, SLOT(EnableRateCorrection())); + disconnect(btnGroupRate, SIGNAL(buttonClicked(int)), this, SLOT(SetRateCorrection())); + disconnect(spinCustomDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); - double rate; - rate = (double)myDet->getRateCorrection(); - qDefs::checkErrorMessage(myDet, "qTabDataOutput::GetRateCorrection"); - FILE_LOG(logDEBUG) << "Getting rate correction from server: " << rate << '\n'; - if (rate == 0) { - chkRate->setChecked(false); - btnDefaultRate->setEnabled(false); - lblDeadTime->setEnabled(false); - spinDeadTime->setEnabled(false); - } + try { + int64_t retval = myDet->getRateCorrection(); + if (retval == -1) { + qDefs::Message(qDefs::WARNING, "Rate correction (enable/tau) is inconsistent for all detectors.", "qTabDataOutput::GetRateCorrection"); + spinCustomDeadTime->setValue(-1); + } else { + chkRate->setChecked(retval == 0 ? false : true); + if (retval != 0) + spinCustomDeadTime->setValue(retval); + } + } catch (const sls::NonCriticalError &e) { + qDefs::ExceptionMessage("Could not get rate correction.", e.what(), "qTabDataOutput::GetRateCorrection"); + } - else { - chkRate->setChecked(true); - btnDefaultRate->setEnabled(true); - lblDeadTime->setEnabled(true); - spinDeadTime->setEnabled(true); - spinDeadTime->setValue((double)rate); - } - - if (rate == -1) { - qDefs::Message(qDefs::WARNING, "Dead time is inconsistent for all detectors. Returned Value: -1.", "qTabDataOutput::GetRateCorrection"); - FILE_LOG(logWARNING) << "Dead time is inconsistent for all detectors."; - QString errorTip = QString("Rate Corrections.
" - " #ratecorr# tau in seconds

") + - QString("" - "Dead time is inconsistent for all detectors."); - chkRate->setToolTip(errorTip); - spinDeadTime->setToolTip(errorTip); - chkRate->setPalette(red); - chkRate->setText("Rate:*"); - } else { - QString normalTip = QString("Rate Corrections.
" - " #ratecorr# tau in seconds

"); - chkRate->setToolTip(normalTip); - spinDeadTime->setToolTip(normalTip); - chkRate->setPalette(chkDiscardBad->palette()); - chkRate->setText("Rate:"); - } - - connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); - connect(btnDefaultRate, SIGNAL(clicked()), this, SLOT(SetDefaultRateCorrection())); - connect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); + connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(EnableRateCorrection())); + connect(btnGroupRate, SIGNAL(buttonClicked(int)), this, SLOT(SetRateCorrection())); + connect(spinCustomDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); } +void qTabDataOutput::EnableRateCorrection() { + // enable + if (chkRate->isChecked()) { + SetRateCorrection(); + return; + } + FILE_LOG(logINFO) << "Disabling Rate correction"; + // disable + try { + myDet->setRateCorrection(0); + } catch (const sls::NonCriticalError &e) { + qDefs::ExceptionMessage("Could not switch off rate correction.", e.what(), "qTabDataOutput::EnableRateCorrection"); + GetRateCorrection(); + } +} +void qTabDataOutput::SetRateCorrection() { + // do nothing if rate correction is disabled + if (!chkRate->isChecked()) { + return; + } + // get default or custom value + int64_t deadtime = -1; + if (radioCustomDeadtime->isChecked()) { + deadtime = spinCustomDeadTime->value(); + } + FILE_LOG(logINFO) << "Setting Rate Correction with dead time: " << deadtime; - - - - - - + try { + myDet->setRateCorrection(deadtime); + } catch (const sls::NonCriticalError &e) { + qDefs::ExceptionMessage("Could not set rate correction.", e.what(), "qTabDataOutput::SetRateCorrection"); + GetRateCorrection(); + } +} void qTabDataOutput::GetSpeed() { - int ret; - if (widgetEiger->isVisible()) { - disconnect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed())); + FILE_LOG(logDEBUG) << "Getting Speed"; + disconnect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed())); + + try { + int retval = myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER); + switch(retval) { + case -1: + qDefs::Message(qDefs::WARNING, "Speed is inconsistent for all detectors.", "qTabDataOutput::GetSpeed"); + break; + case FULLSPEED: + case HALFSPEED: + case QUARTERSPEED: + comboEigerClkDivider->setCurrentIndex(retval); + break; + default: + qDefs::Message(qDefs::WARNING, std::string("Unknown speed.") + std::to_string(retval), "qTabDataOutput::GetFileFormat"); + break; + } + } catch (const sls::NonCriticalError &e) { + qDefs::ExceptionMessage("Could not get speed.", e.what(), "qTabDataOutput::GetSpeed"); + } - //get speed - ret = myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER, -1); - qDefs::checkErrorMessage(myDet, "qTabDataOutput::GetSpeed"); - - //valid speed - if (ret >= 0 && ret < NUMBEROFSPEEDS) - comboEigerClkDivider->setCurrentIndex(ret); - - //invalid speed - else { - qDefs::Message(qDefs::WARNING, "Inconsistent value from clock divider.\n" - "Setting it for all detectors involved to half speed.", - "qTabDataOutput::GetSpeed"); - FILE_LOG(logWARNING) << "Inconsistent value from clock divider."; - //set to default - comboEigerClkDivider->setCurrentIndex(HALFSPEED); - myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER, HALFSPEED); - qDefs::checkErrorMessage(myDet, "qTabDataOutput::GetSpeed"); - } - connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed())); - } + connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed())); } - -void qTabDataOutput::SetSpeed() { - FILE_LOG(logINFO) << "Setting Speed"; - myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER, comboEigerClkDivider->currentIndex()); - qDefs::checkErrorMessage(myDet, "qTabDataOutput::SetSpeed"); - GetSpeed(); +void qTabDataOutput::SetSpeed(int speed) { + FILE_LOG(logINFO) << "Setting Speed to " << ((speed = FULLSPEED) ? "full" : ((speed == HALFSPEED) ? "half" : "quarter")) << " speed"; + try { + myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER, speed); + } catch (const sls::NonCriticalError &e) { + qDefs::ExceptionMessage("Could not set speed.", e.what(), "qTabDataOutput::SetSpeed"); + GetSpeed(); + } } - - void qTabDataOutput::GetFlags() { - int ret; - if (widgetEiger->isVisible()) { - disconnect(comboEigerFlags1, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags())); - disconnect(comboEigerFlags2, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags())); + FILE_LOG(logDEBUG) << "Getting readout flags"; + disconnect(comboEigerFlags1, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags())); + disconnect(comboEigerFlags2, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags())); - //get speed - ret = myDet->setReadOutFlags(slsDetectorDefs::GET_READOUT_FLAGS); - qDefs::checkErrorMessage(myDet, "qTabDataOutput::GetFlags"); - - //invalid flags - if (ret == -1) { - qDefs::Message(qDefs::WARNING, "Inconsistent value for readout flags.\n" - "Setting it for all detectors involved to continous nonparallel mode.", - "qTabDataOutput::GetFlags"); - FILE_LOG(logWARNING) << "Inconsistent value for readout flags."; - //set to default - comboEigerFlags1->setCurrentIndex(CONTINUOUS); - myDet->setReadOutFlags(slsDetectorDefs::CONTINOUS_RO); - qDefs::checkErrorMessage(myDet, "qTabDataOutput::GetFlags"); - comboEigerFlags2->setCurrentIndex(NONPARALLEL); - myDet->setReadOutFlags(slsDetectorDefs::NONPARALLEL); - qDefs::checkErrorMessage(myDet, "qTabDataOutput::GetFlags"); - } - - //valid flags - else { - if (ret & slsDetectorDefs::STORE_IN_RAM) + try { + int retval = myDet->setReadOutFlags(slsDetectorDefs::GET_READOUT_FLAGS); + if (retval == -1) { + qDefs::Message(qDefs::WARNING, "Readout flags are inconsistent for all detectors.", "qTabDataOutput::GetFlags"); + } else { + // store in ram or continuous + if (retval & slsDetectorDefs::STORE_IN_RAM) comboEigerFlags1->setCurrentIndex(STOREINRAM); - else if (ret & slsDetectorDefs::CONTINOUS_RO) + else if (retval & slsDetectorDefs::CONTINOUS_RO) comboEigerFlags1->setCurrentIndex(CONTINUOUS); - if (ret & slsDetectorDefs::PARALLEL) - comboEigerFlags2->setCurrentIndex(PARALLEL); - else if (ret & slsDetectorDefs::NONPARALLEL) - comboEigerFlags2->setCurrentIndex(NONPARALLEL); - else if (ret & slsDetectorDefs::SAFE) - comboEigerFlags2->setCurrentIndex(SAFE); - } + else { + qDefs::Message(qDefs::WARNING, std::string("Unknown flag (Not Store in ram or Continous).") + std::to_string(retval), "qTabDataOutput::GetFlags"); + } - connect(comboEigerFlags1, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags())); - connect(comboEigerFlags2, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags())); - } + // parallel or non parallel + if (retval & slsDetectorDefs::PARALLEL) + comboEigerFlags2->setCurrentIndex(PARALLEL); + else if (retval & slsDetectorDefs::NONPARALLEL) + comboEigerFlags2->setCurrentIndex(NONPARALLEL); + else { + qDefs::Message(qDefs::WARNING, std::string("Unknown flag (Not Parallel or Non Parallel).") + std::to_string(retval), "qTabDataOutput::GetFlags"); + } + } + } catch (const sls::NonCriticalError &e) { + qDefs::ExceptionMessage("Could not get speed.", e.what(), "qTabDataOutput::GetSpeed"); + } + + connect(comboEigerFlags1, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags())); + connect(comboEigerFlags2, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags())); } void qTabDataOutput::SetFlags() { - FILE_LOG(logINFO) << "Setting Readout Flags"; - slsDetectorDefs::readOutFlags val = slsDetectorDefs::GET_READOUT_FLAGS; + auto flag1 = slsDetectorDefs::GET_READOUT_FLAGS; + auto flag2 = slsDetectorDefs::GET_READOUT_FLAGS; //set to continous or storeinram switch (comboEigerFlags1->currentIndex()) { case STOREINRAM: - val = slsDetectorDefs::STORE_IN_RAM; + FILE_LOG(logINFO) << "Setting Readout Flags to Store in Ram"; + flag1 = slsDetectorDefs::STORE_IN_RAM; break; default: - val = slsDetectorDefs::CONTINOUS_RO; + FILE_LOG(logINFO) << "Setting Readout Flags to Continuous"; + flag1 = slsDetectorDefs::CONTINOUS_RO; break; } - myDet->setReadOutFlags(val); - qDefs::checkErrorMessage(myDet, "qTabDataOutput::setFlags"); //set to parallel, nonparallel or safe switch (comboEigerFlags2->currentIndex()) { case PARALLEL: - val = slsDetectorDefs::PARALLEL; - break; - case SAFE: - val = slsDetectorDefs::SAFE; + FILE_LOG(logINFO) << "Setting Readout Flags to Parallel"; + flag2 = slsDetectorDefs::PARALLEL; break; default: - val = slsDetectorDefs::NONPARALLEL; + FILE_LOG(logINFO) << "Setting Readout Flags to Non Parallel"; + flag2 = slsDetectorDefs::NONPARALLEL; break; } - myDet->setReadOutFlags(val); - qDefs::checkErrorMessage(myDet, "qTabDataOutput::setFlags"); - - //update flags - GetFlags(); + try { + myDet->setReadOutFlags(flag1); + myDet->setReadOutFlags(flag2); + } catch (const sls::NonCriticalError &e) { + qDefs::ExceptionMessage("Could not set readout flags.", e.what(), "qTabDataOutput::SetFlags"); + GetFlags(); + } } @@ -503,52 +429,20 @@ void qTabDataOutput::Refresh() { FILE_LOG(logDEBUG) << "**Updating DataOutput Tab"; EnableBrowse(); - if (!myDet->enableWriteToFile()) - boxFileWriteEnabled->setEnabled(false); - else - boxFileWriteEnabled->setEnabled(true); - - // output dir - GetOutputDir(); - - //overwrite - GetFileOverwrite(); - - //file format - GetFileFormat(); - - //file name dispFileName->setText(QString(myDet->getFileName().c_str())); - - // rate correction + GetOutputDir(); + GetFileOverwrite(); + GetFileFormat(); if (chkRate->isEnabled()) { GetRateCorrection(); } - - if (myDet->setReceiverOnline() == slsDetectorDefs::ONLINE_FLAG) { - btnOutputBrowse->setEnabled(false); - btnOutputBrowse->setToolTip("This button is disabled as receiver PC is different from " - "client PC and hence different directory structures.

" + - dispOutputDir->toolTip()); - } else { - btnOutputBrowse->setEnabled(true); - btnOutputBrowse->setToolTip(dispOutputDir->toolTip()); - } - - // 10GbE if (chkTenGiga->isEnabled()) { - GetTenGigaEnable(-1, 1); + GetTenGigaEnable(); } - - //Eiger specific - if (widgetEiger->isVisible()) { - //speed + if (widgetEiger->isEnabled()) { GetSpeed(); - //flags GetFlags(); } FILE_LOG(logDEBUG) << "**Updated DataOutput Tab"; - - qDefs::checkErrorMessage(myDet, "qTabDataOutput::Refresh"); } diff --git a/slsDetectorSoftware/include/multiSlsDetector.h b/slsDetectorSoftware/include/multiSlsDetector.h index 0f660c129..d961de695 100755 --- a/slsDetectorSoftware/include/multiSlsDetector.h +++ b/slsDetectorSoftware/include/multiSlsDetector.h @@ -773,6 +773,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * adcphase for Gotthard, others for CTB & Moench) * @param value (clkdivider 0,1,2 for full, half and quarter speed). Other * values check manual + * @param mode 0 for shift, 1 for degrees. relevant only for speed type adcphase and dbit phase * @param detPos -1 for all detectors in list or specific detector position * @returns value of speed set */ diff --git a/slsDetectorSoftware/include/slsDetector.h b/slsDetectorSoftware/include/slsDetector.h index 197628d41..85c1fb9c1 100755 --- a/slsDetectorSoftware/include/slsDetector.h +++ b/slsDetectorSoftware/include/slsDetector.h @@ -763,6 +763,7 @@ class slsDetector : public virtual slsDetectorDefs{ * @param sp speed type (clkdivider option for Jungfrau and Eiger, * adcphase for Gotthard, others for CTB & Moench) * @param value (clkdivider 0,1,2 for full, half and quarter speed). Other values check manual + * @param mode 0 for shift, 1 for degrees. relevant only for speed type adcphase and dbit phase * @returns value of speed set */ int setSpeed(speedVariable sp, int value = -1, int mode = 0);