diff --git a/docs/src/pyexamples.rst b/docs/src/pyexamples.rst index 6da3ca391..f432541da 100755 --- a/docs/src/pyexamples.rst +++ b/docs/src/pyexamples.rst @@ -6,6 +6,33 @@ open an issue in our our `github repo `_. +------------------------------------ +Setting exposure time +------------------------------------ + +Setting and reading back exposure time can be done either using a Python datetime.timedelta +or by setting the time in seconds. + +:: + + # Set exposure time to 1.2 seconds + >>> d.exptime = 1.2 + + # Setting exposure time using timedelta + import datetime as dt + >>> d.exptime = dt.timedelta(seconds = 1.2) + + # With timedelta any arbitrary combination of units can be used + >>> t = dt.timedelta(microseconds = 100, seconds = 5.3, minutes = .3) + + # To set exposure time for individual detector one have to resort + # to the C++ style API. + # Sets exposure time to 1.2 seconds for module 0, 6 and 12 + >>> d.setExptime(1.2, [0, 6, 12]) + >>> d.setExptime(dt.timedelta(seconds = 1.2), [0, 6, 12]) + + + ------------------------------------ Converting numbers to hex ------------------------------------ @@ -17,13 +44,13 @@ using the built in hex() function. .. code-block :: python from slsdet import Detector - d = Detector() + >>> d = Detector() >>> d.patwait0 = 0xaa >>> d.patwait0 170 # Convert to string - >>> (d.patwait0) + >>> hex(d.patwait0) '0xaa' For multiple values one can use a list comprehension to loop over the values. diff --git a/python/slsdet/detector.py b/python/slsdet/detector.py index 69ad0311c..e258e6f4c 100755 --- a/python/slsdet/detector.py +++ b/python/slsdet/detector.py @@ -669,17 +669,27 @@ class Detector(CppDetectorApi): Modified only when using an intermediate process after receiver. \n Must be different for every detector (and udp port). \n Multi command will automatically increment for individual modules, use setRxZmqPort. - Exmaples + + Examples -------- + >>> d.rx_zmqport [30001, 30002, 30003, 300004] - >>> d.rx_zmqport = ????? + >>> d.rx_zmqport = 30001 + >>> d.rx_zmqport = [30001, 30005] #Set ports for the two first detectors + """ return element_if_equal(self.getRxZmqPort()) @rx_zmqport.setter def rx_zmqport(self, port): - self.setRxZmqPort(port) + if isinstance(port, int): + self.setRxZmqPort(port, -1) + elif is_iterable(port): + for i, p in enumerate(port): + self.setRxZmqPort(p, i) + else: + raise ValueError("Unknown argument type") @property def zmqport(self): @@ -687,7 +697,13 @@ class Detector(CppDetectorApi): @zmqport.setter def zmqport(self, port): - self.setClientZmqPort(port) + if isinstance(port, int): + self.setClientZmqPort(port, -1) + elif is_iterable(port): + for i, p in enumerate(port): + self.setClientZmqPort(p, i) + else: + raise ValueError("Unknown argument type") @property def rx_zmqip(self): @@ -709,7 +725,7 @@ class Detector(CppDetectorApi): @rx_zmqip.setter def rx_zmqip(self, ip): - self.setRxZmqIP(ip) + self.setRxZmqIP(IpAddr(ip)) @property def zmqip(self): @@ -717,7 +733,7 @@ class Detector(CppDetectorApi): @zmqip.setter def zmqip(self, ip): - self.setClientZmqIp(ip) + self.setClientZmqIp(IpAddr(ip)) @property def udp_dstip(self): @@ -755,6 +771,30 @@ class Detector(CppDetectorApi): def udp_dstmac2(self, mac): self.setDestinationUDPMAC2(MacAddr(mac)) + @property + def udp_srcmac(self): + return element_if_equal(self.getSourceUDPMAC()) + + @udp_srcmac.setter + def udp_srcmac(self, mac): + if isinstance(mac, (list, tuple)): + for i, m in enumerate(mac): + self.setSourceUDPMAC(MacAddr(m), [i]) + else: + self.setSourceUDPMAC(MacAddr(mac)) + + @property + def udp_srcmac2(self): + return element_if_equal(self.getSourceUDPMAC2()) + + @udp_srcmac2.setter + def udp_srcmac2(self, mac): + if isinstance(mac, (list, tuple)): + for i, m in enumerate(mac): + self.setSourceUDPMAC2(MacAddr(m), [i]) + else: + self.setSourceUDPMAC2(MacAddr(mac)) + @property def udp_srcip(self): return element_if_equal(self.getSourceUDPIP()) @@ -769,7 +809,7 @@ class Detector(CppDetectorApi): @udp_srcip2.setter def udp_srcip2(self, ip): - self.setSourceUDPIP2(ip) + self.setSourceUDPIP2(IpAddr(ip)) @property def udp_dstport(self): diff --git a/slsDetectorGui/forms/form_dac.ui b/slsDetectorGui/forms/form_dac.ui index 25e512d1d..83e0d7c56 100755 --- a/slsDetectorGui/forms/form_dac.ui +++ b/slsDetectorGui/forms/form_dac.ui @@ -52,6 +52,9 @@ 25 + + false + -1.000000000000000 diff --git a/slsDetectorGui/forms/form_tab_advanced.ui b/slsDetectorGui/forms/form_tab_advanced.ui index ea19dab8a..0adf847a9 100755 --- a/slsDetectorGui/forms/form_tab_advanced.ui +++ b/slsDetectorGui/forms/form_tab_advanced.ui @@ -98,6 +98,9 @@ 25 + + false + -1 diff --git a/slsDetectorGui/forms/form_tab_dataoutput.ui b/slsDetectorGui/forms/form_tab_dataoutput.ui index ea7f80c65..d6f8d5225 100755 --- a/slsDetectorGui/forms/form_tab_dataoutput.ui +++ b/slsDetectorGui/forms/form_tab_dataoutput.ui @@ -463,6 +463,9 @@ Compression using Root. Available only for Gotthard in Expert Mode. 25 + + false + ns diff --git a/slsDetectorGui/forms/form_tab_developer.ui b/slsDetectorGui/forms/form_tab_developer.ui index 8cf71fea6..e16e86287 100755 --- a/slsDetectorGui/forms/form_tab_developer.ui +++ b/slsDetectorGui/forms/form_tab_developer.ui @@ -180,6 +180,9 @@ <html><head/><body><p>High Voltage. Range: 60 - 200V. Swich off high voltage by setting to 0.</p><p>-1 corresponds to different values from detectors.</p><p>#highvoltage#</p></body></html> + + false + -1 diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index 22be36a18..9d3ee2616 100755 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -2169,7 +2169,7 @@ Displays minimum, maximum and sum of values for each plot. - 0 + 1 @@ -2181,6 +2181,9 @@ Displays minimum, maximum and sum of values for each plot. 0 + + false + 3 @@ -2249,6 +2252,9 @@ Displays minimum, maximum and sum of values for each plot. 0 + + false + 1 diff --git a/slsDetectorGui/include/qTabAdvanced.h b/slsDetectorGui/include/qTabAdvanced.h index 7165eeb2f..ba4ff2a0e 100644 --- a/slsDetectorGui/include/qTabAdvanced.h +++ b/slsDetectorGui/include/qTabAdvanced.h @@ -18,17 +18,24 @@ class qTabAdvanced : public QWidget, private Ui::TabAdvancedObject { void SetDetector(); void SetControlPort(int port); void SetStopPort(int port); - void SetDetectorUDPIP(); - void SetDetectorUDPMAC(); + void SetDetectorUDPIP(bool force = false); + void ForceSetDetectorUDPIP(); + void SetDetectorUDPMAC(bool force = false); + void ForceSetDetectorUDPMAC(); void SetCltZMQPort(int port); - void SetCltZMQIP(); - void SetRxrHostname(); + void SetCltZMQIP(bool force = false); + void ForceSetCltZMQIP(); + void SetRxrHostname(bool force = false); + void ForceSetRxrHostname(); void SetRxrTCPPort(int port); void SetRxrUDPPort(int port); - void SetRxrUDPIP(); - void SetRxrUDPMAC(); + void SetRxrUDPIP(bool force = false); + void ForceSetRxrUDPIP(); + void SetRxrUDPMAC(bool force = false); + void ForceSetRxrUDPMAC(); void SetRxrZMQPort(int port); - void SetRxrZMQIP(); + void SetRxrZMQIP(bool force = false); + void ForceSetRxrZMQIP(); void GetROI(); void ClearROI(); void SetROI(); diff --git a/slsDetectorGui/include/qTabDataOutput.h b/slsDetectorGui/include/qTabDataOutput.h index 0df374e57..e1cdf5fcb 100644 --- a/slsDetectorGui/include/qTabDataOutput.h +++ b/slsDetectorGui/include/qTabDataOutput.h @@ -13,7 +13,8 @@ class qTabDataOutput : public QWidget, private Ui::TabDataOutputObject { private slots: void GetOutputDir(); void BrowseOutputDir(); - void SetOutputDir(); + void SetOutputDir(bool force = false); + void ForceSetOutputDir(); void SetFileFormat(int format); void SetOverwriteEnable(bool enable); void SetTenGigaEnable(bool enable); diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h index b38148188..091936ecc 100644 --- a/slsDetectorGui/include/qTabMeasurement.h +++ b/slsDetectorGui/include/qTabMeasurement.h @@ -31,7 +31,8 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject { void SetDelay(); void SetBurstPeriod(); void SetFileWrite(bool val); - void SetFileName(); + void SetFileName(bool force = false); + void ForceSetFileName(); void SetRunIndex(int val); void SetStartingFrameNumber(int val); void UpdateProgress(); diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h index 879e6f259..5bca30acd 100644 --- a/slsDetectorGui/include/qTabPlot.h +++ b/slsDetectorGui/include/qTabPlot.h @@ -24,6 +24,12 @@ class qTabPlot : public QWidget, private Ui::TabPlotObject { void SetBinary(); void SetGapPixels(bool enable); void SetTitles(); + void isXMinModified(); + void isXMaxModified(); + void isYMinModified(); + void isYMaxModified(); + void isZMinModified(); + void isZMaxModified(); void SetXRange(); void SetYRange(); void CheckAspectRatio(); diff --git a/slsDetectorGui/src/qDacWidget.cpp b/slsDetectorGui/src/qDacWidget.cpp index 045bf5e75..5db875e4f 100644 --- a/slsDetectorGui/src/qDacWidget.cpp +++ b/slsDetectorGui/src/qDacWidget.cpp @@ -26,7 +26,7 @@ void qDacWidget::SetupWidgetWindow(std::string name) { void qDacWidget::Initialization() { if (isDac) { - connect(spinDac, SIGNAL(editingFinished()), this, SLOT(SetDac())); + connect(spinDac, SIGNAL(valueChanged(double)), this, SLOT(SetDac())); } } @@ -38,7 +38,7 @@ void qDacWidget::SetDetectorIndex(int id) { void qDacWidget::GetDac() { LOG(logDEBUG) << "Getting Dac " << index; - disconnect(spinDac, SIGNAL(editingFinished()), this, SLOT(SetDac())); + disconnect(spinDac, SIGNAL(valueChanged(double)), this, SLOT(SetDac())); try { // dac units auto retval = det->getDAC(index, 0, {detectorIndex}).squash(-1); @@ -52,7 +52,7 @@ void qDacWidget::GetDac() { CATCH_DISPLAY(std::string("Could not get dac ") + std::to_string(index), "qDacWidget::GetDac") - connect(spinDac, SIGNAL(editingFinished()), this, SLOT(SetDac())); + connect(spinDac, SIGNAL(valueChanged(double)), this, SLOT(SetDac())); } void qDacWidget::SetDac() { diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index e5ad30cab..85f7c42a3 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -65,8 +65,7 @@ void qTabAdvanced::Initialization() { // trimming if (tab_trimming->isEnabled()) { - // editingFinished to not set trimbits for every character input - connect(spinSetAllTrimbits, SIGNAL(editingFinished()), this, + connect(spinSetAllTrimbits, SIGNAL(valueChanged(int)), this, SLOT(SetAllTrimbits())); } @@ -79,23 +78,36 @@ void qTabAdvanced::Initialization() { SLOT(SetStopPort(int))); connect(dispDetectorUDPIP, SIGNAL(editingFinished()), this, SLOT(SetDetectorUDPIP())); + connect(dispDetectorUDPIP, SIGNAL(returnPressed()), this, + SLOT(ForceSetDetectorUDPIP())); connect(dispDetectorUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetDetectorUDPMAC())); + connect(dispDetectorUDPMAC, SIGNAL(returnPressed()), this, + SLOT(ForceSetDetectorUDPMAC())); connect(spinZMQPort, SIGNAL(valueChanged(int)), this, SLOT(SetCltZMQPort(int))); connect(dispZMQIP, SIGNAL(editingFinished()), this, SLOT(SetCltZMQIP())); + connect(dispZMQIP, SIGNAL(returnPressed()), this, SLOT(ForceSetCltZMQIP())); connect(dispRxrHostname, SIGNAL(editingFinished()), this, SLOT(SetRxrHostname())); + connect(dispRxrHostname, SIGNAL(returnPressed()), this, + SLOT(ForceSetRxrHostname())); connect(spinRxrTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int))); connect(spinRxrUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int))); connect(dispRxrUDPIP, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPIP())); + connect(dispRxrUDPIP, SIGNAL(returnPressed()), this, + SLOT(ForceSetRxrUDPIP())); connect(dispRxrUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPMAC())); + connect(dispRxrUDPMAC, SIGNAL(returnPressed()), this, + SLOT(ForceSetRxrUDPMAC())); connect(spinRxrZMQPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrZMQPort(int))); connect(dispRxrZMQIP, SIGNAL(editingFinished()), this, SLOT(SetRxrZMQIP())); + connect(dispRxrZMQIP, SIGNAL(returnPressed()), this, + SLOT(ForceSetRxrZMQIP())); // roi if (tab_roi->isEnabled()) { @@ -421,28 +433,42 @@ void qTabAdvanced::SetStopPort(int port) { &qTabAdvanced::GetStopPort) } -void qTabAdvanced::SetDetectorUDPIP() { - std::string s = dispDetectorUDPIP->text().toAscii().constData(); - LOG(logINFO) << "Setting Detector UDP IP:" << s; - try { - det->setSourceUDPIP(sls::IpAddr{s}, {comboDetector->currentIndex()}); +void qTabAdvanced::SetDetectorUDPIP(bool force) { + // return forces modification (inconsistency from command line) + if (dispDetectorUDPIP->isModified() || force) { + dispDetectorUDPIP->setModified(false); + std::string s = dispDetectorUDPIP->text().toAscii().constData(); + LOG(logINFO) << "Setting Detector UDP IP:" << s; + try { + det->setSourceUDPIP(sls::IpAddr{s}, + {comboDetector->currentIndex()}); + } + CATCH_HANDLE("Could not set Detector UDP IP.", + "qTabAdvanced::SetDetectorUDPIP", this, + &qTabAdvanced::GetDetectorUDPIP) } - CATCH_HANDLE("Could not set Detector UDP IP.", - "qTabAdvanced::SetDetectorUDPIP", this, - &qTabAdvanced::GetDetectorUDPIP) } -void qTabAdvanced::SetDetectorUDPMAC() { - std::string s = dispDetectorUDPMAC->text().toAscii().constData(); - LOG(logINFO) << "Setting Detector UDP MAC:" << s; - try { - det->setSourceUDPMAC(sls::MacAddr{s}, {comboDetector->currentIndex()}); +void qTabAdvanced::ForceSetDetectorUDPIP() { SetDetectorUDPIP(true); }; + +void qTabAdvanced::SetDetectorUDPMAC(bool force) { + // return forces modification (inconsistency from command line) + if (dispDetectorUDPMAC->isModified() || force) { + dispDetectorUDPMAC->setModified(false); + std::string s = dispDetectorUDPMAC->text().toAscii().constData(); + LOG(logINFO) << "Setting Detector UDP MAC:" << s; + try { + det->setSourceUDPMAC(sls::MacAddr{s}, + {comboDetector->currentIndex()}); + } + CATCH_HANDLE("Could not set Detector UDP MAC.", + "qTabAdvanced::SetDetectorUDPMAC", this, + &qTabAdvanced::GetDetectorUDPMAC) } - CATCH_HANDLE("Could not set Detector UDP MAC.", - "qTabAdvanced::SetDetectorUDPMAC", this, - &qTabAdvanced::GetDetectorUDPMAC) } +void qTabAdvanced::ForceSetDetectorUDPMAC() { SetDetectorUDPMAC(true); } + void qTabAdvanced::SetCltZMQPort(int port) { LOG(logINFO) << "Setting Client ZMQ Port:" << port; try { @@ -453,29 +479,44 @@ void qTabAdvanced::SetCltZMQPort(int port) { &qTabAdvanced::GetCltZMQPort) } -void qTabAdvanced::SetCltZMQIP() { - std::string s = dispZMQIP->text().toAscii().constData(); - LOG(logINFO) << "Setting Client ZMQ IP:" << s; - try { - det->setClientZmqIp(sls::IpAddr{s}, {comboDetector->currentIndex()}); +void qTabAdvanced::SetCltZMQIP(bool force) { + // return forces modification (inconsistency from command line) + if (dispZMQIP->isModified() || force) { + dispZMQIP->setModified(false); + std::string s = dispZMQIP->text().toAscii().constData(); + LOG(logINFO) << "Setting Client ZMQ IP:" << s; + try { + det->setClientZmqIp(sls::IpAddr{s}, + {comboDetector->currentIndex()}); + } + CATCH_HANDLE("Could not set Client ZMQ IP.", + "qTabAdvanced::SetCltZMQIP", this, + &qTabAdvanced::GetCltZMQIP) } - CATCH_HANDLE("Could not set Client ZMQ IP.", "qTabAdvanced::SetCltZMQIP", - this, &qTabAdvanced::GetCltZMQIP) } -void qTabAdvanced::SetRxrHostname() { - std::string s = dispZMQIP->text().toAscii().constData(); - LOG(logINFO) << "Setting Receiver Hostname:" << s; - try { - det->setRxHostname(s, {comboDetector->currentIndex()}); - } - CATCH_HANDLE("Could not set Client ZMQ IP.", "qTabAdvanced::SetRxrHostname", - this, &qTabAdvanced::GetRxrHostname) +void qTabAdvanced::ForceSetCltZMQIP() { SetCltZMQIP(true); } - // update all network widgets (receiver mainly) - SetDetector(); +void qTabAdvanced::SetRxrHostname(bool force) { + // return forces modification (inconsistency from command line) + if (dispRxrHostname->isModified() || force) { + dispRxrHostname->setModified(false); + std::string s = dispRxrHostname->text().toAscii().constData(); + LOG(logINFO) << "Setting Receiver Hostname:" << s; + try { + det->setRxHostname(s, {comboDetector->currentIndex()}); + } + CATCH_HANDLE("Could not set Client ZMQ IP.", + "qTabAdvanced::SetRxrHostname", this, + &qTabAdvanced::GetRxrHostname) + + // update all network widgets (receiver mainly) + SetDetector(); + } } +void qTabAdvanced::ForceSetRxrHostname() { SetRxrHostname(true); } + void qTabAdvanced::SetRxrTCPPort(int port) { LOG(logINFO) << "Setting Receiver TCP Port:" << port; try { @@ -496,29 +537,42 @@ void qTabAdvanced::SetRxrUDPPort(int port) { &qTabAdvanced::GetRxrUDPPort) } -void qTabAdvanced::SetRxrUDPIP() { - std::string s = dispRxrUDPIP->text().toAscii().constData(); - LOG(logINFO) << "Setting Receiver UDP IP:" << s; - try { - det->setDestinationUDPIP(sls::IpAddr{s}, - {comboDetector->currentIndex()}); +void qTabAdvanced::SetRxrUDPIP(bool force) { + // return forces modification (inconsistency from command line) + if (dispRxrUDPIP->isModified() || force) { + dispRxrUDPIP->setModified(false); + std::string s = dispRxrUDPIP->text().toAscii().constData(); + LOG(logINFO) << "Setting Receiver UDP IP:" << s; + try { + det->setDestinationUDPIP(sls::IpAddr{s}, + {comboDetector->currentIndex()}); + } + CATCH_HANDLE("Could not set Receiver UDP IP.", + "qTabAdvanced::SetRxrUDPIP", this, + &qTabAdvanced::GetRxrUDPIP) } - CATCH_HANDLE("Could not set Receiver UDP IP.", "qTabAdvanced::SetRxrUDPIP", - this, &qTabAdvanced::GetRxrUDPIP) } -void qTabAdvanced::SetRxrUDPMAC() { - std::string s = dispRxrUDPMAC->text().toAscii().constData(); - LOG(logINFO) << "Setting Receiver UDP MAC:" << s; - try { - det->setDestinationUDPMAC(sls::MacAddr{s}, - {comboDetector->currentIndex()}); +void qTabAdvanced::ForceSetRxrUDPIP() { SetRxrUDPIP(true); } + +void qTabAdvanced::SetRxrUDPMAC(bool force) { + // return forces modification (inconsistency from command line) + if (dispRxrUDPMAC->isModified() || force) { + dispRxrUDPMAC->setModified(false); + std::string s = dispRxrUDPMAC->text().toAscii().constData(); + LOG(logINFO) << "Setting Receiver UDP MAC:" << s; + try { + det->setDestinationUDPMAC(sls::MacAddr{s}, + {comboDetector->currentIndex()}); + } + CATCH_HANDLE("Could not set Receiver UDP MAC.", + "qTabAdvanced::SetRxrUDPMAC", this, + &qTabAdvanced::GetRxrUDPMAC) } - CATCH_HANDLE("Could not set Receiver UDP MAC.", - "qTabAdvanced::SetRxrUDPMAC", this, - &qTabAdvanced::GetRxrUDPMAC) } +void qTabAdvanced::ForceSetRxrUDPMAC() { SetRxrUDPMAC(true); } + void qTabAdvanced::SetRxrZMQPort(int port) { LOG(logINFO) << "Setting Receiver ZMQ Port:" << port; try { @@ -529,16 +583,23 @@ void qTabAdvanced::SetRxrZMQPort(int port) { &qTabAdvanced::GetRxrZMQPort) } -void qTabAdvanced::SetRxrZMQIP() { - std::string s = dispRxrZMQIP->text().toAscii().constData(); - LOG(logINFO) << "Setting Receiver ZMQ IP:" << s; - try { - det->setRxZmqIP(sls::IpAddr{s}, {comboDetector->currentIndex()}); +void qTabAdvanced::SetRxrZMQIP(bool force) { + // return forces modification (inconsistency from command line) + if (dispRxrZMQIP->isModified() || force) { + dispRxrZMQIP->setModified(false); + std::string s = dispRxrZMQIP->text().toAscii().constData(); + LOG(logINFO) << "Setting Receiver ZMQ IP:" << s; + try { + det->setRxZmqIP(sls::IpAddr{s}, {comboDetector->currentIndex()}); + } + CATCH_HANDLE("Could not set Receiver ZMQ IP.", + "qTabAdvanced::SetRxrZMQIP", this, + &qTabAdvanced::GetRxrZMQIP) } - CATCH_HANDLE("Could not set Receiver ZMQ IP.", "qTabAdvanced::SetRxrZMQIP", - this, &qTabAdvanced::GetRxrZMQIP) } +void qTabAdvanced::ForceSetRxrZMQIP() { SetRxrZMQIP(true); } + void qTabAdvanced::GetROI() { LOG(logDEBUG) << "Getting ROI"; try { @@ -575,7 +636,7 @@ void qTabAdvanced::SetROI() { void qTabAdvanced::GetAllTrimbits() { LOG(logDEBUG) << "Getting all trimbits value"; - disconnect(spinSetAllTrimbits, SIGNAL(editingFinished()), this, + disconnect(spinSetAllTrimbits, SIGNAL(valueChanged(int)), this, SLOT(SetAllTrimbits())); try { @@ -584,7 +645,7 @@ void qTabAdvanced::GetAllTrimbits() { } CATCH_DISPLAY("Could not get all trimbits.", "qTabAdvanced::GetAllTrimbits") - connect(spinSetAllTrimbits, SIGNAL(editingFinished()), this, + connect(spinSetAllTrimbits, SIGNAL(valueChanged(int)), this, SLOT(SetAllTrimbits())); } diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 590477855..9767e519a 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -54,6 +54,8 @@ void qTabDataOutput::Initialization() { SLOT(GetOutputDir())); connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir())); + connect(dispOutputDir, SIGNAL(returnPressed()), this, + SLOT(ForceSetOutputDir())); connect(btnOutputBrowse, SIGNAL(clicked()), this, SLOT(BrowseOutputDir())); connect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFileFormat(int))); @@ -69,7 +71,7 @@ void qTabDataOutput::Initialization() { SLOT(EnableRateCorrection())); connect(btnGroupRate, SIGNAL(buttonClicked(int)), this, SLOT(SetRateCorrection())); - connect(spinCustomDeadTime, SIGNAL(editingFinished()), this, + connect(spinCustomDeadTime, SIGNAL(valueChanged(int)), this, SLOT(SetRateCorrection())); } // flags, speed @@ -169,35 +171,41 @@ void qTabDataOutput::BrowseOutputDir() { dispOutputDir->setText(directory); } -void qTabDataOutput::SetOutputDir() { - QString path = dispOutputDir->text(); - LOG(logDEBUG) << "Setting output directory to " - << path.toAscii().constData(); +void qTabDataOutput::SetOutputDir(bool force) { + // return forces modification (inconsistency from command line) + if (dispOutputDir->isModified() || force) { + dispOutputDir->setModified(false); + QString path = dispOutputDir->text(); + LOG(logDEBUG) << "Setting output directory to " + << path.toAscii().constData(); - // empty - if (path.isEmpty()) { - qDefs::Message(qDefs::WARNING, - "Invalid Output Path. Must not be empty.", - "qTabDataOutput::SetOutputDir"); - LOG(logWARNING) << "Invalid Output Path. Must not be empty."; - GetOutputDir(); - } else { - // chop off trailing '/' - if (path.endsWith('/')) { - while (path.endsWith('/')) { - path.chop(1); + // empty + if (path.isEmpty()) { + qDefs::Message(qDefs::WARNING, + "Invalid Output Path. Must not be empty.", + "qTabDataOutput::SetOutputDir"); + LOG(logWARNING) << "Invalid Output Path. Must not be empty."; + GetOutputDir(); + } else { + // chop off trailing '/' + if (path.endsWith('/')) { + while (path.endsWith('/')) { + path.chop(1); + } } + std::string spath = std::string(path.toAscii().constData()); + try { + det->setFilePath(spath, {comboDetector->currentIndex() - 1}); + } + CATCH_HANDLE("Could not set output file path.", + "qTabDataOutput::SetOutputDir", this, + &qTabDataOutput::GetOutputDir) } - std::string spath = std::string(path.toAscii().constData()); - try { - det->setFilePath(spath, {comboDetector->currentIndex() - 1}); - } - CATCH_HANDLE("Could not set output file path.", - "qTabDataOutput::SetOutputDir", this, - &qTabDataOutput::GetOutputDir) } } +void qTabDataOutput::ForceSetOutputDir() { SetOutputDir(true); }; + void qTabDataOutput::GetFileFormat() { LOG(logDEBUG) << "Getting File Format"; disconnect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this, @@ -288,7 +296,7 @@ void qTabDataOutput::GetRateCorrection() { SLOT(EnableRateCorrection())); disconnect(btnGroupRate, SIGNAL(buttonClicked(int)), this, SLOT(SetRateCorrection())); - disconnect(spinCustomDeadTime, SIGNAL(editingFinished()), this, + disconnect(spinCustomDeadTime, SIGNAL(valueChanged(int)), this, SLOT(SetRateCorrection())); try { spinCustomDeadTime->setValue(-1); @@ -305,7 +313,7 @@ void qTabDataOutput::GetRateCorrection() { connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(EnableRateCorrection())); connect(btnGroupRate, SIGNAL(buttonClicked(int)), this, SLOT(SetRateCorrection())); - connect(spinCustomDeadTime, SIGNAL(editingFinished()), this, + connect(spinCustomDeadTime, SIGNAL(valueChanged(int)), this, SLOT(SetRateCorrection())); } diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index 3e3742f7d..8d0084719 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -290,7 +290,7 @@ void qTabDeveloper::Initialization() { SLOT(Refresh())); connect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage())); - connect(spinHV, SIGNAL(editingFinished()), this, SLOT(SetHighVoltage())); + connect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage())); } void qTabDeveloper::PopulateDetectors() { @@ -312,7 +312,7 @@ void qTabDeveloper::GetHighVoltage() { if (!comboHV->isVisible() && !spinHV->isVisible()) return; LOG(logDEBUG) << "Getting High Voltage"; - disconnect(spinHV, SIGNAL(editingFinished()), this, SLOT(SetHighVoltage())); + disconnect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage())); disconnect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage())); try { @@ -359,7 +359,7 @@ void qTabDeveloper::GetHighVoltage() { } CATCH_DISPLAY("Could not get high voltage.", "qTabDeveloper::GetHighVoltage") - connect(spinHV, SIGNAL(editingFinished()), this, SLOT(SetHighVoltage())); + connect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage())); connect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage())); } diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 4af9b9053..06d283f15 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -129,6 +129,8 @@ void qTabMeasurement::Initialization() { } connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWrite(bool))); connect(dispFileName, SIGNAL(editingFinished()), this, SLOT(SetFileName())); + connect(dispFileName, SIGNAL(returnPressed()), this, + SLOT(ForceSetFileName())); connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(SetRunIndex(int))); if (startingFnumImplemented) { connect(spinStartingFrameNumber, SIGNAL(valueChanged(int)), this, @@ -723,19 +725,26 @@ void qTabMeasurement::GetFileName() { connect(dispFileName, SIGNAL(editingFinished()), this, SLOT(SetFileName())); } -void qTabMeasurement::SetFileName() { - std::string val = std::string(dispFileName->text().toAscii().constData()); - LOG(logINFO) << "Setting File Name Prefix:" << val; - try { - det->setFileNamePrefix(val); - } - CATCH_HANDLE("Could not set file name prefix.", - "qTabMeasurement::SetFileName", this, - &qTabMeasurement::GetFileName) +void qTabMeasurement::SetFileName(bool force) { + // return forces modification (inconsistency from command line) + if (dispFileName->isModified() || force) { + dispFileName->setModified(false); + std::string val = + std::string(dispFileName->text().toAscii().constData()); + LOG(logINFO) << "Setting File Name Prefix:" << val; + try { + det->setFileNamePrefix(val); + } + CATCH_HANDLE("Could not set file name prefix.", + "qTabMeasurement::SetFileName", this, + &qTabMeasurement::GetFileName) - emit FileNameChangedSignal(dispFileName->text()); + emit FileNameChangedSignal(dispFileName->text()); + } } +void qTabMeasurement::ForceSetFileName() { SetFileName(true); } + void qTabMeasurement::GetRunIndex() { LOG(logDEBUG) << "Getting Acquisition File index"; disconnect(spinIndex, SIGNAL(valueChanged(int)), this, diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 31eca3458..5a0a9e9fc 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -87,9 +87,9 @@ void qTabPlot::Initialization() { SLOT(SetStreamingFrequency())); connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency())); - connect(spinTimeGap, SIGNAL(editingFinished()), this, + connect(spinTimeGap, SIGNAL(valueChanged(double)), this, SLOT(SetStreamingFrequency())); - connect(spinNthFrame, SIGNAL(editingFinished()), this, + connect(spinNthFrame, SIGNAL(valueChanged(int)), this, SLOT(SetStreamingFrequency())); // navigation buttons for options @@ -174,17 +174,17 @@ void qTabPlot::Initialization() { connect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(SetXRange())); connect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(SetYRange())); connect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(SetYRange())); - connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXRange())); - connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXRange())); - connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYRange())); - connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange())); + connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(isXMinModified())); + connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(isXMaxModified())); + connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(isYMinModified())); + connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(isYMaxModified())); connect(chkAspectRatio, SIGNAL(toggled(bool)), this, SLOT(CheckAspectRatio())); connect(chkZMin, SIGNAL(toggled(bool)), this, SLOT(SetZRange())); connect(chkZMax, SIGNAL(toggled(bool)), this, SLOT(SetZRange())); - connect(dispZMin, SIGNAL(editingFinished()), this, SLOT(SetZRange())); - connect(dispZMax, SIGNAL(editingFinished()), this, SLOT(SetZRange())); + connect(dispZMin, SIGNAL(editingFinished()), this, SLOT(isZMinModified())); + connect(dispZMax, SIGNAL(editingFinished()), this, SLOT(isZMaxModified())); } void qTabPlot::Select1DPlot(bool enable) { @@ -389,6 +389,48 @@ void qTabPlot::SetTitles() { SLOT(SetTitles())); } +void qTabPlot::isXMinModified() { + if (dispXMin->isModified()) { + dispXMin->setModified(false); + SetXRange(); + } +} + +void qTabPlot::isXMaxModified() { + if (dispXMax->isModified()) { + dispXMax->setModified(false); + SetXRange(); + } +} + +void qTabPlot::isYMinModified() { + if (dispYMin->isModified()) { + dispYMin->setModified(false); + SetYRange(); + } +} + +void qTabPlot::isYMaxModified() { + if (dispYMax->isModified()) { + dispYMax->setModified(false); + SetYRange(); + } +} + +void qTabPlot::isZMinModified() { + if (dispZMin->isModified()) { + dispZMin->setModified(false); + SetZRange(); + } +} + +void qTabPlot::isZMaxModified() { + if (dispZMax->isModified()) { + dispZMax->setModified(false); + SetZRange(); + } +} + void qTabPlot::SetXRange() { LOG(logDEBUG) << "Enable X axis range"; @@ -452,10 +494,14 @@ void qTabPlot::MaintainAspectRatio(int dimension) { disconnect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(SetXRange())); disconnect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(SetYRange())); disconnect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(SetYRange())); - disconnect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXRange())); - disconnect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXRange())); - disconnect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYRange())); - disconnect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange())); + disconnect(dispXMin, SIGNAL(editingFinished()), this, + SLOT(isXMinModified())); + disconnect(dispXMax, SIGNAL(editingFinished()), this, + SLOT(isXMaxModified())); + disconnect(dispYMin, SIGNAL(editingFinished()), this, + SLOT(isYMinModified())); + disconnect(dispYMax, SIGNAL(editingFinished()), this, + SLOT(isYMaxModified())); // check all, fill all chkXMin->setChecked(true); @@ -550,10 +596,10 @@ void qTabPlot::MaintainAspectRatio(int dimension) { connect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(SetXRange())); connect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(SetYRange())); connect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(SetYRange())); - connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXRange())); - connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXRange())); - connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYRange())); - connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange())); + connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(isXMinModified())); + connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(isXMaxModified())); + connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(isYMinModified())); + connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(isYMaxModified())); bool isRange[4]{true, true, true, true}; plot->SetXYRangeChanged(true, ranges, isRange); @@ -583,9 +629,9 @@ void qTabPlot::GetStreamingFrequency() { SLOT(SetStreamingFrequency())); disconnect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency())); - disconnect(spinTimeGap, SIGNAL(editingFinished()), this, + disconnect(spinTimeGap, SIGNAL(valueChanged(double)), this, SLOT(SetStreamingFrequency())); - disconnect(spinNthFrame, SIGNAL(editingFinished()), this, + disconnect(spinNthFrame, SIGNAL(valueChanged(int)), this, SLOT(SetStreamingFrequency())); try { int freq = det->getRxZmqFrequency().tsquash( @@ -621,9 +667,9 @@ void qTabPlot::GetStreamingFrequency() { SLOT(SetStreamingFrequency())); connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency())); - connect(spinTimeGap, SIGNAL(editingFinished()), this, + connect(spinTimeGap, SIGNAL(valueChanged(double)), this, SLOT(SetStreamingFrequency())); - connect(spinNthFrame, SIGNAL(editingFinished()), this, + connect(spinNthFrame, SIGNAL(valueChanged(int)), this, SLOT(SetStreamingFrequency())); } diff --git a/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer b/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer index a2cb8e6e8..a83ae9f9d 100755 Binary files a/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer and b/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer differ diff --git a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c index 2fe739003..90c4971ec 100644 --- a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c @@ -901,12 +901,13 @@ int setPeriod(int64_t val) { LOG(logERROR, ("Invalid period: %lld ns\n", val)); return FAIL; } - val *= (1E-9 * systemFrequency); if (burstMode == BURST_OFF) { LOG(logINFO, ("Setting period %lld ns [Continuous mode]\n", val)); + val *= (1E-9 * systemFrequency); set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG); } else { LOG(logINFO, ("Setting period %lld ns [Burst mode]\n", val)); + val *= (1E-9 * systemFrequency); set64BitReg(val, ASIC_INT_PERIOD_LSB_REG, ASIC_INT_PERIOD_MSB_REG); } // validate for tolerance diff --git a/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h b/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h index 330e53b04..439817a66 100644 --- a/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h +++ b/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h @@ -46,8 +46,8 @@ #define DEFAULT_CURRENT_SOURCE (0) #define DEFAULT_TIMING_SOURCE (TIMING_INTERNAL) -#define DEFAULT_READOUT_C0 (8) //(108333336) // rdo_clk, 108 MHz -#define DEFAULT_READOUT_C1 (8) //(108333336) // rdo_x2_clk, 108 MHz +#define DEFAULT_READOUT_C0 (6) //(144444448) // rdo_clk, 144 MHz +#define DEFAULT_READOUT_C1 (6) //(144444448) // rdo_x2_clk, 144 MHz #define DEFAULT_SYSTEM_C0 (5) //(144444448) // run_clk, 144 MHz #define DEFAULT_SYSTEM_C1 (10) //(72222224) // chip_clk, 72 MHz #define DEFAULT_SYSTEM_C2 (5) //(144444448) // sync_clk, 144 MHz diff --git a/slsSupportLib/include/versionAPI.h b/slsSupportLib/include/versionAPI.h index 4637973d3..f45cf6141 100644 --- a/slsSupportLib/include/versionAPI.h +++ b/slsSupportLib/include/versionAPI.h @@ -5,8 +5,8 @@ #define APIGUI 0x200804 #define APICTB 0x200810 #define APIGOTTHARD 0x200810 -#define APIGOTTHARD2 0x200810 #define APIJUNGFRAU 0x200810 #define APIMOENCH 0x200810 #define APIEIGER 0x200831 #define APIMYTHEN3 0x200901 +#define APIGOTTHARD2 0x200902