Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
FemtoCurrentAmplifier
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
MeasureInstruments
FemtoCurrentAmplifier
Commits
8acf4123
Commit
8acf4123
authored
Jun 18, 2015
by
Alain BUTEAU
Browse files
Options
Downloads
Patches
Plain Diff
Created tag release_1_5_0.
parent
8ca63bd9
Branches
Branches containing commit
Tags
release_1_5_0
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
pom.xml
+2
-2
2 additions, 2 deletions
pom.xml
src/AutoSearchGainTask.cpp
+21
-17
21 additions, 17 deletions
src/AutoSearchGainTask.cpp
src/FemtoCurrentAmplifier.cpp
+47
-25
47 additions, 25 deletions
src/FemtoCurrentAmplifier.cpp
src/FemtoCurrentAmplifier.h
+3
-2
3 additions, 2 deletions
src/FemtoCurrentAmplifier.h
with
73 additions
and
46 deletions
pom.xml
+
2
−
2
View file @
8acf4123
...
...
@@ -8,7 +8,7 @@
</parent>
<groupId>
fr.soleil.device
</groupId>
<artifactId>
FemtoCurrentAmplifier-${aol}-${mode}
</artifactId>
<version>
1.
4.4
</version>
<version>
1.
5.0
</version>
<packaging>
nar
</packaging>
<name>
FemtoCurrentAmplifier
</name>
<!-- use for the name of executable -->
...
...
This diff is collapsed.
Click to expand it.
src/AutoSearchGainTask.cpp
+
21
−
17
View file @
8acf4123
...
...
@@ -15,6 +15,8 @@
// ----------------------------------------------------------------------------
const
size_t
kPERIODIC_TMOUT_MS
=
30000
;
//- task period = in ms
const
size_t
AUTOSEARCH_TMOUT_MS
=
10000
;
//- task period = in ms
//---------------------------------------------------------
//- the YAT user messages : switch magnet sequence
//const size_t SWICTH_MAGNET_SEQ = yat::FIRST_USER_MSG + 1;
...
...
@@ -31,6 +33,8 @@ namespace FemtoCurrentAmplifier_ns
AutoSearchGainTask
::
AutoSearchGainTask
(
Tango
::
DeviceImpl
*
host_device
)
:
yat4tango
::
DeviceTask
(
host_device
)
{
DEBUG_STREAM
<<
"CTOR : AutoSearchGainTask::AutoSearchGainTask "
<<
std
::
endl
;
_host_dev
=
(
FemtoCurrentAmplifier
*
)
host_device
;
this
->
enable_timeout_msg
(
false
);
// no need to get periodic activity
...
...
@@ -52,7 +56,7 @@ void AutoSearchGainTask::process_message (yat::Message& _msg)
throw
(
Tango
::
DevFailed
)
{
//- The DeviceTask's lock_ -------------
DEBUG_STREAM
<<
"AutoSearchGainTask::process_message::receiving msg "
<<
_msg
.
t
o_string
()
<<
std
::
endl
;
DEBUG_STREAM
<<
"AutoSearchGainTask::process_message::receiving msg "
<<
_msg
.
t
ype
()
<<
std
::
endl
;
//- handle msg
switch
(
_msg
.
type
())
...
...
@@ -61,7 +65,6 @@ throw (Tango::DevFailed)
case
yat
::
TASK_INIT
:
{
DEBUG_STREAM
<<
"AutoSearchGainTask::handle_message::THREAD_INIT::thread is starting up"
<<
std
::
endl
;
}
break
;
//- TASK_EXIT =======================
...
...
@@ -80,6 +83,8 @@ throw (Tango::DevFailed)
//- WRITE_SET_POINT =======================
case
AUTO_SEARCH_GAIN
:
{
DEBUG_STREAM
<<
"AutoSearchGainTask::handle_message handling AUTO_SEARCH_GAIN msg ..."
<<
std
::
endl
;
this
->
autosearch_gain
();
}
break
;
...
...
@@ -92,29 +97,26 @@ throw (Tango::DevFailed)
void
AutoSearchGainTask
::
autosearch_gain
(
void
)
{
INFO_STREAM
<<
"AutoSearchGainTask::autosearch_gain AUTO_SEARCH_GAIN msg ..."
<<
std
::
endl
;
//- Start the Loop on Gains
for
(
int
i
=
_host_dev
->
get_max_gain_index
();
i
>
-
1
;
i
--
)
{
//- set the gain
INFO_STREAM
<<
"AutoSearchGainTask::autosearch_gain trying to write gain = "
<<
i
<<
std
::
endl
;
_host_dev
->
write_gain
((
short
)
i
);
omni_thread
::
sleep
(
100
);
//- read Overload
_host_dev
->
always_executed_hook
();
omni_thread
::
sleep
(
1
);
//- Check if overload happen: 1->overload , 0->not overload
if
(
_host_dev
->
get_overload
()
==
0
)
{
INFO_STREAM
<<
"Gain Found: gain value= "
<<
i
<<
endl
;
_host_dev
->
internal_set_state
(
Tango
::
ON
);
_host_dev
->
internal_set_status
(
"Femto is in NORMAL operation"
);
INFO_STREAM
<<
" No Overload "
;
break
;
}
else
INFO_STREAM
<<
"
Gain not Found, try with next one
"
<<
endl
;
INFO_STREAM
<<
"
Overload still present ==> try decreasing gain
"
<<
endl
;
}
WARN_STREAM
<<
"Gain Not Found: Maybe signal is too High"
<<
endl
;
_host_dev
->
internal_set_state
(
Tango
::
ON
);
_host_dev
->
internal_set_status
(
"Femto is in NORMAL operation"
);
}
//-----------------------------------------------
...
...
@@ -123,18 +125,20 @@ void AutoSearchGainTask::autosearch_gain (void)
void
AutoSearchGainTask
::
search_gain
(
void
)
{
DEBUG_STREAM
<<
"AutoSearchGainTask::search_gain starting..."
<<
std
::
endl
;
//- create and post msg
yat
::
Message
*
msg
=
new
yat
::
Message
(
AUTO_SEARCH_GAIN
,
MAX_USER_PRIORITY
,
true
);
if
(
!
msg
)
{
ERROR_STREAM
<<
"A
BC1260Task::get_battery_charge->
yat::Message allocation failed."
<<
std
::
endl
;
ERROR_STREAM
<<
"A
utoSearchGainTask::search_gain
yat::Message allocation failed."
<<
std
::
endl
;
Tango
::
Except
::
throw_exception
(
"OUT_OF_MEMORY"
,
"yat::Message allocation failed"
,
"ABC1260Task::get_battery_charge"
);
}
//- wait till the message is processed !!
this
->
wait_msg_handled
(
msg
);
this
->
post
(
msg
,
AUTOSEARCH_TMOUT_MS
);
}
...
...
This diff is collapsed.
Click to expand it.
src/FemtoCurrentAmplifier.cpp
+
47
−
25
View file @
8acf4123
...
...
@@ -419,7 +419,6 @@ namespace FemtoCurrentAmplifier_ns
void
FemtoCurrentAmplifier
::
always_executed_hook
()
{
yat
::
AutoMutex
<>
guard
(
this
->
_always_executed_hook_mutex
);
if
(
!
is_dio_proxy_created
)
{
...
...
@@ -632,7 +631,7 @@ void FemtoCurrentAmplifier::read_gainSelectedNum(Tango::Attribute &attr)
//
// description : Extract real attribute values for gainMode acquisition result.
//
//--------------------------------------------------------------
---------------
//--------------------------------------------------------------
1
void
FemtoCurrentAmplifier
::
read_gainMode
(
Tango
::
Attribute
&
attr
)
{
DEBUG_STREAM
<<
"FemtoCurrentAmplifier::read_gainMode(Tango::Attribute &attr) entering... "
<<
endl
;
...
...
@@ -691,12 +690,8 @@ void FemtoCurrentAmplifier::read_gainSelectedNum(Tango::Attribute &attr)
try
{
bool
temp_overload
;
_DEV_TRY
(
dio_board_proxy
->
command_inout
(
"ReadLine"
,
overloadLine
.
c_str
(),
temp_overload
),
"dio_board_proxy->command_inout(ReadLine,overloadLine.c_str())"
,
"FemtoCurrentAmplifier::read_overload"
);
*
attr_overload_read
=
get_overload
();
*
attr_overload_read
=
temp_overload
;
attr
.
set_value
(
attr_overload_read
);
if
(
*
attr_overload_read
==
1
)
{
...
...
@@ -814,6 +809,8 @@ void FemtoCurrentAmplifier::read_gainSelectedNum(Tango::Attribute &attr)
//+------------------------------------------------------------------
void
FemtoCurrentAmplifier
::
set_gain_on_dio_board
(
short
gain_value
)
{
INFO_STREAM
<<
"FemtoCurrentAmplifier::set_gain_on_dio_board(): entering.... gain= "
<<
gain_value
<<
endl
;
//- Check if valid value
if
((
gain_value
<
0
)
||
(
gain_value
>
MAX_GAIN_INDEX
))
{
...
...
@@ -867,6 +864,7 @@ void FemtoCurrentAmplifier::read_gainSelectedNum(Tango::Attribute &attr)
//- Reset MSB
if
(
(
gain_value
<
4
)
||
(
gain_value
>
7
))
{
_DEV_TRY
(
dio_board_proxy
->
command_in
(
"ResetLine"
,
mSBGainLine
.
c_str
()),
"dio_board_proxy->command_inout(ResetLine,mSBGainLine.c_str())"
,
"FemtoCurrentAmplifier::set_gain_on_dio_board"
);
...
...
@@ -905,6 +903,7 @@ void FemtoCurrentAmplifier::read_gainSelectedNum(Tango::Attribute &attr)
//coupling line - Pin13 = 1;
}
}
// end femto300
}
...
...
@@ -961,12 +960,15 @@ void FemtoCurrentAmplifier::read_gainSelectedNum(Tango::Attribute &attr)
return
local_read_gain
;
}
//+------------------------------------------------------------------
/**
* method: FemtoCurrentAmplifier::auto_search_gain
*
* description: method to execute "AutoSearchGain"
* Automatically search Gain:
* Automatically search Gain:1434644282 [-1326478432] DEBUG tmp/test/femto FemtoCurrentAmplifier::read_overload(Tango::Attribute &attr) entering...
* Set 1st Gain
* Check if Overload
* ....
...
...
@@ -985,6 +987,27 @@ void FemtoCurrentAmplifier::read_gainSelectedNum(Tango::Attribute &attr)
}
//+------------------------------------------------------------------
/**
* method: FemtoCurrentAmplifier::get_overload
*
* description: method to execute read Overload on HW
*/
//+------------------------------------------------------------------
bool
FemtoCurrentAmplifier
::
get_overload
()
{
DEBUG_STREAM
<<
"FemtoCurrentAmplifier::get_overload(): entering... !"
<<
endl
;
yat
::
AutoMutex
<>
guard
(
this
->
_get_overload_mutex
);
bool
temp_overload
;
dio_board_proxy
->
command_inout
(
"ReadLine"
,
overloadLine
.
c_str
(),
temp_overload
);
return
temp_overload
;
}
//+------------------------------------------------------------------
/**
* method: FemtoCurrentAmplifier::write_gain
*
...
...
@@ -994,18 +1017,17 @@ void FemtoCurrentAmplifier::read_gainSelectedNum(Tango::Attribute &attr)
void
FemtoCurrentAmplifier
::
write_gain
(
short
new_gain
)
{
DEBUG_STREAM
<<
"FemtoCurrentAmplifier::write_gain(): entering... !"
<<
endl
;
INFO_STREAM
<<
"FemtoCurrentAmplifier::write_gain(): entering... . new_gain= "
<<
new_gain
<<
endl
;
yat
::
AutoMutex
<>
guard
(
this
->
_write_gain_mutex
);
if
(
new_gain
>
MAX_GAIN_INDEX
)
{
attr_gain_write
=
MAX_GAIN_INDEX
;
new_gain
=
MAX_GAIN_INDEX
;
}
if
(
new_gain
<
0
)
{
attr_gain_write
=
0
;
new_gain
=
0
;
}
attr_gain_write
=
new_gain
;
//- Avoid the wheelswith to go above or under the max-min
Tango
::
WAttribute
&
gain_w
=
dev_attr
->
get_w_attr_by_name
(
"gain"
);
...
...
This diff is collapsed.
Click to expand it.
src/FemtoCurrentAmplifier.h
+
3
−
2
View file @
8acf4123
...
...
@@ -75,7 +75,7 @@ public :
short
get_max_gain_index
()
{
return
MAX_GAIN_INDEX
;};
void
write_gain
(
short
gain
);
bool
get_overload
()
{
return
*
attr_overload_read
;}
;
bool
get_overload
()
;
// Here is the Start of the automatic code generation part
//-------------------------------------------------------------
...
...
@@ -366,7 +366,8 @@ private :
class
AutoSearchGainTask
*
_auto_search_task
;
yat
::
Mutex
_state_mutex
;
yat
::
Mutex
_status_mutex
;
yat
::
Mutex
_always_executed_hook_mutex
;
yat
::
Mutex
_get_overload_mutex
;
yat
::
Mutex
_write_gain_mutex
;
public
:
void
internal_set_state
(
Tango
::
DevState
new_state
)
...
...
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