diff --git a/slsDetectorGui/forms/form_tab_dataoutput.ui b/slsDetectorGui/forms/form_tab_dataoutput.ui index 17d6f9659..7593e0dc2 100755 --- a/slsDetectorGui/forms/form_tab_dataoutput.ui +++ b/slsDetectorGui/forms/form_tab_dataoutput.ui @@ -145,6 +145,9 @@ Directory where one saves the data. + + false + 0 @@ -216,6 +219,9 @@ Compression using Root. Available only for Gotthard in Expert Mode. + + false + 3 @@ -306,11 +312,6 @@ Compression using Root. Available only for Gotthard in Expert Mode. Quarter Speed - - - Super Slow Speed - - @@ -366,6 +367,9 @@ Compression using Root. Available only for Gotthard in Expert Mode. + + false + 20 @@ -404,8 +408,7 @@ Directory where one saves the data. </nobr><br> #outdir# <br> -Disabled if a receiver is utilized in acquisition. -<br> +Disabled if receiver pc is not same as client pc. diff --git a/slsDetectorGui/include/qDetectorMain.h b/slsDetectorGui/include/qDetectorMain.h index a6e8d198e..7552bb941 100755 --- a/slsDetectorGui/include/qDetectorMain.h +++ b/slsDetectorGui/include/qDetectorMain.h @@ -70,11 +70,6 @@ class qDetectorMain : public QMainWindow, private Ui::DetectorMainObject { */ int GetProgress(); - /** - * Verifies if output directories for all the receivers exist - */ - int DoesOutputDirExist(); - private slots: /** * Enables modes as selected -Debug, Expert, Dockable: calls setdockablemode diff --git a/slsDetectorGui/include/qTabDataOutput.h b/slsDetectorGui/include/qTabDataOutput.h index a0b9964c3..96f618372 100755 --- a/slsDetectorGui/include/qTabDataOutput.h +++ b/slsDetectorGui/include/qTabDataOutput.h @@ -33,15 +33,13 @@ public: */ void Refresh(); - /** - * Verify output directories - * @returns success or fail - */ - int VerifyOutputDirectory(); - - private slots: + /** + * Get output directory + */ + void GetOutputDir(); + /** * Open dialog to choose the output directory */ @@ -53,30 +51,34 @@ public: void SetOutputDir(); /** - * Get output directory + * Set file format + * @param format file format */ - void GetOutputDir(); + void SetFileFormat(int format); + + /** + * Set overwrite enable + * @param enable enable + */ + void SetOverwriteEnable(bool enable); + + /** + * Enable/Disable 10GbE + * @param enable enable + */ + void SetTenGigaEnable(bool enable); /** * Set rate correction + * @param deadtime dead time */ - void SetRateCorrection(int deadtime=0); + void SetRateCorrection(int deadtime = 0); /** * Set default rate correction */ void SetDefaultRateCorrection(); - /** - * Set update rate correction from server - */ - void UpdateRateCorrectionFromServer(); - - /** - * Enable/Disable 10GbE - */ - void EnableTenGigabitEthernet(bool enable, int get=0); - /** * Set speed */ @@ -87,17 +89,6 @@ public: */ void SetFlags(); - /** - * Set file format - */ - void SetFileFormat(int format); - - /** - * Set overwrite enable - */ - void SetOverwriteEnable(bool enable); - - private: /** @@ -115,45 +106,66 @@ public: */ void PopulateDetectors(); - /** - * Update speed + /** + * Enable browse */ - void UpdateSpeedFromServer(); + void EnableBrowse(); /** - * Update flags + * Get file format */ - void UpdateFlagsFromServer(); + void GetFileFormat(); /** - * Update file format + * Get overwrite enable */ - void UpdateFileFormatFromServer(); + void GetFileOverwrite(); /** - * Update overwrite enable + * Get Ten Giga Enable */ - void UpdateFileOverwriteFromServer(); + void GetTenGigaEnable(); + /** + * Set Get rate correction + */ + void GetRateCorrection(); + + /** + * Get speed + */ + void GetSpeed(); + + /** + * Get flags + */ + void GetFlags(); /** The sls detector object */ multiSlsDetector *myDet; - /** detector type */ - slsDetectorDefs::detectorType detType; - - QString outDirTip; - QPalette red; - QPalette black; - QPalette *red1; - QPalette *black1; + /** Palette */ + QPalette red; /** enum for the Eiger clock divider */ - enum {FULLSPEED, HALFSPEED, QUARTERSPEED, SUPERSLOWSPEED, NUMBEROFSPEEDS}; - /** enum for the Eiger readout flags1 */ - enum {CONTINUOUS, STOREINRAM}; - /** enum for the Eiger readout flags2 */ - enum {PARALLEL, NONPARALLEL, SAFE}; + enum { + FULLSPEED, + HALFSPEED, + QUARTERSPEED, + SUPERSLOWSPEED, + NUMBEROFSPEEDS + }; + /** enum for the Eiger readout flags1 */ + enum { + CONTINUOUS, + STOREINRAM + }; + + /** enum for the Eiger readout flags2 */ + enum { + PARALLEL, + NONPARALLEL + }; }; diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 8e92408cd..228d5d0cb 100755 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -145,10 +145,6 @@ bool qDetectorMain::isPlotRunning() { return myPlot->isRunning(); } int qDetectorMain::GetProgress() { return tabMeasurement->GetProgress(); } -int qDetectorMain::DoesOutputDirExist() { - return tabDataOutput->VerifyOutputDirectory(); -} - void qDetectorMain::SetUpWidgetWindow() { // Layout diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index 3f67fedae..12b6dd734 100755 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -16,14 +16,14 @@ QWidget(parent), myDet(detector) { qTabAdvanced::~qTabAdvanced(){} void qTabAdvanced::SetupWidgetWindow(){ - + // palette red = QPalette(); red.setColor(QPalette::Active,QPalette::WindowText,Qt::red); detOnlineTip = dispOnline->toolTip(); rxrOnlineTip = dispRxrOnline->toolTip(); errOnlineTip = QString("

It is offline!"); - + // enabling according to det type switch((int)myDet->getDetectorTypeAsEnum()) { case slsDetectorDefs::EIGER: // trimming @@ -41,7 +41,8 @@ void qTabAdvanced::SetupWidgetWindow(){ // roi tab_roi->setEnabled(true); break; - + default: + break; } // set initially to network tab @@ -108,6 +109,7 @@ void qTabAdvanced::PopulateDetectors() { FILE_LOG(logDEBUG) << "Populating detectors"; disconnect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(SetDetector(int))); + comboDetector->clear(); for(int i = 0; i < myDet->getNumberOfDetectors(); ++i) comboDetector->addItem(QString(myDet->getHostname(i).c_str())); comboDetector->setCurrentIndex(0); diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 6256b0363..788b891cb 100755 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -12,7 +12,6 @@ qTabDataOutput::qTabDataOutput(QWidget *parent, multiSlsDetector *detector) : QWidget(parent), myDet(detector) { setupUi(this); SetupWidgetWindow(); - Refresh(); FILE_LOG(logDEBUG) << "DataOutput ready"; } @@ -21,104 +20,99 @@ qTabDataOutput::~qTabDataOutput() {} void qTabDataOutput::SetupWidgetWindow() { + // palette red = QPalette(); red.setColor(QPalette::Active, QPalette::WindowText, Qt::red); - black = QPalette(); - black.setColor(QPalette::Active, QPalette::WindowText, Qt::black); - red1 = new QPalette(); - red1->setColor(QPalette::Text, Qt::red); - black1 = new QPalette(); - black1->setColor(QPalette::Text, Qt::black); - - outDirTip = lblOutputDir->toolTip(); - - // Detector Type - detType = myDet->getDetectorTypeAsEnum(); - - // disabling depening on detector type - chkRate->setEnabled(false); - widgetEiger->setVisible(false); - if (detType == slsDetectorDefs::EIGER) { - chkRate->setEnabled(true); - widgetEiger->setVisible(true); + // enabling according to det type + switch((int)myDet->getDetectorTypeAsEnum()) { + case slsDetectorDefs::EIGER: + chkTenGiga->setEnabled(true); + chkRate->setEnabled(true); + widgetEiger->setVisible(true); + widgetEiger->setEnabled(true); + break; + case slsDetectorDefs::MOENCH: + chkTenGiga->setEnabled(true); + break; + default: + break; } - chkTenGiga->setEnabled(false); - if (detType == slsDetectorDefs::EIGER || detType == slsDetectorDefs::MOENCH) { - chkTenGiga->setEnabled(true); - } - + PopulateDetectors(); + EnableBrowse(); Initialization(); - // populate detectors, get output dir - PopulateDetectors(); - - VerifyOutputDirectory(); - - // over write - UpdateFileOverwriteFromServer(); - - // file format - UpdateFileFormatFromServer(); - - // rate correction + GetOutputDir(); + GetFileOverwrite(); + GetFileFormat(); if (chkRate->isEnabled()) { - UpdateRateCorrectionFromServer(); + GetRateCorrection(); } - - // 10 gbe if (chkTenGiga->isEnabled()) { - EnableTenGigabitEthernet(-1, 1); + GetTenGigaEnable(); } - - //Eiger specific - if (widgetEiger->isVisible()) { - //speed - UpdateSpeedFromServer(); - //flags - UpdateFlagsFromServer(); + if (widgetEiger->isEnabled()) { + GetSpeed(); + GetFlags(); } - - qDefs::checkErrorMessage(myDet, "qTabDataOutput::SetupWidgetWindow"); + Refresh(); } - void qTabDataOutput::Initialization() { - //output dir connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(GetOutputDir())); connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir())); connect(btnOutputBrowse, SIGNAL(clicked()), this, SLOT(BrowseOutputDir())); - - //overwrite enable - connect(chkOverwriteEnable, SIGNAL(toggled(bool)), this, SLOT(SetOverwriteEnable(bool))); - - //file format connect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFileFormat(int))); - - //rate correction - connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); - connect(btnDefaultRate, SIGNAL(clicked()), this, SLOT(SetDefaultRateCorrection())); - connect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); - - //10GbE - connect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(EnableTenGigabitEthernet(bool))); - - //eiger - if (widgetEiger->isVisible()) { - //speed + connect(chkOverwriteEnable, SIGNAL(toggled(bool)), this, SLOT(SetOverwriteEnable(bool))); + if (chkTenGiga->isEnabled()) { + 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())); + } + if (widgetEiger->isEnabled()) { connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed())); - //flags connect(comboEigerFlags1, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags())); connect(comboEigerFlags2, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags())); } } +void qTabDataOutput::PopulateDetectors() { + FILE_LOG(logDEBUG) << "Populating detectors"; -void qTabDataOutput::BrowseOutputDir() { - QString directory = QFileDialog::getExistingDirectory(this, tr("Choose Output Directory "), dispOutputDir->text()); - if (!directory.isEmpty()) - dispOutputDir->setText(directory); - SetOutputDir(); + comboDetector->clear(); + comboDetector->addItem("All"); + if (myDet->getNumberOfDetectors() > 1) { + for (int i = 0; i < myDet->getNumberOfDetectors(); ++i) + comboDetector->addItem(QString(myDet->getHostname(i).c_str())); + } +} + +void qTabDataOutput::EnableBrowse() { + try { + std::string receiverHostname = myDet->getReceiverHostname(comboDetector->currentIndex() - 1); + if (receiverHostname == "localhost") { + btnOutputBrowse->setEnabled(true); + } else { + std::string hostname; + size_t len = 15; + char host[len]{}; + if (gethostname(host, len) == 0) { + hostname.assign(host); + } + // client pc (hostname) same as reciever hostname + if (hostname == receiverHostname) { + btnOutputBrowse->setEnabled(true); + } else { + btnOutputBrowse->setEnabled(false); + } + } + } catch (const sls::RuntimeError &e) { + qDefs::ExceptionMessage("Could not get receiver hostname.", e.what(), "qTabDataOutput::EnableBrowse"); + btnOutputBrowse->setEnabled(false); + } } @@ -126,166 +120,79 @@ void qTabDataOutput::GetOutputDir() { FILE_LOG(logDEBUG) << "Getting output directory"; disconnect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir())); - //all - if (!comboDetector->currentIndex()) { - dispOutputDir->setText(QString(myDet->getFilePath().c_str())); - qDefs::checkErrorMessage(myDet, "qTabDataOutput::GetOutputDir"); - //multi file path blank means sls file paths are different - if (dispOutputDir->text().isEmpty()) { - qDefs::Message(qDefs::INFORMATION, "The file path for individual readouts are different.\n" - "Hence, leaving the common field blank.", "qTabDataOutput::GetOutputDir"); - FILE_LOG(logWARNING) << "The file path for individual units are different."; - QString errTip = QString("
" - "Output Directory Information only: The file path for individual readouts are different.
" - "Hence, leaving the common field blank.
"); - lblOutputDir->setText("Path*:"); - lblOutputDir->setPalette(red); - lblOutputDir->setToolTip(errTip); - btnOutputBrowse->setToolTip(errTip); - dispOutputDir->setToolTip(errTip); - } else { - lblOutputDir->setText("Path:"); - lblOutputDir->setPalette(*black1); - lblOutputDir->setToolTip(outDirTip); - btnOutputBrowse->setToolTip(outDirTip); - dispOutputDir->setToolTip(outDirTip); - } - } - - //specific - else { - dispOutputDir->setText(QString(myDet->getFilePath(comboDetector->currentIndex() - 1).c_str())); - qDefs::checkErrorMessage(myDet, comboDetector->currentIndex() - 1, "qTabDataOutput::GetOutputDir"); - } + qDefs::IgnoreNonCriticalExceptions( + myDet, + "Could not get output file path." + "qTabDataOutput::GetOutputDir", + dispOutputDir, + &QLineEdit::setText, + &multiSlsDetector::getFilePath, comboDetector->currentIndex() - 1); connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir())); } - -int qTabDataOutput::VerifyOutputDirectory() { - FILE_LOG(logDEBUG) << "Verifying output directory"; - - GetOutputDir(); - - bool error = false; - std::string detName = ""; - std::string mess = ""; - - //common (check only if no +, different values) - std::string fpath = myDet->getFilePath(); - if (fpath.find('+') == std::string::npos) { - myDet->setFilePath(myDet->getFilePath()); - if (!qDefs::checkErrorMessage(myDet, "qTabDataOutput::VerifyOutputDirectory").empty()) - error = true; - } - - //for each detector - for (int i = 0; i < myDet->getNumberOfDetectors(); ++i) { - detName = std::string("\n - ") + std::string(comboDetector->itemText(i+1).toAscii().constData()); - myDet->setFilePath(myDet->getFilePath(i), i); - if(!qDefs::checkErrorMessage(myDet, i, "qTabDataOutput::VerifyOutputDirectory").empty()) { - mess. append(detName); - error = true; - } - } - - //invalid - if (error) { - qDefs::Message(qDefs::WARNING, std::string("Invalid Output Directory ") + mess, "qTabDataOutput::VerifyOutputDirectory"); - FILE_LOG(logWARNING) << "The output path doesnt exist anymore"; - //replace all \n with
- size_t pos = 0; - while ((pos = mess.find("\n", pos)) != std::string::npos) { - mess.replace(pos, 1, "
"); - pos += 1; - } - QString errTip = outDirTip + - QString("
" - "Invalid Output Directory") + - QString(mess.c_str()) + - QString("."); - lblOutputDir->setText("Path*:"); - lblOutputDir->setPalette(red); - lblOutputDir->setToolTip(errTip); - btnOutputBrowse->setToolTip(errTip); - dispOutputDir->setToolTip(errTip); - - return slsDetectorDefs::FAIL; - } - - //valid - else { - FILE_LOG(logDEBUG) << "The output path is valid"; - lblOutputDir->setText("Path:"); - lblOutputDir->setPalette(*black1); - lblOutputDir->setToolTip(outDirTip); - btnOutputBrowse->setToolTip(outDirTip); - dispOutputDir->setToolTip(outDirTip); - } - - return slsDetectorDefs::OK; +void qTabDataOutput::BrowseOutputDir() { + FILE_LOG(logDEBUG) << "Browsing output directory"; + QString directory = QFileDialog::getExistingDirectory(this, tr("Choose Output Directory "), dispOutputDir->text()); + if (!directory.isEmpty()) + dispOutputDir->setText(directory); } - void qTabDataOutput::SetOutputDir() { - FILE_LOG(logDEBUG) << "Setting output directory"; - disconnect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir())); - - bool error = false; QString path = dispOutputDir->text(); - - //empty + // empty if (path.isEmpty()) { qDefs::Message(qDefs::WARNING, "Invalid Output Path. Must not be empty.", "qTabDataOutput::SetOutputDir"); FILE_LOG(logWARNING) << "Invalid Output Path. Must not be empty."; - error = true; - } - //gets rid of the end '/'s - else if (path.endsWith('/')) { - while (path.endsWith('/')) - path.chop(1); - dispOutputDir->setText(path); - } - - //specific - if (comboDetector->currentIndex()) { - myDet->setFilePath(std::string(dispOutputDir->text().toAscii().constData()), comboDetector->currentIndex() - 1); - if (!qDefs::checkErrorMessage(myDet, comboDetector->currentIndex() - 1, "qTabDataOutput::SetOutputDir").empty()) - error = true; - } - - //multi - else { - myDet->setFilePath(std::string(path.toAscii().constData())); - if (!qDefs::checkErrorMessage(myDet, "qTabDataOutput::SetOutputDir").empty()) - error = true; - } - - if (error) { - FILE_LOG(logWARNING) << "The output path could not be set"; - QString errTip = outDirTip + QString("
" - "Invalid File Path"); - - lblOutputDir->setText("Path*:"); - lblOutputDir->setPalette(red); - lblOutputDir->setToolTip(errTip); - btnOutputBrowse->setToolTip(errTip); - dispOutputDir->setToolTip(errTip); + GetOutputDir(); } else { - FILE_LOG(logINFO) << "Output dir set to " << path.toAscii().constData(); - lblOutputDir->setText("Path:"); - lblOutputDir->setPalette(*black1); - lblOutputDir->setToolTip(outDirTip); - btnOutputBrowse->setToolTip(outDirTip); - dispOutputDir->setToolTip(outDirTip); + // chop off trailing '/' + if (path.endsWith('/')) { + while (path.endsWith('/')) { + path.chop(1); + } + } + std::string spath = std::string(path.toAscii().constData()); + try { + myDet->setFilePath(spath, comboDetector->currentIndex() - 1); + } catch (const sls::NonCriticalError &e) { + qDefs::ExceptionMessage("Could not set output file path.", e.what(), "qTabDataOutput::SetOutputDir"); + GetOutputDir(); + } } - - connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir())); } +void qTabDataOutput::GetFileFormat() { + FILE_LOG(logDEBUG) << "Getting File Format"; + disconnect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFileFormat(int))); + + qDefs::IgnoreNonCriticalExceptions( + myDet, + "Could not get file format." + "qTabAdvanced::GetFileFormat", + comboFileFormat, + &QComboBox::setCurrentIndex, + &multiSlsDetector::getFileFormat, -1); + + connect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFileFormat(int))); +} + +void qTabDataOutput::SetFileFormat(int format) { + FILE_LOG(logINFO) << "Setting File Format"; + try { + myDet->setFileFormat((slsDetectorDefs::fileFormat)comboFileFormat->currentIndex()); + } catch (const sls::NonCriticalError &e) { + qDefs::ExceptionMessage("Could not set file format.", e.what(), "qTabDataOutput::SetFileFormat"); + GetFileFormat(); + } +} + + + + void qTabDataOutput::SetRateCorrection(int deadtime) { @@ -323,7 +230,7 @@ void qTabDataOutput::SetRateCorrection(int deadtime) { 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::UpdateRateCorrectionFromServer"); + 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("" @@ -337,7 +244,7 @@ void qTabDataOutput::SetRateCorrection(int deadtime) { " #ratecorr# tau in seconds

"); chkRate->setToolTip(normalTip); spinDeadTime->setToolTip(normalTip); - chkRate->setPalette(chkDiscardBad->palette()); + chkRate->setPalette(lblDeadTime->palette()); chkRate->setText("Rate:"); } @@ -351,14 +258,14 @@ void qTabDataOutput::SetDefaultRateCorrection() { } -void qTabDataOutput::UpdateRateCorrectionFromServer() { +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())); double rate; rate = (double)myDet->getRateCorrection(); - qDefs::checkErrorMessage(myDet, "qTabDataOutput::UpdateRateCorrectionFromServer"); + qDefs::checkErrorMessage(myDet, "qTabDataOutput::GetRateCorrection"); FILE_LOG(logDEBUG) << "Getting rate correction from server: " << rate << '\n'; if (rate == 0) { chkRate->setChecked(false); @@ -376,7 +283,7 @@ void qTabDataOutput::UpdateRateCorrectionFromServer() { } if (rate == -1) { - qDefs::Message(qDefs::WARNING, "Dead time is inconsistent for all detectors. Returned Value: -1.", "qTabDataOutput::UpdateRateCorrectionFromServer"); + 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

") + @@ -401,55 +308,41 @@ void qTabDataOutput::UpdateRateCorrectionFromServer() { } -void qTabDataOutput::PopulateDetectors() { - disconnect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(GetOutputDir())); - - FILE_LOG(logDEBUG) << "Populating detectors"; - comboDetector->clear(); - comboDetector->addItem("All"); - lblOutputDir->setText("Path:"); - //add specific detector options only if more than 1 detector - if (myDet->getNumberOfDetectors() > 1) { - for (int i = 0; i < myDet->getNumberOfDetectors(); i++) - comboDetector->addItem(QString(myDet->getHostname(i).c_str())); - } - GetOutputDir(); - connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(GetOutputDir())); -} -void qTabDataOutput::EnableTenGigabitEthernet(bool enable, int get) { + +void qTabDataOutput::GetTenGigaEnable(bool enable, int get) { if (get || enable == -1) { FILE_LOG(logDEBUG) << "Getting 10Gbe enable"; } else { FILE_LOG(logINFO) << (enable == 0 ? "Disabling" : "Enabling") << "10GbE"; } - disconnect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(EnableTenGigabitEthernet(bool))); + disconnect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(GetTenGigaEnable(bool))); int ret; if (get) - ret = myDet->enableTenGigabitEthernet(-1); + ret = myDet->GetTenGigaEnable(-1); else - ret = myDet->enableTenGigabitEthernet(enable); + ret = myDet->GetTenGigaEnable(enable); if (ret > 0) chkTenGiga->setChecked(true); else chkTenGiga->setChecked(false); - connect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(EnableTenGigabitEthernet(bool))); + connect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(GetTenGigaEnable(bool))); - qDefs::checkErrorMessage(myDet, "qTabDataOutput::EnableTenGigabitEthernet"); + qDefs::checkErrorMessage(myDet, "qTabDataOutput::GetTenGigaEnable"); } -void qTabDataOutput::UpdateSpeedFromServer() { +void qTabDataOutput::GetSpeed() { int ret; if (widgetEiger->isVisible()) { disconnect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed())); //get speed ret = myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER, -1); - qDefs::checkErrorMessage(myDet, "qTabDataOutput::updateSpeedFromServer"); + qDefs::checkErrorMessage(myDet, "qTabDataOutput::GetSpeed"); //valid speed if (ret >= 0 && ret < NUMBEROFSPEEDS) @@ -459,12 +352,12 @@ void qTabDataOutput::UpdateSpeedFromServer() { else { qDefs::Message(qDefs::WARNING, "Inconsistent value from clock divider.\n" "Setting it for all detectors involved to half speed.", - "qTabDataOutput::updateSpeedFromServer"); + "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::updateSpeedFromServer"); + qDefs::checkErrorMessage(myDet, "qTabDataOutput::GetSpeed"); } connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed())); } @@ -475,12 +368,12 @@ void qTabDataOutput::SetSpeed() { FILE_LOG(logINFO) << "Setting Speed"; myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER, comboEigerClkDivider->currentIndex()); qDefs::checkErrorMessage(myDet, "qTabDataOutput::SetSpeed"); - UpdateSpeedFromServer(); + GetSpeed(); } -void qTabDataOutput::UpdateFlagsFromServer() { +void qTabDataOutput::GetFlags() { int ret; if (widgetEiger->isVisible()) { disconnect(comboEigerFlags1, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags())); @@ -488,21 +381,21 @@ void qTabDataOutput::UpdateFlagsFromServer() { //get speed ret = myDet->setReadOutFlags(slsDetectorDefs::GET_READOUT_FLAGS); - qDefs::checkErrorMessage(myDet, "qTabDataOutput::updateFlagsFromServer"); + 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::updateFlagsFromServer"); + "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::updateFlagsFromServer"); + qDefs::checkErrorMessage(myDet, "qTabDataOutput::GetFlags"); comboEigerFlags2->setCurrentIndex(NONPARALLEL); myDet->setReadOutFlags(slsDetectorDefs::NONPARALLEL); - qDefs::checkErrorMessage(myDet, "qTabDataOutput::updateFlagsFromServer"); + qDefs::checkErrorMessage(myDet, "qTabDataOutput::GetFlags"); } //valid flags @@ -557,36 +450,15 @@ void qTabDataOutput::SetFlags() { qDefs::checkErrorMessage(myDet, "qTabDataOutput::setFlags"); //update flags - UpdateFlagsFromServer(); + GetFlags(); } -void qTabDataOutput::UpdateFileFormatFromServer() { - FILE_LOG(logDEBUG) << "Getting File Format"; - disconnect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFileFormat(int))); - - comboFileFormat->setCurrentIndex((int)myDet->getFileFormat()); - - connect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFileFormat(int))); -} -void qTabDataOutput::SetFileFormat(int format) { - FILE_LOG(logINFO) << "Setting File Format"; - disconnect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFileFormat(int))); - int ret = (int)myDet->setFileFormat((slsDetectorDefs::fileFormat)comboFileFormat->currentIndex()); - if (ret != comboFileFormat->currentIndex()) { - qDefs::Message(qDefs::WARNING, "Could not set file format.", "qTabDataOutput::SetFileFormat"); - comboFileFormat->setCurrentIndex((int)ret); - } - - connect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFileFormat(int))); -} - - -void qTabDataOutput::UpdateFileOverwriteFromServer() { +void qTabDataOutput::GetFileOverwrite() { FILE_LOG(logDEBUG) << "Getting File Over Write Enable"; disconnect(chkOverwriteEnable, SIGNAL(toggled(bool)), this, SLOT(SetOverwriteEnable(bool))); @@ -606,33 +478,34 @@ void qTabDataOutput::SetOverwriteEnable(bool enable) { connect(chkOverwriteEnable, SIGNAL(toggled(bool)), this, SLOT(SetOverwriteEnable(bool))); - UpdateFileOverwriteFromServer(); + GetFileOverwrite(); } void qTabDataOutput::Refresh() { FILE_LOG(logDEBUG) << "**Updating DataOutput Tab"; + EnableBrowse(); if (!myDet->enableWriteToFile()) boxFileWriteEnabled->setEnabled(false); else boxFileWriteEnabled->setEnabled(true); // output dir - PopulateDetectors(); + GetOutputDir(); //overwrite - UpdateFileOverwriteFromServer(); + GetFileOverwrite(); //file format - UpdateFileFormatFromServer(); + GetFileFormat(); //file name dispFileName->setText(QString(myDet->getFileName().c_str())); // rate correction if (chkRate->isEnabled()) { - UpdateRateCorrectionFromServer(); + GetRateCorrection(); } if (myDet->setReceiverOnline() == slsDetectorDefs::ONLINE_FLAG) { @@ -647,15 +520,15 @@ void qTabDataOutput::Refresh() { // 10GbE if (chkTenGiga->isEnabled()) { - EnableTenGigabitEthernet(-1, 1); + GetTenGigaEnable(-1, 1); } //Eiger specific if (widgetEiger->isVisible()) { //speed - UpdateSpeedFromServer(); + GetSpeed(); //flags - UpdateFlagsFromServer(); + GetFlags(); } FILE_LOG(logDEBUG) << "**Updated DataOutput Tab"; diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index fab4ab919..9a08a113c 100755 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -400,7 +400,7 @@ void qTabMeasurement::Enable(bool enable) { } int qTabMeasurement::VerifyOutputDirectoryError() { - for (int i = 0; i < myDet->getNumberOfDetectors(); i++) { + for (int i = 0; i < myDet->getNumberOfDetectors(); i++) {xx if (getModuleErrorMask(i) == FILE_PATH_DOES_NOT_EXIST) { return slsDetectorDefs:: FAIL; } diff --git a/slsDetectorServers/eigerDetectorServer/FebControl.c b/slsDetectorServers/eigerDetectorServer/FebControl.c index 8c787db94..3dee3c5ba 100755 --- a/slsDetectorServers/eigerDetectorServer/FebControl.c +++ b/slsDetectorServers/eigerDetectorServer/FebControl.c @@ -1266,9 +1266,6 @@ int Feb_Control_SetReadoutSpeed(unsigned int readout_speed) { //0->full,1->half, } else if (readout_speed==2) { Feb_Control_acquireNReadoutMode |= DAQ_CHIP_CONTROLLER_QUARTER_SPEED; FILE_LOG(logINFO, ("Speed set to quarter speed (25 MHz)\n")); - } else if (readout_speed==3) { - Feb_Control_acquireNReadoutMode |= DAQ_CHIP_CONTROLLER_SUPER_SLOW_SPEED; - FILE_LOG(logINFO, ("Speed set to super slow speed (~0.200 MHz)\n")); } else { if (readout_speed) { FILE_LOG(logERROR, ("readout speed %d unknown, defaulting to full speed.\n",readout_speed)); diff --git a/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_gui b/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_gui new file mode 100755 index 000000000..a3a451907 Binary files /dev/null and b/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_gui differ diff --git a/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c index 305b7b7c8..ba970c03a 100755 --- a/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c @@ -553,11 +553,6 @@ enum readOutFlags setReadOutFlags(enum readOutFlags val) { val=E_NON_PARALLEL; FILE_LOG(logDEBUG1, ("Setting Read out Flag: Non Parallel\n")); break; - case SAFE: - val=E_SAFE; - FILE_LOG(logDEBUG1, ("Setting Read out Flag: Safe\n")); - break; - default: FILE_LOG(logERROR, ("Cannot set unknown readout flag. 0x%x\n", val)); return -1; @@ -623,9 +618,6 @@ enum readOutFlags setReadOutFlags(enum readOutFlags val) { case E_NON_PARALLEL: retval=NONPARALLEL; break; - case E_SAFE: - retval=SAFE; - break; } switch(eiger_overflow32) { diff --git a/slsDetectorServers/slsDetectorServer/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/slsDetectorServer_funcs.c index c71f6bf7e..a2b4770bb 100755 --- a/slsDetectorServers/slsDetectorServer/slsDetectorServer_funcs.c +++ b/slsDetectorServers/slsDetectorServer/slsDetectorServer_funcs.c @@ -1832,7 +1832,6 @@ int set_readout_flags(int file_des) { case CONTINOUS_RO: case PARALLEL: case NONPARALLEL: - case SAFE: case SHOW_OVERFLOW: case NOOVERFLOW: #elif CHIPTESTBOARDD diff --git a/slsDetectorSoftware/src/slsDetectorCommand.cpp b/slsDetectorSoftware/src/slsDetectorCommand.cpp index 493e3e646..23af89b63 100755 --- a/slsDetectorSoftware/src/slsDetectorCommand.cpp +++ b/slsDetectorSoftware/src/slsDetectorCommand.cpp @@ -376,7 +376,7 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) { */ /*! \page config - - flags [flag] sets/gets the readout flags to mode. Options: none, storeinram, tot, continous, parallel, nonparallel, safe, digital, analog_digital, overflow, nooverflow, unknown. Used for EIGER only. \c Returns \c (string). put takes one string and \c returns concatenation of all active flags separated by spaces. + - flags [flag] sets/gets the readout flags to mode. Options: none, storeinram, tot, continous, parallel, nonparallel, digital, analog_digital, overflow, nooverflow, unknown. Used for EIGER only. \c Returns \c (string). put takes one string and \c returns concatenation of all active flags separated by spaces. */ descrToFuncMap[i].m_pFuncName = "flags"; descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdAdvanced; @@ -4777,8 +4777,6 @@ std::string slsDetectorCommand::cmdAdvanced(int narg, const char * const args[], flag = PARALLEL; else if (sval == "nonparallel") flag = NONPARALLEL; - else if (sval == "safe") - flag = SAFE; else if (sval == "digital") flag = DIGITAL_ONLY; else if (sval == "analog_digital") @@ -4809,8 +4807,6 @@ std::string slsDetectorCommand::cmdAdvanced(int narg, const char * const args[], strcat(answer, "parallel "); if (retval & NONPARALLEL) strcat(answer, "nonparallel "); - if (retval & SAFE) - strcat(answer, "safe "); if (retval & DIGITAL_ONLY) strcat(answer, "digital "); if (retval & ANALOG_AND_DIGITAL) @@ -4960,7 +4956,7 @@ std::string slsDetectorCommand::helpAdvanced(int action) { if (action == PUT_ACTION || action == HELP_ACTION) { os << "extsig mode \t sets the mode of the external signal. can be \n \t \t \t off, \n \t \t \t gate_in_active_high, \n \t \t \t gate_in_active_low, \n \t \t \t trigger_in_rising_edge, \n \t \t \t trigger_in_falling_edge, \n \t \t \t ro_trigger_in_rising_edge, \n \t \t \t ro_trigger_in_falling_edge, \n \t \t \t gate_out_active_high, \n \t \t \t gate_out_active_low, \n \t \t \t trigger_out_rising_edge, \n \t \t \t trigger_out_falling_edge, \n \t \t \t ro_trigger_out_rising_edge, \n \t \t \t ro_trigger_out_falling_edge" << std::endl; - os << "flags mode \t sets the readout flags to mode. can be none, storeinram, tot, continous, parallel, nonparallel, safe, digital, analog_digital, overlow, nooverflow, unknown." << std::endl; + os << "flags mode \t sets the readout flags to mode. can be none, storeinram, tot, continous, parallel, nonparallel, digital, analog_digital, overlow, nooverflow, unknown." << std::endl; os << "programfpga f \t programs the fpga with file f (with .pof extension)." << std::endl; os << "resetfpga f \t resets fpga, f can be any value" << std::endl; @@ -4976,7 +4972,7 @@ std::string slsDetectorCommand::helpAdvanced(int action) { os << "extsig \t gets the mode of the external signal. can be \n \t \t \t off, \n \t \t \t gate_in_active_high, \n \t \t \t gate_in_active_low, \n \t \t \t trigger_in_rising_edge, \n \t \t \t trigger_in_falling_edge, \n \t \t \t ro_trigger_in_rising_edge, \n \t \t \t ro_trigger_in_falling_edge, \n \t \t \t gate_out_active_high, \n \t \t \t gate_out_active_low, \n \t \t \t trigger_out_rising_edge, \n \t \t \t trigger_out_falling_edge, \n \t \t \t ro_trigger_out_rising_edge, \n \t \t \t ro_trigger_out_falling_edge" << std::endl; - os << "flags \t gets the readout flags. can be none, storeinram, tot, continous, parallel, nonparallel, safe, digital, analog_digital, overflow, nooverflow, unknown" << std::endl; + os << "flags \t gets the readout flags. can be none, storeinram, tot, continous, parallel, nonparallel, digital, analog_digital, overflow, nooverflow, unknown" << std::endl; os << "led \t returns led status (0 off, 1 on)" << std::endl; os << "powerchip \t gets if the chip has been powered on or off" << std::endl; os << "auto_comp_disable \t Currently not implemented. gets if the automatic comparator diable mode is enabled/disabled" << std::endl; diff --git a/slsSupportLib/include/sls_detector_defs.h b/slsSupportLib/include/sls_detector_defs.h index bf14a3545..06b1c6f12 100755 --- a/slsSupportLib/include/sls_detector_defs.h +++ b/slsSupportLib/include/sls_detector_defs.h @@ -516,7 +516,6 @@ format CONTINOUS_RO = 0x4000, /**< pump-probe mode */ PARALLEL = 0x10000, /**< eiger parallel mode */ NONPARALLEL = 0x20000, /**< eiger serial mode */ - SAFE = 0x40000 /**< eiger safe mode */, DIGITAL_ONLY = 0x80000, /** chiptest board read only digital bits (not adc values)*/ ANALOG_AND_DIGITAL = 0x100000, /** chiptest board read adc values and