Browse Source

refactoring spectrometer_service 2/2

unknown 3 days ago
parent
commit
fbc1a3d949

+ 3 - 0
spectrometer_service/mserv00/bin/picologs/pico-log-20250827-121403.txt

@@ -0,0 +1,3 @@
+[2025-08-27 12:14:03:884] / [INFO]	Open socket
+[2025-08-27 12:14:03:885] / [INFO]	Socket initialized!
+[2025-08-27 12:14:03:885] / [INFO]	Wait for connection...

BIN
spectrometer_service/mserv00/bin/picologs/pico-log-20250827-123005.txt


BIN
spectrometer_service/mserv00/bin/picologs/pico-log-20250827-130006.txt


BIN
spectrometer_service/mserv00/bin/picologs/pico-log-20250827-134103.txt


BIN
spectrometer_service/mserv00/bin/picologs/pico-log-20250827-134238.txt


BIN
spectrometer_service/mserv00/db.sqlite3


BIN
spectrometer_service/mserv00/spectrometer/__pycache__/engine.cpython-313.pyc


+ 243 - 214
spectrometer_service/mserv00/spectrometer/engine.py

@@ -73,10 +73,24 @@ class DefaultEngine:
         ret = self.sync_interface.upload(str(settings.BASE_DIR) + '\\bin\\Sync.exe',
                                         self.measure.info.isync.file,
                                         self.measure.info.isync.port)
+        
+        if(ret != 0):
+            self.measure.state.grax.status = 'CONFIG ERROR'
+            self.measure.state.grax.code = -1
+            self.measure.state.status = 'SYNC ERROR'
+            self.measure.state.code = -1
+            self.lock.acquire()
+            self.measure.state.grax.save()
+            self.measure.state.save()
+            self.measure.save()
+            self.lock.release()
+            return -1
 
         # Final configuration: set the status to configured for sync and overall.
         self.measure.state.sync.status = 'CONFIGURED'
         self.measure.state.sync.code = 1
+        self.measure.state.status = 'SYNC CONFIGURED'
+        self.measure.state.code = 1
 
         self.lock.acquire()
         self.measure.state.sync.save()
@@ -101,6 +115,8 @@ class DefaultEngine:
             return -1
         self.measure.state.sync.status = 'WAIT FOR TRIGGER'
         self.measure.state.sync.code = 2
+        self.measure.state.status = 'SYNC WAIT'
+        self.measure.state.code = 2
         print('SENDED')
         return 0
 
@@ -277,12 +293,224 @@ class DefaultEngine:
         
         self.measure.state.graz.code = 1
         self.measure.state.graz.status = 'CONFIGURED'
+        self.measure.state.status = 'GRA CONFIGURED'
+        self.measure.state.code = 2
+        
         self.lock.acquire()
         self.measure.state.graz.save()
         self.measure.state.save()
         self.measure.save()
         self.lock.release()
+        return 0
+
+    def adcUp(self):
+        try:
+            self.adc_interface.connect()
+        except:
+            self.measure.state.adc.status = 'CONN ERROR'
+            self.measure.state.adc.code = -1
+            self.measure.state.status = 'ADC ERROR'
+            self.measure.state.code = -3
+            self.lock.acquire()
+            self.measure.state.adc.save()
+            self.measure.state.save()
+            self.measure.save()
+            self.lock.release()
+            self.adc_interface.client_socket.close()
+            return -1
         
+        ret = self.adc_interface.open()
+        if(ret[0] == 0xFF):
+            self.measure.state.adc.status = 'OPEN ERROR'
+            self.measure.state.adc.code = -2
+            self.measure.state.status = 'ADC ERROR'
+            self.measure.state.code = -3
+            self.lock.acquire()
+            self.measure.state.adc.save()
+            self.measure.state.save()
+            self.measure.save()
+            self.lock.release()
+            self.adc_interface.client_socket.close()
+            return ret
+        self.measure.state.adc.status = 'OPENED'
+        self.measure.state.adc.code = 1
+        self.measure.state.status = 'ADC OPENED'
+        self.measure.state.code = 3
+        self.lock.acquire()
+        self.measure.state.sync.save()
+        self.measure.state.save()
+        self.measure.save()
+        self.lock.release()
+        print('UPDATED')
+        return 0
+
+    def adcConfig(self):
+        rate = self.measure.info.iadc.srate
+        ret = self.adc_interface.set_rate(rate)
+        if(ret[0] == 0xFF):
+            self.measure.state.adc.status = 'RATE ERROR'
+            self.measure.state.adc.code = -3
+            self.measure.state.status = 'ADC ERROR'
+            self.measure.state.code = -3
+            self.lock.acquire()
+            self.measure.state.adc.save()
+            self.measure.state.save()
+            self.measure.save()
+            self.lock.release()
+            self.adc_interface.client_socket.close()
+            return ret
+        
+        points = self.measure.info.iadc.points
+        ret = self.adc_interface.set_points(points)
+        if(ret[0] == 0xFF):
+            self.measure.state.adc.status = 'POINTS ERROR'
+            self.measure.state.adc.code = -4
+            self.measure.state.status = 'ADC ERROR'
+            self.measure.state.code = -3
+            self.lock.acquire()
+            self.measure.state.adc.save()
+            self.measure.state.save()
+            self.measure.save()
+            self.lock.release()
+            self.adc_interface.client_socket.close()
+            return ret
+        
+        ret = self.adc_interface.config_channels(self.measure.info.iadc.n_channels,
+                                                self.measure.info.iadc.channel_ranges,
+                                                self.measure.info.iadc.trigger_channel, 
+                                                self.measure.info.iadc.trig_direction,
+                                                self.measure.info.iadc.threshold,
+                                                self.measure.info.iadc.auto_measure_time)
+        if(ret[0] == 0xFF):
+            self.measure.state.adc.status = 'TRIGGER CONFIG ERROR'
+            self.measure.state.adc.code = -5
+            self.measure.state.status = 'ADC ERROR'
+            self.measure.state.code = -3
+            self.lock.acquire()
+            self.measure.state.adc.save()
+            self.measure.state.save()
+            self.measure.save()
+            self.lock.release()
+            self.adc_interface.client_socket.close()
+            return ret
+        
+        ret = self.adc_interface.set_premeasure(0)
+        if(ret[0] == 0xFF):
+            self.measure.state.adc.status = 'SET PREMEASURE ERROR'
+            self.measure.state.adc.code = -6
+            self.measure.state.status = 'ADC ERROR'
+            self.measure.state.code = -3
+            self.lock.acquire()
+            self.measure.state.adc.save()
+            self.measure.state.save()
+            self.measure.save()
+            self.lock.release()
+            self.adc_interface.client_socket.close()
+            return ret
+        
+        ret = self.adc_interface.set_trignum(self.measure.info.iadc.n_triggers)
+        if(ret[0] == 0xFF):
+            self.measure.state.adc.status = 'SET PREMEASURE ERROR'
+            self.measure.state.adc.code = -6
+            self.measure.state.status = 'ADC ERROR'
+            self.measure.state.code = -3
+            self.lock.acquire()
+            self.measure.state.adc.save()
+            self.measure.state.save()
+            self.measure.save()
+            self.lock.release()
+            self.adc_interface.client_socket.close()
+            return ret
+        self.measure.state.adc.status = 'CONFIGURED'
+        self.measure.state.adc.code = 2
+        self.measure.state.status = 'ADC CONFIGURED'
+        self.measure.state.code = 3
+        self.lock.acquire()
+        self.measure.state.sync.save()
+        self.measure.state.save()
+        self.measure.save()
+        self.lock.release()
+        print('UPDATED')
+        return 0
+
+    def sdrUp(self, thr):
+        ret = self.sdr_interface.transf(str(settings.BASE_DIR) + '\\bin\\hackrftrans00.exe',
+                                        self.measure.info.isdr.file,
+                                        self.measure.info.isdr.freq,
+                                        self.measure.info.isdr.srate,
+                                        int(self.measure.info.isdr.ampl),
+                                        self.measure.info.isdr.gain)
+        if(ret[0] == 0xFF):
+            self.measure.state.sdr.status = 'SDR ERROR (WAIT FOR STOPING ADC!)'
+            self.measure.state.sdr.code = -1
+            self.measure.state.status = 'SDR ERROR'
+            self.measure.state.code = -3
+            self.lock.acquire()
+            self.measure.state.sdr.save()
+            self.measure.state.save()
+            self.measure.save()
+            self.lock.release()
+            if(thr != None):
+                thr.join()
+            self.measure.state.sdr.status = 'SDR ERROR'
+            self.measure.state.sdr.code = -2
+            self.lock.acquire()
+            self.measure.state.sdr.save()
+            self.measure.state.save()
+            self.measure.save()
+            self.lock.release()
+            self.adc_interface.client_socket.close()
+            return ret
+        self.measure.state.sdr.status = 'STARTED'
+        self.measure.state.sdr.code = 1
+        self.measure.state.status = 'SDR START'
+        self.measure.state.code = 4
+        self.lock.acquire()
+        self.measure.state.sdr.save()
+        self.measure.state.save()
+        self.measure.save()
+        self.lock.release()
+        return 0
+
+    def adcWrite(self, k):
+        self.lock.acquire()
+        for i in range(len(self.adc_interface.ndata)):
+            data = models.measurement_data.objects.create(data_num=i, averaging_num=k, measurement=self.measure)
+            for j in range(len(self.adc_interface.ndata[i])):
+                cdata = data.channel_data.create(channel_num=j,
+                                        measurement_data=data,
+                                        channel_data=base64.b64encode(self.adc_interface.ndata[i][j]).decode('utf-8'))
+                cdata.save()
+                data.save()
+        self.measure.save()
+        self.lock.release()
+        self.adc_interface.clear_ndata()
+        tm.sleep(1)
+        return 0
+    
+    def close(self):
+        ret = self.sync_interface.serial_close()
+        if(self.measure.info.iadc.enabled):
+            self.adc_interface.client_socket.close()
+
+        self.measure.state.adc.status = 'MEASURE COMPLETED'
+        self.measure.state.data_ready = True
+        self.measure.state.adc.code = 1
+        self.measure.state.status = 'MEASURE COMPLETED'
+        self.measure.state.code = 1
+
+        self.lock.acquire()
+        self.measure.state.grax.save()
+        self.measure.state.gray.save()
+        self.measure.state.graz.save()
+        self.measure.state.sync.save()
+        self.measure.state.sdr.save()
+        self.measure.state.adc.save()
+        self.measure.state.save()
+        self.measure.save()
+        self.lock.release()
+        return 0
+
     def run(self):
         # Connect to the sync product first
         # Open the sync product, check for errors if any returned with status byte 0xFF
@@ -292,8 +520,6 @@ class DefaultEngine:
         self.sync_interface.serial_open(self.measure.info.isync.port)
 
         if(self.measure.info.iadc.enabled == True):
-            print('try to connect')
-
             for k in range(0, self.measure.info.iadc.averaging):
                 print('SENDING TRIGGER')
 
@@ -302,110 +528,12 @@ class DefaultEngine:
                 if(ret != 0):
                     return ret
                 
-                try:
-                    self.adc_interface.connect()
-                except:
-                    self.measure.state.adc.status = 'CONN ERROR'
-                    self.measure.state.adc.code = -1
-                    self.measure.state.status = 'ADC ERROR'
-                    self.measure.state.code = -3
-                    self.lock.acquire()
-                    self.measure.state.adc.save()
-                    self.measure.state.save()
-                    self.measure.save()
-                    self.lock.release()
-                    self.adc_interface.client_socket.close()
-                    return -1
-                
-                ret = self.adc_interface.open()
-                if(ret[0] == 0xFF):
-                    self.measure.state.adc.status = 'OPEN ERROR'
-                    self.measure.state.adc.code = -2
-                    self.measure.state.status = 'ADC ERROR'
-                    self.measure.state.code = -3
-                    self.lock.acquire()
-                    self.measure.state.adc.save()
-                    self.measure.state.save()
-                    self.measure.save()
-                    self.lock.release()
-                    self.adc_interface.client_socket.close()
-                    return ret
-                
-                rate = self.measure.info.iadc.srate
-                ret = self.adc_interface.set_rate(rate)
-                if(ret[0] == 0xFF):
-                    self.measure.state.adc.status = 'RATE ERROR'
-                    self.measure.state.adc.code = -3
-                    self.measure.state.status = 'ADC ERROR'
-                    self.measure.state.code = -3
-                    self.lock.acquire()
-                    self.measure.state.adc.save()
-                    self.measure.state.save()
-                    self.measure.save()
-                    self.lock.release()
-                    self.adc_interface.client_socket.close()
-                    return ret
-                
-                points = self.measure.info.iadc.points
-                ret = self.adc_interface.set_points(points)
-                if(ret[0] == 0xFF):
-                    self.measure.state.adc.status = 'POINTS ERROR'
-                    self.measure.state.adc.code = -4
-                    self.measure.state.status = 'ADC ERROR'
-                    self.measure.state.code = -3
-                    self.lock.acquire()
-                    self.measure.state.adc.save()
-                    self.measure.state.save()
-                    self.measure.save()
-                    self.lock.release()
-                    self.adc_interface.client_socket.close()
-                    return ret
-                
-                ret = self.adc_interface.config_channels(self.measure.info.iadc.n_channels,
-                                                        self.measure.info.iadc.channel_ranges,
-                                                        self.measure.info.iadc.trigger_channel, 
-                                                        self.measure.info.iadc.trig_direction,
-                                                        self.measure.info.iadc.threshold,
-                                                        self.measure.info.iadc.auto_measure_time)
-                if(ret[0] == 0xFF):
-                    self.measure.state.adc.status = 'TRIGGER CONFIG ERROR'
-                    self.measure.state.adc.code = -5
-                    self.measure.state.status = 'ADC ERROR'
-                    self.measure.state.code = -3
-                    self.lock.acquire()
-                    self.measure.state.adc.save()
-                    self.measure.state.save()
-                    self.measure.save()
-                    self.lock.release()
-                    self.adc_interface.client_socket.close()
-                    return ret
-                
-                ret = self.adc_interface.set_premeasure(0)
-                if(ret[0] == 0xFF):
-                    self.measure.state.adc.status = 'SET PREMEASURE ERROR'
-                    self.measure.state.adc.code = -6
-                    self.measure.state.status = 'ADC ERROR'
-                    self.measure.state.code = -3
-                    self.lock.acquire()
-                    self.measure.state.adc.save()
-                    self.measure.state.save()
-                    self.measure.save()
-                    self.lock.release()
-                    self.adc_interface.client_socket.close()
+                ret = self.adcUp()
+                if(ret != 0):
                     return ret
                 
-                ret = self.adc_interface.set_trignum(self.measure.info.iadc.n_triggers)
-                if(ret[0] == 0xFF):
-                    self.measure.state.adc.status = 'SET PREMEASURE ERROR'
-                    self.measure.state.adc.code = -6
-                    self.measure.state.status = 'ADC ERROR'
-                    self.measure.state.code = -3
-                    self.lock.acquire()
-                    self.measure.state.adc.save()
-                    self.measure.state.save()
-                    self.measure.save()
-                    self.lock.release()
-                    self.adc_interface.client_socket.close()
+                ret = self.adcConfig()
+                if(ret != 0):
                     return ret
                 
                 t = NewThread(target=self.adc_interface.start)
@@ -413,35 +541,10 @@ class DefaultEngine:
 
                 tm.sleep(1)
 
-                ret = self.sdr_interface.transf(str(settings.BASE_DIR) + '\\bin\\hackrftrans00.exe',
-                                        self.measure.info.isdr.file,
-                                        self.measure.info.isdr.freq,
-                                        self.measure.info.isdr.srate,
-                                        int(self.measure.info.isdr.ampl),
-                                        self.measure.info.isdr.gain)
-                if(ret[0] == 0xFF):
-                    self.measure.state.sdr.status = 'SDR ERROR'
-                    self.measure.state.sdr.code = -8
-                    self.measure.state.status = 'SDR ERROR (WAIT FOR STOPING ADC!)'
-                    self.measure.state.code = -3
-                    self.lock.acquire()
-                    self.measure.state.sdr.save()
-                    self.measure.state.save()
-                    self.measure.save()
-                    self.lock.release()
-                    t.join()
-                    self.adc_interface.client_socket.close()
-                    return ret
-                
-                self.measure.state.sdr.status = 'CONFIGURED'
-                self.measure.state.sdr.code = 1
-                self.lock.acquire()
-                self.measure.state.sdr.save()
-                self.measure.state.save()
-                self.measure.save()
-                self.lock.release()
+                ret = self.sdrUp(t)
                 
                 t.join()
