From 4c58f2acb17ad1d005ee5447d8af231db796af63 Mon Sep 17 00:00:00 2001
From: "paolo.cinquegrana@elettra.eu" <paolo.cinquegrana@elettra.eu>
Date: Thu, 9 Jun 2022 16:50:20 +0200
Subject: [PATCH] cambio canale trigger elite1

---
 src/SluDelayCalculator.py | 60 +++++++++++++++++++--------------------
 1 file changed, 30 insertions(+), 30 deletions(-)

diff --git a/src/SluDelayCalculator.py b/src/SluDelayCalculator.py
index ba3c9cc..7033fe9 100644
--- a/src/SluDelayCalculator.py
+++ b/src/SluDelayCalculator.py
@@ -423,12 +423,12 @@ class MainWindow(QDialog):
             voce = time.ctime()[11:19] + ' Error reading ' + str(devprodic["triggerEVR"]) + ' Chan2Delay. check with atomic panel and launch this program again'
             self.logbox.insertItem(0, voce)
         try:
-            self.zero_trgE1 = devprodic["triggerEVR2"].Chan1Delay
+            self.zero_trgE1 = devprodic["triggerEVR"].Chan1Delay
             self.trgE1_iniziale.setText(str(round(self.zero_trgE1, 1)))
         except:
             self.funzionamento.setText('!! FAULT !!')
             self.funzionamento.setStyleSheet("background-color: rgb(255, 0, 0)")
-            voce = time.ctime()[11:19] + ' Error reading ' + str(devprodic["triggerEVR2"]) + ' Chan2Delay. check with atomic panel and launch this program again'
+            voce = time.ctime()[11:19] + ' Error reading ' + str(devprodic["triggerEVR"]) + ' Chan1Delay. check with atomic panel and launch this program again'
             self.logbox.insertItem(0, voce)
         try:
             self.zero_FundAlignment = devprodic["tmu"].PllFundAlignment
@@ -537,7 +537,7 @@ class MainWindow(QDialog):
         try:
             tmp = devprodic["triggerEVR"].read_attributes(['State', 'Chan1Delay', 'Chan2Delay'])
             self.read_values_trg_state = str(tmp[0].value)
-            self.read_values_trg_E1_delay = devprodic["triggerEVR2"].Chan1Delay #tmp[1].value
+            self.read_values_trg_E1_delay = tmp[1].value
             self.read_values_trg_E2_delay = tmp[2].value
         except:
             self.funzionamento.setText('!! FAULT !!')
@@ -1410,30 +1410,30 @@ class MainWindow(QDialog):
 
     def disastro_soloE1trg(self):
         try:
-            self.trgE1_old = devprodic["triggerEVR2"].Chan1Delay
+            self.trgE1_old = devprodic["triggerEVR"].Chan1Delay
             procedi = True
         except:
             self.funzionamento.setText('!! FAULT !!')
             self.funzionamento.setStyleSheet("background-color: rgb(255, 0, 0)")
-            voce = time.ctime()[11:19] + ' Error reading ' + str(devprodic["triggerEVR2"]) + ' Chan1Delay.'
+            voce = time.ctime()[11:19] + ' Error reading ' + str(devprodic["triggerEVR"]) + ' Chan1Delay.'
             self.logbox.insertItem(0, voce)
             procedi = False
         if procedi:
             self.comandifalliti = 0
             try:
-                devprodic["triggerEVR2"].write_attribute("Chan1Delay", float(self.trg_elite1calc))
+                devprodic["triggerEVR"].write_attribute("Chan1Delay", float(self.trg_elite1calc))
             except:
-                voce = time.ctime()[11:19] + ' Error with ' + str(devprodic["triggerEVR2"]) + ' while write_attribute("Chan1Delay", ' + str(self.trg_elite1calc) + ')'
+                voce = time.ctime()[11:19] + ' Error with ' + str(devprodic["triggerEVR"]) + ' while write_attribute("Chan1Delay", ' + str(self.trg_elite1calc) + ')'
                 self.logbox.insertItem(0, voce)
                 self.comandifalliti = 1
             time.sleep(0.2)
             try:
-                tmp = devprodic["triggerEVR2"].get_attribute_config_ex("Chan1Delay")
+                tmp = devprodic["triggerEVR"].get_attribute_config_ex("Chan1Delay")
                 tmp[0].alarms.min_alarm = str(self.trg_elite1calc - 1)
                 tmp[0].alarms.max_alarm = str(self.trg_elite1calc + 1)
-                devprodic["triggerEVR2"].set_attribute_config(tmp)
+                devprodic["triggerEVR"].set_attribute_config(tmp)
             except:
-                voce = time.ctime()[11:19] + ' Error with ' + str(devprodic["triggerEVR2"]) + ' while the script set alarm threshold [' + str(self.trg_elite1calc - 1) + ', ' + str(self.trg_elite1calc +1) + '] for attribute Chan1Delay'
+                voce = time.ctime()[11:19] + ' Error with ' + str(devprodic["triggerEVR"]) + ' while the script set alarm threshold [' + str(self.trg_elite1calc - 1) + ', ' + str(self.trg_elite1calc +1) + '] for attribute Chan1Delay'
                 self.logbox.insertItem(0, voce)
                 self.comandifalliti = 1
         if self.comandifalliti < 1:
@@ -1441,11 +1441,11 @@ class MainWindow(QDialog):
             self.trgE1_storna.show()
 
     def doppiodisastro_soloE1trg(self):
-        devprodic["triggerEVR2"].write_attribute('Chan1Delay', self.trgE1_old)
-        tmp = devprodic["triggerEVR2"].get_attribute_config_ex('Chan1Delay')
+        devprodic["triggerEVR"].write_attribute('Chan1Delay', self.trgE1_old)
+        tmp = devprodic["triggerEVR"].get_attribute_config_ex('Chan1Delay')
         tmp[0].alarms.min_alarm = str(self.trgE1_old - 1)
         tmp[0].alarms.max_alarm = str(self.trgE1_old + 1)
-        devprodic["triggerEVR2"].set_attribute_config(tmp)
+        devprodic["triggerEVR"].set_attribute_config(tmp)
         self.trgE1_applica.show()
         self.trgE1_storna.hide()
 
@@ -1569,11 +1569,11 @@ class MainWindow(QDialog):
             self.logbox.insertItem(0, voce)
             procedi = False
         try:
-            self.trgE1_old = devprodic["triggerEVR2"].Chan1Delay
+            self.trgE1_old = devprodic["triggerEVR"].Chan1Delay
         except:
             self.funzionamento.setText('!! FAULT !!')
             self.funzionamento.setStyleSheet("background-color: rgb(255, 0, 0)")
-            voce = time.ctime()[11:19] + ' Error reading ' + str(devprodic["triggerEVR2"]) + ' Chan1Delay. The script will not chage any value. check with atomic panel and launch this program again'
+            voce = time.ctime()[11:19] + ' Error reading ' + str(devprodic["triggerEVR"]) + ' Chan1Delay. The script will not chage any value. check with atomic panel and launch this program again'
             self.logbox.insertItem(0, voce)
             procedi = False
         try:
@@ -1653,20 +1653,20 @@ class MainWindow(QDialog):
             time.sleep(3)
             print("triggerEVR" + ' ' + "Chan1Delay" + ' ' +  str(self.trg_elite1calc))
             try:
-                devprodic["triggerEVR2"].write_attribute("Chan1Delay", float(self.trg_elite1calc))
+                devprodic["triggerEVR"].write_attribute("Chan1Delay", float(self.trg_elite1calc))
                 print('Chan1Delay ' + str(self.trg_elite1calc))
             except:
-                voce = time.ctime()[11:19] + ' Error with ' + str(devprodic["triggerEVR2"]) + ' while write_attribute("Chan1Delay", ' + str(self.trg_elite1calc) + ')'
+                voce = time.ctime()[11:19] + ' Error with ' + str(devprodic["triggerEVR"]) + ' while write_attribute("Chan1Delay", ' + str(self.trg_elite1calc) + ')'
                 self.logbox.insertItem(0, voce)
                 self.comandifalliti = 1
             time.sleep(0.2)
             try:
-                tmp = devprodic["triggerEVR2"].get_attribute_config_ex("Chan1Delay")
+                tmp = devprodic["triggerEVR"].get_attribute_config_ex("Chan1Delay")
                 tmp[0].alarms.min_alarm = str(self.trg_elite1calc - 1)
                 tmp[0].alarms.max_alarm = str(self.trg_elite1calc + 1)
-                devprodic["triggerEVR2"].set_attribute_config(tmp)
+                devprodic["triggerEVR"].set_attribute_config(tmp)
             except:
-                voce = time.ctime()[11:19] + ' Error with ' + str(devprodic["triggerEVR2"]) + ' while the script set alarm threshold [' + str(self.trg_elite1calc - 1) + ', ' + str(self.trg_elite1calc +1) + '] for attribute Chan1Delay'
+                voce = time.ctime()[11:19] + ' Error with ' + str(devprodic["triggerEVR"]) + ' while the script set alarm threshold [' + str(self.trg_elite1calc - 1) + ', ' + str(self.trg_elite1calc +1) + '] for attribute Chan1Delay'
                 self.logbox.insertItem(0, voce)
                 self.comandifalliti = 1
             print("triggerEVR" + ' ' + "Chan2Delay" + ' ' +  str(self.trg_elite2calc))
