From 9cda8f08736d0ce978b67a07f24930b04bad85ad Mon Sep 17 00:00:00 2001
From: Guenter Quast <guenter.quast@online.de>
Date: Fri, 7 Jun 2024 00:28:58 +0200
Subject: [PATCH] working version of mimoCoRB interface

---
 redPoscdaq.py | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/redPoscdaq.py b/redPoscdaq.py
index 8449191..b4c83cb 100755
--- a/redPoscdaq.py
+++ b/redPoscdaq.py
@@ -106,6 +106,9 @@ class rpControl(QMainWindow, Ui_MCPHA):
              callback: function receiving recorded waveforms
         """
         super(rpControl, self).__init__()
+
+        plt.style.use("default") # set graphics style
+
         self.callback_function = callback
         self.callback = True
         # get command line arguments
@@ -864,14 +867,17 @@ class redP_mimocorb():
         self.active=True
         
     def data_sink(self, data):
-        """function called by redPoscdaq 
-           this simple version calculates statistics only
+        """function called by redPoscdaq  
         """
-        while (self.events_required == 0 or self.event_count < self.events_required) and self.active:
+        if (self.events_required == 0 or self.event_count < self.events_required) and self.active:
            # deliver pulse data and no metadata
-           active = self.action(data/5000., None)
+           active = self.action(data, None) # send data
            self.event_count += 1
-  
+        else:
+           active = self.action(None, None) # send None to signal end
+           print("redPoscdaq exiting") 
+           sys.exit()
+           
 def run_rpControl(callback=None):
     # start redPidaya GUI under Qt5 
     app = QApplication(sys.argv)
-- 
GitLab