HasControlledBy: update target without switching to self control
when a HeaterOutput module is used e.g. from a software loop, a method is needed to update the output without switching to self-controlled Change-Id: I9c83b4e172e14812a405e836757491622ff5f949 Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/33903 Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch> Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de> Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
This commit is contained in:
@@ -56,6 +56,20 @@ class HasControlledBy:
|
|||||||
for deactivate_control in self.inputCallbacks.values():
|
for deactivate_control in self.inputCallbacks.values():
|
||||||
deactivate_control(self.name)
|
deactivate_control(self.name)
|
||||||
|
|
||||||
|
def update_target(self, module, value):
|
||||||
|
"""update internal target value
|
||||||
|
|
||||||
|
as write_target would switch to manual mode, the controlling module
|
||||||
|
has to use this method to update the value
|
||||||
|
|
||||||
|
override and super call, if other actions are needed
|
||||||
|
"""
|
||||||
|
if self.controlled_by != module:
|
||||||
|
deactivate_control = self.inputCallbacks.get(self.controlled_by)
|
||||||
|
if deactivate_control:
|
||||||
|
deactivate_control(module)
|
||||||
|
self.target = value
|
||||||
|
|
||||||
|
|
||||||
class HasOutputModule:
|
class HasOutputModule:
|
||||||
"""mixin for modules having an output module
|
"""mixin for modules having an output module
|
||||||
|
|||||||
Reference in New Issue
Block a user