@@ -1774,20 +1774,20 @@ class MainWindow(QDialog):
                 self.logbox.insertItem(0, voce)
         time.sleep(3)
         try:
-            devprodic["triggerEVR2"].write_attribute('Chan1Delay', self.trgE1_old)
+            devprodic["triggerEVR"].write_attribute('Chan1Delay', self.trgE1_old)
             print('Chan1Delay ' + str(self.trgE1_old))
         except:
-            voce = time.ctime()[11:19] + ' Error with ' + str(devprodic["triggerEVR2"]) + ' while write_attribute("Chan1Delay", ' + str(self.trgE1_old) + ')'
+            voce = time.ctime()[11:19] + ' Error with ' + str(devprodic["triggerEVR"]) + ' while write_attribute("Chan1Delay", ' + str(self.trgE1_old) + ')'
             self.logbox.insertItem(0, voce)
             self.comandifalliti = 1
         time.sleep(0.1)
         try:
-            tmp = devprodic["triggerEVR2"].get_attribute_config_ex('Chan1Delay')
+            tmp = devprodic["triggerEVR"].get_attribute_config_ex('Chan1Delay')
             tmp[0].alarms.min_alarm = str(self.trgE1_old - 1)
             tmp[0].alarms.max_alarm = str(self.trgE1_old + 1)
-            devprodic["triggerEVR2"].set_attribute_config(tmp)
+            devprodic["triggerEVR"].set_attribute_config(tmp)
         except:
-            voce = time.ctime()[11:19] + ' Error with ' + str(devprodic["triggerEVR2"]) + ' while the script set alarm threshold [' + str(self.trgE1_old - 1) + ', ' + str(self.trgE1_old +1) + '] for attribute Chan1Delay'
+            voce = time.ctime()[11:19] + ' Error with ' + str(devprodic["triggerEVR"]) + ' while the script set alarm threshold [' + str(self.trgE1_old - 1) + ', ' + str(self.trgE1_old +1) + '] for attribute Chan1Delay'
             self.logbox.insertItem(0, voce)
             self.comandifalliti = 1
         try:
@@ -1880,20 +1880,20 @@ class MainWindow(QDialog):
                 self.logbox.insertItem(0, voce)
         time.sleep(3)
         try:
-            devprodic["triggerEVR2"].write_attribute('Chan1Delay', self.zero_trgE1)
+            devprodic["triggerEVR"].write_attribute('Chan1Delay', self.zero_trgE1)
             print('Chan1Delay ' + str(self.zero_trgE1))
         except:
-            voce = time.ctime()[11:19] + ' Error with ' + str(devprodic["triggerEVR2"]) + ' while write_attribute("Chan1Delay", ' + str(self.zero_trgE1) + ')'
+            voce = time.ctime()[11:19] + ' Error with ' + str(devprodic["triggerEVR"]) + ' while write_attribute("Chan1Delay", ' + str(self.zero_trgE1) + ')'
             self.logbox.insertItem(0, voce)
             self.comandifalliti = 1
         time.sleep(0.1)
         try:
-            tmp = devprodic["triggerEVR2"].get_attribute_config_ex('Chan1Delay')
+            tmp = devprodic["triggerEVR"].get_attribute_config_ex('Chan1Delay')
             tmp[0].alarms.min_alarm = str(self.zero_trgE1 - 1)
             tmp[0].alarms.max_alarm = str(self.zero_trgE1 + 1)
-            devprodic["triggerEVR2"].set_attribute_config(tmp)
+            devprodic["triggerEVR"].set_attribute_config(tmp)
         except:
-            voce = time.ctime()[11:19] + ' Error with ' + str(devprodic["triggerEVR2"]) + ' while the script set alarm threshold [' + str(self.zero_trgE1 - 1) + ', ' + str(self.zero_trgE1 +1) + '] for attribute Chan1Delay'
+            voce = time.ctime()[11:19] + ' Error with ' + str(devprodic["triggerEVR"]) + ' while the script set alarm threshold [' + str(self.zero_trgE1 - 1) + ', ' + str(self.zero_trgE1 +1) + '] for attribute Chan1Delay'
             self.logbox.insertItem(0, voce)
             self.comandifalliti = 1
         try:
-- 
GitLab