From 996e82c70c35b0bc97baa144e0928a5bfdeb46bb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnter=20Quast?= <guenter.quast@online.de>
Date: Fri, 7 Jun 2024 15:30:43 +0200
Subject: [PATCH] fixes to mimiCoRB interface

---
 redPoscdaq.py | 24 +++++++++++-------------
 rpControl.ui  |  4 ++--
 2 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/redPoscdaq.py b/redPoscdaq.py
index efb96ff..a25b4ca 100755
--- a/redPoscdaq.py
+++ b/redPoscdaq.py
@@ -113,12 +113,12 @@ class rpControl(QMainWindow, Ui_MCPHA):
         self.callback_function = callback
         self.confd = {} if conf_dict is None else conf_dict
         self.callback = True if callback is not None else False
-        # get command line arguments
-        self.parse_args()
-#        if conf_dict is None:        
-#           self.parse_args()
-#        else:
-#           self.parse_confd()
+        # get configuration from command line or config dict
+        if conf_dict is None:
+             self.parse_args()
+        else:
+            self.parse_confd()
+        
         # set physical units (for axis labels)
         self.get_physical_units()
         self.setupUi(self)
@@ -200,8 +200,7 @@ class rpControl(QMainWindow, Ui_MCPHA):
         parser.add_argument('--no-daq', dest='daq_mode', action='store_false',
                             help='do not start in DAQ mode' )
         parser.add_argument('-f', '--file', type=str, default='',
-                            help='file name')
-        
+                            help='file name')        
         args = parser.parse_args()
         # all relevant parameters are here
         self.ip_address = args.connect_ip
@@ -227,8 +226,8 @@ class rpControl(QMainWindow, Ui_MCPHA):
             else self.confd["pre_trigger_samples"]/self.sample_size
         self.trigger_mode = 0 if "trigger_mode" not in self.confd else\
             1 if self.confd["trigger_mode"] == "auto" else 0
-        self.trigger_source = 1  if "trigger_channel" not in self.confd \
-            else int(self.confd["trigger_channel"])
+        self.trigger_source = 0  if "trigger_channel" not in self.confd \
+            else int(self.confd["trigger_channel"])-1
         self.trigger_level = 500 if "trigger_level" not in self.confd else self.confd["trigger_level"]
         self.trigger_slope = 0 if "trigger_direction" not in self.confd else\
             0 if self.confd["trigger_direction"] == "rising" else 1
@@ -917,6 +916,5 @@ def run_rpControl(callback=None, conf_dict=None):
 if __name__ == '__main__': # --------------------------------------------
 #    run_rpControl()
 
-    sink = redP_consumer()
-    print(sys.argv)
-    run_rpControl(callback=sink.data_sink)
+    data_processor = redP_consumer()
+    run_rpControl(callback=data_processor.data_sink)
diff --git a/rpControl.ui b/rpControl.ui
index db1fe4c..cce47f0 100644
--- a/rpControl.ui
+++ b/rpControl.ui
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <ui version="4.0">
  <class>MCPHA</class>
- <widget class="QMainWindow" name="MCPHA">
+ <widget class="QMainWindow" name="OscilloscopeDAQ">
   <property name="geometry">
    <rect>
     <x>0</x>
@@ -17,7 +17,7 @@
    </size>
   </property>
   <property name="windowTitle">
-   <string>Multichannel Pulse Height Analyzer</string>
+   <string>Oscilloscope DAQ</string>
   </property>
   <widget class="QWidget" name="centralWidget">
    <layout class="QVBoxLayout" name="verticalLayout">
-- 
GitLab