+
                 ret = self.adc_interface.measure_code
                 if(ret[0] == 0xFF):
                     self.measure.state.adc.status = 'MEASURE ERROR'
@@ -455,99 +558,25 @@ class DefaultEngine:
                     self.lock.release()
                     self.adc_interface.client_socket.close()
                     return ret
-                
-                #ret = self.adc_interface.stop()
-                #if(ret == 0xFF):
-                #    self.measure.state.adc.status = 'CLOSE ERROR'
-                #    self.measure.state.adc.code = -8
-                #    self.measure.state.status = 'ADC ERROR'
-                #    self.measure.state.code = -3
-                #    self.lock.acquire()
-                #    self.measure.state.adc.save()
-                #    self.measure.state.save()
-                #    self.measure.save()
-                #    self.lock.release()
-                #    return ret
 
-                self.lock.acquire()
-                for i in range(len(self.adc_interface.ndata)):
-                    data = models.measurement_data.objects.create(data_num=i, averaging_num=k, measurement=self.measure)
-                    for j in range(len(self.adc_interface.ndata[i])):
-                        cdata = data.channel_data.create(channel_num=j,
-                                                measurement_data=data,
-                                                channel_data=base64.b64encode(self.adc_interface.ndata[i][j]).decode('utf-8'))
-                        cdata.save()
-                        data.save()
-                self.measure.save()
-                self.lock.release()
-                self.adc_interface.clear_ndata()
-                tm.sleep(1)
+                self.adcWrite(k)
         else:
-            print('STARTING')
             print('SENDING TRIGGER')
             # Set trigger wait, check for errors
-            ret = self.sync_interface.trig_wait(self.measure.info.isync.port)
-            if(ret[0] == 0xFF):
-                self.measure.state.sync.status = 'TRIG SET ERROR'
-                self.measure.state.sync.code = -4
-                self.measure.state.status = 'SYNC ERROR'
-                self.measure.state.code = -1
-                self.lock.acquire()
-                self.measure.state.sync.save()
-                self.measure.state.save()
-                self.measure.save()
-                self.lock.release()
+            ret = self.syncWait()
+            if(ret != 0):
                 return ret
 
-            ret = self.sdr_interface.transf(str(settings.BASE_DIR) + '\\bin\\hackrftrans00.exe',
-                                    self.measure.info.isdr.file,
-                                    self.measure.info.isdr.freq,
-                                    self.measure.info.isdr.srate,
-                                    int(self.measure.info.isdr.ampl),
-                                    self.measure.info.isdr.gain)
-            if(ret[0] == 0xFF):
-                self.measure.state.sdr.status = 'SDR ERROR'
-                self.measure.state.sdr.code = -8
-                self.measure.state.status = 'SDR ERROR'
-                self.measure.state.code = -3
-                self.lock.acquire()
-                self.measure.state.sdr.save()
-                self.measure.state.save()
-                self.measure.save()
-                self.lock.release()
+            ret = self.sdrUp(None)
+            if(ret[0] != 0):
                 return ret
             
-            self.measure.state.sdr.status = 'CONFIGURED'
-            self.measure.state.sdr.code = 1
-            self.lock.acquire()
-            self.measure.state.sdr.save()
-            self.measure.state.save()
-            self.measure.save()
-            self.lock.release()
-            
-
-        ret = self.sync_interface.serial_close()
-        if(self.measure.info.iadc.enabled):
-            self.adc_interface.client_socket.close()
-
-        self.measure.state.adc.status = 'MEASURE COMPLETED'
-        self.measure.state.data_ready = True
-        self.measure.state.adc.code = 1
-        self.measure.state.status = 'MEASURE COMPLETED'
-        self.measure.state.code = 1
 
-        self.lock.acquire()
-        self.measure.state.grax.save()
-        self.measure.state.gray.save()
-        self.measure.state.graz.save()
-        self.measure.state.sync.save()
-        self.measure.state.sdr.save()
-        self.measure.state.adc.save()
-        self.measure.state.save()
-        self.measure.save()
-        self.lock.release()
+        ret = self.close()
+        if(ret != 0):
+            return ret
 
-        return (0x00, 0)
+        return 0
 
 EngineDict = {
     'DefaultEngine': DefaultEngine

+ 133 - 0
spectrometer_service/mserv00/synclogs/sync-log-20250827-134100.log

@@ -0,0 +1,133 @@
+[2025-08-27 13:41:00:548] / [INFO]	Start...
+[2025-08-27 13:41:00:549] / [INFO]	File: C:\LF_MRI\test_19_02_2025\Sync_param_test_19_02_2025.xml
+[2025-08-27 13:41:00:549] / [INFO]	Try to load file...
+[2025-08-27 13:41:00:549] / [OK]	External XML structure is OK
+[2025-08-27 13:41:00:549] / [DEBUG]	ParamCount = 5
+[2025-08-27 13:41:00:549] / [OK]	Internal structure of XML is OK
+[2025-08-27 13:41:00:549] / [DONE]	File loaded successfully
+[2025-08-27 13:41:00:549] / [INFO]	Creating synchronization program...
+[2025-08-27 13:41:00:549] / [DEBUG]	
+RF 0
+7080000
+SW 0
+7080000
+ADC 1
+7080100
+GRU 1
+7080100
+[2025-08-27 13:41:00:549] / [DEBUG]	
+RF 1
+7080002
+SW 0
+7080002
+ADC 0
+7080002
+GRU 0
+2000002
+[2025-08-27 13:41:00:550] / [DEBUG]	Analise Node 1/5...
+[2025-08-27 13:41:00:552] / [DEBUG]	duepp: Everything is allright
+[2025-08-27 13:41:00:553] / [DEBUG]	
+RF 0
+7080000
+SW 0
+7080000
+ADC 0
+7080000
+GRU 0
+2000000
+[2025-08-27 13:41:00:554] / [DEBUG]	Analise Node 2/5...
+[2025-08-27 13:41:00:556] / [DEBUG]	duepp: Everything is allright
+[2025-08-27 13:41:00:557] / [DEBUG]	
+RF 1
+7080002
+SW 0
+7080002
+ADC 0
+7080002
+GRU 0
+2000002
+[2025-08-27 13:41:00:558] / [DEBUG]	Analise Node 3/5...
+[2025-08-27 13:41:00:559] / [DEBUG]	duepp: Everything is allright
+[2025-08-27 13:41:00:561] / [DEBUG]	
+RF 0
+7080000
+SW 0
+7080000
+ADC 0
+7080000
+GRU 0
+2000000
+[2025-08-27 13:41:00:562] / [DEBUG]	Analise Node 4/5...
+[2025-08-27 13:41:00:563] / [DEBUG]	duepp: Everything is allright
+[2025-08-27 13:41:00:564] / [DONE]	Events added
+[2025-08-27 13:41:00:565] / [DEBUG]	duepp: Everything is allright
+[2025-08-27 13:41:00:567] / [DEBUG]	duepp: Everything is allright
+[2025-08-27 13:41:00:568] / [DEBUG]	duepp: Get program dump:
+
+Program Dump
+0 BRANCH header, 2 events
+1 outputs: 0x7080000 time: 0x14
+3 outputs: 0x7080100 time: 0xb4
+0 BRANCH
+5 EXT_TRIG
+6 BRANCH header, 4 events
+7 outputs: 0x2000002 time: 0x61a8
+9 outputs: 0x2000000 time: 0x2710
+11 outputs: 0x2000002 time: 0x61a8
+13 outputs: 0x2000000 time: 0x61a8
+6 BRANCH
+15 EXI
+[2025-08-27 13:41:00:577] / [INFO]	Program in HEX:
+00020002
+07080000
+00000014
+07080100
+000000B4
+00060000
+00020004
+02000002
+000061A8
+02000000
+00002710
+02000002
+000061A8
+02000000
+000061A8
+00030000
+[2025-08-27 13:41:00:581] / [INFO]	Trying due_download_prog_save_to_file_command() 
+[2025-08-27 13:41:00:582] / [INFO]	file fd = 1
+[2025-08-27 13:41:00:590] / [ERROR]	duepp: due_download_command: got invalid file descriptor (<=0) 
+e: 0x14
+3 outputs: 0x7080100 time: 0xb4
+0 BRANCH
+5 EXT_TRIG
+6 BRANCH header, 4 events
+7 outputs: 0x2000002 time: 0x61a8
+9 outputs: 0x2000000 time: 0x2710
+11 outputs: 0x2000002 time: 0x61a8
+13 outputs: 0x2000000 time: 0x61a8
+6 BRANCH
+15 E
+[2025-08-27 13:41:00:591] / [INFO]	Creating Serial object
+[2025-08-27 13:41:00:592] / [INFO]	Connecting to Serial object
+[2025-08-27 13:41:00:595] / [INFO]	Checking connection
+[2025-08-27 13:41:00:596] / [DONE]	Successful connection to \\.\COM7[2025-08-27 13:41:00:696] / [INFO]	S serial.available = 22
+[2025-08-27 13:41:00:697] / [INFO]	S serial.readString = status final_timeout

+
+[2025-08-27 13:41:00:699] / [INFO]	Q serial.available = 0
+[2025-08-27 13:41:00:700] / [INFO]	Q serial.readString = Due pulse programmer v1

+
+[2025-08-27 13:41:03:737] / [UNDEF]	D serial.readString = 254 86 data received

+
+ing prog size: 16 
+e: 0x14
+3 outputs: 0x7080100 time: 0xb4
+0 BRANCH
+5 EXT_TRIG
+6 BRANCH header, 4 events
+7 outputs: 0x2000002 time: 0x61a8
+9 outputs: 0x2000000 time: 0x2710
+11 outputs: 0x2000002 time: 0x61a8
+13 outputs: 0x2000000 time: 0x61a8
+6 BRANCH
+15 E[2025-08-27 13:41:03:738] / [OK]	DONE!

+ 133 - 0
spectrometer_service/mserv00/synclogs/sync-log-20250827-134235.log

@@ -0,0 +1,133 @@
+[2025-08-27 13:42:35:91] / [INFO]	Start...
+[2025-08-27 13:42:35:91] / [INFO]	File: C:\LF_MRI\test_19_02_2025\Sync_param_test_19_02_2025.xml
+[2025-08-27 13:42:35:91] / [INFO]	Try to load file...
+[2025-08-27 13:42:35:91] / [OK]	External XML structure is OK
+[2025-08-27 13:42:35:92] / [DEBUG]	ParamCount = 5
+[2025-08-27 13:42:35:92] / [OK]	Internal structure of XML is OK
+[2025-08-27 13:42:35:92] / [DONE]	File loaded successfully
+[2025-08-27 13:42:35:92] / [INFO]	Creating synchronization program...
+[2025-08-27 13:42:35:92] / [DEBUG]	
+RF 0
+7080000
+SW 0
+7080000
+ADC 1
+7080100
+GRU 1
+7080100
+[2025-08-27 13:42:35:92] / [DEBUG]	
+RF 1
+7080002
+SW 0
+7080002
+ADC 0
+7080002
+GRU 0
+2000002
+[2025-08-27 13:42:35:93] / [DEBUG]	Analise Node 1/5...
+[2025-08-27 13:42:35:94] / [DEBUG]	duepp: Everything is allright
+[2025-08-27 13:42:35:96] / [DEBUG]	
+RF 0
+7080000
+SW 0
+7080000
+ADC 0
+7080000
+GRU 0
+2000000
+[2025-08-27 13:42:35:97] / [DEBUG]	Analise Node 2/5...
+[2025-08-27 13:42:35:98] / [DEBUG]	duepp: Everything is allright
+[2025-08-27 13:42:35:104] / [DEBUG]	
+RF 1
+7080002
+SW 0
+7080002
+ADC 0
+7080002
+GRU 0
+2000002
+[2025-08-27 13:42:35:105] / [DEBUG]	Analise Node 3/5...
+[2025-08-27 13:42:35:106] / [DEBUG]	duepp: Everything is allright
+[2025-08-27 13:42:35:108] / [DEBUG]	
+RF 0
+7080000
+SW 0
+7080000
+ADC 0
+7080000
+GRU 0
+2000000
+[2025-08-27 13:42:35:109] / [DEBUG]	Analise Node 4/5...
+[2025-08-27 13:42:35:110] / [DEBUG]	duepp: Everything is allright
+[2025-08-27 13:42:35:111] / [DONE]	Events added
+[2025-08-27 13:42:35:113] / [DEBUG]	duepp: Everything is allright
+[2025-08-27 13:42:35:114] / [DEBUG]	duepp: Everything is allright
+[2025-08-27 13:42:35:118] / [DEBUG]	duepp: Get program dump:
+
+Program Dump
+0 BRANCH header, 2 events
+1 outputs: 0x7080000 time: 0x14
+3 outputs: 0x7080100 time: 0xb4
+0 BRANCH
+5 EXT_TRIG
+6 BRANCH header, 4 events
+7 outputs: 0x2000002 time: 0x61a8
+9 outputs: 0x2000000 time: 0x2710
+11 outputs: 0x2000002 time: 0x61a8
+13 outputs: 0x2000000 time: 0x61a8
+6 BRANCH
+15 EXI
+[2025-08-27 13:42:35:126] / [INFO]	Program in HEX:
+00020002
+07080000
+00000014
+07080100
+000000B4
+00060000
+00020004
+02000002
+000061A8
+02000000
+00002710
+02000002
+000061A8
+02000000
+000061A8
+00030000
+[2025-08-27 13:42:35:130] / [INFO]	Trying due_download_prog_save_to_file_command() 
+[2025-08-27 13:42:35:131] / [INFO]	file fd = 1
+[2025-08-27 13:42:35:139] / [ERROR]	duepp: due_download_command: got invalid file descriptor (<=0) 
+e: 0x14
+3 outputs: 0x7080100 time: 0xb4
+0 BRANCH
+5 EXT_TRIG
+6 BRANCH header, 4 events
+7 outputs: 0x2000002 time: 0x61a8
+9 outputs: 0x2000000 time: 0x2710
+11 outputs: 0x2000002 time: 0x61a8
+13 outputs: 0x2000000 time: 0x61a8
+6 BRANCH
+15 E
+[2025-08-27 13:42:35:141] / [INFO]	Creating Serial object
+[2025-08-27 13:42:35:142] / [INFO]	Connecting to Serial object
+[2025-08-27 13:42:35:144] / [INFO]	Checking connection
+[2025-08-27 13:42:35:145] / [DONE]	Successful connection to \\.\COM7[2025-08-27 13:42:35:264] / [INFO]	S serial.available = 22
+[2025-08-27 13:42:35:266] / [INFO]	S serial.readString = status final_timeout

+
+[2025-08-27 13:42:35:267] / [INFO]	Q serial.available = 0
+[2025-08-27 13:42:35:269] / [INFO]	Q serial.readString = Due pulse programmer v1

+
+[2025-08-27 13:42:38:291] / [UNDEF]	D serial.readString = 254 86 data received

+
+ing prog size: 16 
+e: 0x14
+3 outputs: 0x7080100 time: 0xb4
+0 BRANCH
+5 EXT_TRIG
+6 BRANCH header, 4 events
+7 outputs: 0x2000002 time: 0x61a8
+9 outputs: 0x2000000 time: 0x2710
+11 outputs: 0x2000002 time: 0x61a8
+13 outputs: 0x2000000 time: 0x61a8
+6 BRANCH
+15 E[2025-08-27 13:42:38:291] / [OK]	DONE!

+ 1 - 1
spectrometer_service/mserv00/temp

@@ -8,5 +8,5 @@ program->dpos: 16
 D serial.available = 0
 D serial.readString = 
 D serial.available = 22
-D serial.readString = 56 124 data received

+D serial.readString = 254 86 data received