Skip to content
Snippets Groups Projects
Commit 92785a2a authored by Roberto Borghes's avatar Roberto Borghes
Browse files

Added multiple retries in threshold readout

parent 4f44807c
No related branches found
No related tags found
No related merge requests found
......@@ -730,14 +730,19 @@ class PilatusXM (PyTango.LatestDeviceImpl):
if not self.Simulation:
cmd = "SetThreshold"
reply_cmd = "threshold: "
reply = self.comm.send_to_detector(cmd)
if reply is None:
PyTango.Except.throw_exception("Communication error","Pilatus does not reply","read_Threshold")
elif reply_cmd in reply:
self.attr_Threshold_read = int((reply.split(reply_cmd)[-1]).split(" ")[0])
elif "Threshold has not been set" in reply:
PyTango.Except.throw_exception("Pilatus error","Threshold has not been set","read_Threshold")
else:
retries = 5
while (retries > 0):
reply = self.comm.send_to_detector(cmd)
if reply is None:
PyTango.Except.throw_exception("Communication error","Pilatus does not reply","read_Threshold")
elif reply_cmd in reply:
self.attr_Threshold_read = int((reply.split(reply_cmd)[-1]).split(" ")[0])
break
elif "Threshold has not been set" in reply:
PyTango.Except.throw_exception("Pilatus error","Threshold has not been set","read_Threshold")
retries -= 1
time.sleep(0.2)
if retries == 0:
PyTango.Except.throw_exception("Communication error","Pilatus wrong reply","read_Threshold")
attr.set_value(self.attr_Threshold_read)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment