mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 18:17:59 +02:00
WIP
This commit is contained in:
@ -753,12 +753,16 @@ void qDetectorMain::SetZoomToolTip(bool disable) {
|
||||
|
||||
int qDetectorMain::StartStopAcquisitionFromClient(bool start) {
|
||||
FILE_LOG(logINFO) << (start ? "Start" : "Stop")
|
||||
<< " Acquisition From Clien";
|
||||
<< " Acquisition From Client";
|
||||
|
||||
if (tabMeasurement->GetStartStatus() != start) {
|
||||
tabMeasurement->ClickStartStop();
|
||||
while (myPlot->GetClientInitiated())
|
||||
;
|
||||
if (start) {
|
||||
if (tabMeasurement->GetStartStatus() != start) {
|
||||
tabMeasurement->ClentStartAcquisition();
|
||||
while (myPlot->GetClientInitiated())
|
||||
usleep(500);
|
||||
}
|
||||
} else {
|
||||
tabMeasurement->StopAcquisition();
|
||||
}
|
||||
|
||||
return slsDetectorDefs::OK;
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "qTabAdvanced.h"
|
||||
#include "qDrawPlot.h"
|
||||
|
||||
#include "multiSlsDetector.h"
|
||||
#include "qDefs.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@ -366,7 +364,7 @@ void qTabAdvanced::GetRxrZMQIP() {
|
||||
}
|
||||
|
||||
void qTabAdvanced::SetDetector(int index) {
|
||||
FILE_LOG(logDEBUG) << "Set Detector: " << index;
|
||||
FILE_LOG(logDEBUG) << "Set Detector: " << comboDetector->currentText().toAscii().data();
|
||||
|
||||
GetOnline();
|
||||
GetControlPort();
|
||||
@ -776,7 +774,7 @@ void qTabAdvanced::GetSubExposureTime() {
|
||||
|
||||
void qTabAdvanced::SetSubExposureTime() {
|
||||
double timeNS = qDefs::getNSTime((qDefs::timeUnit)comboSubExpTimeUnit->currentIndex(), spinSubExpTime->value());
|
||||
FILE_LOG(logINFO) << "Setting sub frame acquisition time to " << timeNS << " clocks" <<
|
||||
FILE_LOG(logINFO) << "Setting sub frame acquisition time to " << timeNS << " ns" <<
|
||||
"/" << spinSubExpTime->value() << qDefs::getUnitString((qDefs::timeUnit)comboSubExpTimeUnit->currentIndex());
|
||||
try {
|
||||
myDet->setTimer(slsDetectorDefs::SUBFRAME_ACQUISITION_TIME, (int64_t)timeNS, -1);
|
||||
@ -813,7 +811,7 @@ void qTabAdvanced::GetSubDeadTime() {
|
||||
|
||||
void qTabAdvanced::SetSubDeadTime() {
|
||||
double timeNS = qDefs::getNSTime((qDefs::timeUnit)comboSubDeadTimeUnit->currentIndex(), spinSubDeadTime->value());
|
||||
FILE_LOG(logINFO) << "Setting sub frame dead time to " << timeNS << " clocks" <<
|
||||
FILE_LOG(logINFO) << "Setting sub frame dead time to " << timeNS << " ns" <<
|
||||
"/" << spinSubDeadTime->value() << qDefs::getUnitString((qDefs::timeUnit)comboSubDeadTimeUnit->currentIndex());
|
||||
try {
|
||||
myDet->setTimer(slsDetectorDefs::SUBFRAME_DEADTIME, (int64_t)timeNS, -1);
|
||||
@ -825,7 +823,7 @@ void qTabAdvanced::SetSubDeadTime() {
|
||||
|
||||
|
||||
void qTabAdvanced::Refresh(){
|
||||
FILE_LOG(logDEBUG) << endl << "**Updating Advanced Tab";
|
||||
FILE_LOG(logDEBUG) << "**Updating Advanced Tab";
|
||||
|
||||
// trimming
|
||||
if (tab_trimming->isEnabled()) {
|
||||
|
@ -1,9 +1,10 @@
|
||||
#include "qTabDataOutput.h"
|
||||
|
||||
#include "multiSlsDetector.h"
|
||||
#include "qDefs.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QStandardItemModel>
|
||||
#include <QButtonGroup>
|
||||
#include <QString>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
@ -83,6 +84,7 @@ void qTabDataOutput::PopulateDetectors() {
|
||||
}
|
||||
|
||||
void qTabDataOutput::EnableBrowse() {
|
||||
FILE_LOG(logDEBUG) << "Getting browse enable";
|
||||
try {
|
||||
std::string receiverHostname = myDet->getReceiverHostname(comboDetector->currentIndex() - 1);
|
||||
if (receiverHostname == "localhost") {
|
||||
@ -107,6 +109,32 @@ void qTabDataOutput::EnableBrowse() {
|
||||
}
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetFileWriteEnable() {
|
||||
FILE_LOG(logDEBUG) << "Getting file write enable";
|
||||
try {
|
||||
int retval = myDet->getFileWrite();
|
||||
if (retval == -1) {
|
||||
qDefs::Message(qDefs::WARNING, "File write is inconsistent for all detectors.", "qTabDataOutput::GetFileWriteEnable");
|
||||
boxFileWriteEnabled->setEnabled(true);
|
||||
} else {
|
||||
boxFileWriteEnabled->setEnabled(retval == 0 ? false : true);
|
||||
}
|
||||
} catch (const sls::RuntimeError &e) {
|
||||
qDefs::ExceptionMessage("Could not get file enable.", e.what(), "qTabDataOutput::GetFileWriteEnable");
|
||||
boxFileWriteEnabled->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetFileName() {
|
||||
FILE_LOG(logDEBUG) << "Getting file name";
|
||||
try {
|
||||
auto retval = myDet->getFileName();
|
||||
dispFileName->setText(QString(retval.c_str()));
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get file name prefix.", e.what(), "qTabDataOutput::GetFileName");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetOutputDir() {
|
||||
FILE_LOG(logDEBUG) << "Getting file path";
|
||||
@ -182,7 +210,7 @@ void qTabDataOutput::GetFileFormat() {
|
||||
}
|
||||
|
||||
void qTabDataOutput::SetFileFormat(int format) {
|
||||
FILE_LOG(logINFO) << "Setting File Format to " << slsDetectorDefs::getFileFormatType((slsDetectorDefs::fileFormat)format);
|
||||
FILE_LOG(logINFO) << "Setting File Format to " << comboFileFormat->currentText().toAscii().data();
|
||||
try {
|
||||
myDet->setFileFormat((slsDetectorDefs::fileFormat)comboFileFormat->currentIndex());
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
@ -337,7 +365,7 @@ void qTabDataOutput::GetSpeed() {
|
||||
}
|
||||
|
||||
void qTabDataOutput::SetSpeed(int speed) {
|
||||
FILE_LOG(logINFO) << "Setting Speed to " << ((speed = FULLSPEED) ? "full" : ((speed == HALFSPEED) ? "half" : "quarter")) << " speed";
|
||||
FILE_LOG(logINFO) << "Setting Speed to " << comboEigerClkDivider->currentText().toAscii().data();;
|
||||
try {
|
||||
myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER, speed);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
@ -386,33 +414,31 @@ void qTabDataOutput::GetFlags() {
|
||||
void qTabDataOutput::SetFlags() {
|
||||
auto flag1 = slsDetectorDefs::GET_READOUT_FLAGS;
|
||||
auto flag2 = slsDetectorDefs::GET_READOUT_FLAGS;
|
||||
|
||||
|
||||
//set to continous or storeinram
|
||||
switch (comboEigerFlags1->currentIndex()) {
|
||||
case STOREINRAM:
|
||||
FILE_LOG(logINFO) << "Setting Readout Flags to Store in Ram";
|
||||
flag1 = slsDetectorDefs::STORE_IN_RAM;
|
||||
break;
|
||||
default:
|
||||
FILE_LOG(logINFO) << "Setting Readout Flags to Continuous";
|
||||
flag1 = slsDetectorDefs::CONTINOUS_RO;
|
||||
break;
|
||||
}
|
||||
|
||||
//set to parallel, nonparallel or safe
|
||||
//set to parallel or nonparallel
|
||||
switch (comboEigerFlags2->currentIndex()) {
|
||||
case PARALLEL:
|
||||
FILE_LOG(logINFO) << "Setting Readout Flags to Parallel";
|
||||
flag2 = slsDetectorDefs::PARALLEL;
|
||||
break;
|
||||
default:
|
||||
FILE_LOG(logINFO) << "Setting Readout Flags to Non Parallel";
|
||||
flag2 = slsDetectorDefs::NONPARALLEL;
|
||||
break;
|
||||
}
|
||||
|
||||
try {
|
||||
FILE_LOG(logINFO) << "Setting Readout Flags to " << comboEigerFlags1->currentText().toAscii().data();
|
||||
myDet->setReadOutFlags(flag1);
|
||||
FILE_LOG(logINFO) << "Setting Readout Flags to " << comboEigerFlags2->currentText().toAscii().data();
|
||||
myDet->setReadOutFlags(flag2);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set readout flags.", e.what(), "qTabDataOutput::SetFlags");
|
||||
@ -430,7 +456,8 @@ void qTabDataOutput::Refresh() {
|
||||
FILE_LOG(logDEBUG) << "**Updating DataOutput Tab";
|
||||
|
||||
EnableBrowse();
|
||||
dispFileName->setText(QString(myDet->getFileName().c_str()));
|
||||
GetFileWriteEnable();
|
||||
GetFileName();
|
||||
GetOutputDir();
|
||||
GetFileOverwrite();
|
||||
GetFileFormat();
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,5 @@
|
||||
#include "qTabSettings.h"
|
||||
|
||||
#include "multiSlsDetector.h"
|
||||
#include "qDefs.h"
|
||||
|
||||
#include <QStandardItemModel>
|
||||
|
||||
@ -135,6 +134,24 @@ void qTabSettings::GetSettings() {
|
||||
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSettings(int)));
|
||||
}
|
||||
|
||||
void qTabSettings::SetSettings(int index) {
|
||||
// settings
|
||||
auto val = static_cast<slsDetectorDefs::detectorSettings>(index);
|
||||
FILE_LOG(logINFO) << "Setting Settings to " << myDet->slsDetectorDefs::getDetectorSettings(val);
|
||||
|
||||
try {
|
||||
myDet->setSettings(val);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set settings.", e.what(), "qTabSettings::SetSettings");
|
||||
GetSettings();
|
||||
}
|
||||
|
||||
// threshold
|
||||
if (spinThreshold->isEnabled()) {
|
||||
SetThresholdEnergy(spinThreshold->value());
|
||||
}
|
||||
}
|
||||
|
||||
void qTabSettings::GetDynamicRange() {
|
||||
FILE_LOG(logDEBUG) << "Getting dynamic range";
|
||||
disconnect(comboDynamicRange, SIGNAL(activated(int)), this, SLOT(SetDynamicRange(int)));
|
||||
@ -170,6 +187,32 @@ void qTabSettings::GetDynamicRange() {
|
||||
connect(comboDynamicRange, SIGNAL(activated(int)), this,SLOT(SetDynamicRange(int)));
|
||||
}
|
||||
|
||||
void qTabSettings::SetDynamicRange(int index) {
|
||||
FILE_LOG(logINFO) << "Setting dynamic range to " << comboDynamicRange->currentText().toAscii().data()
|
||||
try {
|
||||
switch (index) {
|
||||
case DYNAMICRANGE_32:
|
||||
myDet->setDynamicRange(32);
|
||||
break;
|
||||
case DYNAMICRANGE_16:
|
||||
myDet->setDynamicRange(16);
|
||||
break;
|
||||
case DYNAMICRANGE_8:
|
||||
myDet->setDynamicRange(8);
|
||||
break;
|
||||
case DYNAMICRANGE_4:
|
||||
myDet->setDynamicRange(4);
|
||||
break;
|
||||
default:
|
||||
qDefs::Message(qDefs::WARNING, std::string("Unknown dynamic range: ") + std::to_string(index), "qTabSettings::SetDynamicRange");
|
||||
break;
|
||||
}
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set dynamic range.", e.what(), "qTabSettings::SetDynamicRange");
|
||||
GetDynamicRange();
|
||||
}
|
||||
}
|
||||
|
||||
void qTabSettings::GetThresholdEnergy() {
|
||||
FILE_LOG(logDEBUG) << "Getting theshold energy";
|
||||
disconnect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetThresholdEnergy()));
|
||||
@ -189,53 +232,6 @@ void qTabSettings::GetThresholdEnergy() {
|
||||
connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetThresholdEnergy()));
|
||||
}
|
||||
|
||||
void qTabSettings::SetSettings(int index) {
|
||||
// settings
|
||||
auto val = static_cast<slsDetectorDefs::detectorSettings>(index);
|
||||
FILE_LOG(logINFO) << "Setting Settings to " << myDet->slsDetectorDefs::getDetectorSettings(val);
|
||||
|
||||
try {
|
||||
myDet->setSettings(val);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set settings.", e.what(), "qTabSettings::SetSettings");
|
||||
GetSettings();
|
||||
}
|
||||
|
||||
// threshold
|
||||
if (spinThreshold->isEnabled()) {
|
||||
SetThresholdEnergy(spinThreshold->value());
|
||||
}
|
||||
}
|
||||
|
||||
void qTabSettings::SetDynamicRange(int index) {
|
||||
try {
|
||||
switch (index) {
|
||||
case DYNAMICRANGE_32:
|
||||
FILE_LOG(logINFO) << "Setting dynamic range to 32";
|
||||
myDet->setDynamicRange(32);
|
||||
break;
|
||||
case DYNAMICRANGE_16:
|
||||
FILE_LOG(logINFO) << "Setting dynamic range to 16";
|
||||
myDet->setDynamicRange(16);
|
||||
break;
|
||||
case DYNAMICRANGE_8:
|
||||
FILE_LOG(logINFO) << "Setting dynamic range to 8";
|
||||
myDet->setDynamicRange(8);
|
||||
break;
|
||||
case DYNAMICRANGE_4:
|
||||
FILE_LOG(logINFO) << "Setting dynamic range to 4";
|
||||
myDet->setDynamicRange(4);
|
||||
break;
|
||||
default:
|
||||
qDefs::Message(qDefs::WARNING, std::string("Unknown dynamic range: ") + std::to_string(index), "qTabSettings::SetDynamicRange");
|
||||
break;
|
||||
}
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set dynamic range.", e.what(), "qTabSettings::SetDynamicRange");
|
||||
GetDynamicRange();
|
||||
}
|
||||
}
|
||||
|
||||
void qTabSettings::SetThresholdEnergy(int index) {
|
||||
FILE_LOG(logINFO) << "Setting Threshold Energy to " << index << " eV";
|
||||
try {
|
||||
|
Reference in New Issue
Block a user