Skip to content
Snippets Groups Projects
Commit c36cc3b1 authored by Samuel GARNIER's avatar Samuel GARNIER
Browse files

Thread the sync command, fix align early return lock release

parent 23d4a0a1
No related branches found
No related tags found
No related merge requests found
...@@ -442,6 +442,12 @@ class DG_PY_FOFBTool(Device): ...@@ -442,6 +442,12 @@ class DG_PY_FOFBTool(Device):
:return:None :return:None
""" """
if not self.lock.acquire(False):
self.error_stream("Device is running, skiping command")
return
def target():
db = tango.Database() db = tango.Database()
self.d_status["synchronize"]="Synchronize: starting" self.d_status["synchronize"]="Synchronize: starting"
...@@ -452,6 +458,12 @@ class DG_PY_FOFBTool(Device): ...@@ -452,6 +458,12 @@ class DG_PY_FOFBTool(Device):
FofbTool.Operation.sync_bpm(bpmidlist, lbpevrx, tlocal, self.tangopath_centraltiming) FofbTool.Operation.sync_bpm(bpmidlist, lbpevrx, tlocal, self.tangopath_centraltiming)
self.d_status["synchronize"]="Synchronize: done" self.d_status["synchronize"]="Synchronize: done"
self.set_state(tango.DevState.ON)
self.lock.release()
T = threading.Thread(target=target,)
self.set_state(tango.DevState.RUNNING)
T.start()
# PROTECTED REGION END # // DG_PY_FOFBTool.sync # PROTECTED REGION END # // DG_PY_FOFBTool.sync
...@@ -483,6 +495,8 @@ class DG_PY_FOFBTool(Device): ...@@ -483,6 +495,8 @@ class DG_PY_FOFBTool(Device):
if (seqoffset is None) or seqoffset in (-1,0,1): if (seqoffset is None) or seqoffset in (-1,0,1):
self.error_stream("Could not align all ccn") self.error_stream("Could not align all ccn")
self.d_status["align"]="FA Align: failed" self.d_status["align"]="FA Align: failed"
self.set_state(tango.DevState.ALARM)
self.lock.release()
return return
for cn in self.tangopath_cellnode: for cn in self.tangopath_cellnode:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment