Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DynamicAttributes
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
spe
ds
DynamicAttributes
Commits
b741ca97
Commit
b741ca97
authored
Jun 20, 2024
by
Martin Scarcia
Browse files
Options
Downloads
Patches
Plain Diff
fixed memorized write bug
parent
922fe566
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/dynamic-srv.py
+5
-3
5 additions, 3 deletions
src/dynamic-srv.py
with
5 additions
and
3 deletions
src/dynamic-srv.py
+
5
−
3
View file @
b741ca97
...
@@ -218,6 +218,7 @@ class Dynamic(PyTango.Device_4Impl):
...
@@ -218,6 +218,7 @@ class Dynamic(PyTango.Device_4Impl):
self
.
myattrs
=
CaseLessDict
()
self
.
myattrs
=
CaseLessDict
()
self
.
read_functions
=
CaseLessDict
()
self
.
read_functions
=
CaseLessDict
()
self
.
write_functions
=
CaseLessDict
()
self
.
write_functions
=
CaseLessDict
()
self
.
memorized_attrs
=
[]
#link to the Tango DB
#link to the Tango DB
self
.
db
=
PyTango
.
Database
()
self
.
db
=
PyTango
.
Database
()
...
@@ -267,6 +268,7 @@ class Dynamic(PyTango.Device_4Impl):
...
@@ -267,6 +268,7 @@ class Dynamic(PyTango.Device_4Impl):
attr
=
PyTango
.
Attr
(
str
(
attr_obj
.
name
),
attr_obj
.
datatype
,
attr_obj
.
permission
)
attr
=
PyTango
.
Attr
(
str
(
attr_obj
.
name
),
attr_obj
.
datatype
,
attr_obj
.
permission
)
if
attr_obj
.
memorized
==
1
:
if
attr_obj
.
memorized
==
1
:
attr
.
set_memorized
()
attr
.
set_memorized
()
self
.
memorized_attrs
.
append
(
attr_obj
.
name
)
self
.
add_attribute
(
attr
,
self
.
read_Scalar
,
self
.
write_Scalar
)
self
.
add_attribute
(
attr
,
self
.
read_Scalar
,
self
.
write_Scalar
)
if
attr_obj
.
datatype
==
PyTango
.
ArgType
.
DevString
:
if
attr_obj
.
datatype
==
PyTango
.
ArgType
.
DevString
:
self
.
myattrs
[
attr_obj
.
name
]
=
""
self
.
myattrs
[
attr_obj
.
name
]
=
""
...
@@ -311,8 +313,7 @@ class Dynamic(PyTango.Device_4Impl):
...
@@ -311,8 +313,7 @@ class Dynamic(PyTango.Device_4Impl):
self
.
myattrs
[
attr_obj
.
name
]
=
np
.
zeros
(
attr_obj
.
dimension
,
fromPyTango2NumpyType
(
attr_obj
.
datatype
))
self
.
myattrs
[
attr_obj
.
name
]
=
np
.
zeros
(
attr_obj
.
dimension
,
fromPyTango2NumpyType
(
attr_obj
.
datatype
))
except
Exception
as
ex
:
except
Exception
as
ex
:
print
(
"
why??
"
)
print
(
ex
)
#sys.stderr.write(str(ex)+"\n")
self
.
set_state
(
PyTango
.
DevState
.
FAULT
)
self
.
set_state
(
PyTango
.
DevState
.
FAULT
)
self
.
set_status
(
"
Error(s) detected in cfg script file
"
)
self
.
set_status
(
"
Error(s) detected in cfg script file
"
)
...
@@ -583,6 +584,7 @@ class Dynamic(PyTango.Device_4Impl):
...
@@ -583,6 +584,7 @@ class Dynamic(PyTango.Device_4Impl):
# Only scalar values can be memorized
# Only scalar values can be memorized
return
return
dict_in
=
{
attr_name
:{
'
__value
'
:
value_in
}}
dict_in
=
{
attr_name
:{
'
__value
'
:
value_in
}}
if
attr_name
in
self
.
memorized_attrs
:
self
.
db
.
put_device_attribute_property
(
self
.
get_name
(),
dict_in
)
self
.
db
.
put_device_attribute_property
(
self
.
get_name
(),
dict_in
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment