Skip to content
Snippets Groups Projects
Commit 9d1384af authored by Jan David Mol's avatar Jan David Mol
Browse files

L2SS-449: Actually read new values when waiting for the value to change

parent 3af690cd
Branches
No related tags found
1 merge request!175Resolve L2SS-449 "Add deviceproxy to devices"
...@@ -15,7 +15,7 @@ from abc import abstractmethod ...@@ -15,7 +15,7 @@ from abc import abstractmethod
# PyTango imports # PyTango imports
from tango.server import Device, command, DeviceMeta, attribute from tango.server import Device, command, DeviceMeta, attribute
from tango import AttrWriteType, DevState, DebugIt, Attribute, DeviceProxy from tango import AttrWriteType, DevState, DebugIt, Attribute, DeviceProxy, DevFailed
import time import time
import math import math
...@@ -284,13 +284,11 @@ class lofar_device(Device, metaclass=AbstractDeviceMetas): ...@@ -284,13 +284,11 @@ class lofar_device(Device, metaclass=AbstractDeviceMetas):
pollperiod: how often to check the attribute, in seconds. pollperiod: how often to check the attribute, in seconds.
""" """
attr = getattr(self.proxy, attr_name)
# Poll every half a second # Poll every half a second
for _ in range(math.ceil(timeout/pollperiod)): for _ in range(math.ceil(timeout/pollperiod)):
if attr != value: if getattr(self.proxy, attr_name) != value:
return return
time.sleep(pollperiod) time.sleep(pollperiod)
raise Exception(f"{attr} != {value} after f{timeout} seconds still.") raise Exception(f"{attr_name} != {value} after {timeout} seconds still.")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment