gui hv moved to settings tab from developer tab, allowed also for eiger (#482)

This commit is contained in:
Dhanya Thattil 2022-06-08 17:06:08 +02:00 committed by GitHub
parent 364e0c6268
commit 3cee36a3db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 296 additions and 272 deletions

View File

@ -32,17 +32,29 @@
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="1" column="0" colspan="3">
<widget class="QLabel" name="lblReadout"> <widget class="QTabWidget" name="tabWidget">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>5</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="currentIndex">
<string>Readout: </string> <number>1</number>
</property> </property>
<widget class="QWidget" name="tabDAC">
<attribute name="title">
<string>DACs</string>
</attribute>
<layout class="QGridLayout" name="gridlayoutDac"/>
</widget>
<widget class="QWidget" name="tabADC">
<attribute name="title">
<string>ADCs</string>
</attribute>
<layout class="QGridLayout" name="gridlayoutAdc"/>
</widget>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
@ -77,145 +89,19 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="1" column="0"> <item row="0" column="0">
<widget class="QLabel" name="lblComboHV"> <widget class="QLabel" name="lblReadout">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;High Voltage&lt;/p&gt;&lt;p&gt; #highvoltage#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text"> <property name="text">
<string>High Voltage: </string> <string>Readout: </string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1">
<widget class="QComboBox" name="comboHV">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>28</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;High Voltage&lt;/p&gt;&lt;p&gt; #highvoltage#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<item>
<property name="text">
<string>0</string>
</property>
</item>
<item>
<property name="text">
<string>90</string>
</property>
</item>
<item>
<property name="text">
<string>110</string>
</property>
</item>
<item>
<property name="text">
<string>120</string>
</property>
</item>
<item>
<property name="text">
<string>150</string>
</property>
</item>
<item>
<property name="text">
<string>180</string>
</property>
</item>
<item>
<property name="text">
<string>200</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lblSpinHV">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;High Voltage. Range: 60 - 200V. Swich off high voltage by setting to 0.&lt;/p&gt;&lt;p&gt;-1 corresponds to different values from detectors.&lt;/p&gt;&lt;p&gt;#highvoltage#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>High Voltage: </string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="spinHV">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>28</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;High Voltage. Range: 60 - 200V. Swich off high voltage by setting to 0.&lt;/p&gt;&lt;p&gt;-1 corresponds to different values from detectors.&lt;/p&gt;&lt;p&gt;#highvoltage#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="minimum">
<number>-1</number>
</property>
<property name="maximum">
<number>200</number>
</property>
</widget>
</item>
<item row="3" column="0" colspan="3">
<widget class="QTabWidget" name="tabWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>5</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="tabDAC">
<attribute name="title">
<string>DACs</string>
</attribute>
<layout class="QGridLayout" name="gridlayoutDac"/>
</widget>
<widget class="QWidget" name="tabADC">
<attribute name="title">
<string>ADCs</string>
</attribute>
<layout class="QGridLayout" name="gridlayoutAdc"/>
</widget>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<resources> <resources>

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>775</width> <width>775</width>
<height>385</height> <height>400</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -32,7 +32,77 @@
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item row="2" column="0"> <item row="0" column="2" colspan="5">
<widget class="QComboBox" name="comboHV">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>140</width>
<height>28</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;High Voltage&lt;/p&gt;&lt;p&gt; #highvoltage#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<item>
<property name="text">
<string>0</string>
</property>
</item>
<item>
<property name="text">
<string>90</string>
</property>
</item>
<item>
<property name="text">
<string>110</string>
</property>
</item>
<item>
<property name="text">
<string>120</string>
</property>
</item>
<item>
<property name="text">
<string>150</string>
</property>
</item>
<item>
<property name="text">
<string>180</string>
</property>
</item>
<item>
<property name="text">
<string>200</string>
</property>
</item>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lblComboHV">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;High Voltage&lt;/p&gt;&lt;p&gt; #highvoltage#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>High Voltage: </string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="lblThreshold"> <widget class="QLabel" name="lblThreshold">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -54,7 +124,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="4"> <item row="6" column="4">
<widget class="QCheckBox" name="chkCounter3"> <widget class="QCheckBox" name="chkCounter3">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -73,7 +143,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="14"> <item row="4" column="14">
<spacer name="horizontalSpacer_2"> <spacer name="horizontalSpacer_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -89,7 +159,7 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="0" column="0"> <item row="2" column="0">
<widget class="QLabel" name="lblSettings"> <widget class="QLabel" name="lblSettings">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
@ -111,7 +181,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="2"> <item row="6" column="2">
<widget class="QCheckBox" name="chkCounter1"> <widget class="QCheckBox" name="chkCounter1">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -130,7 +200,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2" colspan="9"> <item row="2" column="2" colspan="9">
<widget class="QComboBox" name="comboSettings"> <widget class="QComboBox" name="comboSettings">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
@ -144,7 +214,7 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>140</width> <width>140</width>
<height>25</height> <height>28</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
@ -269,7 +339,7 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="2" column="11"> <item row="4" column="11">
<widget class="QSpinBox" name="spinThreshold2"> <widget class="QSpinBox" name="spinThreshold2">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -306,7 +376,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="13"> <item row="4" column="13">
<widget class="QPushButton" name="btnSetThreshold"> <widget class="QPushButton" name="btnSetThreshold">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
@ -381,7 +451,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="2" column="1">
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -397,7 +467,7 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="2" column="12"> <item row="4" column="12">
<widget class="QSpinBox" name="spinThreshold3"> <widget class="QSpinBox" name="spinThreshold3">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -434,7 +504,23 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="2" colspan="9"> <item row="7" column="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>190</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="2" colspan="9">
<widget class="QSpinBox" name="spinThreshold"> <widget class="QSpinBox" name="spinThreshold">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -471,7 +557,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="6" column="0">
<widget class="QLabel" name="lblCounter"> <widget class="QLabel" name="lblCounter">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -493,7 +579,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="5" column="0">
<widget class="QLabel" name="lblDynamicRange"> <widget class="QLabel" name="lblDynamicRange">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -515,23 +601,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="2"> <item row="3" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>190</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblGainMode"> <widget class="QLabel" name="lblGainMode">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -553,7 +623,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="2" colspan="9"> <item row="5" column="2" colspan="9">
<widget class="QComboBox" name="comboDynamicRange"> <widget class="QComboBox" name="comboDynamicRange">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -561,7 +631,7 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>140</width> <width>140</width>
<height>25</height> <height>28</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
@ -597,7 +667,7 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="4" column="3"> <item row="6" column="3">
<widget class="QCheckBox" name="chkCounter2"> <widget class="QCheckBox" name="chkCounter2">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -616,7 +686,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="2" colspan="9"> <item row="3" column="2" colspan="9">
<widget class="QComboBox" name="comboGainMode"> <widget class="QComboBox" name="comboGainMode">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -630,7 +700,7 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>140</width> <width>140</width>
<height>25</height> <height>28</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
@ -674,6 +744,50 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="1" column="0">
<widget class="QLabel" name="lblSpinHV">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;High Voltage. Range: 60 - 200V. Swich off high voltage by setting to 0.&lt;/p&gt;&lt;p&gt;-1 corresponds to different values from detectors.&lt;/p&gt;&lt;p&gt;#highvoltage#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>High Voltage: </string>
</property>
</widget>
</item>
<item row="1" column="2" colspan="5">
<widget class="QSpinBox" name="spinHV">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>140</width>
<height>28</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;High Voltage. Range: 60 - 200V. Swich off high voltage by setting to 0.&lt;/p&gt;&lt;p&gt;-1 corresponds to different values from detectors.&lt;/p&gt;&lt;p&gt;#highvoltage#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="minimum">
<number>-1</number>
</property>
<property name="maximum">
<number>200</number>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<tabstops> <tabstops>

View File

@ -20,25 +20,16 @@ class qTabDeveloper : public QWidget, private Ui::TabDeveloperObject {
public slots: public slots:
void Refresh(); void Refresh();
private slots:
void SetHighVoltage();
private: private:
void SetupWidgetWindow(); void SetupWidgetWindow();
void Initialization(); void Initialization();
void PopulateDetectors(); void PopulateDetectors();
void GetHighVoltage();
slsDetectorDefs::dacIndex getSLSIndex(slsDetectorDefs::detectorType detType, slsDetectorDefs::dacIndex getSLSIndex(slsDetectorDefs::detectorType detType,
int index); int index);
Detector *det; Detector *det;
std::vector<qDacWidget *> dacWidgets; std::vector<qDacWidget *> dacWidgets;
std::vector<qDacWidget *> adcWidgets; std::vector<qDacWidget *> adcWidgets;
enum hvVals { HV_0, HV_90, HV_110, HV_120, HV_150, HV_180, HV_200 };
int hvmin;
static const int HV_MIN = 60;
static const int HV_MAX = 200;
}; };
} // namespace sls } // namespace sls

View File

@ -18,6 +18,7 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
void SetExportMode(bool exportMode); void SetExportMode(bool exportMode);
private slots: private slots:
void SetHighVoltage();
void SetSettings(int index); void SetSettings(int index);
void SetGainMode(int index); void SetGainMode(int index);
void SetDynamicRange(int index); void SetDynamicRange(int index);
@ -32,6 +33,7 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
void ShowFixG0(bool expertMode); void ShowFixG0(bool expertMode);
void Initialization(); void Initialization();
void GetHighVoltage();
void GetSettings(); void GetSettings();
void GetGainMode(); void GetGainMode();
void GetDynamicRange(); void GetDynamicRange();
@ -42,6 +44,12 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
Detector *det; Detector *det;
std::vector<QCheckBox *> counters; std::vector<QCheckBox *> counters;
enum hvVals { HV_0, HV_90, HV_110, HV_120, HV_150, HV_180, HV_200 };
int hvmin;
static const int HV_MIN = 60;
static const int HV_MAX = 200;
enum { enum {
STANDARD, STANDARD,
FAST, FAST,

View File

@ -18,12 +18,6 @@ qTabDeveloper::~qTabDeveloper() {}
void qTabDeveloper::SetupWidgetWindow() { void qTabDeveloper::SetupWidgetWindow() {
int tempid = 0; int tempid = 0;
comboHV->hide();
lblComboHV->hide();
lblSpinHV->hide();
spinHV->hide();
hvmin = HV_MIN;
try { try {
slsDetectorDefs::detectorType detType = det->getDetectorType().squash(); slsDetectorDefs::detectorType detType = det->getDetectorType().squash();
switch (detType) { switch (detType) {
@ -84,8 +78,6 @@ void qTabDeveloper::SetupWidgetWindow() {
break; break;
case slsDetectorDefs::GOTTHARD: case slsDetectorDefs::GOTTHARD:
comboHV->show();
lblComboHV->show();
dacWidgets.push_back(new qDacWidget( dacWidgets.push_back(new qDacWidget(
this, det, true, this, det, true,
"v Reference: ", getSLSIndex(detType, tempid++))); "v Reference: ", getSLSIndex(detType, tempid++)));
@ -119,8 +111,6 @@ void qTabDeveloper::SetupWidgetWindow() {
break; break;
case slsDetectorDefs::JUNGFRAU: case slsDetectorDefs::JUNGFRAU:
lblSpinHV->show();
spinHV->show();
dacWidgets.push_back( dacWidgets.push_back(
new qDacWidget(this, det, true, new qDacWidget(this, det, true,
"v vb comp: ", getSLSIndex(detType, tempid++))); "v vb comp: ", getSLSIndex(detType, tempid++)));
@ -150,8 +140,6 @@ void qTabDeveloper::SetupWidgetWindow() {
break; break;
case slsDetectorDefs::MOENCH: case slsDetectorDefs::MOENCH:
lblSpinHV->show();
spinHV->show();
dacWidgets.push_back( dacWidgets.push_back(
new qDacWidget(this, det, true, new qDacWidget(this, det, true,
"vbp_colbuf: ", getSLSIndex(detType, tempid++))); "vbp_colbuf: ", getSLSIndex(detType, tempid++)));
@ -175,9 +163,6 @@ void qTabDeveloper::SetupWidgetWindow() {
break; break;
case slsDetectorDefs::MYTHEN3: case slsDetectorDefs::MYTHEN3:
lblSpinHV->show();
spinHV->show();
hvmin = 0;
dacWidgets.push_back(new qDacWidget( dacWidgets.push_back(new qDacWidget(
this, det, true, "vcassh: ", getSLSIndex(detType, tempid++))); this, det, true, "vcassh: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget( dacWidgets.push_back(new qDacWidget(
@ -218,9 +203,6 @@ void qTabDeveloper::SetupWidgetWindow() {
break; break;
case slsDetectorDefs::GOTTHARD2: case slsDetectorDefs::GOTTHARD2:
lblSpinHV->show();
spinHV->show();
hvmin = 0;
dacWidgets.push_back( dacWidgets.push_back(
new qDacWidget(this, det, true, new qDacWidget(this, det, true,
"vref_h_adc: ", getSLSIndex(detType, tempid++))); "vref_h_adc: ", getSLSIndex(detType, tempid++)));
@ -292,9 +274,6 @@ void qTabDeveloper::SetupWidgetWindow() {
void qTabDeveloper::Initialization() { void qTabDeveloper::Initialization() {
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, connect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
SLOT(Refresh())); SLOT(Refresh()));
connect(comboHV, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetHighVoltage()));
connect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage()));
} }
void qTabDeveloper::PopulateDetectors() { void qTabDeveloper::PopulateDetectors() {
@ -311,75 +290,6 @@ void qTabDeveloper::PopulateDetectors() {
comboDetector->setCurrentIndex(0); comboDetector->setCurrentIndex(0);
} }
void qTabDeveloper::GetHighVoltage() {
// not enabled for eiger
if (!comboHV->isVisible() && !spinHV->isVisible())
return;
LOG(logDEBUG) << "Getting High Voltage";
disconnect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage()));
disconnect(comboHV, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetHighVoltage()));
try {
// dac units
auto retval = det->getHighVoltage({comboDetector->currentIndex() - 1})
.tsquash("Inconsistent values for high voltage.");
// spinHV
if (spinHV->isVisible()) {
if (retval != 0 && retval < hvmin && retval > HV_MAX) {
throw RuntimeError(std::string("Unknown High Voltage: ") +
std::to_string(retval));
}
spinHV->setValue(retval);
}
// combo HV
else {
switch (retval) {
case 0:
comboHV->setCurrentIndex(HV_0);
break;
case 90:
comboHV->setCurrentIndex(HV_90);
break;
case 110:
comboHV->setCurrentIndex(HV_110);
break;
case 120:
comboHV->setCurrentIndex(HV_120);
break;
case 150:
comboHV->setCurrentIndex(HV_150);
break;
case 180:
comboHV->setCurrentIndex(HV_180);
break;
case 200:
comboHV->setCurrentIndex(HV_200);
break;
default:
throw RuntimeError(std::string("Unknown High Voltage: ") +
std::to_string(retval));
}
}
}
CATCH_DISPLAY("Could not get high voltage.",
"qTabDeveloper::GetHighVoltage")
connect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage()));
connect(comboHV, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetHighVoltage()));
}
void qTabDeveloper::SetHighVoltage() {
int val = (comboHV->isVisible() ? comboHV->currentText().toInt()
: spinHV->value());
LOG(logINFO) << "Setting high voltage:" << val;
try {
det->setHighVoltage({comboDetector->currentIndex() - 1});
}
CATCH_HANDLE("Could not set high voltage.", "qTabDeveloper::SetHighVoltage",
this, &qTabDeveloper::GetHighVoltage)
}
slsDetectorDefs::dacIndex slsDetectorDefs::dacIndex
qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) { qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
switch (detType) { switch (detType) {
@ -606,7 +516,6 @@ void qTabDeveloper::Refresh() {
for (const auto &it : adcWidgets) { for (const auto &it : adcWidgets) {
it->SetDetectorIndex(comboDetector->currentIndex() - 1); it->SetDetectorIndex(comboDetector->currentIndex() - 1);
} }
GetHighVoltage();
LOG(logDEBUG) << "**Updated Developer Tab"; LOG(logDEBUG) << "**Updated Developer Tab";
} }

View File

@ -19,6 +19,12 @@ qTabSettings::~qTabSettings() {}
void qTabSettings::SetupWidgetWindow() { void qTabSettings::SetupWidgetWindow() {
comboHV->hide();
lblComboHV->hide();
lblSpinHV->hide();
spinHV->hide();
hvmin = HV_MIN;
counters = std::vector<QCheckBox *>{chkCounter1, chkCounter2, chkCounter3}; counters = std::vector<QCheckBox *>{chkCounter1, chkCounter2, chkCounter3};
spinThreshold2->hide(); spinThreshold2->hide();
@ -37,6 +43,9 @@ void qTabSettings::SetupWidgetWindow() {
// enabling according to det type // enabling according to det type
slsDetectorDefs::detectorType detType = det->getDetectorType().squash(); slsDetectorDefs::detectorType detType = det->getDetectorType().squash();
if (detType == slsDetectorDefs::MYTHEN3) { if (detType == slsDetectorDefs::MYTHEN3) {
lblSpinHV->show();
spinHV->show();
hvmin = 0;
lblDynamicRange->setEnabled(true); lblDynamicRange->setEnabled(true);
comboDynamicRange->setEnabled(true); comboDynamicRange->setEnabled(true);
@ -77,13 +86,28 @@ void qTabSettings::SetupWidgetWindow() {
} }
} }
} else if (detType == slsDetectorDefs::EIGER) { } else if (detType == slsDetectorDefs::EIGER) {
lblSpinHV->show();
spinHV->show();
hvmin = 0;
lblDynamicRange->setEnabled(true); lblDynamicRange->setEnabled(true);
comboDynamicRange->setEnabled(true); comboDynamicRange->setEnabled(true);
lblThreshold->setEnabled(true); lblThreshold->setEnabled(true);
spinThreshold->setEnabled(true); spinThreshold->setEnabled(true);
} else if (detType == slsDetectorDefs::JUNGFRAU) { } else if (detType == slsDetectorDefs::JUNGFRAU) {
lblSpinHV->show();
spinHV->show();
lblGainMode->setEnabled(true); lblGainMode->setEnabled(true);
comboGainMode->setEnabled(true); comboGainMode->setEnabled(true);
} else if (detType == slsDetectorDefs::GOTTHARD) {
comboHV->show();
lblComboHV->show();
} else if (detType == slsDetectorDefs::MOENCH) {
lblSpinHV->show();
spinHV->show();
} else if (detType == slsDetectorDefs::GOTTHARD2) {
lblSpinHV->show();
spinHV->show();
hvmin = 0;
} }
// default settings for the disabled // default settings for the disabled
@ -165,6 +189,11 @@ void qTabSettings::ShowFixG0(bool expertMode) {
} }
void qTabSettings::Initialization() { void qTabSettings::Initialization() {
// High voltage
connect(comboHV, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetHighVoltage()));
connect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage()));
// Settings // Settings
if (comboSettings->isEnabled()) if (comboSettings->isEnabled())
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, connect(comboSettings, SIGNAL(currentIndexChanged(int)), this,
@ -201,6 +230,91 @@ void qTabSettings::Initialization() {
} }
} }
void qTabSettings::GetHighVoltage() {
// not enabled for eiger
if (!comboHV->isVisible() && !spinHV->isVisible())
return;
LOG(logDEBUG) << "Getting High Voltage";
disconnect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage()));
disconnect(comboHV, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetHighVoltage()));
try {
Result<int> retvals = det->getHighVoltage();
int retval = 0;
if (det->getDetectorType().squash() != slsDetectorDefs::EIGER) {
retval = retvals.tsquash("Inconsistent values for high voltage.");
}
// eiger slaves return -999
else {
auto is_master = det->getMaster();
Result<int> master_retvals;
for (size_t i = 0; i != retvals.size(); ++i) {
if (is_master[i]) {
master_retvals.push_back(retvals[i]);
}
}
retval = master_retvals.tsquash("Inconsistent values for high voltage.");
}
// spinHV
if (spinHV->isVisible()) {
if (retval != 0 && retval < hvmin && retval > HV_MAX) {
throw RuntimeError(std::string("Unknown High Voltage: ") +
std::to_string(retval));
}
spinHV->setValue(retval);
}
// combo HV
else {
switch (retval) {
case 0:
comboHV->setCurrentIndex(HV_0);
break;
case 90:
comboHV->setCurrentIndex(HV_90);
break;
case 110:
comboHV->setCurrentIndex(HV_110);
break;
case 120:
comboHV->setCurrentIndex(HV_120);
break;
case 150:
comboHV->setCurrentIndex(HV_150);
break;
case 180:
comboHV->setCurrentIndex(HV_180);
break;
case 200:
comboHV->setCurrentIndex(HV_200);
break;
default:
throw RuntimeError(std::string("Unknown High Voltage: ") +
std::to_string(retval));
}
}
}
CATCH_DISPLAY("Could not get high voltage.",
"qTabSettings::GetHighVoltage")
connect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage()));
connect(comboHV, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetHighVoltage()));
}
void qTabSettings::SetHighVoltage() {
int val = (comboHV->isVisible() ? comboHV->currentText().toInt()
: spinHV->value());
LOG(logINFO) << "Setting high voltage:" << val;
try {
det->setHighVoltage(val);
}
CATCH_HANDLE("Could not set high voltage.", "qTabSettings::SetHighVoltage",
this, &qTabSettings::GetHighVoltage)
}
void qTabSettings::GetSettings() { void qTabSettings::GetSettings() {
LOG(logDEBUG) << "Getting settings"; LOG(logDEBUG) << "Getting settings";
disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this,
@ -472,6 +586,8 @@ void qTabSettings::SetCounterMask() {
void qTabSettings::Refresh() { void qTabSettings::Refresh() {
LOG(logDEBUG) << "**Updating Settings Tab"; LOG(logDEBUG) << "**Updating Settings Tab";
GetHighVoltage();
if (comboSettings->isEnabled()) { if (comboSettings->isEnabled()) {
GetSettings(); GetSettings();
} }