diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml
index 107e1c436..9826f4b13 100644
--- a/.github/workflows/cmake.yml
+++ b/.github/workflows/cmake.yml
@@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v3
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
- packages: libhdf5-dev qtbase5-dev qt5-qmake libqt5svg5-dev
+ packages: libhdf5-dev qtbase5-dev qt5-qmake libqt5svg5-dev libpng-dev libtiff-dev
version: 1.0
- name: Configure CMake
diff --git a/RELEASE.txt b/RELEASE.txt
index 497e1d568..dd5d6280c 100644
--- a/RELEASE.txt
+++ b/RELEASE.txt
@@ -28,7 +28,7 @@ This document describes the differences between vx.x.x and vx.0.2
=====================================
-
+
2 On-board Detector Server Compatibility
diff --git a/conda-recipe/copy_lib.sh b/conda-recipe/copy_lib.sh
index da40a721a..5836146f6 100755
--- a/conda-recipe/copy_lib.sh
+++ b/conda-recipe/copy_lib.sh
@@ -11,6 +11,7 @@ cp build/install/lib/* $PREFIX/lib/
#Binaries
cp build/install/bin/sls_detector_acquire $PREFIX/bin/.
+cp build/install/bin/sls_detector_acquire_zmq $PREFIX/bin/.
cp build/install/bin/sls_detector_get $PREFIX/bin/.
cp build/install/bin/sls_detector_put $PREFIX/bin/.
cp build/install/bin/sls_detector_help $PREFIX/bin/.
diff --git a/docs/src/installation.rst b/docs/src/installation.rst
index c63098425..2f1dca474 100644
--- a/docs/src/installation.rst
+++ b/docs/src/installation.rst
@@ -23,11 +23,15 @@ Conda is not only useful to manage python environments but can also
be used as a user space package manager. Dates in the tag (for eg. 2020.07.23.dev0)
are from the developer branch. Please use released tags for stability.
-We have three different packages available:
-
- * **slsdetlib** shared libraries and command line utilities
- * **slsdetgui** GUI
- * **slsdet** Python bindings
+We have four different packages available:
+ ============== =============================================
+ Package Description
+ ============== =============================================
+ slsdetlib shared libraries and command line utilities
+ slsdetgui GUI
+ slsdet Python bindings
+ moenchzmq moench
+ ============== =============================================
.. code-block:: bash
@@ -43,7 +47,7 @@ We have three different packages available:
#ready to use
sls_detector_get exptime
- etc ...
+ ...
.. code-block:: bash
@@ -55,6 +59,8 @@ We have three different packages available:
conda search slsdet
# gui
conda search slsdetgui
+ # moench
+ conda search moenchzmq
diff --git a/pyctbgui/pyctbgui/services/ADC.py b/pyctbgui/pyctbgui/services/ADC.py
index f470fc917..d9fabaccd 100644
--- a/pyctbgui/pyctbgui/services/ADC.py
+++ b/pyctbgui/pyctbgui/services/ADC.py
@@ -14,6 +14,8 @@ from pyctbgui.utils.defines import Defines
import pyctbgui.utils.pixelmap as pm
from pyctbgui.utils.recordOrApplyPedestal import recordOrApplyPedestal
+from slsdet import detectorType
+
if typing.TYPE_CHECKING:
from pyctbgui.services import AcquisitionTab, PlotTab
@@ -30,6 +32,7 @@ class AdcTab(QtWidgets.QWidget):
self.acquisitionTab: AcquisitionTab | None = None
self.legend: LegendItem | None = None
self.logger = logging.getLogger('AdcTab')
+ self.tengiga = True
def setup_ui(self):
self.plotTab = self.mainWindow.plotTab
@@ -42,6 +45,12 @@ class AdcTab(QtWidgets.QWidget):
self.legend.clear()
# subscribe to toggle legend
self.plotTab.subscribeToggleLegend(self.updateLegend)
+
+ if self.det.type == detectorType.XILINX_CHIPTESTBOARD:
+ self.view.checkBoxADC0_15Inv.setDisabled(True)
+ self.view.checkBoxADC16_31Inv.setDisabled(True)
+ self.view.lineEditADCInversion.setDisabled(True)
+ self.view.labelADCInversion.setDisabled(True)
def initializeAllAnalogPlots(self):
self.mainWindow.plotAnalogWaveform = pg.plot()
@@ -67,7 +76,8 @@ class AdcTab(QtWidgets.QWidget):
def connect_ui(self):
for i in range(Defines.adc.count):
- getattr(self.view, f"checkBoxADC{i}Inv").stateChanged.connect(partial(self.setADCInv, i))
+ if self.det.type == detectorType.CHIPTESTBOARD:
+ getattr(self.view, f"checkBoxADC{i}Inv").stateChanged.connect(partial(self.setADCInv, i))
getattr(self.view, f"checkBoxADC{i}En").stateChanged.connect(partial(self.setADCEnable, i))
getattr(self.view, f"checkBoxADC{i}Plot").stateChanged.connect(partial(self.setADCEnablePlot, i))
getattr(self.view, f"pushButtonADC{i}").clicked.connect(partial(self.selectADCColor, i))
@@ -77,15 +87,17 @@ class AdcTab(QtWidgets.QWidget):
self.view.checkBoxADC0_15Plot.stateChanged.connect(partial(self.setADCEnablePlotRange, 0, Defines.adc.half))
self.view.checkBoxADC16_31Plot.stateChanged.connect(
partial(self.setADCEnablePlotRange, Defines.adc.half, Defines.adc.count))
- self.view.checkBoxADC0_15Inv.stateChanged.connect(partial(self.setADCInvRange, 0, Defines.adc.half))
- self.view.checkBoxADC16_31Inv.stateChanged.connect(
- partial(self.setADCInvRange, Defines.adc.half, Defines.adc.count))
- self.view.lineEditADCInversion.editingFinished.connect(self.setADCInvReg)
self.view.lineEditADCEnable.editingFinished.connect(self.setADCEnableReg)
+ if self.det.type == detectorType.CHIPTESTBOARD:
+ self.view.checkBoxADC0_15Inv.stateChanged.connect(partial(self.setADCInvRange, 0, Defines.adc.half))
+ self.view.checkBoxADC16_31Inv.stateChanged.connect(
+ partial(self.setADCInvRange, Defines.adc.half, Defines.adc.count))
+ self.view.lineEditADCInversion.editingFinished.connect(self.setADCInvReg)
def refresh(self):
self.updateADCNames()
- self.updateADCInv()
+ if self.det.type == detectorType.CHIPTESTBOARD:
+ self.updateADCInv()
self.updateADCEnable()
# ADCs Tab functions
@@ -196,9 +208,11 @@ class AdcTab(QtWidgets.QWidget):
return decoder.decode(analog_array, pm.moench04_analog())
def getADCEnableReg(self):
- retval = self.det.adcenable
- if self.det.tengiga:
- retval = self.det.adcenable10g
+ if self.det.type == detectorType.CHIPTESTBOARD:
+ self.tengiga = self.det.tengiga
+ retval = self.det.adcenable10g
+ if not self.tengiga:
+ retval = self.det.adcenable
self.view.lineEditADCEnable.editingFinished.disconnect()
self.view.lineEditADCEnable.setText("0x{:08x}".format(retval))
self.view.lineEditADCEnable.editingFinished.connect(self.setADCEnableReg)
@@ -207,8 +221,8 @@ class AdcTab(QtWidgets.QWidget):
def setADCEnableReg(self):
self.view.lineEditADCEnable.editingFinished.disconnect()
try:
- mask = int(self.mainWindow.lineEditADCEnable.text(), 16)
- if self.det.tengiga:
+ mask = int(self.view.lineEditADCEnable.text(), 16)
+ if self.tengiga:
self.det.adcenable10g = mask
else:
self.det.adcenable = mask
@@ -239,7 +253,7 @@ class AdcTab(QtWidgets.QWidget):
def setADCEnable(self, i):
checkBox = getattr(self.view, f"checkBoxADC{i}En")
try:
- if self.det.tengiga:
+ if self.tengiga:
enableMask = manipulate_bit(checkBox.isChecked(), self.det.adcenable10g, i)
self.det.adcenable10g = enableMask
else:
@@ -265,7 +279,7 @@ class AdcTab(QtWidgets.QWidget):
for i in range(start_nr, end_nr):
mask = manipulate_bit(checkBox.isChecked(), mask, i)
try:
- if self.det.tengiga:
+ if self.tengiga:
self.det.adcenable10g = mask
else:
self.det.adcenable = mask
@@ -344,7 +358,7 @@ class AdcTab(QtWidgets.QWidget):
def setADCInvReg(self):
self.view.lineEditADCInversion.editingFinished.disconnect()
try:
- self.det.adcinvert = int(self.mainWindow.lineEditADCInversion.text(), 16)
+ self.det.adcinvert = int(self.view.lineEditADCInversion.text(), 16)
except Exception as e:
QtWidgets.QMessageBox.warning(self.mainWindow, "ADC Inversion Fail", str(e), QtWidgets.QMessageBox.Ok)
pass
@@ -395,7 +409,12 @@ class AdcTab(QtWidgets.QWidget):
self.updateADCInv()
def saveParameters(self) -> list[str]:
- return [
- f"adcenable {self.view.lineEditADCEnable.text()}",
- f"adcinvert {self.view.lineEditADCInversion.text()}",
- ]
+ if self.det.type == detectorType.CHIPTESTBOARD:
+ return [
+ f"adcenable {self.view.lineEditADCEnable.text()}",
+ f"adcinvert {self.view.lineEditADCInversion.text()}",
+ ]
+ else:
+ return [
+ f"adcenable {self.view.lineEditADCEnable.text()}"
+ ]
diff --git a/pyctbgui/pyctbgui/services/Acquisition.py b/pyctbgui/pyctbgui/services/Acquisition.py
index d87cad767..e931a1835 100644
--- a/pyctbgui/pyctbgui/services/Acquisition.py
+++ b/pyctbgui/pyctbgui/services/Acquisition.py
@@ -7,7 +7,7 @@ import zmq
from PyQt5 import QtWidgets, uic
import logging
-from slsdet import readoutMode, runStatus
+from slsdet import readoutMode, runStatus, detectorType
from pyctbgui.utils.defines import Defines
from pyctbgui.utils.numpyWriter.npy_writer import NumpyFileManager
from pyctbgui.utils.numpyWriter.npz_writer import NpzFileWriter
@@ -49,20 +49,37 @@ class AcquisitionTab(QtWidgets.QWidget):
self.adcTab = self.mainWindow.adcTab
self.plotTab = self.mainWindow.plotTab
self.toggleStartButton(False)
+ if self.det.type == detectorType.XILINX_CHIPTESTBOARD:
+ self.view.labelRunF.setDisabled(True)
+ self.view.labelADCF.setDisabled(True)
+ self.view.labelADCPhase.setDisabled(True)
+ self.view.labelADCPipeline.setDisabled(True)
+ self.view.labelDBITF.setDisabled(True)
+ self.view.labelDBITPhase.setDisabled(True)
+ self.view.labelDBITPipeline.setDisabled(True)
+ self.view.spinBoxRunF.setDisabled(True)
+ self.view.spinBoxADCF.setDisabled(True)
+ self.view.spinBoxADCPhase.setDisabled(True)
+ self.view.spinBoxADCPipeline.setDisabled(True)
+ self.view.spinBoxDBITF.setDisabled(True)
+ self.view.spinBoxDBITPhase.setDisabled(True)
+ self.view.spinBoxDBITPipeline.setDisabled(True)
def connect_ui(self):
# For Acquistions Tab
self.view.comboBoxROMode.currentIndexChanged.connect(self.setReadOut)
- self.view.spinBoxRunF.editingFinished.connect(self.setRunFrequency)
self.view.spinBoxTransceiver.editingFinished.connect(self.setTransceiver)
self.view.spinBoxAnalog.editingFinished.connect(self.setAnalog)
self.view.spinBoxDigital.editingFinished.connect(self.setDigital)
- self.view.spinBoxADCF.editingFinished.connect(self.setADCFrequency)
- self.view.spinBoxADCPhase.editingFinished.connect(self.setADCPhase)
- self.view.spinBoxADCPipeline.editingFinished.connect(self.setADCPipeline)
- self.view.spinBoxDBITF.editingFinished.connect(self.setDBITFrequency)
- self.view.spinBoxDBITPhase.editingFinished.connect(self.setDBITPhase)
- self.view.spinBoxDBITPipeline.editingFinished.connect(self.setDBITPipeline)
+
+ if self.det.type == detectorType.CHIPTESTBOARD:
+ self.view.spinBoxRunF.editingFinished.connect(self.setRunFrequency)
+ self.view.spinBoxADCF.editingFinished.connect(self.setADCFrequency)
+ self.view.spinBoxADCPhase.editingFinished.connect(self.setADCPhase)
+ self.view.spinBoxADCPipeline.editingFinished.connect(self.setADCPipeline)
+ self.view.spinBoxDBITF.editingFinished.connect(self.setDBITFrequency)
+ self.view.spinBoxDBITPhase.editingFinished.connect(self.setDBITPhase)
+ self.view.spinBoxDBITPipeline.editingFinished.connect(self.setDBITPipeline)
self.view.checkBoxFileWriteRaw.stateChanged.connect(self.setFileWrite)
self.view.checkBoxFileWriteNumpy.stateChanged.connect(self.setFileWriteNumpy)
@@ -77,16 +94,19 @@ class AcquisitionTab(QtWidgets.QWidget):
def refresh(self):
self.getReadout()
- self.getRunFrequency()
self.getTransceiver()
self.getAnalog()
self.getDigital()
- self.getADCFrequency()
- self.getADCPhase()
- self.getADCPipeline()
- self.getDBITFrequency()
- self.getDBITPhase()
- self.getDBITPipeline()
+
+ if self.det.type == detectorType.CHIPTESTBOARD:
+ self.getRunFrequency()
+ self.getADCFrequency()
+ self.getADCPhase()
+ self.getADCPipeline()
+ self.getDBITFrequency()
+ self.getDBITPhase()
+ self.getDBITPipeline()
+
self.getFileWrite()
self.getFileName()
self.getFilePath()
@@ -697,23 +717,39 @@ class AcquisitionTab(QtWidgets.QWidget):
self.socket.subscribe("")
def saveParameters(self) -> list[str]:
- return [
- f'romode {self.view.comboBoxROMode.currentText().lower()}',
- f'runclk {self.view.spinBoxRunF.value()}',
- f'adcclk {self.view.spinBoxADCF.value()}',
- f'adcphase {self.view.spinBoxADCPhase.value()}',
- f'adcpipeline {self.view.spinBoxADCPipeline.value()}',
- f'dbitclk {self.view.spinBoxDBITF.value()}',
- f'dbitphase {self.view.spinBoxDBITPhase.value()}',
- f'dbitpipeline {self.view.spinBoxDBITPipeline.value()}',
- f'fwrite {int(self.view.checkBoxFileWriteRaw.isChecked())}',
- f'fname {self.view.lineEditFileName.text()}',
- f'fpath {self.view.lineEditFilePath.text()}',
- f'findex {self.view.spinBoxAcquisitionIndex.value()}',
- f'frames {self.view.spinBoxFrames.value()}',
- f'triggers {self.view.spinBoxTriggers.value()}',
- f'period {self.view.spinBoxPeriod.value()} {self.view.comboBoxPeriod.currentText().lower()}',
- f'asamples {self.view.spinBoxAnalog.value()}',
- f'dsamples {self.view.spinBoxDigital.value()}',
- f'tsamples {self.view.spinBoxTransceiver.value()}',
- ]
+ if self.det.type == detectorType.CHIPTESTBOARD:
+ return [
+ f'romode {self.view.comboBoxROMode.currentText().lower()}',
+ f'runclk {self.view.spinBoxRunF.value()}',
+ f'adcclk {self.view.spinBoxADCF.value()}',
+ f'adcphase {self.view.spinBoxADCPhase.value()}',
+ f'adcpipeline {self.view.spinBoxADCPipeline.value()}',
+ f'dbitclk {self.view.spinBoxDBITF.value()}',
+ f'dbitphase {self.view.spinBoxDBITPhase.value()}',
+ f'dbitpipeline {self.view.spinBoxDBITPipeline.value()}',
+ f'fwrite {int(self.view.checkBoxFileWriteRaw.isChecked())}',
+ f'fname {self.view.lineEditFileName.text()}',
+ f'fpath {self.view.lineEditFilePath.text()}',
+ f'findex {self.view.spinBoxAcquisitionIndex.value()}',
+ f'frames {self.view.spinBoxFrames.value()}',
+ f'triggers {self.view.spinBoxTriggers.value()}',
+ f'period {self.view.spinBoxPeriod.value()} {self.view.comboBoxPeriod.currentText().lower()}',
+ f'asamples {self.view.spinBoxAnalog.value()}',
+ f'dsamples {self.view.spinBoxDigital.value()}',
+ f'tsamples {self.view.spinBoxTransceiver.value()}',
+ ]
+ else:
+ return [
+ f'romode {self.view.comboBoxROMode.currentText().lower()}',
+ f'fwrite {int(self.view.checkBoxFileWriteRaw.isChecked())}',
+ f'fname {self.view.lineEditFileName.text()}',
+ f'fpath {self.view.lineEditFilePath.text()}',
+ f'findex {self.view.spinBoxAcquisitionIndex.value()}',
+ f'frames {self.view.spinBoxFrames.value()}',
+ f'triggers {self.view.spinBoxTriggers.value()}',
+ f'period {self.view.spinBoxPeriod.value()} {self.view.comboBoxPeriod.currentText().lower()}',
+ f'asamples {self.view.spinBoxAnalog.value()}',
+ f'dsamples {self.view.spinBoxDigital.value()}',
+ f'tsamples {self.view.spinBoxTransceiver.value()}',
+ ]
+
diff --git a/pyctbgui/pyctbgui/services/DACs.py b/pyctbgui/pyctbgui/services/DACs.py
index 1bd7ab721..c626a8613 100644
--- a/pyctbgui/pyctbgui/services/DACs.py
+++ b/pyctbgui/pyctbgui/services/DACs.py
@@ -4,7 +4,7 @@ from pathlib import Path
from PyQt5 import QtWidgets, uic
from pyctbgui.utils.defines import Defines
-from slsdet import dacIndex
+from slsdet import dacIndex, detectorType
class DacTab(QtWidgets.QWidget):
@@ -19,7 +19,14 @@ class DacTab(QtWidgets.QWidget):
dac = getattr(dacIndex, f"DAC_{i}")
getattr(self.view, f"spinBoxDAC{i}").setValue(self.det.getDAC(dac)[0])
- if self.det.highvoltage == 0:
+ if self.det.type == detectorType.XILINX_CHIPTESTBOARD:
+ self.view.checkBoxHighVoltage.setDisabled(True)
+ self.view.spinBoxHighVoltage.setDisabled(True)
+ self.view.labelHighVoltage.setDisabled(True)
+ self.view.labelADCVppDacName.setDisabled(True)
+ self.view.labelADCVpp.setDisabled(True)
+ self.view.comboBoxADCVpp.setDisabled(True)
+ elif self.det.highvoltage == 0:
self.view.spinBoxHighVoltage.setDisabled(True)
self.view.checkBoxHighVoltage.setChecked(False)
@@ -30,9 +37,11 @@ class DacTab(QtWidgets.QWidget):
getattr(self.view, f"checkBoxDAC{i}").stateChanged.connect(partial(self.setDACTristate, i))
getattr(self.view, f"checkBoxDAC{i}mV").stateChanged.connect(partial(self.getDAC, i))
- self.view.comboBoxADCVpp.currentIndexChanged.connect(self.setADCVpp)
- self.view.spinBoxHighVoltage.editingFinished.connect(self.setHighVoltage)
- self.view.checkBoxHighVoltage.stateChanged.connect(self.setHighVoltage)
+ if self.view.comboBoxADCVpp.isEnabled():
+ self.view.comboBoxADCVpp.currentIndexChanged.connect(self.setADCVpp)
+ if self.view.checkBoxHighVoltage.isEnabled():
+ self.view.spinBoxHighVoltage.editingFinished.connect(self.setHighVoltage)
+ self.view.checkBoxHighVoltage.stateChanged.connect(self.setHighVoltage)
def refresh(self):
self.updateDACNames()
@@ -40,8 +49,10 @@ class DacTab(QtWidgets.QWidget):
self.getDACTristate(i)
self.getDAC(i)
- self.getADCVpp()
- self.getHighVoltage()
+ if self.view.comboBoxADCVpp.isEnabled():
+ self.getADCVpp()
+ if self.view.checkBoxHighVoltage.isEnabled():
+ self.getHighVoltage()
def updateDACNames(self):
for i, name in enumerate(self.det.getDacNames()):
@@ -165,6 +176,8 @@ class DacTab(QtWidgets.QWidget):
unit = " mV" if inMV else ""
commands.append(f"dac {i} {value}{unit}")
- commands.append(f"adcvpp {self.view.comboBoxADCVpp.currentText()} mV")
- commands.append(f"highvoltage {self.view.spinBoxHighVoltage.value()}")
+ if self.view.comboBoxADCVpp.isEnabled():
+ commands.append(f"adcvpp {self.view.comboBoxADCVpp.currentText()} mV")
+ if self.view.checkBoxHighVoltage.isEnabled():
+ commands.append(f"highvoltage {self.view.spinBoxHighVoltage.value()}")
return commands
diff --git a/pyctbgui/pyctbgui/services/Pattern.py b/pyctbgui/pyctbgui/services/Pattern.py
index e7e274ff9..98a8a8b81 100644
--- a/pyctbgui/pyctbgui/services/Pattern.py
+++ b/pyctbgui/pyctbgui/services/Pattern.py
@@ -10,6 +10,7 @@ from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as Navigatio
from pyctbgui.utils.defines import Defines
from pyctbgui.utils.plotPattern import PlotPattern
+from slsdet import DurationWrapper
class PatternTab(QtWidgets.QWidget):
@@ -61,7 +62,10 @@ class PatternTab(QtWidgets.QWidget):
getattr(self.view, f"lineEditLoop{i}Wait").editingFinished.connect(partial(self.setPatLoopWaitAddress, i))
getattr(self.view,
f"spinBoxLoop{i}Repetition").editingFinished.connect(partial(self.setPatLoopRepetition, i))
- getattr(self.view, f"spinBoxLoop{i}WaitTime").editingFinished.connect(partial(self.setPatLoopWaitTime, i))
+ getattr(self.view, f"doubleSpinBoxLoop{i}WaitClocks").editingFinished.connect(partial(self.setPatLoopWaitClocks, i))
+ getattr(self.view, f"spinBoxLoop{i}WaitInterval").editingFinished.connect(partial(self.setPatLoopWaitInterval, i))
+ getattr(self.view, f"comboBoxLoop{i}WaitInterval").currentIndexChanged.connect(partial(self.setPatLoopWaitInterval, i))
+ self.view.toolButtonTogglePageWaitTime.clicked.connect(self.setTogglePageWaitTime)
self.view.pushButtonCompiler.clicked.connect(self.setCompiler)
self.view.pushButtonUncompiled.clicked.connect(self.setUncompiledPatternFile)
self.view.pushButtonPatternFile.clicked.connect(self.setPatternFile)
@@ -91,7 +95,8 @@ class PatternTab(QtWidgets.QWidget):
self.getPatLoopStartStopAddress(i)
self.getPatLoopWaitAddress(i)
self.getPatLoopRepetition(i)
- self.getPatLoopWaitTime(i)
+ self.getPatLoopWaitClocks(i)
+ self.getPatLoopWaitInterval(i)
# Pattern Tab functions
@@ -182,17 +187,67 @@ class PatternTab(QtWidgets.QWidget):
self.det.patnloop[level] = spinBox.value()
self.getPatLoopRepetition(level)
- def getPatLoopWaitTime(self, level):
+ def getPatLoopWaitClocks(self, level):
retval = self.det.patwaittime[level]
- spinBox = getattr(self.view, f"spinBoxLoop{level}WaitTime")
+ spinBox = getattr(self.view, f"doubleSpinBoxLoop{level}WaitClocks")
spinBox.editingFinished.disconnect()
spinBox.setValue(retval)
- spinBox.editingFinished.connect(partial(self.setPatLoopWaitTime, level))
+ spinBox.editingFinished.connect(partial(self.setPatLoopWaitClocks, level))
+
+ def setPatLoopWaitClocks(self, level):
+ spinBox = getattr(self.view, f"doubleSpinBoxLoop{level}WaitClocks")
+ self.det.patwaittime[level] = int(spinBox.value())
+ self.getPatLoopWaitClocks(level)
+
+ def getPatLoopWaitInterval(self, level):
+ retval = self.det.getPatternWaitInterval(level)[0].count()
+ spinBox = getattr(self.view, f"spinBoxLoop{level}WaitInterval")
+ comboBox = getattr(self.view, f"comboBoxLoop{level}WaitInterval")
+ spinBox.editingFinished.disconnect()
+ comboBox.currentIndexChanged.disconnect()
+ # Converting to right time unit for period
+ if retval >= 1e9:
+ comboBox.setCurrentIndex(0)
+ spinBox.setValue(retval / 1e9)
+ elif retval >= 1e6:
+ comboBox.setCurrentIndex(1)
+ spinBox.setValue(retval / 1e6)
+ elif retval >= 1e3:
+ comboBox.setCurrentIndex(2)
+ spinBox.setValue(retval / 1e3)
+ else:
+ comboBox.setCurrentIndex(3)
+ spinBox.setValue(retval)
+ spinBox.editingFinished.connect(partial(self.setPatLoopWaitInterval, level))
+ comboBox.currentIndexChanged.connect(partial(self.setPatLoopWaitInterval, level))
+
+ def setPatLoopWaitInterval(self, level):
+ spinBox = getattr(self.view, f"spinBoxLoop{level}WaitInterval")
+ comboBox = getattr(self.view, f"comboBoxLoop{level}WaitInterval")
+ value = spinBox.value()
+ if comboBox.currentIndex() == 0:
+ value *= 1e9
+ elif comboBox.currentIndex() == 1:
+ value *= 1e6
+ elif comboBox.currentIndex() == 2:
+ value *= 1e3
+ t = DurationWrapper()
+ t.set_count(int(value))
+ self.det.patwaittime[level] = t
+ self.getPatLoopWaitInterval(level)
+
+ def setTogglePageWaitTime(self):
+ if self.view.stackedWidgetWaitTime.currentIndex() == 0:
+ self.view.stackedWidgetWaitTime.setCurrentIndex(1)
+ self.view.labelWaitTime.setText("Time")
+ for i in range(Defines.pattern.loops_count):
+ self.getPatLoopWaitInterval(i)
+ else:
+ self.view.stackedWidgetWaitTime.setCurrentIndex(0)
+ self.view.labelWaitTime.setText("Clocks")
+ for i in range(Defines.pattern.loops_count):
+ self.getPatLoopWaitClocks(i)
- def setPatLoopWaitTime(self, level):
- spinBox = getattr(self.view, f"spinBoxLoop{level}WaitTime")
- self.det.patwaittime[level] = spinBox.value()
- self.getPatLoopWaitTime(level)
def setCompiler(self):
response = QtWidgets.QFileDialog.getOpenFileName(
@@ -450,7 +505,7 @@ class PatternTab(QtWidgets.QWidget):
f"{getattr(self.view, f'lineEditLoop{i}Stop').text()}")
commands.append(f"patwait {i} {getattr(self.view, f'lineEditLoop{i}Wait').text()}")
- commands.append(f"patwaittime {i} {getattr(self.view, f'spinBoxLoop{i}WaitTime').text()}")
+ commands.append(f"patwaittime {i} {getattr(self.view, f'doubleSpinBoxLoop{i}WaitClocks').text()}")
commands.append(f"patlimits {self.view.lineEditStartAddress.text()}, {self.view.lineEditStopAddress.text()}")
# commands.append(f"patfname {self.view.lineEditPatternFile.text()}")
return commands
diff --git a/pyctbgui/pyctbgui/services/PowerSupplies.py b/pyctbgui/pyctbgui/services/PowerSupplies.py
index ec8d2f5dd..e5b402101 100644
--- a/pyctbgui/pyctbgui/services/PowerSupplies.py
+++ b/pyctbgui/pyctbgui/services/PowerSupplies.py
@@ -4,7 +4,7 @@ from pathlib import Path
from PyQt5 import QtWidgets, uic
from pyctbgui.utils.defines import Defines
-from slsdet import dacIndex
+from slsdet import dacIndex, detectorType
class PowerSuppliesTab(QtWidgets.QWidget):
@@ -18,7 +18,8 @@ class PowerSuppliesTab(QtWidgets.QWidget):
self.updateVoltageNames()
for i in Defines.powerSupplies:
self.getVoltage(i)
- self.getCurrent(i)
+ if self.det.type == detectorType.CHIPTESTBOARD:
+ self.getCurrent(i)
def connect_ui(self):
for i in Defines.powerSupplies:
@@ -38,6 +39,12 @@ class PowerSuppliesTab(QtWidgets.QWidget):
if retval == 0:
checkBox.setChecked(False)
spinBox.setDisabled(True)
+ if self.det.type == detectorType.XILINX_CHIPTESTBOARD:
+ label = getattr(self.view, f"labelI{i}")
+ label.setDisabled(True)
+ if self.det.type == detectorType.XILINX_CHIPTESTBOARD:
+ self.view.spinBoxVChip.setDisabled(True)
+
def updateVoltageNames(self):
retval = self.det.getPowerNames()
@@ -56,7 +63,10 @@ class PowerSuppliesTab(QtWidgets.QWidget):
spinBox.editingFinished.disconnect()
checkBox.stateChanged.disconnect()
- retval = self.det.getMeasuredPower(voltageIndex)[0]
+ if self.det.type == detectorType.XILINX_CHIPTESTBOARD:
+ retval = self.det.getPower(voltageIndex)[0]
+ else:
+ retval = self.det.getMeasuredPower(voltageIndex)[0]
# spinBox.setValue(retval)
if retval > 1:
checkBox.setChecked(True)
@@ -68,8 +78,9 @@ class PowerSuppliesTab(QtWidgets.QWidget):
spinBox.editingFinished.connect(partial(self.setVoltage, i))
checkBox.stateChanged.connect(partial(self.setVoltage, i))
-
- self.getVChip()
+
+ if self.det.type == detectorType.CHIPTESTBOARD:
+ self.getVChip()
# TODO: handle multiple events when pressing enter (twice)
@@ -91,7 +102,8 @@ class PowerSuppliesTab(QtWidgets.QWidget):
# TODO: (properly) disconnecting and connecting to handle multiple events (out of focus and pressing enter).
spinBox.editingFinished.connect(partial(self.setVoltage, i))
self.getVoltage(i)
- self.getCurrent(i)
+ if self.det.type == detectorType.CHIPTESTBOARD:
+ self.getCurrent(i)
def getCurrent(self, i):
label = getattr(self.view, f"labelI{i}")
diff --git a/pyctbgui/pyctbgui/services/SlowADCs.py b/pyctbgui/pyctbgui/services/SlowADCs.py
index 4b73b18f0..92876286e 100644
--- a/pyctbgui/pyctbgui/services/SlowADCs.py
+++ b/pyctbgui/pyctbgui/services/SlowADCs.py
@@ -4,7 +4,7 @@ from pathlib import Path
from PyQt5 import uic, QtWidgets
from pyctbgui.utils.defines import Defines
-from slsdet import dacIndex
+from slsdet import dacIndex, detectorType
class SlowAdcTab(QtWidgets.QWidget):
@@ -17,7 +17,8 @@ class SlowAdcTab(QtWidgets.QWidget):
self.det = None
def setup_ui(self):
- pass
+ if self.det.type == detectorType.XILINX_CHIPTESTBOARD:
+ self.view.pushButtonTemp.setDisabled(True)
def connect_ui(self):
for i in range(Defines.slowAdc.count):
@@ -28,7 +29,8 @@ class SlowAdcTab(QtWidgets.QWidget):
self.updateSlowAdcNames()
for i in range(Defines.slowAdc.count):
self.updateSlowAdc(i)
- self.updateTemperature()
+ if self.det.type == detectorType.CHIPTESTBOARD:
+ self.updateTemperature()
def updateSlowAdcNames(self):
for i, name in enumerate(self.mainWindow.det.getSlowADCNames()):
diff --git a/pyctbgui/pyctbgui/ui/Dacs.ui b/pyctbgui/pyctbgui/ui/Dacs.ui
index 940f93c7d..64cfd4b57 100644
--- a/pyctbgui/pyctbgui/ui/Dacs.ui
+++ b/pyctbgui/pyctbgui/ui/Dacs.ui
@@ -817,7 +817,7 @@ Only pressing enter on spinbox will set DAC (with this condition).
-
-
+
ADC_VPP
diff --git a/pyctbgui/pyctbgui/ui/acquisition.ui b/pyctbgui/pyctbgui/ui/acquisition.ui
index 5b9fa58fd..c2d15dff6 100644
--- a/pyctbgui/pyctbgui/ui/acquisition.ui
+++ b/pyctbgui/pyctbgui/ui/acquisition.ui
@@ -118,7 +118,7 @@
-
-
+
Run Clock Frequency (MHz):
@@ -218,7 +218,7 @@
-
-
+
200
@@ -231,7 +231,7 @@
-
-
+
0
@@ -278,7 +278,7 @@
-
-
+
DBIT Pipeline:
@@ -338,21 +338,21 @@
-
-
+
ADC Pipeline:
-
-
+
ADC Clock Phase (a.u.):
-
-
+
DBIT Clock Phase (a.u.):
diff --git a/pyctbgui/pyctbgui/ui/adc.ui b/pyctbgui/pyctbgui/ui/adc.ui
index c1fabe266..2a03d9c16 100644
--- a/pyctbgui/pyctbgui/ui/adc.ui
+++ b/pyctbgui/pyctbgui/ui/adc.ui
@@ -19,7 +19,7 @@
Form
-
+
0
@@ -3142,7 +3142,7 @@
-
-
+
10
@@ -3188,7 +3188,7 @@
-
-
+
10
diff --git a/pyctbgui/pyctbgui/ui/pattern.ui b/pyctbgui/pyctbgui/ui/pattern.ui
index 0c642a83a..8bd788f6a 100644
--- a/pyctbgui/pyctbgui/ui/pattern.ui
+++ b/pyctbgui/pyctbgui/ui/pattern.ui
@@ -22,9 +22,9 @@
- 0
+ 10
10
- 471
+ 431
311
@@ -1243,10 +1243,10 @@
- 490
+ 450
10
- 361
- 271
+ 401
+ 311
@@ -1256,268 +1256,33 @@
QFrame::Sunken
-
-
-
-
-
- 125
- 31
-
-
-
-
- 125
- 31
-
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
- 999999999
-
-
-
- -
-
-
-
- 125
- 31
-
-
-
-
- 125
- 31
-
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
- 999999999
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 50
- 16777215
-
+
-
+
+
+ Qt::LeftToRight
- Wait 0
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 50
- 16777215
-
-
-
- Wait 5
-
-
-
- -
-
-
-
- 125
- 31
-
-
-
-
- 125
- 31
-
+ Clocks
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
- 999999999
-
- -
-
-
+
-
+
+
+ Qt::Horizontal
+
+
- 80
- 31
+ 40
+ 20
-
-
- 80
- 31
-
-
-
-
-
-
-
-
- 36
- 31
- 49
-
-
-
-
-
-
-
-
- 36
- 31
- 49
-
-
-
-
-
-
-
-
- 146
- 149
- 149
-
-
-
-
-
-
-
-
- Monospace
-
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
- false
-
-
+
- -
-
-
-
- 80
- 31
-
-
-
-
- 80
- 31
-
-
-
-
-
-
-
-
- 36
- 31
- 49
-
-
-
-
-
-
-
-
- 36
- 31
- 49
-
-
-
-
-
-
-
-
- 146
- 149
- 149
-
-
-
-
-
-
-
-
- Monospace
-
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
- false
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 50
- 16777215
-
-
-
- Wait 3
-
-
-
- -
-
-
- Time
-
-
- Qt::AlignCenter
-
-
-
- -
+
-
@@ -1582,47 +1347,83 @@
-
-
+
- 125
+ 80
31
- 125
+ 80
31
+
+
+
+
+
+
+ 36
+ 31
+ 49
+
+
+
+
+
+
+
+
+ 36
+ 31
+ 49
+
+
+
+
+
+
+
+
+ 146
+ 149
+ 149
+
+
+
+
+
+
+
+
+ Monospace
+
+
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
- 999999999
+
+ false
- -
-
-
+
-
+
+
+ Qt::Vertical
+
+
- 0
- 0
+ 20
+ 40
-
-
- 50
- 16777215
-
-
-
- Wait 4
-
-
+
- -
+
-
@@ -1689,11 +1490,613 @@
- -
+
-
+
+
+ Address
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+ 50
+ 0
+
+
+
+
+ 50
+ 16777215
+
+
+
+ Wait 5
+
+
+
+ -
+
+
+
+ 200
+ 16777215
+
+
+
+ 0
+
+
+
+
+ 0
+
+
+ 0
+
+
+ 6
+
+
-
+
+
+
+ 150
+ 34
+
+
+
+
+ 150
+ 34
+
+
+
+ Qt::ImhDigitsOnly
+
+
+ 0
+
+
+ 9999999999.000000000000000
+
+
+
+ -
+
+
+
+ 150
+ 34
+
+
+
+
+ 150
+ 34
+
+
+
+ Qt::ImhDigitsOnly
+
+
+ 0
+
+
+ 9999999999.000000000000000
+
+
+
+ -
+
+
+
+ 150
+ 34
+
+
+
+
+ 150
+ 34
+
+
+
+ Qt::ImhDigitsOnly
+
+
+ 0
+
+
+ 9999999999.000000000000000
+
+
+
+ -
+
+
+
+ 150
+ 34
+
+
+
+
+ 150
+ 34
+
+
+
+ Qt::ImhDigitsOnly
+
+
+ 0
+
+
+ 9999999999.000000000000000
+
+
+
+ -
+
+
+
+ 150
+ 34
+
+
+
+
+ 150
+ 34
+
+
+
+ Qt::ImhDigitsOnly
+
+
+ 0
+
+
+ 9999999999.000000000000000
+
+
+
+ -
+
+
+
+ 150
+ 34
+
+
+
+
+ 150
+ 34
+
+
+
+ Qt::ImhDigitsOnly
+
+
+ 0
+
+
+ 9999999999.000000000000000
+
+
+
+
+
+
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 120
+ 34
+
+
+
+
+ 150
+ 34
+
+
+
+ 4
+
+
+ 99999.990000000005239
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 120
+ 34
+
+
+
+
+ 150
+ 34
+
+
+
+ 4
+
+
+ 99999.990000000005239
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 120
+ 34
+
+
+
+
+ 150
+ 34
+
+
+
+ 4
+
+
+ 99999.990000000005239
+
+
+
+ -
+
+
+
+ 45
+ 31
+
+
+
+
+ 40
+ 16777215
+
+
+
-
+
+ s
+
+
+ -
+
+ ms
+
+
+ -
+
+ μs
+
+
+ -
+
+ ns
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 120
+ 34
+
+
+
+
+ 150
+ 34
+
+
+
+ 4
+
+
+ 99999.990000000005239
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 120
+ 34
+
+
+
+
+ 150
+ 34
+
+
+
+ 4
+
+
+ 99999.990000000005239
+
+
+
+ -
+
+
+
+ 45
+ 31
+
+
+
+
+ 40
+ 16777215
+
+
+
-
+
+ s
+
+
+ -
+
+ ms
+
+
+ -
+
+ μs
+
+
+ -
+
+ ns
+
+
+
+
+ -
+
+
+
+ 45
+ 31
+
+
+
+
+ 40
+ 16777215
+
+
+
-
+
+ s
+
+
+ -
+
+ ms
+
+
+ -
+
+ μs
+
+
+ -
+
+ ns
+
+
+
+
+ -
+
+
+
+ 45
+ 31
+
+
+
+
+ 40
+ 16777215
+
+
+
-
+
+ s
+
+
+ -
+
+ ms
+
+
+ -
+
+ μs
+
+
+ -
+
+ ns
+
+
+
+
+ -
+
+
+
+ 45
+ 31
+
+
+
+
+ 40
+ 16777215
+
+
+
+ 0
+
+
-
+
+ s
+
+
+ -
+
+ ms
+
+
+ -
+
+ μs
+
+
+ -
+
+ ns
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 120
+ 34
+
+
+
+
+ 150
+ 34
+
+
+
+ 4
+
+
+ 99999.990000000005239
+
+
+
+ -
+
+
+
+ 45
+ 31
+
+
+
+
+ 40
+ 16777215
+
+
+
-
+
+ s
+
+
+ -
+
+ ms
+
+
+ -
+
+ μs
+
+
+ -
+
+ ns
+
+
+
+
+
+
+
+
+ -
- 0
+ 50
0
@@ -1708,7 +2111,7 @@
- -
+
-
@@ -1775,40 +2178,112 @@
- -
-
-
- Address
-
-
- Qt::AlignCenter
-
-
-
- -
-
+
-
+
- 125
- 31
+ 16
+ 16
- 125
- 31
+ 16
+ 16
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+ Choose to set pattern wait time in clocks or time
-
- 999999999
+
+
+
+
+
+ 16
+ 16
+
+
+
+ QToolButton::InstantPopup
+
+
+ Qt::RightArrow
+
+
+
+ -
+
+
+
+ 50
+ 0
+
+
+
+
+ 50
+ 16777215
+
+
+
+ Wait 0
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 50
+ 0
+
+
+
+
+ 50
+ 16777215
+
+
+
+ Wait 2
-
-
+
+
+
+ 50
+ 0
+
+
+
+
+ 50
+ 16777215
+
+
+
+ Wait 3
+
+
+
+ -
+
80
@@ -1871,33 +2346,75 @@
- -
-
+
-
+
- 125
+ 80
31
- 125
+ 80
31
+
+
+
+
+
+
+ 36
+ 31
+ 49
+
+
+
+
+
+
+
+
+ 36
+ 31
+ 49
+
+
+
+
+
+
+
+
+ 146
+ 149
+ 149
+
+
+
+
+
+
+
+
+ Monospace
+
+
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
- 999999999
+
+ false
- -
-
+
-
+
- 0
+ 50
0
@@ -1908,10 +2425,36 @@
- Wait 2
+ Wait 4
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
@@ -2728,6 +3271,77 @@
+
+ spinBoxLoop0Repetition
+ lineEditLoop0Start
+ lineEditLoop0Stop
+ spinBoxLoop1Repetition
+ lineEditLoop1Start
+ lineEditLoop1Stop
+ spinBoxLoop2Repetition
+ lineEditLoop2Start
+ lineEditLoop2Stop
+ spinBoxLoop3Repetition
+ lineEditLoop3Start
+ lineEditLoop3Stop
+ spinBoxLoop4Repetition
+ lineEditLoop4Start
+ lineEditLoop4Stop
+ spinBoxLoop5Repetition
+ lineEditLoop5Start
+ lineEditLoop5Stop
+ lineEditStartAddress
+ lineEditStopAddress
+ toolButtonTogglePageWaitTime
+ lineEditLoop0Wait
+ doubleSpinBoxLoop0WaitClocks
+ lineEditLoop1Wait
+ doubleSpinBoxLoop1WaitClocks
+ lineEditLoop2Wait
+ doubleSpinBoxLoop2WaitClocks
+ lineEditLoop3Wait
+ doubleSpinBoxLoop3WaitClocks
+ lineEditLoop4Wait
+ doubleSpinBoxLoop4WaitClocks
+ lineEditLoop5Wait
+ doubleSpinBoxLoop5WaitClocks
+ spinBoxLoop0WaitInterval
+ comboBoxLoop0WaitInterval
+ spinBoxLoop1WaitInterval
+ comboBoxLoop1WaitInterval
+ spinBoxLoop2WaitInterval
+ comboBoxLoop2WaitInterval
+ spinBoxLoop3WaitInterval
+ comboBoxLoop3WaitInterval
+ spinBoxLoop4WaitInterval
+ comboBoxLoop4WaitInterval
+ spinBoxLoop5WaitInterval
+ comboBoxLoop5WaitInterval
+ lineEditCompiler
+ pushButtonCompiler
+ lineEditUncompiled
+ pushButtonUncompiled
+ lineEditPatternFile
+ pushButtonPatternFile
+ comboBoxPatWait
+ comboBoxPatWaitColor
+ comboBoxPatWaitLineStyle
+ doubleSpinBoxWaitAlpha
+ doubleSpinBoxWaitAlphaRect
+ comboBoxPatLoop
+ comboBoxPatLoopColor
+ comboBoxPatLoopLineStyle
+ doubleSpinBoxLoopAlpha
+ doubleSpinBoxLoopAlphaRect
+ comboBoxPatColorSelect
+ comboBoxPatColor
+ spinBoxPatClockSpacing
+ checkBoxPatShowClockNumber
+ doubleSpinBoxLineWidth
+ checkBoxCompile
+ pushButtonLoadPattern
+ pushButtonViewPattern
+
diff --git a/pyctbgui/pyctbgui/ui/slowAdcs.ui b/pyctbgui/pyctbgui/ui/slowAdcs.ui
index 546a30e53..a5aef5b31 100644
--- a/pyctbgui/pyctbgui/ui/slowAdcs.ui
+++ b/pyctbgui/pyctbgui/ui/slowAdcs.ui
@@ -19,7 +19,7 @@
Form
-
+
0
diff --git a/python/slsdet/detector.py b/python/slsdet/detector.py
index ce8a60999..6b0b86f68 100755
--- a/python/slsdet/detector.py
+++ b/python/slsdet/detector.py
@@ -3702,7 +3702,13 @@ class Detector(CppDetectorApi):
@property
def patwaittime(self):
"""
- [Ctb][Mythen3][Xilinx Ctb] Wait time in clock cycles of loop level provided.
+ [Ctb][Mythen3][Xilinx Ctb] Wait time in clock cycles of loop level provided.
+
+ Info
+ ----
+
+ :getter: Always return in clock cycles. To get in DurationWrapper, use getPatternWaitInterval
+ :setter: Accepts either a value in clock cycles or a time unit (timedelta, DurationWrapper)
Example
-------
@@ -3713,41 +3719,85 @@ class Detector(CppDetectorApi):
0: 5
1: 20
2: 30
+ >>> # using timedelta (up to microseconds precision)
+ >>> from datetime import timedelta
+ >>> d.patwaittime[0] = timedelta(seconds=1, microseconds=3)
+ >>>
+ >>> # using DurationWrapper to set in seconds
+ >>> from slsdet import DurationWrapper
+ >>> d.patwaittime[0] = DurationWrapper(1.2)
+ >>>
+ >>> # using DurationWrapper to set in ns
+ >>> t = DurationWrapper()
+ >>> t.set_count(500)
+ >>> d.patwaittime = t
+ >>>
+ >>> # to get in clock cycles
+ >>> d.patwaittime
+ 1000
+ >>>
+ >>> d.getPatternWaitInterval(0)
+ sls::DurationWrapper(total_seconds: 1.23 count: 1230000000)
"""
return PatWaitTimeProxy(self)
- @property
- @element
- def patwaittime0(self):
- """[Ctb][Mythen3][Xilinx Ctb] Wait 0 time in clock cycles."""
- return self.getPatternWaitTime(0)
- @patwaittime0.setter
- def patwaittime0(self, nclk):
- nclk = ut.merge_args(0, nclk)
- ut.set_using_dict(self.setPatternWaitTime, *nclk)
+ def create_patwaittime_property(level):
+ docstring_template ="""
+ Deprecated command. Use patwaittime instead.
+ [Ctb][Mythen3][Xilinx Ctb] Wait time in clock cycles of loop level {level} provided.
- @property
- @element
- def patwaittime1(self):
- """[Ctb][Mythen3][Xilinx Ctb] Wait 1 time in clock cycles."""
- return self.getPatternWaitTime(1)
+ Info
+ ----
- @patwaittime1.setter
- def patwaittime1(self, nclk):
- nclk = ut.merge_args(1, nclk)
- ut.set_using_dict(self.setPatternWaitTime, *nclk)
+ :getter: Always return in clock cycles. To get in DurationWrapper, use getPatternWaitInterval
+ :setter: Accepts either a value in clock cycles or a time unit (timedelta, DurationWrapper)
+
+ Example
+ -------
+ >>> d.patwaittime{level} = 5
+ >>> d.patwaittime{level}
+ 5
+ >>> # using timedelta (up to microseconds precision)
+ >>> from datetime import timedelta
+ >>> d.patwaittime{level} = timedelta(seconds=1, microseconds=3)
+ >>>
+ >>> # using DurationWrapper to set in seconds
+ >>> from slsdet import DurationWrapper
+ >>> d.patwaittime{level} = DurationWrapper(1.2)
+ >>>
+ >>> # using DurationWrapper to set in ns
+ >>> t = DurationWrapper()
+ >>> t.set_count(500)
+ >>> d.patwaittime{level} = t
+ >>>
+ >>> # to get in clock cycles
+ >>> d.patwaittime{level}
+ 1000
+ >>>
+ >>> d.getPatternWaitInterval(level)
+ sls::DurationWrapper(total_seconds: 1.23 count: 1230000000)
+ """
+ @property
+ @element
+ def patwaittime(self):
+ return self.getPatternWaitClocks(level)
- @property
- @element
- def patwaittime2(self):
- """[Ctb][Mythen3][Xilinx Ctb] Wait 2 time in clock cycles."""
- return self.getPatternWaitTime(2)
+ @patwaittime.setter
+ def patwaittime(self, value):
+ if isinstance(value, (int, float)) and not isinstance(value, bool):
+ nclk = ut.merge_args(level, value)
+ ut.set_using_dict(self.setPatternWaitClocks, level, *nclk)
+ else:
+ ut.set_time_using_dict(self.setPatternWaitInterval, level, value)
+
+ patwaittime.__doc__ = docstring_template.format(level=level)
- @patwaittime2.setter
- def patwaittime2(self, nclk):
- nclk = ut.merge_args(2, nclk)
- ut.set_using_dict(self.setPatternWaitTime, *nclk)
+ return patwaittime
+
+ patwaittime0 = create_patwaittime_property(0)
+ patwaittime1 = create_patwaittime_property(1)
+ patwaittime2 = create_patwaittime_property(2)
@property
diff --git a/python/slsdet/proxy.py b/python/slsdet/proxy.py
index cd10cb38a..f3e7ad71b 100644
--- a/python/slsdet/proxy.py
+++ b/python/slsdet/proxy.py
@@ -275,10 +275,13 @@ class PatWaitTimeProxy:
self.det = det
def __getitem__(self, key):
- return element_if_equal(self.det.getPatternWaitTime(key))
+ return element_if_equal(self.det.getPatternWaitClocks(key))
def __setitem__(self, key, value):
- set_proxy_using_dict(self.det.setPatternWaitTime, key, value)
+ if isinstance(value, (int, float)) and not isinstance(value, bool):
+ set_proxy_using_dict(self.det.setPatternWaitClocks, key, value)
+ else:
+ set_proxy_using_dict(self.det.setPatternWaitInterval, key, value)
def __repr__(self):
max_levels = MAX_PATTERN_LEVELS
diff --git a/python/src/detector.cpp b/python/src/detector.cpp
index 5ca05412b..4106e8065 100644
--- a/python/src/detector.cpp
+++ b/python/src/detector.cpp
@@ -1861,13 +1861,22 @@ void init_det(py::module &m) {
Detector::setPatternWaitAddr,
py::arg(), py::arg(), py::arg() = Positions{});
CppDetectorApi.def(
- "getPatternWaitTime",
+ "getPatternWaitClocks",
(Result(Detector::*)(int, sls::Positions) const) &
- Detector::getPatternWaitTime,
+ Detector::getPatternWaitClocks,
py::arg(), py::arg() = Positions{});
- CppDetectorApi.def("setPatternWaitTime",
+ CppDetectorApi.def("setPatternWaitClocks",
(void (Detector::*)(int, uint64_t, sls::Positions)) &
- Detector::setPatternWaitTime,
+ Detector::setPatternWaitClocks,
+ py::arg(), py::arg(), py::arg() = Positions{});
+ CppDetectorApi.def(
+ "getPatternWaitInterval",
+ (Result(Detector::*)(int, sls::Positions) const) &
+ Detector::getPatternWaitInterval,
+ py::arg(), py::arg() = Positions{});
+ CppDetectorApi.def("setPatternWaitInterval",
+ (void (Detector::*)(int, sls::ns, sls::Positions)) &
+ Detector::setPatternWaitInterval,
py::arg(), py::arg(), py::arg() = Positions{});
CppDetectorApi.def("getPatternMask",
(Result(Detector::*)(sls::Positions)) &
diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h
index 491fc38e0..375d62d6c 100644
--- a/slsDetectorGui/include/qDefs.h
+++ b/slsDetectorGui/include/qDefs.h
@@ -61,7 +61,9 @@ class qDefs : public QWidget {
}
}
- template struct NonDeduced { using type = CT; };
+ template struct NonDeduced {
+ using type = CT;
+ };
template
static void HandleExceptions(const std::string emsg, const std::string src,
S *s, RT (S::*somefunc)(CT...),
diff --git a/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer
index a52f0b609..87ac5ef1f 100755
Binary files a/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer and b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer differ
diff --git a/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c
index 4cd42436e..bf9773e71 100644
--- a/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c
+++ b/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c
@@ -1095,26 +1095,17 @@ int setNumTransceiverSamples(int val) {
int getNumTransceiverSamples() { return ntSamples; }
int setExpTime(int64_t val) {
- if (val < 0) {
- LOG(logERROR, ("Invalid exptime: %lld ns\n", (long long int)val));
- return FAIL;
- }
- LOG(logINFO, ("Setting exptime %lld ns\n", (long long int)val));
- val *= (1E-3 * clkFrequency[RUN_CLK]);
- setPatternWaitTime(0, val);
+ setPatternWaitInterval(0, val);
// validate for tolerance
int64_t retval = getExpTime();
- val /= (1E-3 * clkFrequency[RUN_CLK]);
if (val != retval) {
return FAIL;
}
return OK;
}
-int64_t getExpTime() {
- return getPatternWaitTime(0) / (1E-3 * clkFrequency[RUN_CLK]);
-}
+int64_t getExpTime() { return getPatternWaitInterval(0); }
int setPeriod(int64_t val) {
if (val < 0) {
diff --git a/slsDetectorServers/eigerDetectorServer/9mhvserial_bf.c b/slsDetectorServers/eigerDetectorServer/9mhvserial_bf.c
index d5651ec7b..f67a46dbf 100644
--- a/slsDetectorServers/eigerDetectorServer/9mhvserial_bf.c
+++ b/slsDetectorServers/eigerDetectorServer/9mhvserial_bf.c
@@ -17,7 +17,7 @@
#define BUFFERSIZE 16
#define I2C_DEVICE_FILE "/dev/i2c-0"
#define I2C_DEVICE_ADDRESS 0x4C
-//#define I2C_DEVICE_ADDRESS 0x48
+// #define I2C_DEVICE_ADDRESS 0x48
#define I2C_REGISTER_ADDRESS 0x40
int i2c_open(const char *file, unsigned int addr) {
diff --git a/slsDetectorServers/eigerDetectorServer/FebRegisterDefs.h b/slsDetectorServers/eigerDetectorServer/FebRegisterDefs.h
index b1246db33..785a854af 100644
--- a/slsDetectorServers/eigerDetectorServer/FebRegisterDefs.h
+++ b/slsDetectorServers/eigerDetectorServer/FebRegisterDefs.h
@@ -98,8 +98,8 @@
// everything at ~200 kHz (200 kHz MHz ddr readout)
#define DAQ_CHIP_CONTROLLER_SUPER_SLOW_SPEED 0x000c0000
-//#define DAQ_FIFO_ENABLE 0x00100000 commented out as it
-// is not used anywhere
+// #define DAQ_FIFO_ENABLE 0x00100000 commented out as it
+// is not used anywhere
#define DAQ_REG_CHIP_CMDS_INT_TRIGGER 0x00100000
// direct chip commands to the DAQ_REG_CHIP_CMDS register
@@ -131,8 +131,9 @@
#define DAQ_NEXPOSURERS_ACTIVATE_AUTO_SUBIMAGING 0x20000000
#define DAQ_NEXPOSURERS_ACTIVATE_RATE_CORRECTION 0x40000000
-//#define DAQ_MASTER_HALF_MODULE 0x80000000 currently not
-// used
+// #define DAQ_MASTER_HALF_MODULE 0x80000000 currently
+// not
+// used
// chips static bits
#define DAQ_STATIC_BIT_PROGRAM 0x00000001
diff --git a/slsDetectorServers/eigerDetectorServer/xfs_types.h b/slsDetectorServers/eigerDetectorServer/xfs_types.h
index 1c998bdc4..68d5321f6 100644
--- a/slsDetectorServers/eigerDetectorServer/xfs_types.h
+++ b/slsDetectorServers/eigerDetectorServer/xfs_types.h
@@ -2,7 +2,7 @@
// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
-//#include "types.h"
+// #include "types.h"
#include
/******************************************************************************/
/* types */
diff --git a/slsDetectorServers/eigerDetectorServer/xparameters.h b/slsDetectorServers/eigerDetectorServer/xparameters.h
index 4b3bf1312..66a4a4396 100644
--- a/slsDetectorServers/eigerDetectorServer/xparameters.h
+++ b/slsDetectorServers/eigerDetectorServer/xparameters.h
@@ -92,7 +92,7 @@ XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_LEFT_BASEADDR
#define XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_LEFT_HIGHADDR 0xC410FFFF
/* Definitions for a new memory */
-//#define XPAR_PLB_LL_NEW_MEMORY 0xD1000000//0xD1000084//0xC4200000
+// #define XPAR_PLB_LL_NEW_MEMORY 0xD1000000//0xD1000084//0xC4200000
/* Definitions for peripheral PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_RIGHT */
#define XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_RIGHT_BASEADDR 0xC4110000
diff --git a/slsDetectorServers/gotthardDetectorServer/RegisterDefs.h b/slsDetectorServers/gotthardDetectorServer/RegisterDefs.h
index d04e80346..f1ecbf613 100644
--- a/slsDetectorServers/gotthardDetectorServer/RegisterDefs.h
+++ b/slsDetectorServers/gotthardDetectorServer/RegisterDefs.h
@@ -22,13 +22,13 @@
((0x1 << GAIN_CONFGAIN_OFST) & GAIN_CONFGAIN_MSK)
/** Flow Control register */
-//#define FLOW_CONTROL_REG (0x11 << MEM_MAP_SHIFT)
+// #define FLOW_CONTROL_REG (0x11 << MEM_MAP_SHIFT)
/** Flow Status register */
-//#define FLOW_STATUS_REG (0x12 << MEM_MAP_SHIFT)
+// #define FLOW_STATUS_REG (0x12 << MEM_MAP_SHIFT)
/** Frame register */
-//#define FRAME_REG (0x13 << MEM_MAP_SHIFT)
+// #define FRAME_REG (0x13 << MEM_MAP_SHIFT)
/** Multi Purpose register */
#define MULTI_PURPOSE_REG (0x14 << MEM_MAP_SHIFT)
@@ -79,7 +79,7 @@
((0x0007f << DAQ_PCKT_LNGTH_OFST) & DAQ_PCKT_LNGTH_MSK)
/** Time From Start register */
-//#define TIME_FROM_START_REG (0x16 << MEM_MAP_SHIFT)
+// #define TIME_FROM_START_REG (0x16 << MEM_MAP_SHIFT)
/** DAC Control register */
#define SPI_REG (0x17 << MEM_MAP_SHIFT)
@@ -139,7 +139,7 @@
((0x1b << ADC_SYNC_ENET_DELAY_OFST) & ADC_SYNC_ENET_DELAY_MSK)
/** Time From Start register */
-//#define MU_TIME_REG (0x1a << MEM_MAP_SHIFT)
+// #define MU_TIME_REG (0x1a << MEM_MAP_SHIFT)
/** Temperatre SPI In register */
#define TEMP_SPI_IN_REG (0x1b << MEM_MAP_SHIFT)
@@ -171,7 +171,7 @@
#define ENET_CONF_REG (0x1e << MEM_MAP_SHIFT)
/** Write TSE Shadow register */
-//#define WRITE_TSE_SHADOW_REG (0x1f << MEM_MAP_SHIFT)
+// #define WRITE_TSE_SHADOW_REG (0x1f << MEM_MAP_SHIFT)
/** High Voltage register */
#define HV_REG (0x20 << MEM_MAP_SHIFT)
@@ -288,10 +288,10 @@
((0x4 << EXT_SIGNAL_OFST) & EXT_SIGNAL_MSK)
/** Look at me register */
-//#define LOOK_AT_ME_REG (0x28 << MEM_MAP_SHIFT)
+// #define LOOK_AT_ME_REG (0x28 << MEM_MAP_SHIFT)
/** FPGA SVN register */
-//#define FPGA_SVN_REG (0x29 << MEM_MAP_SHIFT)
+// #define FPGA_SVN_REG (0x29 << MEM_MAP_SHIFT)
/** Chip of Interest register */
#define CHIP_OF_INTRST_REG (0x2a << MEM_MAP_SHIFT)
@@ -303,7 +303,7 @@
(0x0000FFFF << CHIP_OF_INTRST_NUM_CHNNLS_OFST)
/** Out MUX register */
-//#define OUT_MUX_REG (0x2b << MEM_MAP_SHIFT)
+// #define OUT_MUX_REG (0x2b << MEM_MAP_SHIFT)
/** Board Version register */
#define BOARD_REVISION_REG (0x2c << MEM_MAP_SHIFT)
@@ -312,29 +312,29 @@
#define BOARD_REVISION_MSK (0x0000FFFF << BOARD_REVISION_OFST)
#define DETECTOR_TYPE_OFST (16)
#define DETECTOR_TYPE_MSK (0x0000000F << DETECTOR_TYPE_OFST)
-//#define DETECTOR_TYPE_GOTTHARD_VAL (??)
+// #define DETECTOR_TYPE_GOTTHARD_VAL (??)
#define DETECTOR_TYPE_MOENCH_VAL (2)
/** Memory Test register */
-//#define MEMORY_TEST_REG (0x2d << MEM_MAP_SHIFT)
+// #define MEMORY_TEST_REG (0x2d << MEM_MAP_SHIFT)
/** Hit Threshold register */
-//#define HIT_THRESHOLD_REG (0x2e << MEM_MAP_SHIFT)
+// #define HIT_THRESHOLD_REG (0x2e << MEM_MAP_SHIFT)
/** Hit Count register */
-//#define HIT_COUNT_REG (0x2f << MEM_MAP_SHIFT)
+// #define HIT_COUNT_REG (0x2f << MEM_MAP_SHIFT)
/* 16 bit Fifo Data register */
#define FIFO_DATA_REG (0x50 << MEM_MAP_SHIFT) // Not used in FW and SW (16bit)
/** Dacs Set 1 register */
-//#define DACS_SET_1_REG (0x65 << MEM_MAP_SHIFT)
+// #define DACS_SET_1_REG (0x65 << MEM_MAP_SHIFT)
/** Dacs Set 2 register */
-//#define DACS_SET_2_REG (0x66 << MEM_MAP_SHIFT)
+// #define DACS_SET_2_REG (0x66 << MEM_MAP_SHIFT)
/** Dacs Set 3 register */
-//#define DACS_SET_3_REG (0x67 << MEM_MAP_SHIFT)
+// #define DACS_SET_3_REG (0x67 << MEM_MAP_SHIFT)
/* Set Delay 64 bit register */
#define SET_DELAY_LSB_REG (0x68 << MEM_MAP_SHIFT)
@@ -377,12 +377,12 @@
#define GET_EXPTIME_MSB_REG (0x7b << MEM_MAP_SHIFT)
/* Set Gates 64 bit register */
-//#define SET_GATES_LSB_REG (0x7c << MEM_MAP_SHIFT)
-//#define SET_GATES_MSB_REG (0x7d << MEM_MAP_SHIFT)
+// #define SET_GATES_LSB_REG (0x7c << MEM_MAP_SHIFT)
+// #define SET_GATES_MSB_REG (0x7d << MEM_MAP_SHIFT)
/* Set Gates 64 bit register */
-//#define GET_GATES_LSB_REG (0x7e << MEM_MAP_SHIFT)
-//#define GET_GATES_MSB_REG (0x7f << MEM_MAP_SHIFT)
+// #define GET_GATES_LSB_REG (0x7e << MEM_MAP_SHIFT)
+// #define GET_GATES_MSB_REG (0x7f << MEM_MAP_SHIFT)
/* Dark Image starting address */
#define DARK_IMAGE_REG (0x81 << MEM_MAP_SHIFT)
diff --git a/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer b/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer
index 91195ea74..0661d3a32 100755
Binary files a/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer and b/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer differ
diff --git a/slsDetectorServers/mythen3DetectorServer/mythen3.c b/slsDetectorServers/mythen3DetectorServer/mythen3.c
index 96bf73902..f4dc01871 100644
--- a/slsDetectorServers/mythen3DetectorServer/mythen3.c
+++ b/slsDetectorServers/mythen3DetectorServer/mythen3.c
@@ -39,8 +39,8 @@ patternParameters *setChipStatusRegisterPattern(int csr) {
patword = clearBit(SIGNAL_resCounter, patword);
for (int i = 0; i < 8; i++)
pat->word[iaddr++] = patword;
- //#This version of the serializer pushes in the MSB first (compatible with
- // the CSR bit numbering)
+ // #This version of the serializer pushes in the MSB first (compatible with
+ // the CSR bit numbering)
for (int ib = nbits - 1; ib >= 0; ib--) {
if (csr & (1 << ib))
patword = setBit(SIGNAL_serialIN, patword);
diff --git a/slsDetectorServers/mythen3DetectorServer/mythen3.h b/slsDetectorServers/mythen3DetectorServer/mythen3.h
index 1ac9aad21..f7a62e346 100644
--- a/slsDetectorServers/mythen3DetectorServer/mythen3.h
+++ b/slsDetectorServers/mythen3DetectorServer/mythen3.h
@@ -38,11 +38,11 @@
#define CSR_invpol 4
#define CSR_dpulse 5
#define CSR_interp 6
-#define _CSR_C10pre 7 //#default, negative polarity
+#define _CSR_C10pre 7 // #default, negative polarity
#define CSR_pumprobe 8
#define CSR_apulse 9
#define CSR_C15sh 10
-#define CSR_C30sh 11 //#default
+#define CSR_C30sh 11 // #default
#define CSR_C50sh 12
#define CSR_C225ACsh \
13 // Connects 225fF SHAPER AC cap (1: 225 to shaper, 225 to GND. 0: 450 to
diff --git a/slsDetectorServers/slsDetectorServer/include/loadPattern.h b/slsDetectorServers/slsDetectorServer/include/loadPattern.h
index 7cc9b5a88..0da960038 100644
--- a/slsDetectorServers/slsDetectorServer/include/loadPattern.h
+++ b/slsDetectorServers/slsDetectorServer/include/loadPattern.h
@@ -27,10 +27,15 @@ int getPatternWaitAddress(int level);
int validate_setPatternWaitAddresses(char *message, int level, int addr);
void setPatternWaitAddress(int level, int addr);
-int validate_getPatternWaitTime(char *message, int level, uint64_t *waittime);
-uint64_t getPatternWaitTime(int level);
-int validate_setPatternWaitTime(char *message, int level, uint64_t waittime);
-void setPatternWaitTime(int level, uint64_t t);
+int validate_getPatternWaitClocksAndInterval(char *message, int level,
+ uint64_t *waittime, int clocks);
+uint64_t getPatternWaitClocks(int level);
+uint64_t getPatternWaitInterval(int level);
+
+int validate_setPatternWaitClocksAndInterval(char *message, int level,
+ uint64_t waittime, int clocks);
+void setPatternWaitClocks(int level, uint64_t t);
+void setPatternWaitInterval(int level, uint64_t t);
int validate_getPatternLoopCycles(char *message, int level, int *numLoops);
int getPatternLoopCycles(int level);
diff --git a/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h b/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h
index 33f37becc..2c7e60ce9 100644
--- a/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h
+++ b/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h
@@ -104,7 +104,7 @@ int set_pattern_word(int);
int set_pattern_loop_addresses(int);
int set_pattern_loop_cycles(int);
int set_pattern_wait_addr(int);
-int set_pattern_wait_time(int);
+int set_pattern_wait_clocks(int);
int set_pattern_mask(int);
int get_pattern_mask(int);
int set_pattern_bit_mask(int);
@@ -336,3 +336,5 @@ int get_timing_info_decoder(int);
int set_timing_info_decoder(int);
int get_collection_mode(int);
int set_collection_mode(int);
+int get_pattern_wait_interval(int);
+int set_pattern_wait_interval(int);
diff --git a/slsDetectorServers/slsDetectorServer/src/I2C.c b/slsDetectorServers/slsDetectorServer/src/I2C.c
index 31efc129a..5c60311ac 100644
--- a/slsDetectorServers/slsDetectorServer/src/I2C.c
+++ b/slsDetectorServers/slsDetectorServer/src/I2C.c
@@ -106,9 +106,9 @@
(0x0000FFFF << I2C_SDA_HOLD_COUNT_PERIOD_OFST)
/** Receive Data Fifo Level register */
-//#define I2C_RX_DATA_FIFO_LVL_OFST (0)
-//#define I2C_RX_DATA_FIFO_LVL_MSK (0x000000FF <<
-// I2C_RX_DATA_FIFO_LVL_OFST)
+// #define I2C_RX_DATA_FIFO_LVL_OFST (0)
+// #define I2C_RX_DATA_FIFO_LVL_MSK (0x000000FF <<
+// I2C_RX_DATA_FIFO_LVL_OFST)
// defines in the fpga
uint32_t I2C_Control_Reg = 0x0;
diff --git a/slsDetectorServers/slsDetectorServer/src/communication_funcs.c b/slsDetectorServers/slsDetectorServer/src/communication_funcs.c
index bcec87fdc..b53fe078b 100644
--- a/slsDetectorServers/slsDetectorServer/src/communication_funcs.c
+++ b/slsDetectorServers/slsDetectorServer/src/communication_funcs.c
@@ -622,7 +622,7 @@ void getIpAddressinString(char *cip, uint32_t ip) {
inet_ntop(AF_INET, &ip, cip, INET_ADDRSTRLEN);
#else
sprintf(cip, "%d.%d.%d.%d", (ip >> 24) & 0xff, (ip >> 16) & 0xff,
- (ip >> 8) & 0xff, (ip)&0xff);
+ (ip >> 8) & 0xff, (ip) & 0xff);
#endif
}
diff --git a/slsDetectorServers/slsDetectorServer/src/loadPattern.c b/slsDetectorServers/slsDetectorServer/src/loadPattern.c
index 02399321e..6065d0076 100644
--- a/slsDetectorServers/slsDetectorServer/src/loadPattern.c
+++ b/slsDetectorServers/slsDetectorServer/src/loadPattern.c
@@ -11,6 +11,10 @@
#ifdef MYTHEN3D
extern enum TLogLevel trimmingPrint;
+extern uint32_t clkDivider[];
+#endif
+#ifdef CHIPTESTBOARDD
+extern uint32_t clkFrequency[];
#endif
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD)
@@ -317,7 +321,8 @@ void setPatternWaitAddress(int level, int addr) {
}
}
-int validate_getPatternWaitTime(char *message, int level, uint64_t *waittime) {
+int validate_getPatternWaitClocksAndInterval(char *message, int level,
+ uint64_t *waittime, int clocks) {
// validate input
if (level < 0 || level >= MAX_LEVELS) {
sprintf(message,
@@ -326,11 +331,15 @@ int validate_getPatternWaitTime(char *message, int level, uint64_t *waittime) {
LOG(logERROR, (message));
return FAIL;
}
- *waittime = getPatternWaitTime(level);
+ if (clocks) {
+ *waittime = getPatternWaitClocks(level);
+ } else {
+ *waittime = getPatternWaitInterval(level);
+ }
return OK;
}
-uint64_t getPatternWaitTime(int level) {
+uint64_t getPatternWaitClocks(int level) {
switch (level) {
case 0:
return getU64BitReg(PATTERN_WAIT_TIMER_0_LSB_REG,
@@ -357,7 +366,25 @@ uint64_t getPatternWaitTime(int level) {
}
}
-int validate_setPatternWaitTime(char *message, int level, uint64_t waittime) {
+uint64_t getPatternWaitInterval(int level) {
+ uint64_t numClocks = getPatternWaitClocks(level);
+ int runclk = 0;
+#ifdef CHIPTESTBOARDD
+ runclk = clkFrequency[RUN_CLK];
+#elif XILINX_CHIPTESTBOARDD
+ runclk = RUN_CLK;
+#elif MYTHEN3D
+ runclk = clkDivider[SYSTEM_C0];
+#endif
+ if (runclk == 0) {
+ LOG(logERROR, ("runclk is 0. Cannot divide by 0. Returning -1.\n"));
+ return -1;
+ }
+ return numClocks / (1E-3 * runclk);
+}
+
+int validate_setPatternWaitClocksAndInterval(char *message, int level,
+ uint64_t waittime, int clocks) {
// validate input
if (level < 0 || level >= MAX_LEVELS) {
sprintf(message,
@@ -367,12 +394,21 @@ int validate_setPatternWaitTime(char *message, int level, uint64_t waittime) {
return FAIL;
}
- setPatternWaitTime(level, waittime);
+ uint64_t retval = 0;
+ if (clocks) {
+ setPatternWaitClocks(level, waittime);
+ // validate result
+ retval = getPatternWaitClocks(level);
+ LOG(logDEBUG1, ("Pattern wait time in clocks (level:%d) retval: %d\n",
+ level, (long long int)retval));
+ } else {
+ setPatternWaitInterval(level, waittime);
+ // validate result
+ retval = getPatternWaitInterval(level);
+ LOG(logDEBUG1, ("Pattern wait time (level:%d) retval: %d\n", level,
+ (long long int)retval));
+ }
- // validate result
- uint64_t retval = getPatternWaitTime(level);
- LOG(logDEBUG1, ("Pattern wait time (level:%d) retval: %d\n", level,
- (long long int)retval));
int ret = OK;
char mode[128];
memset(mode, 0, sizeof(mode));
@@ -381,13 +417,13 @@ int validate_setPatternWaitTime(char *message, int level, uint64_t waittime) {
return ret;
}
-void setPatternWaitTime(int level, uint64_t t) {
+void setPatternWaitClocks(int level, uint64_t t) {
#ifdef MYTHEN3D
LOG(trimmingPrint,
#else
LOG(logINFO,
#endif
- ("Setting Pattern Wait Time (level:%d) :%lld\n", level,
+ ("Setting Pattern Wait Time in clocks (level:%d) :%lld\n", level,
(long long int)t));
switch (level) {
case 0:
@@ -421,6 +457,26 @@ void setPatternWaitTime(int level, uint64_t t) {
}
}
+void setPatternWaitInterval(int level, uint64_t t) {
+#ifdef MYTHEN3D
+ LOG(trimmingPrint,
+#else
+ LOG(logINFO,
+#endif
+ ("Setting Pattern Wait Time (level:%d) :%lld ns\n", level,
+ (long long int)t));
+ int runclk = 0;
+#ifdef CHIPTESTBOARDD
+ runclk = clkFrequency[RUN_CLK];
+#elif XILINX_CHIPTESTBOARDD
+ runclk = RUN_CLK;
+#elif MYTHEN3D
+ runclk = clkDivider[SYSTEM_C0];
+#endif
+ uint64_t numClocks = t * (1E-3 * runclk);
+ setPatternWaitClocks(level, numClocks);
+}
+
int validate_getPatternLoopCycles(char *message, int level, int *numLoops) {
// validate input
if (level < 0 || level >= MAX_LEVELS) {
@@ -830,7 +886,8 @@ int loadPattern(char *message, enum TLogLevel printLevel,
}
// wait time
- ret = validate_setPatternWaitTime(message, i, pat->waittime[i]);
+ ret = validate_setPatternWaitClocksAndInterval(message, i,
+ pat->waittime[i], 1);
if (ret == FAIL) {
break;
}
@@ -894,7 +951,8 @@ int getPattern(char *message, patternParameters *pat) {
pat->wait[i] = retval1;
// wait time
- ret = validate_getPatternWaitTime(message, i, &retval64);
+ ret = validate_getPatternWaitClocksAndInterval(message, i,
+ &retval64, 1);
if (ret == FAIL) {
break;
}
@@ -1095,7 +1153,8 @@ int loadPatternFile(char *patFname, char *errMessage) {
break;
}
- if (validate_setPatternWaitTime(temp, level, waittime) == FAIL) {
+ if (validate_setPatternWaitClocksAndInterval(temp, level, waittime,
+ 1) == FAIL) {
break;
}
}
diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c
index 5255a22fd..9cf641b2d 100644
--- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c
+++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c
@@ -302,7 +302,7 @@ void function_table() {
flist[F_SET_PATTERN_LOOP_ADDRESSES] = &set_pattern_loop_addresses;
flist[F_SET_PATTERN_LOOP_CYCLES] = &set_pattern_loop_cycles;
flist[F_SET_PATTERN_WAIT_ADDR] = &set_pattern_wait_addr;
- flist[F_SET_PATTERN_WAIT_TIME] = &set_pattern_wait_time;
+ flist[F_SET_PATTERN_WAIT_CLOCKS] = &set_pattern_wait_clocks;
flist[F_SET_PATTERN_MASK] = &set_pattern_mask;
flist[F_GET_PATTERN_MASK] = &get_pattern_mask;
flist[F_SET_PATTERN_BIT_MASK] = &set_pattern_bit_mask;
@@ -518,7 +518,8 @@ void function_table() {
flist[F_SET_TIMING_INFO_DECODER] = &set_timing_info_decoder;
flist[F_GET_COLLECTION_MODE] = &get_collection_mode;
flist[F_SET_COLLECTION_MODE] = &set_collection_mode;
-
+ flist[F_GET_PATTERN_WAIT_INTERVAL] = &get_pattern_wait_interval;
+ flist[F_SET_PATTERN_WAIT_INTERVAL] = &set_pattern_wait_interval;
// check
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
LOG(logERROR, ("The last detector function enum has reached its "
@@ -2013,102 +2014,106 @@ int acquire(int blocking, int file_des) {
#if defined(JUNGFRAUD)
// chipv1.1 has to be configured before acquisition
if (getChipVersion() == 11 && !isChipConfigured()) {
- ret = FAIL;
- strcpy(mess, "Could not start acquisition. Chip is not configured. "
- "Power it on to configure it.\n");
- LOG(logERROR, (mess));
- } else
+ ret = FAIL;
+ strcpy(mess,
+ "Could not start acquisition. Chip is not configured. "
+ "Power it on to configure it.\n");
+ LOG(logERROR, (mess));
+ } else
#endif
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD)
- if ((getReadoutMode() == ANALOG_AND_DIGITAL ||
- getReadoutMode() == ANALOG_ONLY) &&
- (getNumAnalogSamples() <= 0)) {
- ret = FAIL;
- sprintf(mess,
- "Could not start acquisition. Invalid number of analog "
- "samples: %d.\n",
- getNumAnalogSamples());
- LOG(logERROR, (mess));
- } else if ((getReadoutMode() == ANALOG_AND_DIGITAL ||
- getReadoutMode() == DIGITAL_ONLY ||
- getReadoutMode() == DIGITAL_AND_TRANSCEIVER) &&
- (getNumDigitalSamples() <= 0)) {
- ret = FAIL;
- sprintf(mess,
+ if ((getReadoutMode() == ANALOG_AND_DIGITAL ||
+ getReadoutMode() == ANALOG_ONLY) &&
+ (getNumAnalogSamples() <= 0)) {
+ ret = FAIL;
+ sprintf(mess,
+ "Could not start acquisition. Invalid number of analog "
+ "samples: %d.\n",
+ getNumAnalogSamples());
+ LOG(logERROR, (mess));
+ } else if ((getReadoutMode() == ANALOG_AND_DIGITAL ||
+ getReadoutMode() == DIGITAL_ONLY ||
+ getReadoutMode() == DIGITAL_AND_TRANSCEIVER) &&
+ (getNumDigitalSamples() <= 0)) {
+ ret = FAIL;
+ sprintf(
+ mess,
"Could not start acquisition. Invalid number of digital "
"samples: %d.\n",
getNumDigitalSamples());
- LOG(logERROR, (mess));
- } else if ((getReadoutMode() == TRANSCEIVER_ONLY ||
- getReadoutMode() == DIGITAL_AND_TRANSCEIVER) &&
- (getNumTransceiverSamples() <= 0)) {
- ret = FAIL;
- sprintf(mess,
- "Could not start acquisition. Invalid number of "
- "transceiver "
- "samples: %d.\n",
- getNumTransceiverSamples());
- LOG(logERROR, (mess));
- } else
+ LOG(logERROR, (mess));
+ } else if ((getReadoutMode() == TRANSCEIVER_ONLY ||
+ getReadoutMode() == DIGITAL_AND_TRANSCEIVER) &&
+ (getNumTransceiverSamples() <= 0)) {
+ ret = FAIL;
+ sprintf(mess,
+ "Could not start acquisition. Invalid number of "
+ "transceiver "
+ "samples: %d.\n",
+ getNumTransceiverSamples());
+ LOG(logERROR, (mess));
+ } else
#endif
#ifdef EIGERD
- // check for hardware mac and hardware ip
- if (udpDetails[0].srcmac != getDetectorMAC()) {
- ret = FAIL;
- uint64_t sourcemac = getDetectorMAC();
- char src_mac[MAC_ADDRESS_SIZE];
- getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, sourcemac);
- sprintf(mess,
- "Invalid udp source mac address for this detector. "
- "Must be "
- "same as hardware detector mac address %s\n",
- src_mac);
- LOG(logERROR, (mess));
- } else if (!enableTenGigabitEthernet(GET_FLAG) &&
- (udpDetails[0].srcip != getDetectorIP())) {
- ret = FAIL;
- uint32_t sourceip = getDetectorIP();
- char src_ip[INET_ADDRSTRLEN];
- getIpAddressinString(src_ip, sourceip);
- sprintf(mess,
- "Invalid udp source ip address for this detector. Must "
- "be "
- "same as hardware detector ip address %s in 1G readout "
- "mode \n",
- src_ip);
- LOG(logERROR, (mess));
- } else
-#endif
- if (configured == FAIL) {
- ret = FAIL;
- strcpy(mess, "Could not start acquisition because ");
- strcat(mess, configureMessage);
- LOG(logERROR, (mess));
- } else if (sharedMemory_getScanStatus() == RUNNING) {
- ret = FAIL;
- strcpy(mess, "Could not start acquisition because a scan is "
- "already running!\n");
- LOG(logERROR, (mess));
- } else {
- memset(scanErrMessage, 0, MAX_STR_LENGTH);
- sharedMemory_setScanStop(0);
- sharedMemory_setScanStatus(IDLE); // if it was error
- if (pthread_create(&pthread_tid, NULL, &start_state_machine,
- &blocking)) {
- ret = FAIL;
- strcpy(mess, "Could not start acquisition thread!\n");
- LOG(logERROR, (mess));
- } else {
- // wait for blocking always (scan or not)
- // non blocking-no scan also wait (for error message)
- // non blcoking-scan dont wait (there is
- // scanErrorMessage)
- if (blocking || !scan) {
- pthread_join(pthread_tid, NULL);
+ // check for hardware mac and hardware ip
+ if (udpDetails[0].srcmac != getDetectorMAC()) {
+ ret = FAIL;
+ uint64_t sourcemac = getDetectorMAC();
+ char src_mac[MAC_ADDRESS_SIZE];
+ getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, sourcemac);
+ sprintf(mess,
+ "Invalid udp source mac address for this detector. "
+ "Must be "
+ "same as hardware detector mac address %s\n",
+ src_mac);
+ LOG(logERROR, (mess));
+ } else if (!enableTenGigabitEthernet(GET_FLAG) &&
+ (udpDetails[0].srcip != getDetectorIP())) {
+ ret = FAIL;
+ uint32_t sourceip = getDetectorIP();
+ char src_ip[INET_ADDRSTRLEN];
+ getIpAddressinString(src_ip, sourceip);
+ sprintf(
+ mess,
+ "Invalid udp source ip address for this detector. Must "
+ "be "
+ "same as hardware detector ip address %s in 1G readout "
+ "mode \n",
+ src_ip);
+ LOG(logERROR, (mess));
} else
- pthread_detach(pthread_tid);
- }
- }
+#endif
+ if (configured == FAIL) {
+ ret = FAIL;
+ strcpy(mess, "Could not start acquisition because ");
+ strcat(mess, configureMessage);
+ LOG(logERROR, (mess));
+ } else if (sharedMemory_getScanStatus() == RUNNING) {
+ ret = FAIL;
+ strcpy(mess,
+ "Could not start acquisition because a scan is "
+ "already running!\n");
+ LOG(logERROR, (mess));
+ } else {
+ memset(scanErrMessage, 0, MAX_STR_LENGTH);
+ sharedMemory_setScanStop(0);
+ sharedMemory_setScanStatus(IDLE); // if it was error
+ if (pthread_create(&pthread_tid, NULL, &start_state_machine,
+ &blocking)) {
+ ret = FAIL;
+ strcpy(mess, "Could not start acquisition thread!\n");
+ LOG(logERROR, (mess));
+ } else {
+ // wait for blocking always (scan or not)
+ // non blocking-no scan also wait (for error message)
+ // non blcoking-scan dont wait (there is
+ // scanErrorMessage)
+ if (blocking || !scan) {
+ pthread_join(pthread_tid, NULL);
+ } else
+ pthread_detach(pthread_tid);
+ }
+ }
}
return Server_SendResult(file_des, INT32, NULL, 0);
}
@@ -3531,13 +3536,13 @@ int set_pattern_wait_addr(int file_des) {
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
}
-int set_pattern_wait_time(int file_des) {
+int set_pattern_wait_clocks(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
uint64_t args[2] = {-1, -1};
uint64_t retval = -1;
- if (receiveData(file_des, args, sizeof(args), INT32) < 0)
+ if (receiveData(file_des, args, sizeof(args), INT64) < 0)
return printSocketReadError();
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD) && \
!defined(MYTHEN3D)
@@ -3545,16 +3550,23 @@ int set_pattern_wait_time(int file_des) {
#else
int loopLevel = (int)args[0];
uint64_t timeval = args[1];
- LOG(logDEBUG1, ("Setting Pattern wait time (loopLevel:%d timeval:0x%llx)\n",
- loopLevel, (long long int)timeval));
+ LOG(logDEBUG1,
+ ("Setting Pattern wait clocks (loopLevel:%d clocks:0x%lld)\n",
+ loopLevel, (long long int)timeval));
if (((int64_t)timeval == GET_FLAG) || (Server_VerifyLock() == OK)) {
// set
if ((int64_t)timeval != GET_FLAG) {
- ret = validate_setPatternWaitTime(mess, loopLevel, timeval);
+ ret = validate_setPatternWaitClocksAndInterval(mess, loopLevel,
+ timeval, 1);
}
// get
if (ret == OK) {
- ret = validate_getPatternWaitTime(mess, loopLevel, &retval);
+ ret = validate_getPatternWaitClocksAndInterval(mess, loopLevel,
+ &retval, 1);
+ if ((int64_t)timeval != GET_FLAG) {
+ validate64(&ret, mess, (int64_t)timeval, retval,
+ "set pattern wait clocks", DEC);
+ }
}
}
#endif
@@ -11206,3 +11218,54 @@ int set_collection_mode(int file_des) {
#endif
return Server_SendResult(file_des, INT32, NULL, 0);
}
+
+int get_pattern_wait_interval(int file_des) {
+ ret = OK;
+ memset(mess, 0, sizeof(mess));
+ int loopLevel = -1;
+ uint64_t retval = -1;
+
+ if (receiveData(file_des, &loopLevel, sizeof(loopLevel), INT32) < 0)
+ return printSocketReadError();
+#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD) && \
+ !defined(MYTHEN3D)
+ functionNotImplemented();
+#else
+ LOG(logDEBUG1,
+ ("Getting Pattern wait interva (loopLevel:%d)\n", loopLevel));
+ ret = validate_getPatternWaitClocksAndInterval(mess, loopLevel, &retval, 0);
+#endif
+ return Server_SendResult(file_des, INT64, &retval, sizeof(retval));
+}
+
+int set_pattern_wait_interval(int file_des) {
+ ret = OK;
+ memset(mess, 0, sizeof(mess));
+ uint64_t args[2] = {-1, -1};
+
+ if (receiveData(file_des, args, sizeof(args), INT64) < 0)
+ return printSocketReadError();
+#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD) && \
+ !defined(MYTHEN3D)
+ functionNotImplemented();
+#else
+ int loopLevel = (int)args[0];
+ uint64_t timeval = args[1];
+ LOG(logDEBUG1,
+ ("Setting Pattern wait interval (loopLevel:%d timeval:0x%llx ns)\n",
+ loopLevel, (long long int)timeval));
+ if (Server_VerifyLock() == OK) {
+ ret = validate_setPatternWaitClocksAndInterval(mess, loopLevel, timeval,
+ 0);
+ if (ret == OK) {
+ uint64_t retval = 0;
+ ret = validate_getPatternWaitClocksAndInterval(mess, loopLevel,
+ &retval, 0);
+ validate64(&ret, mess, (int64_t)timeval, retval,
+ "set pattern wait interval", DEC);
+ }
+ }
+
+#endif
+ return Server_SendResult(file_des, INT64, NULL, 0);
+}
\ No newline at end of file
diff --git a/slsDetectorServers/xilinx_ctbDetectorServer/Makefile b/slsDetectorServers/xilinx_ctbDetectorServer/Makefile
index 06a4d986d..c271efdfe 100755
--- a/slsDetectorServers/xilinx_ctbDetectorServer/Makefile
+++ b/slsDetectorServers/xilinx_ctbDetectorServer/Makefile
@@ -7,7 +7,12 @@ support_lib = ../../slsSupportLib/include/
det_lib = ../../slsDetectorSoftware/include/sls/
md5_dir = ../../slsSupportLib/src/
-CROSS = aarch64-none-linux-gnu-
+ifeq ($(shell uname -m),aarch64)
+ # no cross compilation needed when on aarch64
+ CROSS =
+else
+ CROSS = aarch64-none-linux-gnu-
+endif
CC = $(CROSS)gcc
#TODO: allow these warnings and fix code
CFLAGS += -Wall -std=gnu99 -Wno-format-overflow -Wno-format-truncation -DXILINX_CHIPTESTBOARDD -DARMPROCESSOR -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(det_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
diff --git a/slsDetectorServers/xilinx_ctbDetectorServer/bin/xilinx_ctbDetectorServer_developer b/slsDetectorServers/xilinx_ctbDetectorServer/bin/xilinx_ctbDetectorServer_developer
index 73f0e1655..15bb18072 100755
Binary files a/slsDetectorServers/xilinx_ctbDetectorServer/bin/xilinx_ctbDetectorServer_developer and b/slsDetectorServers/xilinx_ctbDetectorServer/bin/xilinx_ctbDetectorServer_developer differ
diff --git a/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c
index 1b10b088e..d0b42841a 100644
--- a/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c
+++ b/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c
@@ -863,24 +863,17 @@ int getNumTransceiverSamples() {
}
int setExpTime(int64_t val) {
- if (val < 0) {
- LOG(logERROR, ("Invalid exptime: %lld ns\n", (long long int)val));
- return FAIL;
- }
- LOG(logINFO, ("Setting exptime %lld ns\n", (long long int)val));
- val *= (1E-3 * RUN_CLK);
- setPatternWaitTime(0, val);
+ setPatternWaitInterval(0, val);
// validate for tolerance
int64_t retval = getExpTime();
- val /= (1E-3 * RUN_CLK);
if (val != retval) {
return FAIL;
}
return OK;
}
-int64_t getExpTime() { return getPatternWaitTime(0) / (1E-3 * RUN_CLK); }
+int64_t getExpTime() { return getPatternWaitInterval(0); }
int setPeriod(int64_t val) {
if (val < 0) {
@@ -1056,7 +1049,7 @@ int getPower(enum DACINDEX ind) {
// dac powered off
if (dacValues[ind] == LTC2620_D_GetPowerDownValue()) {
- LOG(logWARNING, ("Power V%s powered down\n", powerNames[pwrIndex]));
+ LOG(logWARNING, ("Power V%s is powered down\n", powerNames[pwrIndex]));
return LTC2620_D_GetPowerDownValue();
}
diff --git a/slsDetectorSoftware/generator/Caller.in.h b/slsDetectorSoftware/generator/Caller.in.h
index fafe99edd..f1a3a2821 100644
--- a/slsDetectorSoftware/generator/Caller.in.h
+++ b/slsDetectorSoftware/generator/Caller.in.h
@@ -19,10 +19,7 @@ class Caller {
IpAddr getDstIpFromAuto();
IpAddr getSrcIpFromAuto();
UdpDestination getUdpEntry();
- void GetLevelAndUpdateArgIndex(int action,
- std::string levelSeparatedCommand,
- int &level, int &iArg, size_t nGetArgs,
- size_t nPutArgs);
+ int GetLevelAndInsertIntoArgs(std::string levelSeparatedCommand);
void WrongNumberOfParameters(size_t expected);
template std::string OutStringHex(const V &value) {
diff --git a/slsDetectorSoftware/generator/commands.yaml b/slsDetectorSoftware/generator/commands.yaml
index a31d5ac73..be298d0fd 100644
--- a/slsDetectorSoftware/generator/commands.yaml
+++ b/slsDetectorSoftware/generator/commands.yaml
@@ -2656,6 +2656,44 @@ slowadc:
argc: 1
arg_types: [ int ]
+patwaittime:
+ is_description: true
+ actions:
+ GET:
+ argc: -1
+ PUT:
+ argc: -1
+
+patwaittime0:
+ is_description: true
+ duplicate_function: true
+ function_alias: patwaittime
+ actions:
+ GET:
+ argc: -1
+ PUT:
+ argc: -1
+
+patwaittime1:
+ is_description: true
+ duplicate_function: true
+ function_alias: patwaittime
+ actions:
+ GET:
+ argc: -1
+ PUT:
+ argc: -1
+
+patwaittime2:
+ is_description: true
+ duplicate_function: true
+ function_alias: patwaittime
+ actions:
+ GET:
+ argc: -1
+ PUT:
+ argc: -1
+
rx_dbitlist:
is_description: true
actions:
@@ -3930,34 +3968,34 @@ patlimits:
patloop:
help: "[0-6] [start addr] [stop addr] \n\t[Ctb][Mythen3][Xilinx Ctb] Limits of the loop level provided.\n\t[Mythen3] Level options: 0-3 only."
+ infer_action: false
+ pattern_command: patloop
actions:
GET:
- argc: -1
- pattern_command:
- command_name: patloop
- nGetArgs: 0
- nPutArgs: 2
+ argc: 1
require_det_id: true
function: getPatternLoopAddresses
+ extra_variables:
+ - name: level
+ type: int
+ value: "StringTo(args[0])"
input: [ level ]
input_types: [ int ]
- cast_input: [ false ]
output: [level,"' '" ,"OutStringHex(t, 4)" ]
PUT:
- argc: -1
- extra_variables:
- - name: start
- type: int
- value: "StringTo(args[iArg++])"
- - name: stop
- type: int
- value: "StringTo(args[iArg++])"
- pattern_command:
- command_name: patloop
- nGetArgs: 0
- nPutArgs: 2
+ argc: 3
require_det_id: true
function: setPatternLoopAddresses
+ extra_variables:
+ - name: level
+ type: int
+ value: "StringTo(args[0])"
+ - name: start
+ type: int
+ value: "StringTo(args[1])"
+ - name: stop
+ type: int
+ value: "StringTo(args[2])"
input: [ level, start, stop ]
input_types: [ int, int, int ]
output: [level,"' '" , "'['" , "ToStringHex(start, 4)" , '", "' , "ToStringHex(stop, 4)", "']'" ]
@@ -3979,34 +4017,33 @@ patloop2:
patnloop:
help: "[0-6] [n_cycles] \n\t[Ctb][Mythen3][Xilinx Ctb] Number of cycles of the loop level provided.\n\t[Mythen3] Level options: 0-3 only."
+ infer_action: false
+ pattern_command: patnloop
actions:
GET:
- argc: -1
- pattern_command:
- command_name: patnloop
- nGetArgs: 0
- nPutArgs: 1
+ argc: 1
require_det_id: true
function: getPatternLoopCycles
+ extra_variables:
+ - name: level
+ type: int
+ value: "StringTo(args[0])"
input: [ level ]
input_types: [ int ]
- cast_input: [ false ]
output: [ level,"' '" , "OutString(t)" ]
PUT:
- argc: -1
- extra_variables:
- - name: nloops
- type: std::string
- value: "args[iArg++]"
- pattern_command:
- command_name: patnloop
- nGetArgs: 0
- nPutArgs: 1
+ argc: 2
require_det_id: true
function: setPatternLoopCycles
+ extra_variables:
+ - name: level
+ type: int
+ value: "StringTo(args[0])"
+ - name: nloops
+ type: int
+ value: "StringTo(args[1])"
input: [ level, nloops ]
input_types: [ int, int ]
- cast_input: [ false, true ]
output: [ level,"' '" , nloops ]
patnloop0:
@@ -4014,9 +4051,9 @@ patnloop0:
inherit_actions: patnloop
actions:
GET:
- output: [ "OutString(t)" ]
+ output: [ OutString(t) ]
PUT:
- output: [ "nloops" ]
+ output: [ nloops ]
patnloop1:
inherit_actions: patnloop0
@@ -4026,31 +4063,31 @@ patnloop2:
patwait:
help: "[0-6] [addr] \n\t[Ctb][Mythen3][Xilinx Ctb] Wait address for loop level provided. \n\t[Mythen3] Level options: 0-3 only."
+ infer_action: false
+ pattern_command: patwait
actions:
GET:
- argc: -1
- pattern_command:
- command_name: patwait
- nGetArgs: 0
- nPutArgs: 1
+ argc: 1
require_det_id: true
function: getPatternWaitAddr
+ extra_variables:
+ - name: level
+ type: int
+ value: "StringTo(args[0])"
input: [ level ]
input_types: [ int ]
- cast_input: [ false ]
output: [level,"' '" , "OutStringHex(t, 4)" ]
PUT:
- argc: -1
- extra_variables:
- - name: addr
- type: int
- value: "StringTo(args[iArg++])"
- pattern_command:
- command_name: patwait
- nGetArgs: 0
- nPutArgs: 1
+ argc: 2
require_det_id: true
function: setPatternWaitAddr
+ extra_variables:
+ - name: level
+ type: int
+ value: "StringTo(args[0])"
+ - name: addr
+ type: int
+ value: "StringTo(args[1])"
input: [ level, addr ]
input_types: [ int, int ]
output: [level,"' '" , "ToStringHex(addr, 4)" ]
@@ -4070,52 +4107,6 @@ patwait1:
patwait2:
inherit_actions: patwait0
-patwaittime:
- help: "[0-6] [n_clk] \n\t[Ctb][Mythen3][Xilinx Ctb] Wait time in clock cycles for the loop provided.\n\t[Mythen3] Level options: 0-3 only."
- actions:
- GET:
- argc: -1
- pattern_command:
- command_name: patwaittime
- nGetArgs: 0
- nPutArgs: 1
- require_det_id: true
- function: getPatternWaitTime
- input: [ level ]
- input_types: [ int ]
- cast_input: [ false ]
- output: [ level,"' '" , "OutString(t)" ]
- PUT:
- argc: -1
- extra_variables:
- - name: waittime
- type: uint64_t
- value: "StringTo(args[iArg++])"
- pattern_command:
- command_name: patwaittime
- nGetArgs: 0
- nPutArgs: 1
- require_det_id: true
- function: setPatternWaitTime
- input: [ level, waittime ]
- input_types: [ int, int ]
- output: [level,"' '" , "waittime" ]
-
-patwaittime0:
- help: "\n\tDeprecated command. Use patwaittime."
- inherit_actions: patwaittime
- actions:
- GET:
- output: [ "OutString(t)" ]
- PUT:
- output: [ "waittime" ]
-
-patwaittime1:
- inherit_actions: patwaittime0
-
-patwaittime2:
- inherit_actions: patwaittime0
-
rx_jsonpara:
help: "[key1] [value1]\n\t[Receiver] Additional json header parameter streamed out from receiver. If not found in header, the pair is appended. An empty values deletes parameter. Max 20 characters for each key/value."
actions:
diff --git a/slsDetectorSoftware/generator/cpp_codegen/codegen.py b/slsDetectorSoftware/generator/cpp_codegen/codegen.py
index ffb2c52e8..dc5e3294f 100644
--- a/slsDetectorSoftware/generator/cpp_codegen/codegen.py
+++ b/slsDetectorSoftware/generator/cpp_codegen/codegen.py
@@ -119,17 +119,11 @@ class CodeGenerator:
def write_check_arg(self):
pass
+
def write_arg(self, args, action, command_name):
for arg in args:
if arg['argc'] != -1:
if_block(f'args.size() == {arg["argc"]}',).__enter__()
- if 'pattern_command' in arg and arg['pattern_command']:
- self.write_line(f'int level = -1, iArg = 0, '
- f'nGetArgs = {arg["pattern_command"]["nGetArgs"]},'
- f' nPutArgs = {arg["pattern_command"]["nPutArgs"]};\nGetLevelAndUpdateArgIndex(action, '
- f'"{arg["pattern_command"]["command_name"]}", level, iArg, nGetArgs,nPutArgs);'
- )
-
if 'extra_variables' in arg:
for var in arg['extra_variables']:
codegen.write_line(f'{var["type"]} {var["name"]} = {var["value"]};')
diff --git a/slsDetectorSoftware/generator/extended_commands.yaml b/slsDetectorSoftware/generator/extended_commands.yaml
index 65499d2f9..6f4d7b583 100644
--- a/slsDetectorSoftware/generator/extended_commands.yaml
+++ b/slsDetectorSoftware/generator/extended_commands.yaml
@@ -5942,11 +5942,15 @@ patloop:
args:
- arg_types:
- int
- argc: -1
+ argc: 1
cast_input:
- false
check_det_id: false
convert_det_id: true
+ extra_variables:
+ - name: level
+ type: int
+ value: StringTo(args[0])
function: getPatternLoopAddresses
input:
- level
@@ -5956,10 +5960,6 @@ patloop:
- level
- ''' '''
- OutStringHex(t, 4)
- pattern_command:
- command_name: patloop
- nGetArgs: 0
- nPutArgs: 2
require_det_id: true
store_result_in_t: true
PUT:
@@ -5968,7 +5968,7 @@ patloop:
- int
- int
- int
- argc: -1
+ argc: 3
cast_input:
- false
- false
@@ -5976,12 +5976,15 @@ patloop:
check_det_id: false
convert_det_id: true
extra_variables:
+ - name: level
+ type: int
+ value: StringTo(args[0])
- name: start
type: int
- value: StringTo(args[iArg++])
+ value: StringTo(args[1])
- name: stop
type: int
- value: StringTo(args[iArg++])
+ value: StringTo(args[2])
function: setPatternLoopAddresses
input:
- level
@@ -5999,28 +6002,29 @@ patloop:
- '", "'
- ToStringHex(stop, 4)
- ''']'''
- pattern_command:
- command_name: patloop
- nGetArgs: 0
- nPutArgs: 2
require_det_id: true
store_result_in_t: false
command_name: patloop
function_alias: patloop
help: "[0-6] [start addr] [stop addr] \n\t[Ctb][Mythen3][Xilinx Ctb] Limits of the\
\ loop level provided.\n\t[Mythen3] Level options: 0-3 only."
- infer_action: true
+ infer_action: false
+ pattern_command: patloop
patloop0:
actions:
GET:
args:
- arg_types:
- int
- argc: -1
+ argc: 1
cast_input:
- false
check_det_id: false
convert_det_id: true
+ extra_variables:
+ - name: level
+ type: int
+ value: StringTo(args[0])
function: getPatternLoopAddresses
input:
- level
@@ -6028,10 +6032,6 @@ patloop0:
- int
output:
- OutStringHex(t, 4)
- pattern_command:
- command_name: patloop
- nGetArgs: 0
- nPutArgs: 2
require_det_id: true
store_result_in_t: true
PUT:
@@ -6040,7 +6040,7 @@ patloop0:
- int
- int
- int
- argc: -1
+ argc: 3
cast_input:
- false
- false
@@ -6048,12 +6048,15 @@ patloop0:
check_det_id: false
convert_det_id: true
extra_variables:
+ - name: level
+ type: int
+ value: StringTo(args[0])
- name: start
type: int
- value: StringTo(args[iArg++])
+ value: StringTo(args[1])
- name: stop
type: int
- value: StringTo(args[iArg++])
+ value: StringTo(args[2])
function: setPatternLoopAddresses
input:
- level
@@ -6069,27 +6072,28 @@ patloop0:
- '", "'
- ToStringHex(stop, 4)
- ''']'''
- pattern_command:
- command_name: patloop
- nGetArgs: 0
- nPutArgs: 2
require_det_id: true
store_result_in_t: false
command_name: patloop0
function_alias: patloop0
help: "\n\tDeprecated command. Use patloop."
- infer_action: true
+ infer_action: false
+ pattern_command: patloop
patloop1:
actions:
GET:
args:
- arg_types:
- int
- argc: -1
+ argc: 1
cast_input:
- false
check_det_id: false
convert_det_id: true
+ extra_variables:
+ - name: level
+ type: int
+ value: StringTo(args[0])
function: getPatternLoopAddresses
input:
- level
@@ -6097,10 +6101,6 @@ patloop1:
- int
output:
- OutStringHex(t, 4)
- pattern_command:
- command_name: patloop
- nGetArgs: 0
- nPutArgs: 2
require_det_id: true
store_result_in_t: true
PUT:
@@ -6109,7 +6109,7 @@ patloop1:
- int
- int
- int
- argc: -1
+ argc: 3
cast_input:
- false
- false
@@ -6117,12 +6117,15 @@ patloop1:
check_det_id: false
convert_det_id: true
extra_variables:
+ - name: level
+ type: int
+ value: StringTo(args[0])
- name: start
type: int
- value: StringTo(args[iArg++])
+ value: StringTo(args[1])
- name: stop
type: int
- value: StringTo(args[iArg++])
+ value: StringTo(args[2])
function: setPatternLoopAddresses
input:
- level
@@ -6138,27 +6141,28 @@ patloop1:
- '", "'
- ToStringHex(stop, 4)
- ''']'''
- pattern_command:
- command_name: patloop
- nGetArgs: 0
- nPutArgs: 2
require_det_id: true
store_result_in_t: false
command_name: patloop1
function_alias: patloop1
help: "\n\tDeprecated command. Use patloop."
- infer_action: true
+ infer_action: false
+ pattern_command: patloop
patloop2:
actions:
GET:
args:
- arg_types:
- int
- argc: -1
+ argc: 1
cast_input:
- false
check_det_id: false
convert_det_id: true
+ extra_variables:
+ - name: level
+ type: int
+ value: StringTo(args[0])
function: getPatternLoopAddresses
input:
- level
@@ -6166,10 +6170,6 @@ patloop2:
- int
output:
- OutStringHex(t, 4)
- pattern_command:
- command_name: patloop
- nGetArgs: 0
- nPutArgs: 2
require_det_id: true
store_result_in_t: true
PUT:
@@ -6178,7 +6178,7 @@ patloop2:
- int
- int
- int
- argc: -1
+ argc: 3
cast_input:
- false
- false
@@ -6186,12 +6186,15 @@ patloop2:
check_det_id: false
convert_det_id: true
extra_variables:
+ - name: level
+ type: int
+ value: StringTo(args[0])
- name: start
type: int
- value: StringTo(args[iArg++])
+ value: StringTo(args[1])
- name: stop
type: int
- value: StringTo(args[iArg++])
+ value: StringTo(args[2])
function: setPatternLoopAddresses
input:
- level
@@ -6207,16 +6210,13 @@ patloop2:
- '", "'
- ToStringHex(stop, 4)
- ''']'''
- pattern_command:
- command_name: patloop
- nGetArgs: 0
- nPutArgs: 2
require_det_id: true
store_result_in_t: false
command_name: patloop2
function_alias: patloop2
help: "\n\tDeprecated command. Use patloop."
- infer_action: true
+ infer_action: false
+ pattern_command: patloop
patmask:
actions:
GET:
@@ -6263,11 +6263,15 @@ patnloop:
args:
- arg_types:
- int
- argc: -1
+ argc: 1
cast_input:
- false
check_det_id: false
convert_det_id: true
+ extra_variables:
+ - name: level
+ type: int
+ value: StringTo(args[0])
function: getPatternLoopCycles
input:
- level
@@ -6277,10 +6281,6 @@ patnloop:
- level
- ''' '''
- OutString(t)
- pattern_command:
- command_name: patnloop
- nGetArgs: 0
- nPutArgs: 1
require_det_id: true
store_result_in_t: true
PUT:
@@ -6288,16 +6288,19 @@ patnloop:
- arg_types:
- int
- int
- argc: -1
+ argc: 2
cast_input:
- false
- - true
+ - false
check_det_id: false
convert_det_id: true
extra_variables:
+ - name: level
+ type: int
+ value: StringTo(args[0])
- name: nloops
- type: std::string
- value: args[iArg++]
+ type: int
+ value: StringTo(args[1])
function: setPatternLoopCycles
input:
- level
@@ -6309,28 +6312,29 @@ patnloop:
- level
- ''' '''
- nloops
- pattern_command:
- command_name: patnloop
- nGetArgs: 0
- nPutArgs: 1
require_det_id: true
store_result_in_t: false
command_name: patnloop
function_alias: patnloop
help: "[0-6] [n_cycles] \n\t[Ctb][Mythen3][Xilinx Ctb] Number of cycles of the loop\
\ level provided.\n\t[Mythen3] Level options: 0-3 only."
- infer_action: true
+ infer_action: false
+ pattern_command: patnloop
patnloop0:
actions:
GET:
args:
- arg_types:
- int
- argc: -1
+ argc: 1
cast_input:
- false
check_det_id: false
convert_det_id: true
+ extra_variables:
+ - name: level
+ type: int
+ value: StringTo(args[0])
function: getPatternLoopCycles
input:
- level
@@ -6338,10 +6342,6 @@ patnloop0:
- int
output:
- OutString(t)
- pattern_command:
- command_name: patnloop
- nGetArgs: 0
- nPutArgs: 1
require_det_id: true
store_result_in_t: true
PUT:
@@ -6349,16 +6349,19 @@ patnloop0:
- arg_types:
- int
- int
- argc: -1
+ argc: 2
cast_input:
- false
- - true
+ - false
check_det_id: false
convert_det_id: true
extra_variables:
+ - name: level
+ type: int
+ value: StringTo(args[0])
- name: nloops
- type: std::string
- value: args[iArg++]
+ type: int
+ value: StringTo(args[1])
function: setPatternLoopCycles
input:
- level
@@ -6368,27 +6371,28 @@ patnloop0:
- int
output:
- nloops
- pattern_command:
- command_name: patnloop
- nGetArgs: 0
- nPutArgs: 1
require_det_id: true
store_result_in_t: false
command_name: patnloop0
function_alias: patnloop0
help: "\n\tDeprecated command. Use patnloop."
- infer_action: true
+ infer_action: false
+ pattern_command: patnloop
patnloop1:
actions:
GET:
args:
- arg_types:
- int
- argc: -1
+ argc: 1
cast_input:
- false
check_det_id: false
convert_det_id: true
+ extra_variables:
+ - name: level
+ type: int
+ value: StringTo(args[0])
function: getPatternLoopCycles
input:
- level
@@ -6396,10 +6400,6 @@ patnloop1:
- int
output:
- OutString(t)
- pattern_command:
- command_name: patnloop
- nGetArgs: 0
- nPutArgs: 1
require_det_id: true
store_result_in_t: true
PUT:
@@ -6407,16 +6407,19 @@ patnloop1:
- arg_types:
- int
- int
- argc: -1
+ argc: 2
cast_input:
- false
- - true
+ - false
check_det_id: false
convert_det_id: true
extra_variables:
+ - name: level
+ type: int
+ value: StringTo(args[0])
- name: nloops
- type: std::string
- value: args[iArg++]
+ type: int
+ value: StringTo(args[1])
function: setPatternLoopCycles
input:
- level
@@ -6426,27 +6429,28 @@ patnloop1:
- int
output:
- nloops
- pattern_command:
- command_name: patnloop
- nGetArgs: 0
- nPutArgs: 1
require_det_id: true
store_result_in_t: false
command_name: patnloop1
function_alias: patnloop1
help: "\n\tDeprecated command. Use patnloop."
- infer_action: true
+ infer_action: false
+ pattern_command: patnloop
patnloop2:
actions:
GET:
args:
- arg_types:
- int
- argc: -1
+ argc: 1
cast_input:
- false
check_det_id: false
convert_det_id: true
+ extra_variables:
+ - name: level
+ type: int
+ value: StringTo(args[0])
function: getPatternLoopCycles
input:
- level
@@ -6454,10 +6458,6 @@ patnloop2:
- int
output:
- OutString(t)
- pattern_command:
- command_name: patnloop
- nGetArgs: 0
- nPutArgs: 1
require_det_id: true
store_result_in_t: true
PUT:
@@ -6465,16 +6465,19 @@ patnloop2:
- arg_types:
- int
- int
- argc: -1
+ argc: 2
cast_input:
- false
- - true
+ - false
check_det_id: false
convert_det_id: true
extra_variables:
+ - name: level
+ type: int
+ value: StringTo(args[0])
- name: nloops
- type: std::string
- value: args[iArg++]
+ type: int
+ value: StringTo(args[1])
function: setPatternLoopCycles
input:
- level
@@ -6484,16 +6487,13 @@ patnloop2:
- int
output:
- nloops
- pattern_command:
- command_name: patnloop
- nGetArgs: 0
- nPutArgs: 1
require_det_id: true
store_result_in_t: false
command_name: patnloop2
function_alias: patnloop2
help: "\n\tDeprecated command. Use patnloop."
- infer_action: true
+ infer_action: false
+ pattern_command: patnloop
patsetbit:
actions:
GET:
@@ -6586,11 +6586,15 @@ patwait:
args:
- arg_types:
- int
- argc: -1
+ argc: 1
cast_input:
- false
check_det_id: false
convert_det_id: true
+ extra_variables:
+ - name: level
+ type: int
+ value: StringTo(args[0])
function: getPatternWaitAddr
input:
- level
@@ -6600,10 +6604,6 @@ patwait:
- level
- ''' '''
- OutStringHex(t, 4)
- pattern_command:
- command_name: patwait
- nGetArgs: 0
- nPutArgs: 1
require_det_id: true
store_result_in_t: true
PUT:
@@ -6611,16 +6611,19 @@ patwait:
- arg_types:
- int
- int
- argc: -1
+ argc: 2
cast_input:
- false
- false
check_det_id: false
convert_det_id: true
extra_variables:
+ - name: level
+ type: int
+ value: StringTo(args[0])
- name: addr
type: int
- value: StringTo(args[iArg++])
+ value: StringTo(args[1])
function: setPatternWaitAddr
input:
- level
@@ -6632,28 +6635,29 @@ patwait:
- level
- ''' '''
- ToStringHex(addr, 4)
- pattern_command:
- command_name: patwait
- nGetArgs: 0
- nPutArgs: 1
require_det_id: true
store_result_in_t: false
command_name: patwait
function_alias: patwait
help: "[0-6] [addr] \n\t[Ctb][Mythen3][Xilinx Ctb] Wait address for loop level provided.\
\ \n\t[Mythen3] Level options: 0-3 only."
- infer_action: true
+ infer_action: false
+ pattern_command: patwait
patwait0:
actions:
GET:
args:
- arg_types:
- int
- argc: -1
+ argc: 1
cast_input:
- false
check_det_id: false
convert_det_id: true
+ extra_variables:
+ - name: level
+ type: int
+ value: StringTo(args[0])
function: getPatternWaitAddr
input:
- level
@@ -6661,10 +6665,6 @@ patwait0:
- int
output:
- OutStringHex(t, 4)
- pattern_command:
- command_name: patwait
- nGetArgs: 0
- nPutArgs: 1
require_det_id: true
store_result_in_t: true
PUT:
@@ -6672,16 +6672,19 @@ patwait0:
- arg_types:
- int
- int
- argc: -1
+ argc: 2
cast_input:
- false
- false
check_det_id: false
convert_det_id: true
extra_variables:
+ - name: level
+ type: int
+ value: StringTo(args[0])
- name: addr
type: int
- value: StringTo(args[iArg++])
+ value: StringTo(args[1])
function: setPatternWaitAddr
input:
- level
@@ -6691,27 +6694,28 @@ patwait0:
- int
output:
- ToStringHex(addr, 4)
- pattern_command:
- command_name: patwait
- nGetArgs: 0
- nPutArgs: 1
require_det_id: true
store_result_in_t: false
command_name: patwait0
function_alias: patwait0
help: "\n\tDeprecated command. Use patwait."
- infer_action: true
+ infer_action: false
+ pattern_command: patwait
patwait1:
actions:
GET:
args:
- arg_types:
- int
- argc: -1
+ argc: 1
cast_input:
- false
check_det_id: false
convert_det_id: true
+ extra_variables:
+ - name: level
+ type: int
+ value: StringTo(args[0])
function: getPatternWaitAddr
input:
- level
@@ -6719,10 +6723,6 @@ patwait1:
- int
output:
- OutStringHex(t, 4)
- pattern_command:
- command_name: patwait
- nGetArgs: 0
- nPutArgs: 1
require_det_id: true
store_result_in_t: true
PUT:
@@ -6730,16 +6730,19 @@ patwait1:
- arg_types:
- int
- int
- argc: -1
+ argc: 2
cast_input:
- false
- false
check_det_id: false
convert_det_id: true
extra_variables:
+ - name: level
+ type: int
+ value: StringTo(args[0])
- name: addr
type: int
- value: StringTo(args[iArg++])
+ value: StringTo(args[1])
function: setPatternWaitAddr
input:
- level
@@ -6749,27 +6752,28 @@ patwait1:
- int
output:
- ToStringHex(addr, 4)
- pattern_command:
- command_name: patwait
- nGetArgs: 0
- nPutArgs: 1
require_det_id: true
store_result_in_t: false
command_name: patwait1
function_alias: patwait1
help: "\n\tDeprecated command. Use patwait."
- infer_action: true
+ infer_action: false
+ pattern_command: patwait
patwait2:
actions:
GET:
args:
- arg_types:
- int
- argc: -1
+ argc: 1
cast_input:
- false
check_det_id: false
convert_det_id: true
+ extra_variables:
+ - name: level
+ type: int
+ value: StringTo(args[0])
function: getPatternWaitAddr
input:
- level
@@ -6777,10 +6781,6 @@ patwait2:
- int
output:
- OutStringHex(t, 4)
- pattern_command:
- command_name: patwait
- nGetArgs: 0
- nPutArgs: 1
require_det_id: true
store_result_in_t: true
PUT:
@@ -6788,16 +6788,19 @@ patwait2:
- arg_types:
- int
- int
- argc: -1
+ argc: 2
cast_input:
- false
- false
check_det_id: false
convert_det_id: true
extra_variables:
+ - name: level
+ type: int
+ value: StringTo(args[0])
- name: addr
type: int
- value: StringTo(args[iArg++])
+ value: StringTo(args[1])
function: setPatternWaitAddr
input:
- level
@@ -6807,253 +6810,148 @@ patwait2:
- int
output:
- ToStringHex(addr, 4)
- pattern_command:
- command_name: patwait
- nGetArgs: 0
- nPutArgs: 1
require_det_id: true
store_result_in_t: false
command_name: patwait2
function_alias: patwait2
help: "\n\tDeprecated command. Use patwait."
- infer_action: true
+ infer_action: false
+ pattern_command: patwait
patwaittime:
actions:
GET:
args:
- - arg_types:
- - int
+ - arg_types: []
argc: -1
- cast_input:
- - false
+ cast_input: []
check_det_id: false
convert_det_id: true
- function: getPatternWaitTime
- input:
- - level
- input_types:
- - int
- output:
- - level
- - ''' '''
- - OutString(t)
- pattern_command:
- command_name: patwaittime
- nGetArgs: 0
- nPutArgs: 1
- require_det_id: true
+ function: ''
+ input: []
+ input_types: []
+ output: []
+ require_det_id: false
store_result_in_t: true
PUT:
args:
- - arg_types:
- - int
- - int
+ - arg_types: []
argc: -1
- cast_input:
- - false
- - false
+ cast_input: []
check_det_id: false
convert_det_id: true
- extra_variables:
- - name: waittime
- type: uint64_t
- value: StringTo(args[iArg++])
- function: setPatternWaitTime
- input:
- - level
- - waittime
- input_types:
- - int
- - int
- output:
- - level
- - ''' '''
- - waittime
- pattern_command:
- command_name: patwaittime
- nGetArgs: 0
- nPutArgs: 1
- require_det_id: true
+ function: ''
+ input: []
+ input_types: []
+ output: []
+ require_det_id: false
store_result_in_t: false
command_name: patwaittime
function_alias: patwaittime
- help: "[0-6] [n_clk] \n\t[Ctb][Mythen3][Xilinx Ctb] Wait time in clock cycles for\
- \ the loop provided.\n\t[Mythen3] Level options: 0-3 only."
+ help: ''
infer_action: true
+ is_description: true
patwaittime0:
actions:
GET:
args:
- - arg_types:
- - int
+ - arg_types: []
argc: -1
- cast_input:
- - false
+ cast_input: []
check_det_id: false
convert_det_id: true
- function: getPatternWaitTime
- input:
- - level
- input_types:
- - int
- output:
- - OutString(t)
- pattern_command:
- command_name: patwaittime
- nGetArgs: 0
- nPutArgs: 1
- require_det_id: true
+ function: ''
+ input: []
+ input_types: []
+ output: []
+ require_det_id: false
store_result_in_t: true
PUT:
args:
- - arg_types:
- - int
- - int
+ - arg_types: []
argc: -1
- cast_input:
- - false
- - false
+ cast_input: []
check_det_id: false
convert_det_id: true
- extra_variables:
- - name: waittime
- type: uint64_t
- value: StringTo(args[iArg++])
- function: setPatternWaitTime
- input:
- - level
- - waittime
- input_types:
- - int
- - int
- output:
- - waittime
- pattern_command:
- command_name: patwaittime
- nGetArgs: 0
- nPutArgs: 1
- require_det_id: true
+ function: ''
+ input: []
+ input_types: []
+ output: []
+ require_det_id: false
store_result_in_t: false
command_name: patwaittime0
- function_alias: patwaittime0
- help: "\n\tDeprecated command. Use patwaittime."
+ duplicate_function: true
+ function_alias: patwaittime
+ help: ''
infer_action: true
+ is_description: true
patwaittime1:
actions:
GET:
args:
- - arg_types:
- - int
+ - arg_types: []
argc: -1
- cast_input:
- - false
+ cast_input: []
check_det_id: false
convert_det_id: true
- function: getPatternWaitTime
- input:
- - level
- input_types:
- - int
- output:
- - OutString(t)
- pattern_command:
- command_name: patwaittime
- nGetArgs: 0
- nPutArgs: 1
- require_det_id: true
+ function: ''
+ input: []
+ input_types: []
+ output: []
+ require_det_id: false
store_result_in_t: true
PUT:
args:
- - arg_types:
- - int
- - int
+ - arg_types: []
argc: -1
- cast_input:
- - false
- - false
+ cast_input: []
check_det_id: false
convert_det_id: true
- extra_variables:
- - name: waittime
- type: uint64_t
- value: StringTo(args[iArg++])
- function: setPatternWaitTime
- input:
- - level
- - waittime
- input_types:
- - int
- - int
- output:
- - waittime
- pattern_command:
- command_name: patwaittime
- nGetArgs: 0
- nPutArgs: 1
- require_det_id: true
+ function: ''
+ input: []
+ input_types: []
+ output: []
+ require_det_id: false
store_result_in_t: false
command_name: patwaittime1
- function_alias: patwaittime1
- help: "\n\tDeprecated command. Use patwaittime."
+ duplicate_function: true
+ function_alias: patwaittime
+ help: ''
infer_action: true
+ is_description: true
patwaittime2:
actions:
GET:
args:
- - arg_types:
- - int
+ - arg_types: []
argc: -1
- cast_input:
- - false
+ cast_input: []
check_det_id: false
convert_det_id: true
- function: getPatternWaitTime
- input:
- - level
- input_types:
- - int
- output:
- - OutString(t)
- pattern_command:
- command_name: patwaittime
- nGetArgs: 0
- nPutArgs: 1
- require_det_id: true
+ function: ''
+ input: []
+ input_types: []
+ output: []
+ require_det_id: false
store_result_in_t: true
PUT:
args:
- - arg_types:
- - int
- - int
+ - arg_types: []
argc: -1
- cast_input:
- - false
- - false
+ cast_input: []
check_det_id: false
convert_det_id: true
- extra_variables:
- - name: waittime
- type: uint64_t
- value: StringTo(args[iArg++])
- function: setPatternWaitTime
- input:
- - level
- - waittime
- input_types:
- - int
- - int
- output:
- - waittime
- pattern_command:
- command_name: patwaittime
- nGetArgs: 0
- nPutArgs: 1
- require_det_id: true
+ function: ''
+ input: []
+ input_types: []
+ output: []
+ require_det_id: false
store_result_in_t: false
command_name: patwaittime2
- function_alias: patwaittime2
- help: "\n\tDeprecated command. Use patwaittime."
+ duplicate_function: true
+ function_alias: patwaittime
+ help: ''
infer_action: true
+ is_description: true
patword:
actions:
GET:
diff --git a/slsDetectorSoftware/generator/gen_commands.py b/slsDetectorSoftware/generator/gen_commands.py
index cc1aedf09..ee4f97a8c 100644
--- a/slsDetectorSoftware/generator/gen_commands.py
+++ b/slsDetectorSoftware/generator/gen_commands.py
@@ -63,6 +63,11 @@ def generate(
codegen.write_line(f'os << R"V0G0N({command["help"]} )V0G0N" << std::endl;')
codegen.write_line('return os.str();')
+
+ # inserting arguments if needed
+ if 'pattern_command' in command and command['pattern_command']:
+ codegen.write_line(f'GetLevelAndInsertIntoArgs("{command["pattern_command"]}");')
+
# check if action and arguments are valid
codegen.write_line('// check if action and arguments are valid')
diff --git a/slsDetectorSoftware/include/sls/Detector.h b/slsDetectorSoftware/include/sls/Detector.h
index 04abc8dba..eed90955b 100644
--- a/slsDetectorSoftware/include/sls/Detector.h
+++ b/slsDetectorSoftware/include/sls/Detector.h
@@ -1749,7 +1749,8 @@ class Detector {
Result> getRxDbitList(Positions pos = {}) const;
/** [CTB] list contains the set of digital signal bits (0-63) to save, must
- * be non repetitive */
+ * be non repetitive. Note: data will be rearranged according to signal bits
+ */
void setRxDbitList(const std::vector &list, Positions pos = {});
/** [CTB] */
@@ -1929,10 +1930,15 @@ class Detector {
void setPatternWaitAddr(int level, int addr, Positions pos = {});
/** [CTB][Mythen3][Xilinx CTB] */
- Result getPatternWaitTime(int level, Positions pos = {}) const;
+ Result getPatternWaitClocks(int level, Positions pos = {}) const;
/** [CTB][Mythen3][Xilinx CTB] Options: level 0-2 */
- void setPatternWaitTime(int level, uint64_t t, Positions pos = {});
+ void setPatternWaitClocks(int level, uint64_t t, Positions pos = {});
+
+ Result getPatternWaitInterval(int level, Positions pos = {}) const;
+
+ /** [CTB][Mythen3][Xilinx CTB] Options: level 0-2 */
+ void setPatternWaitInterval(int level, ns t, Positions pos = {});
/** [CTB][Mythen3][Xilinx CTB] */
Result getPatternMask(Positions pos = {});
diff --git a/slsDetectorSoftware/src/Caller.cpp b/slsDetectorSoftware/src/Caller.cpp
index 6530bfc54..96fd229a1 100644
--- a/slsDetectorSoftware/src/Caller.cpp
+++ b/slsDetectorSoftware/src/Caller.cpp
@@ -7859,19 +7859,30 @@ std::string Caller::patloop(int action) {
return os.str();
}
+ GetLevelAndInsertIntoArgs("patloop");
// check if action and arguments are valid
if (action == slsDetectorDefs::GET_ACTION) {
- if (0) {
+ if (1 && args.size() != 1) {
throw RuntimeError("Wrong number of arguments for action GET");
}
+ if (args.size() == 1) {
+ int level = StringTo(args[0]);
+ }
+
}
else if (action == slsDetectorDefs::PUT_ACTION) {
- if (0) {
+ if (1 && args.size() != 3) {
throw RuntimeError("Wrong number of arguments for action PUT");
}
+ if (args.size() == 3) {
+ int level = StringTo(args[0]);
+ int start = StringTo(args[1]);
+ int stop = StringTo(args[2]);
+ }
+
}
else {
@@ -7882,23 +7893,24 @@ std::string Caller::patloop(int action) {
// generate code for each action
if (action == slsDetectorDefs::GET_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 2;
- GetLevelAndUpdateArgIndex(action, "patloop", level, iArg, nGetArgs,
- nPutArgs);
- auto t = det->getPatternLoopAddresses(level, std::vector{det_id});
- os << level << ' ' << OutStringHex(t, 4) << '\n';
+ if (args.size() == 1) {
+ int level = StringTo(args[0]);
+ auto t =
+ det->getPatternLoopAddresses(level, std::vector{det_id});
+ os << level << ' ' << OutStringHex(t, 4) << '\n';
+ }
}
if (action == slsDetectorDefs::PUT_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 2;
- GetLevelAndUpdateArgIndex(action, "patloop", level, iArg, nGetArgs,
- nPutArgs);
- int start = StringTo(args[iArg++]);
- int stop = StringTo(args[iArg++]);
- det->setPatternLoopAddresses(level, start, stop,
- std::vector{det_id});
- os << level << ' ' << '[' << ToStringHex(start, 4) << ", "
- << ToStringHex(stop, 4) << ']' << '\n';
+ if (args.size() == 3) {
+ int level = StringTo(args[0]);
+ int start = StringTo(args[1]);
+ int stop = StringTo(args[2]);
+ det->setPatternLoopAddresses(level, start, stop,
+ std::vector{det_id});
+ os << level << ' ' << '[' << ToStringHex(start, 4) << ", "
+ << ToStringHex(stop, 4) << ']' << '\n';
+ }
}
return os.str();
@@ -7915,19 +7927,30 @@ std::string Caller::patloop0(int action) {
return os.str();
}
+ GetLevelAndInsertIntoArgs("patloop");
// check if action and arguments are valid
if (action == slsDetectorDefs::GET_ACTION) {
- if (0) {
+ if (1 && args.size() != 1) {
throw RuntimeError("Wrong number of arguments for action GET");
}
+ if (args.size() == 1) {
+ int level = StringTo(args[0]);
+ }
+
}
else if (action == slsDetectorDefs::PUT_ACTION) {
- if (0) {
+ if (1 && args.size() != 3) {
throw RuntimeError("Wrong number of arguments for action PUT");
}
+ if (args.size() == 3) {
+ int level = StringTo(args[0]);
+ int start = StringTo(args[1]);
+ int stop = StringTo(args[2]);
+ }
+
}
else {
@@ -7938,23 +7961,24 @@ std::string Caller::patloop0(int action) {
// generate code for each action
if (action == slsDetectorDefs::GET_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 2;
- GetLevelAndUpdateArgIndex(action, "patloop", level, iArg, nGetArgs,
- nPutArgs);
- auto t = det->getPatternLoopAddresses(level, std::vector{det_id});
- os << OutStringHex(t, 4) << '\n';
+ if (args.size() == 1) {
+ int level = StringTo(args[0]);
+ auto t =
+ det->getPatternLoopAddresses(level, std::vector{det_id});
+ os << OutStringHex(t, 4) << '\n';
+ }
}
if (action == slsDetectorDefs::PUT_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 2;
- GetLevelAndUpdateArgIndex(action, "patloop", level, iArg, nGetArgs,
- nPutArgs);
- int start = StringTo(args[iArg++]);
- int stop = StringTo(args[iArg++]);
- det->setPatternLoopAddresses(level, start, stop,
- std::vector{det_id});
- os << '[' << ToStringHex(start, 4) << ", " << ToStringHex(stop, 4)
- << ']' << '\n';
+ if (args.size() == 3) {
+ int level = StringTo(args[0]);
+ int start = StringTo(args[1]);
+ int stop = StringTo(args[2]);
+ det->setPatternLoopAddresses(level, start, stop,
+ std::vector{det_id});
+ os << '[' << ToStringHex(start, 4) << ", " << ToStringHex(stop, 4)
+ << ']' << '\n';
+ }
}
return os.str();
@@ -7971,19 +7995,30 @@ std::string Caller::patloop1(int action) {
return os.str();
}
+ GetLevelAndInsertIntoArgs("patloop");
// check if action and arguments are valid
if (action == slsDetectorDefs::GET_ACTION) {
- if (0) {
+ if (1 && args.size() != 1) {
throw RuntimeError("Wrong number of arguments for action GET");
}
+ if (args.size() == 1) {
+ int level = StringTo(args[0]);
+ }
+
}
else if (action == slsDetectorDefs::PUT_ACTION) {
- if (0) {
+ if (1 && args.size() != 3) {
throw RuntimeError("Wrong number of arguments for action PUT");
}
+ if (args.size() == 3) {
+ int level = StringTo(args[0]);
+ int start = StringTo(args[1]);
+ int stop = StringTo(args[2]);
+ }
+
}
else {
@@ -7994,23 +8029,24 @@ std::string Caller::patloop1(int action) {
// generate code for each action
if (action == slsDetectorDefs::GET_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 2;
- GetLevelAndUpdateArgIndex(action, "patloop", level, iArg, nGetArgs,
- nPutArgs);
- auto t = det->getPatternLoopAddresses(level, std::vector{det_id});
- os << OutStringHex(t, 4) << '\n';
+ if (args.size() == 1) {
+ int level = StringTo(args[0]);
+ auto t =
+ det->getPatternLoopAddresses(level, std::vector{det_id});
+ os << OutStringHex(t, 4) << '\n';
+ }
}
if (action == slsDetectorDefs::PUT_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 2;
- GetLevelAndUpdateArgIndex(action, "patloop", level, iArg, nGetArgs,
- nPutArgs);
- int start = StringTo(args[iArg++]);
- int stop = StringTo(args[iArg++]);
- det->setPatternLoopAddresses(level, start, stop,
- std::vector{det_id});
- os << '[' << ToStringHex(start, 4) << ", " << ToStringHex(stop, 4)
- << ']' << '\n';
+ if (args.size() == 3) {
+ int level = StringTo(args[0]);
+ int start = StringTo(args[1]);
+ int stop = StringTo(args[2]);
+ det->setPatternLoopAddresses(level, start, stop,
+ std::vector{det_id});
+ os << '[' << ToStringHex(start, 4) << ", " << ToStringHex(stop, 4)
+ << ']' << '\n';
+ }
}
return os.str();
@@ -8027,19 +8063,30 @@ std::string Caller::patloop2(int action) {
return os.str();
}
+ GetLevelAndInsertIntoArgs("patloop");
// check if action and arguments are valid
if (action == slsDetectorDefs::GET_ACTION) {
- if (0) {
+ if (1 && args.size() != 1) {
throw RuntimeError("Wrong number of arguments for action GET");
}
+ if (args.size() == 1) {
+ int level = StringTo(args[0]);
+ }
+
}
else if (action == slsDetectorDefs::PUT_ACTION) {
- if (0) {
+ if (1 && args.size() != 3) {
throw RuntimeError("Wrong number of arguments for action PUT");
}
+ if (args.size() == 3) {
+ int level = StringTo(args[0]);
+ int start = StringTo(args[1]);
+ int stop = StringTo(args[2]);
+ }
+
}
else {
@@ -8050,23 +8097,24 @@ std::string Caller::patloop2(int action) {
// generate code for each action
if (action == slsDetectorDefs::GET_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 2;
- GetLevelAndUpdateArgIndex(action, "patloop", level, iArg, nGetArgs,
- nPutArgs);
- auto t = det->getPatternLoopAddresses(level, std::vector{det_id});
- os << OutStringHex(t, 4) << '\n';
+ if (args.size() == 1) {
+ int level = StringTo(args[0]);
+ auto t =
+ det->getPatternLoopAddresses(level, std::vector{det_id});
+ os << OutStringHex(t, 4) << '\n';
+ }
}
if (action == slsDetectorDefs::PUT_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 2;
- GetLevelAndUpdateArgIndex(action, "patloop", level, iArg, nGetArgs,
- nPutArgs);
- int start = StringTo(args[iArg++]);
- int stop = StringTo(args[iArg++]);
- det->setPatternLoopAddresses(level, start, stop,
- std::vector{det_id});
- os << '[' << ToStringHex(start, 4) << ", " << ToStringHex(stop, 4)
- << ']' << '\n';
+ if (args.size() == 3) {
+ int level = StringTo(args[0]);
+ int start = StringTo(args[1]);
+ int stop = StringTo(args[2]);
+ det->setPatternLoopAddresses(level, start, stop,
+ std::vector{det_id});
+ os << '[' << ToStringHex(start, 4) << ", " << ToStringHex(stop, 4)
+ << ']' << '\n';
+ }
}
return os.str();
@@ -8146,19 +8194,29 @@ std::string Caller::patnloop(int action) {
return os.str();
}
+ GetLevelAndInsertIntoArgs("patnloop");
// check if action and arguments are valid
if (action == slsDetectorDefs::GET_ACTION) {
- if (0) {
+ if (1 && args.size() != 1) {
throw RuntimeError("Wrong number of arguments for action GET");
}
+ if (args.size() == 1) {
+ int level = StringTo(args[0]);
+ }
+
}
else if (action == slsDetectorDefs::PUT_ACTION) {
- if (0) {
+ if (1 && args.size() != 2) {
throw RuntimeError("Wrong number of arguments for action PUT");
}
+ if (args.size() == 2) {
+ int level = StringTo(args[0]);
+ int nloops = StringTo(args[1]);
+ }
+
}
else {
@@ -8169,21 +8227,20 @@ std::string Caller::patnloop(int action) {
// generate code for each action
if (action == slsDetectorDefs::GET_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
- GetLevelAndUpdateArgIndex(action, "patnloop", level, iArg, nGetArgs,
- nPutArgs);
- auto t = det->getPatternLoopCycles(level, std::vector{det_id});
- os << level << ' ' << OutString(t) << '\n';
+ if (args.size() == 1) {
+ int level = StringTo(args[0]);
+ auto t = det->getPatternLoopCycles(level, std::vector{det_id});
+ os << level << ' ' << OutString(t) << '\n';
+ }
}
if (action == slsDetectorDefs::PUT_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
- GetLevelAndUpdateArgIndex(action, "patnloop", level, iArg, nGetArgs,
- nPutArgs);
- std::string nloops = args[iArg++];
- auto arg1 = StringTo(nloops);
- det->setPatternLoopCycles(level, arg1, std::vector{det_id});
- os << level << ' ' << nloops << '\n';
+ if (args.size() == 2) {
+ int level = StringTo(args[0]);
+ int nloops = StringTo(args[1]);
+ det->setPatternLoopCycles(level, nloops, std::vector{det_id});
+ os << level << ' ' << nloops << '\n';
+ }
}
return os.str();
@@ -8200,19 +8257,29 @@ std::string Caller::patnloop0(int action) {
return os.str();
}
+ GetLevelAndInsertIntoArgs("patnloop");
// check if action and arguments are valid
if (action == slsDetectorDefs::GET_ACTION) {
- if (0) {
+ if (1 && args.size() != 1) {
throw RuntimeError("Wrong number of arguments for action GET");
}
+ if (args.size() == 1) {
+ int level = StringTo(args[0]);
+ }
+
}
else if (action == slsDetectorDefs::PUT_ACTION) {
- if (0) {
+ if (1 && args.size() != 2) {
throw RuntimeError("Wrong number of arguments for action PUT");
}
+ if (args.size() == 2) {
+ int level = StringTo(args[0]);
+ int nloops = StringTo(args[1]);
+ }
+
}
else {
@@ -8223,21 +8290,20 @@ std::string Caller::patnloop0(int action) {
// generate code for each action
if (action == slsDetectorDefs::GET_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
- GetLevelAndUpdateArgIndex(action, "patnloop", level, iArg, nGetArgs,
- nPutArgs);
- auto t = det->getPatternLoopCycles(level, std::vector{det_id});
- os << OutString(t) << '\n';
+ if (args.size() == 1) {
+ int level = StringTo(args[0]);
+ auto t = det->getPatternLoopCycles(level, std::vector{det_id});
+ os << OutString(t) << '\n';
+ }
}
if (action == slsDetectorDefs::PUT_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
- GetLevelAndUpdateArgIndex(action, "patnloop", level, iArg, nGetArgs,
- nPutArgs);
- std::string nloops = args[iArg++];
- auto arg1 = StringTo(nloops);
- det->setPatternLoopCycles(level, arg1, std::vector{det_id});
- os << nloops << '\n';
+ if (args.size() == 2) {
+ int level = StringTo(args[0]);
+ int nloops = StringTo(args[1]);
+ det->setPatternLoopCycles(level, nloops, std::vector{det_id});
+ os << nloops << '\n';
+ }
}
return os.str();
@@ -8254,19 +8320,29 @@ std::string Caller::patnloop1(int action) {
return os.str();
}
+ GetLevelAndInsertIntoArgs("patnloop");
// check if action and arguments are valid
if (action == slsDetectorDefs::GET_ACTION) {
- if (0) {
+ if (1 && args.size() != 1) {
throw RuntimeError("Wrong number of arguments for action GET");
}
+ if (args.size() == 1) {
+ int level = StringTo(args[0]);
+ }
+
}
else if (action == slsDetectorDefs::PUT_ACTION) {
- if (0) {
+ if (1 && args.size() != 2) {
throw RuntimeError("Wrong number of arguments for action PUT");
}
+ if (args.size() == 2) {
+ int level = StringTo(args[0]);
+ int nloops = StringTo(args[1]);
+ }
+
}
else {
@@ -8277,21 +8353,20 @@ std::string Caller::patnloop1(int action) {
// generate code for each action
if (action == slsDetectorDefs::GET_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
- GetLevelAndUpdateArgIndex(action, "patnloop", level, iArg, nGetArgs,
- nPutArgs);
- auto t = det->getPatternLoopCycles(level, std::vector{det_id});
- os << OutString(t) << '\n';
+ if (args.size() == 1) {
+ int level = StringTo(args[0]);
+ auto t = det->getPatternLoopCycles(level, std::vector{det_id});
+ os << OutString(t) << '\n';
+ }
}
if (action == slsDetectorDefs::PUT_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
- GetLevelAndUpdateArgIndex(action, "patnloop", level, iArg, nGetArgs,
- nPutArgs);
- std::string nloops = args[iArg++];
- auto arg1 = StringTo(nloops);
- det->setPatternLoopCycles(level, arg1, std::vector{det_id});
- os << nloops << '\n';
+ if (args.size() == 2) {
+ int level = StringTo(args[0]);
+ int nloops = StringTo(args[1]);
+ det->setPatternLoopCycles(level, nloops, std::vector{det_id});
+ os << nloops << '\n';
+ }
}
return os.str();
@@ -8308,19 +8383,29 @@ std::string Caller::patnloop2(int action) {
return os.str();
}
+ GetLevelAndInsertIntoArgs("patnloop");
// check if action and arguments are valid
if (action == slsDetectorDefs::GET_ACTION) {
- if (0) {
+ if (1 && args.size() != 1) {
throw RuntimeError("Wrong number of arguments for action GET");
}
+ if (args.size() == 1) {
+ int level = StringTo(args[0]);
+ }
+
}
else if (action == slsDetectorDefs::PUT_ACTION) {
- if (0) {
+ if (1 && args.size() != 2) {
throw RuntimeError("Wrong number of arguments for action PUT");
}
+ if (args.size() == 2) {
+ int level = StringTo(args[0]);
+ int nloops = StringTo(args[1]);
+ }
+
}
else {
@@ -8331,21 +8416,20 @@ std::string Caller::patnloop2(int action) {
// generate code for each action
if (action == slsDetectorDefs::GET_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
- GetLevelAndUpdateArgIndex(action, "patnloop", level, iArg, nGetArgs,
- nPutArgs);
- auto t = det->getPatternLoopCycles(level, std::vector{det_id});
- os << OutString(t) << '\n';
+ if (args.size() == 1) {
+ int level = StringTo(args[0]);
+ auto t = det->getPatternLoopCycles(level, std::vector{det_id});
+ os << OutString(t) << '\n';
+ }
}
if (action == slsDetectorDefs::PUT_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
- GetLevelAndUpdateArgIndex(action, "patnloop", level, iArg, nGetArgs,
- nPutArgs);
- std::string nloops = args[iArg++];
- auto arg1 = StringTo(nloops);
- det->setPatternLoopCycles(level, arg1, std::vector{det_id});
- os << nloops << '\n';
+ if (args.size() == 2) {
+ int level = StringTo(args[0]);
+ int nloops = StringTo(args[1]);
+ det->setPatternLoopCycles(level, nloops, std::vector{det_id});
+ os << nloops << '\n';
+ }
}
return os.str();
@@ -8503,19 +8587,29 @@ std::string Caller::patwait(int action) {
return os.str();
}
+ GetLevelAndInsertIntoArgs("patwait");
// check if action and arguments are valid
if (action == slsDetectorDefs::GET_ACTION) {
- if (0) {
+ if (1 && args.size() != 1) {
throw RuntimeError("Wrong number of arguments for action GET");
}
+ if (args.size() == 1) {
+ int level = StringTo(args[0]);
+ }
+
}
else if (action == slsDetectorDefs::PUT_ACTION) {
- if (0) {
+ if (1 && args.size() != 2) {
throw RuntimeError("Wrong number of arguments for action PUT");
}
+ if (args.size() == 2) {
+ int level = StringTo(args[0]);
+ int addr = StringTo(args[1]);
+ }
+
}
else {
@@ -8526,20 +8620,20 @@ std::string Caller::patwait(int action) {
// generate code for each action
if (action == slsDetectorDefs::GET_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
- GetLevelAndUpdateArgIndex(action, "patwait", level, iArg, nGetArgs,
- nPutArgs);
- auto t = det->getPatternWaitAddr(level, std::vector{det_id});
- os << level << ' ' << OutStringHex(t, 4) << '\n';
+ if (args.size() == 1) {
+ int level = StringTo(args[0]);
+ auto t = det->getPatternWaitAddr(level, std::vector{det_id});
+ os << level << ' ' << OutStringHex(t, 4) << '\n';
+ }
}
if (action == slsDetectorDefs::PUT_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
- GetLevelAndUpdateArgIndex(action, "patwait", level, iArg, nGetArgs,
- nPutArgs);
- int addr = StringTo(args[iArg++]);
- det->setPatternWaitAddr(level, addr, std::vector{det_id});
- os << level << ' ' << ToStringHex(addr, 4) << '\n';
+ if (args.size() == 2) {
+ int level = StringTo(args[0]);
+ int addr = StringTo(args[1]);
+ det->setPatternWaitAddr(level, addr, std::vector{det_id});
+ os << level << ' ' << ToStringHex(addr, 4) << '\n';
+ }
}
return os.str();
@@ -8556,19 +8650,29 @@ std::string Caller::patwait0(int action) {
return os.str();
}
+ GetLevelAndInsertIntoArgs("patwait");
// check if action and arguments are valid
if (action == slsDetectorDefs::GET_ACTION) {
- if (0) {
+ if (1 && args.size() != 1) {
throw RuntimeError("Wrong number of arguments for action GET");
}
+ if (args.size() == 1) {
+ int level = StringTo(args[0]);
+ }
+
}
else if (action == slsDetectorDefs::PUT_ACTION) {
- if (0) {
+ if (1 && args.size() != 2) {
throw RuntimeError("Wrong number of arguments for action PUT");
}
+ if (args.size() == 2) {
+ int level = StringTo(args[0]);
+ int addr = StringTo(args[1]);
+ }
+
}
else {
@@ -8579,20 +8683,20 @@ std::string Caller::patwait0(int action) {
// generate code for each action
if (action == slsDetectorDefs::GET_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
- GetLevelAndUpdateArgIndex(action, "patwait", level, iArg, nGetArgs,
- nPutArgs);
- auto t = det->getPatternWaitAddr(level, std::vector{det_id});
- os << OutStringHex(t, 4) << '\n';
+ if (args.size() == 1) {
+ int level = StringTo(args[0]);
+ auto t = det->getPatternWaitAddr(level, std::vector{det_id});
+ os << OutStringHex(t, 4) << '\n';
+ }
}
if (action == slsDetectorDefs::PUT_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
- GetLevelAndUpdateArgIndex(action, "patwait", level, iArg, nGetArgs,
- nPutArgs);
- int addr = StringTo(args[iArg++]);
- det->setPatternWaitAddr(level, addr, std::vector{det_id});
- os << ToStringHex(addr, 4) << '\n';
+ if (args.size() == 2) {
+ int level = StringTo(args[0]);
+ int addr = StringTo(args[1]);
+ det->setPatternWaitAddr(level, addr, std::vector{det_id});
+ os << ToStringHex(addr, 4) << '\n';
+ }
}
return os.str();
@@ -8609,19 +8713,29 @@ std::string Caller::patwait1(int action) {
return os.str();
}
+ GetLevelAndInsertIntoArgs("patwait");
// check if action and arguments are valid
if (action == slsDetectorDefs::GET_ACTION) {
- if (0) {
+ if (1 && args.size() != 1) {
throw RuntimeError("Wrong number of arguments for action GET");
}
+ if (args.size() == 1) {
+ int level = StringTo(args[0]);
+ }
+
}
else if (action == slsDetectorDefs::PUT_ACTION) {
- if (0) {
+ if (1 && args.size() != 2) {
throw RuntimeError("Wrong number of arguments for action PUT");
}
+ if (args.size() == 2) {
+ int level = StringTo(args[0]);
+ int addr = StringTo(args[1]);
+ }
+
}
else {
@@ -8632,20 +8746,20 @@ std::string Caller::patwait1(int action) {
// generate code for each action
if (action == slsDetectorDefs::GET_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
- GetLevelAndUpdateArgIndex(action, "patwait", level, iArg, nGetArgs,
- nPutArgs);
- auto t = det->getPatternWaitAddr(level, std::vector{det_id});
- os << OutStringHex(t, 4) << '\n';
+ if (args.size() == 1) {
+ int level = StringTo(args[0]);
+ auto t = det->getPatternWaitAddr(level, std::vector{det_id});
+ os << OutStringHex(t, 4) << '\n';
+ }
}
if (action == slsDetectorDefs::PUT_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
- GetLevelAndUpdateArgIndex(action, "patwait", level, iArg, nGetArgs,
- nPutArgs);
- int addr = StringTo(args[iArg++]);
- det->setPatternWaitAddr(level, addr, std::vector{det_id});
- os << ToStringHex(addr, 4) << '\n';
+ if (args.size() == 2) {
+ int level = StringTo(args[0]);
+ int addr = StringTo(args[1]);
+ det->setPatternWaitAddr(level, addr, std::vector{det_id});
+ os << ToStringHex(addr, 4) << '\n';
+ }
}
return os.str();
@@ -8662,19 +8776,29 @@ std::string Caller::patwait2(int action) {
return os.str();
}
+ GetLevelAndInsertIntoArgs("patwait");
// check if action and arguments are valid
if (action == slsDetectorDefs::GET_ACTION) {
- if (0) {
+ if (1 && args.size() != 1) {
throw RuntimeError("Wrong number of arguments for action GET");
}
+ if (args.size() == 1) {
+ int level = StringTo(args[0]);
+ }
+
}
else if (action == slsDetectorDefs::PUT_ACTION) {
- if (0) {
+ if (1 && args.size() != 2) {
throw RuntimeError("Wrong number of arguments for action PUT");
}
+ if (args.size() == 2) {
+ int level = StringTo(args[0]);
+ int addr = StringTo(args[1]);
+ }
+
}
else {
@@ -8685,233 +8809,20 @@ std::string Caller::patwait2(int action) {
// generate code for each action
if (action == slsDetectorDefs::GET_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
- GetLevelAndUpdateArgIndex(action, "patwait", level, iArg, nGetArgs,
- nPutArgs);
- auto t = det->getPatternWaitAddr(level, std::vector{det_id});
- os << OutStringHex(t, 4) << '\n';
+ if (args.size() == 1) {
+ int level = StringTo(args[0]);
+ auto t = det->getPatternWaitAddr(level, std::vector{det_id});
+ os << OutStringHex(t, 4) << '\n';
+ }
}
if (action == slsDetectorDefs::PUT_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
- GetLevelAndUpdateArgIndex(action, "patwait", level, iArg, nGetArgs,
- nPutArgs);
- int addr = StringTo(args[iArg++]);
- det->setPatternWaitAddr(level, addr, std::vector{det_id});
- os << ToStringHex(addr, 4) << '\n';
- }
-
- return os.str();
-}
-
-std::string Caller::patwaittime(int action) {
-
- std::ostringstream os;
- // print help
- if (action == slsDetectorDefs::HELP_ACTION) {
- os << R"V0G0N([0-6] [n_clk]
- [Ctb][Mythen3][Xilinx Ctb] Wait time in clock cycles for the loop provided.
- [Mythen3] Level options: 0-3 only. )V0G0N"
- << std::endl;
- return os.str();
- }
-
- // check if action and arguments are valid
- if (action == slsDetectorDefs::GET_ACTION) {
- if (0) {
- throw RuntimeError("Wrong number of arguments for action GET");
+ if (args.size() == 2) {
+ int level = StringTo(args[0]);
+ int addr = StringTo(args[1]);
+ det->setPatternWaitAddr(level, addr, std::vector{det_id});
+ os << ToStringHex(addr, 4) << '\n';
}
-
- }
-
- else if (action == slsDetectorDefs::PUT_ACTION) {
- if (0) {
- throw RuntimeError("Wrong number of arguments for action PUT");
- }
-
- }
-
- else {
-
- throw RuntimeError("INTERNAL ERROR: Invalid action: supported actions "
- "are ['GET', 'PUT']");
- }
-
- // generate code for each action
- if (action == slsDetectorDefs::GET_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
- GetLevelAndUpdateArgIndex(action, "patwaittime", level, iArg, nGetArgs,
- nPutArgs);
- auto t = det->getPatternWaitTime(level, std::vector{det_id});
- os << level << ' ' << OutString(t) << '\n';
- }
-
- if (action == slsDetectorDefs::PUT_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
- GetLevelAndUpdateArgIndex(action, "patwaittime", level, iArg, nGetArgs,
- nPutArgs);
- uint64_t waittime = StringTo(args[iArg++]);
- det->setPatternWaitTime(level, waittime, std::vector{det_id});
- os << level << ' ' << waittime << '\n';
- }
-
- return os.str();
-}
-
-std::string Caller::patwaittime0(int action) {
-
- std::ostringstream os;
- // print help
- if (action == slsDetectorDefs::HELP_ACTION) {
- os << R"V0G0N(
- Deprecated command. Use patwaittime. )V0G0N"
- << std::endl;
- return os.str();
- }
-
- // check if action and arguments are valid
- if (action == slsDetectorDefs::GET_ACTION) {
- if (0) {
- throw RuntimeError("Wrong number of arguments for action GET");
- }
-
- }
-
- else if (action == slsDetectorDefs::PUT_ACTION) {
- if (0) {
- throw RuntimeError("Wrong number of arguments for action PUT");
- }
-
- }
-
- else {
-
- throw RuntimeError("INTERNAL ERROR: Invalid action: supported actions "
- "are ['GET', 'PUT']");
- }
-
- // generate code for each action
- if (action == slsDetectorDefs::GET_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
- GetLevelAndUpdateArgIndex(action, "patwaittime", level, iArg, nGetArgs,
- nPutArgs);
- auto t = det->getPatternWaitTime(level, std::vector{det_id});
- os << OutString(t) << '\n';
- }
-
- if (action == slsDetectorDefs::PUT_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
- GetLevelAndUpdateArgIndex(action, "patwaittime", level, iArg, nGetArgs,
- nPutArgs);
- uint64_t waittime = StringTo(args[iArg++]);
- det->setPatternWaitTime(level, waittime, std::vector{det_id});
- os << waittime << '\n';
- }
-
- return os.str();
-}
-
-std::string Caller::patwaittime1(int action) {
-
- std::ostringstream os;
- // print help
- if (action == slsDetectorDefs::HELP_ACTION) {
- os << R"V0G0N(
- Deprecated command. Use patwaittime. )V0G0N"
- << std::endl;
- return os.str();
- }
-
- // check if action and arguments are valid
- if (action == slsDetectorDefs::GET_ACTION) {
- if (0) {
- throw RuntimeError("Wrong number of arguments for action GET");
- }
-
- }
-
- else if (action == slsDetectorDefs::PUT_ACTION) {
- if (0) {
- throw RuntimeError("Wrong number of arguments for action PUT");
- }
-
- }
-
- else {
-
- throw RuntimeError("INTERNAL ERROR: Invalid action: supported actions "
- "are ['GET', 'PUT']");
- }
-
- // generate code for each action
- if (action == slsDetectorDefs::GET_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
- GetLevelAndUpdateArgIndex(action, "patwaittime", level, iArg, nGetArgs,
- nPutArgs);
- auto t = det->getPatternWaitTime(level, std::vector{det_id});
- os << OutString(t) << '\n';
- }
-
- if (action == slsDetectorDefs::PUT_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
- GetLevelAndUpdateArgIndex(action, "patwaittime", level, iArg, nGetArgs,
- nPutArgs);
- uint64_t waittime = StringTo(args[iArg++]);
- det->setPatternWaitTime(level, waittime, std::vector{det_id});
- os << waittime << '\n';
- }
-
- return os.str();
-}
-
-std::string Caller::patwaittime2(int action) {
-
- std::ostringstream os;
- // print help
- if (action == slsDetectorDefs::HELP_ACTION) {
- os << R"V0G0N(
- Deprecated command. Use patwaittime. )V0G0N"
- << std::endl;
- return os.str();
- }
-
- // check if action and arguments are valid
- if (action == slsDetectorDefs::GET_ACTION) {
- if (0) {
- throw RuntimeError("Wrong number of arguments for action GET");
- }
-
- }
-
- else if (action == slsDetectorDefs::PUT_ACTION) {
- if (0) {
- throw RuntimeError("Wrong number of arguments for action PUT");
- }
-
- }
-
- else {
-
- throw RuntimeError("INTERNAL ERROR: Invalid action: supported actions "
- "are ['GET', 'PUT']");
- }
-
- // generate code for each action
- if (action == slsDetectorDefs::GET_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
- GetLevelAndUpdateArgIndex(action, "patwaittime", level, iArg, nGetArgs,
- nPutArgs);
- auto t = det->getPatternWaitTime(level, std::vector{det_id});
- os << OutString(t) << '\n';
- }
-
- if (action == slsDetectorDefs::PUT_ACTION) {
- int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
- GetLevelAndUpdateArgIndex(action, "patwaittime", level, iArg, nGetArgs,
- nPutArgs);
- uint64_t waittime = StringTo(args[iArg++]);
- det->setPatternWaitTime(level, waittime, std::vector{det_id});
- os << waittime << '\n';
}
return os.str();
diff --git a/slsDetectorSoftware/src/Caller.h b/slsDetectorSoftware/src/Caller.h
index b1f1e58b3..65958653c 100644
--- a/slsDetectorSoftware/src/Caller.h
+++ b/slsDetectorSoftware/src/Caller.h
@@ -19,10 +19,7 @@ class Caller {
IpAddr getDstIpFromAuto();
IpAddr getSrcIpFromAuto();
UdpDestination getUdpEntry();
- void GetLevelAndUpdateArgIndex(int action,
- std::string levelSeparatedCommand,
- int &level, int &iArg, size_t nGetArgs,
- size_t nPutArgs);
+ int GetLevelAndInsertIntoArgs(std::string levelSeparatedCommand);
void WrongNumberOfParameters(size_t expected);
template std::string OutStringHex(const V &value) {
@@ -207,9 +204,6 @@ class Caller {
std::string patwait1(int action);
std::string patwait2(int action);
std::string patwaittime(int action);
- std::string patwaittime0(int action);
- std::string patwaittime1(int action);
- std::string patwaittime2(int action);
std::string patword(int action);
std::string pedestalmode(int action);
std::string period(int action);
@@ -556,9 +550,9 @@ class Caller {
{"patwait1", &Caller::patwait1},
{"patwait2", &Caller::patwait2},
{"patwaittime", &Caller::patwaittime},
- {"patwaittime0", &Caller::patwaittime0},
- {"patwaittime1", &Caller::patwaittime1},
- {"patwaittime2", &Caller::patwaittime2},
+ {"patwaittime0", &Caller::patwaittime},
+ {"patwaittime1", &Caller::patwaittime},
+ {"patwaittime2", &Caller::patwaittime},
{"patword", &Caller::patword},
{"pedestalmode", &Caller::pedestalmode},
{"period", &Caller::period},
diff --git a/slsDetectorSoftware/src/CallerSpecial.cpp b/slsDetectorSoftware/src/CallerSpecial.cpp
index fc0a2bfa3..12e02b0ff 100644
--- a/slsDetectorSoftware/src/CallerSpecial.cpp
+++ b/slsDetectorSoftware/src/CallerSpecial.cpp
@@ -175,28 +175,16 @@ void Caller::WrongNumberOfParameters(size_t expected) {
std::to_string(args.size()) + "\n");
}
-void Caller::GetLevelAndUpdateArgIndex(int action,
- std::string levelSeparatedCommand,
- int &level, int &iArg, size_t nGetArgs,
- size_t nPutArgs) {
- if (cmd == levelSeparatedCommand) {
- ++nGetArgs;
- ++nPutArgs;
- } else {
+int Caller::GetLevelAndInsertIntoArgs(std::string levelSeparatedCommand) {
+ if (cmd != levelSeparatedCommand) {
LOG(logWARNING) << "This command is deprecated and will be removed. "
"Please migrate to "
<< levelSeparatedCommand;
+ int level = cmd[cmd.find_first_of("012")] - '0';
+ args.insert(args.begin(), std::to_string(level));
+ return true;
}
- if (action == defs::GET_ACTION && args.size() != nGetArgs) {
- WrongNumberOfParameters(nGetArgs);
- } else if (action == defs::PUT_ACTION && args.size() != nPutArgs) {
- WrongNumberOfParameters(nPutArgs);
- }
- if (cmd == levelSeparatedCommand) {
- level = StringTo(args[iArg++]);
- } else {
- level = cmd[cmd.find_first_of("012")] - '0';
- }
+ return false;
}
std::string Caller::free(int action) {
@@ -1017,13 +1005,94 @@ std::string Caller::slowadc(int action) {
}
return os.str();
}
+std::string Caller::patwaittime(int action) {
+ std::ostringstream os;
+
+ if (action == defs::HELP_ACTION) {
+ os << "[0-6] [n_clk] \n\t[Ctb][Mythen3][Xilinx Ctb] Wait time in clock "
+ "cycles for the loop provided.\n\t[Mythen3] Level options: 0-3 "
+ "only."
+ << '\n';
+ return os.str();
+ }
+
+ // parse level
+ bool deprecated_cmd = GetLevelAndInsertIntoArgs("patwaittime");
+ int level = 0;
+ try {
+ if (args.size() > 0)
+ level = StringTo(args[0]);
+ } catch (const std::exception &e) {
+ LOG(logERROR) << "Could not scan level.";
+ throw;
+ }
+ if (!deprecated_cmd && args.size() >= 1)
+ os << args[0] << ' ';
+
+ if (action == defs::GET_ACTION) {
+ if (args.size() != 1 && args.size() != 2)
+ WrongNumberOfParameters(1);
+ // with time unit
+ if (args.size() == 2) {
+ auto t =
+ det->getPatternWaitInterval(level, std::vector{det_id});
+ os << OutString(t, args[1]) << '\n';
+ }
+ // in clocks
+ else {
+ auto t = det->getPatternWaitClocks(level, std::vector{det_id});
+ os << OutString(t) << '\n';
+ }
+ } else if (action == defs::PUT_ACTION) {
+ if (args.size() != 2 && args.size() != 3)
+ WrongNumberOfParameters(2);
+ // clocks (all digits)
+ if (args.size() == 2 &&
+ std::all_of(args[1].begin(), args[1].end(), ::isdigit)) {
+ uint64_t waittime = StringTo(args[1]);
+ det->setPatternWaitClocks(level, waittime,
+ std::vector{det_id});
+ os << waittime << '\n';
+ }
+ // time
+ else {
+ time::ns converted_time{0};
+ try {
+ if (args.size() == 2) {
+ std::string tmp_time(args[1]);
+ std::string unit = RemoveUnit(tmp_time);
+ converted_time = StringTo(tmp_time, unit);
+ } else {
+ converted_time = StringTo(args[1], args[2]);
+ }
+ } catch (...) {
+ throw RuntimeError("Could not convert argument to time::ns");
+ }
+ det->setPatternWaitInterval(level, converted_time,
+ std::vector