From 5f858cc9646755ef5c1c69d370d360cd96b31c26 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Romain=20BRON=C3=88S?= <romain.brones@synchrotron-soleil.fr>
Date: Tue, 6 Aug 2024 15:26:25 +0200
Subject: [PATCH] Fixes

* Test on full restart and sync
---
 FofbTool/Configuration.py | 4 ++--
 FofbTool/Operation.py     | 4 +++-
 FofbTool/Utils.py         | 8 ++++----
 scripts/FofbTool          | 2 +-
 4 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/FofbTool/Configuration.py b/FofbTool/Configuration.py
index afcebb7..dca0bf7 100644
--- a/FofbTool/Configuration.py
+++ b/FofbTool/Configuration.py
@@ -85,11 +85,11 @@ def cellnode_configure_comlbp(node_tangopath, seqoffset=0):
         logger.error("Failed to obtain tango proxy or to ping to {}".format(node_tangopath))
         return None
 
-    logger.debug("Program sequence offset {} in {}".format(seqoffset, cellnodename))
+    logger.debug("Program sequence offset {} in {}".format(seqoffset, node_tangopath))
     for n in range(4):
         prx["comlbp{}_seqoffset".format(n)]=seqoffset
 
-    logger.info("Configuration of ComLBP done on {}.".format(p))
+    logger.info("Configuration of ComLBP done on {}.".format(node_tangopath))
     return True
 
 ###################################################################################################
diff --git a/FofbTool/Operation.py b/FofbTool/Operation.py
index 6762ae7..203c9af 100644
--- a/FofbTool/Operation.py
+++ b/FofbTool/Operation.py
@@ -550,7 +550,7 @@ def electron_stop_com(bpmlist):
 #    OPERATIONS FOR LBP and Electron SYNCHRONIZATION
 ###################################################################################################
 
-def sync_all_bpm(bpmlist, lbpevrx, tlocal, tcentral):
+def sync_bpm(bpmlist, bpmidlist, lbpevrx, tlocal, tcentral):
     """
     Synchronize all BPM electronics, Electron and Brillance Plus.
     This will use the timing system (central and local board).
@@ -559,6 +559,8 @@ def sync_all_bpm(bpmlist, lbpevrx, tlocal, tcentral):
     -----------
     bpmlist: list
         list of Libera Electron tango path
+    bpmidlist: list
+        list of ID to put on Libera Electron
     lbpevrx: list
         list of LBP Evrx tanfo path
     tlocal: list
diff --git a/FofbTool/Utils.py b/FofbTool/Utils.py
index 4287d0c..c43e87d 100644
--- a/FofbTool/Utils.py
+++ b/FofbTool/Utils.py
@@ -435,7 +435,7 @@ def align_all_ccn(cellnodename, force=False):
     for n,p in config["tangopath.fofbnodes"].items():
         if 'cellnode' in n:
             try:
-                FofbTool.Configuration.cellnode_configure_comlbp(n, seqoffset)
+                FofbTool.Configuration.cellnode_configure_comlbp(p, seqoffset)
             except (tango.DevFailed, TypeError):
                 logger.error("Could not set comlbp offset on {}".format(n))
 
@@ -468,9 +468,9 @@ def sync_all_bpm():
 
     # Set a group of Libera Brillance Plus EVRX board, from FofbTool configuration
     lbpevrx = tango.Group('lbpevrx')
-    lbpevrx.add(FofbTool.Configuration.config["tangopath"]["lbpevrx"].split())
+    lbpevrx.add(config["tangopath"]["lbpevrx"].split())
 
-    tcentral = tango.DeviceProxy(FofbTool.Configuration.config["tangopath"]["timing-central"])
+    tcentral = tango.DeviceProxy(config["tangopath"]["timing-central"])
 
-    FofbTool.Operation.sync_bpm(bpmlist, lbpevrx, tlocal, tcentral)
+    FofbTool.Operation.sync_bpm(bpmlist, bpmidlist, lbpevrx, tlocal, tcentral)
 
diff --git a/scripts/FofbTool b/scripts/FofbTool
index d816ccc..15449ce 100755
--- a/scripts/FofbTool
+++ b/scripts/FofbTool
@@ -139,7 +139,7 @@ if __name__ == '__main__':
         FofbTool.Utils.conf_centralnode_corr()
 
     if args.sync:
-        FofbTool.Operation.sync_all_bpm()
+        FofbTool.Utils.sync_all_bpm()
 
     if (args.start or args.start_comlbp) and not args.nolbp:
         FofbTool.Utils.start_all_comlbp()
-- 
GitLab