Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
SingleShotAO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Software Control System
Tango devices
InputOutput
ADLINK
SingleShotAO
Commits
646f4650
Commit
646f4650
authored
3 months ago
by
Alexandre MALFREYT
Committed by
Florent LANGLOIS
3 months ago
Browse files
Options
Downloads
Patches
Plain Diff
feat: added logging and consolidate dynamic attribute management
parent
2c69e3b7
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!4
develop -> main
,
!3
EnableRamps and OutputMemorizedChannelsAtInit properties
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/SingleShotAO.cpp
+65
-1
65 additions, 1 deletion
src/SingleShotAO.cpp
with
65 additions
and
1 deletion
src/SingleShotAO.cpp
+
65
−
1
View file @
646f4650
...
...
@@ -318,6 +318,7 @@ void SingleShotAO::init_device()
m_nb_chan
=
16
;
}
INFO_STREAM
<<
"Board has "
<<
m_nb_chan
<<
" channels"
<<
endl
;
// construct the AO manager
//--------------------------------------------
...
...
@@ -377,6 +378,20 @@ void SingleShotAO::init_device()
return
;
}
// Remove existing dynamic attributes to avoid duplicates or other issues
// --------------------------------------------
if
(
m_dyn_attr_manager
)
{
try
{
m_dyn_attr_manager
->
remove_attributes
();
delete
m_dyn_attr_manager
;
m_dyn_attr_manager
=
NULL
;
DEBUG_STREAM
<<
"Existing dynamic attributes manager cleaned up"
<<
endl
;
}
catch
(...)
{
ERROR_STREAM
<<
"Error cleaning up existing dynamic attributes manager, continuing..."
<<
endl
;
// Continue anyway - we'll create a new one
}
}
// Create dynamic attributes
//--------------------------------------------
...
...
@@ -404,6 +419,17 @@ void SingleShotAO::init_device()
// add dynamic attributes: channel, speed & initial for each channel
std
::
vector
<
yat4tango
::
DynamicAttributeInfo
>
l_dynAttrList
;
// Log how many attributes we're going to create
INFO_STREAM
<<
"Creating dynamic attributes for "
<<
m_nb_chan
<<
" channels."
;
INFO_STREAM
<<
"Total attributes: "
<<
m_nb_chan
*
(
enableRamps
?
3
:
1
)
<<
endl
;
// if enableRamps if false, skip speed and initial attributes
if
(
!
enableRamps
)
{
INFO_STREAM
<<
"Ramps are disabled. Skipping speed and initial attributes"
<<
std
::
endl
;
}
for
(
unsigned
int
l_cpt
=
0
;
l_cpt
<
m_nb_chan
;
l_cpt
++
)
{
yat
::
OSStream
oss
;
...
...
@@ -515,8 +541,45 @@ void SingleShotAO::init_device()
l_dynAttrList
.
push_back
(
dai_initial
);
}
// Log the size of our attribute list before adding to manager
INFO_STREAM
<<
"Prepared "
<<
l_dynAttrList
.
size
()
<<
" dynamic attributes for creation"
<<
endl
;
// Add all attributes
try
{
m_dyn_attr_manager
->
add_attributes
(
l_dynAttrList
);
INFO_STREAM
<<
"Successfully added all dynamic attributes"
<<
endl
;
}
catch
(
Tango
::
DevFailed
&
df
)
{
ERROR_STREAM
<<
"Failed to add dynamic attributes: "
<<
df
<<
endl
;
m_currStatus
=
"Failed to add dynamic attributes. See log for details"
;
m_state
=
Tango
::
FAULT
;
return
;
}
catch
(...)
{
ERROR_STREAM
<<
"Unknown exception when adding dynamic attributes"
<<
endl
;
m_currStatus
=
"Failed to add dynamic attributes. Unknown error"
;
m_state
=
Tango
::
FAULT
;
return
;
}
// Initialize maps in manager class for all channels
try
{
for
(
unsigned
int
l_cpt
=
0
;
l_cpt
<
m_nb_chan
;
l_cpt
++
)
{
// Initialize with default values
m_manager
->
set_channel
(
l_cpt
,
0.0
);
if
(
enableRamps
)
{
m_manager
->
set_speed
(
l_cpt
,
0.0
);
m_manager
->
set_initial
(
l_cpt
,
0.0
);
}
}
}
catch
(
Tango
::
DevFailed
&
df
)
{
ERROR_STREAM
<<
"Failed to initialize channel maps: "
<<
df
<<
endl
;
m_currStatus
=
"Failed to initialize channel maps. See log for details"
;
m_state
=
Tango
::
FAULT
;
return
;
}
// Get memorized values from database
for
(
unsigned
int
l_cpt
=
0
;
l_cpt
<
m_nb_chan
;
l_cpt
++
)
...
...
@@ -531,6 +594,7 @@ void SingleShotAO::init_device()
try
{
std
::
string
attrName
=
attrPrefix
+
oss
.
str
();
double
val
=
yat4tango
::
PropertyHelper
::
get_memorized_attribute
<
double
>
(
this
,
attrName
);
DEBUG_STREAM
<<
"Found memorized value for "
<<
attrName
<<
": "
<<
val
<<
endl
;
(
m_manager
->*
setter
)(
l_cpt
,
val
);
}
catch
(...)
{
...
...
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
register
or
sign in
to comment