Skip to content
Snippets Groups Projects
Commit 3606883a authored by Auke Klazema's avatar Auke Klazema
Browse files

L2SS-481: Calculate offset when properties change

Added a properties_changed hook that is called on init_device and
Initialise.
This way if properties change we can update values depending on the
proptery values.
parent 99564c36
No related branches found
No related tags found
1 merge request!248Resolve L2SS-481
...@@ -81,6 +81,8 @@ class lofar_device(Device, metaclass=DeviceMeta): ...@@ -81,6 +81,8 @@ class lofar_device(Device, metaclass=DeviceMeta):
# NOTE: Will delete_device first, if necessary # NOTE: Will delete_device first, if necessary
Device.init_device(self) Device.init_device(self)
self.properties_changed()
self.set_state(DevState.OFF) self.set_state(DevState.OFF)
self.set_status("Device is in the OFF state.") self.set_status("Device is in the OFF state.")
...@@ -131,6 +133,8 @@ class lofar_device(Device, metaclass=DeviceMeta): ...@@ -131,6 +133,8 @@ class lofar_device(Device, metaclass=DeviceMeta):
self.configure_for_initialise() self.configure_for_initialise()
self.properties_changed()
self.set_state(DevState.STANDBY) self.set_state(DevState.STANDBY)
self.set_status("Device is in the STANDBY state.") self.set_status("Device is in the STANDBY state.")
...@@ -219,6 +223,9 @@ class lofar_device(Device, metaclass=DeviceMeta): ...@@ -219,6 +223,9 @@ class lofar_device(Device, metaclass=DeviceMeta):
"""Method always executed before any TANGO command is executed.""" """Method always executed before any TANGO command is executed."""
pass pass
def properties_changed(self):
pass
@command() @command()
@only_in_states([DevState.STANDBY, DevState.ON]) @only_in_states([DevState.STANDBY, DevState.ON])
@DebugIt() @DebugIt()
......
...@@ -158,9 +158,8 @@ class RECV(opcua_device): ...@@ -158,9 +158,8 @@ class RECV(opcua_device):
# -------- # --------
# overloaded functions # overloaded functions
# -------- # --------
def configure_for_initialise(self): def properties_changed(self):
super().configure_for_initialise() super().properties_changed()
self.HBAT_bf_delay_offset = numpy.mean(self.HBAT_bf_delay_step_delays) self.HBAT_bf_delay_offset = numpy.mean(self.HBAT_bf_delay_step_delays)
# -------- # --------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment