Skip to content
Snippets Groups Projects
Commit b741ca97 authored by Martin Scarcia's avatar Martin Scarcia
Browse files

fixed memorized write bug

parent 922fe566
No related branches found
No related tags found
No related merge requests found
......@@ -218,6 +218,7 @@ class Dynamic(PyTango.Device_4Impl):
self.myattrs = CaseLessDict()
self.read_functions = CaseLessDict()
self.write_functions = CaseLessDict()
self.memorized_attrs = []
#link to the Tango DB
self.db = PyTango.Database()
......@@ -267,6 +268,7 @@ class Dynamic(PyTango.Device_4Impl):
attr = PyTango.Attr(str(attr_obj.name), attr_obj.datatype, attr_obj.permission)
if attr_obj.memorized == 1:
attr.set_memorized()
self.memorized_attrs.append(attr_obj.name)
self.add_attribute(attr, self.read_Scalar,self.write_Scalar)
if attr_obj.datatype == PyTango.ArgType.DevString:
self.myattrs[attr_obj.name] = ""
......@@ -311,8 +313,7 @@ class Dynamic(PyTango.Device_4Impl):
self.myattrs[attr_obj.name] = np.zeros(attr_obj.dimension, fromPyTango2NumpyType(attr_obj.datatype))
except Exception as ex:
print("why??")
#sys.stderr.write(str(ex)+"\n")
print(ex)
self.set_state(PyTango.DevState.FAULT)
self.set_status("Error(s) detected in cfg script file")
......@@ -583,7 +584,8 @@ class Dynamic(PyTango.Device_4Impl):
# Only scalar values can be memorized
return
dict_in = {attr_name:{'__value':value_in}}
self.db.put_device_attribute_property(self.get_name(),dict_in)
if attr_name in self.memorized_attrs:
self.db.put_device_attribute_property(self.get_name(),dict_in)
#==================================================================
......
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