Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
PulseGeneration
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Software Control System
Tango devices
CounterTimer
NI
PulseGeneration
Commits
155a4390
Commit
155a4390
authored
Dec 13, 2007
by
Gwenaelle ABEILLE
Browse files
Options
Downloads
Patches
Plain Diff
better managment of state machine
parent
8a915610
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/PulseGeneration.cpp
+39
-55
39 additions, 55 deletions
src/PulseGeneration.cpp
src/PulseGeneration.h
+0
-1
0 additions, 1 deletion
src/PulseGeneration.h
with
39 additions
and
56 deletions
src/PulseGeneration.cpp
+
39
−
55
View file @
155a4390
...
...
@@ -184,8 +184,11 @@ void PulseGeneration::delete_device()
try
{
pulses
->
release
();
if
(
generation_type
.
compare
(
"CONTINUOUS"
)
==
0
)
if
(
!
useExtStartTrigger
&&
generation_type
.
compare
(
"RETRIG"
)
!=
0
)
{
start_trigger
->
release
();
}
}
catch
(...)
{
//ignore
...
...
@@ -198,7 +201,7 @@ void PulseGeneration::delete_device()
delete
pulses
;
pulses
=
0
;
}
if
(
generation_type
.
compare
(
"
CONTINUOUS
"
)
=
=
0
)
if
(
!
useExtStartTrigger
&&
generation_type
.
compare
(
"
RETRIG
"
)
!
=
0
)
if
(
start_trigger
)
{
delete
start_trigger
;
...
...
@@ -695,7 +698,26 @@ void PulseGeneration::get_device_property()
//-----------------------------------------------------------------------------
void
PulseGeneration
::
always_executed_hook
()
{
if
(
generation_type
.
compare
(
"FINITE"
)
==
0
&&
this
->
get_state
()
==
Tango
::
RUNNING
)
{
bool
is_finished
=
false
;
pulses
->
is_done
(
is_finished
);
if
(
is_finished
)
this
->
stop
();
}
if
(
clock
.
compare
(
"INTERNAL"
)
!=
0
&&
this
->
get_state
()
==
Tango
::
RUNNING
)
{
std
::
stringstream
s
;
for
(
int
i
=
0
;
i
<
8
;
i
++
)
{
if
(
ctr_enable
[
i
])
s
<<
"Delay ctr"
<<
i
<<
": "
<<
delay_ticks
[
i
]
<<
" clk ticks; "
<<
"Pulse width ctr"
<<
i
<<
": "
<<
pulse_width_ticks
[
i
]
<<
" clk ticks"
<<
endl
;
}
s
<<
ends
;
string
status_str
=
s
.
str
();
this
->
set_status
(
status_str
.
c_str
());
}
}
//+----------------------------------------------------------------------------
//
...
...
@@ -732,19 +754,6 @@ void PulseGeneration::read_attr_hardware(vector<long> &attr_list)
}
}*/
//this->set_internal_state();
if
(
clock
.
compare
(
"INTERNAL"
)
!=
0
&&
this
->
get_state
()
==
Tango
::
RUNNING
)
{
std
::
stringstream
s
;
for
(
int
i
=
0
;
i
<
8
;
i
++
)
{
if
(
ctr_enable
[
i
])
s
<<
"Delay ctr"
<<
i
<<
": "
<<
delay_ticks
[
i
]
<<
" clk ticks; "
<<
"Pulse width ctr"
<<
i
<<
": "
<<
pulse_width_ticks
[
i
]
<<
" clk ticks"
<<
endl
;
}
s
<<
ends
;
string
status_str
=
s
.
str
();
this
->
set_status
(
status_str
.
c_str
());
}
}
//+----------------------------------------------------------------------------
//
...
...
@@ -2088,21 +2097,6 @@ void PulseGeneration::write_counter7Enable(Tango::WAttribute &attr)
this
->
init_counters
();
}
//+----------------------------------------------------------------------------
//
// method : PulseGeneration::wait_and_stop
//
// description : static method to wait for end of generation
//
//-----------------------------------------------------------------------------
void
PulseGeneration
::
wait_and_stop
(
void
*
me
)
{
PulseGeneration
*
obj
=
(
PulseGeneration
*
)
me
;
cout
<<
"waiting"
<<
endl
;
obj
->
pulses
->
wait_finished
(
-
1
);
obj
->
stop
();
cout
<<
"finished"
<<
endl
;
}
//+------------------------------------------------------------------
/**
* method: PulseGeneration::start
...
...
@@ -2149,19 +2143,6 @@ void PulseGeneration::start()
this
->
set_status
(
"Warning: All counters are disable!"
);
this
->
set_state
(
Tango
::
RUNNING
);
}
// this->update_values();
/*
static omni_thread* create(void (*fn)(void*), void* arg = NULL,
priority_t pri = PRIORITY_NORMAL);
static omni_thread* create(void* (*fn)(void*), void* arg = NULL,
priority_t pri = PRIORITY_NORMAL);*/
if
(
generation_type
.
compare
(
"FINITE"
)
==
0
)
{
omni_thread
::
sleep
(
0
,
10000
);
omni_thread
::
create
(
PulseGeneration
::
wait_and_stop
,(
void
*
)
this
);
}
}
...
...
@@ -2179,23 +2160,24 @@ void PulseGeneration::stop()
{
DEBUG_STREAM
<<
"PulseGeneration::stop(): entering... !"
<<
endl
;
if
(
generation_type
.
compare
(
"RETRIG"
)
!=
0
&&
!
useExtStartTrigger
)
{
_NI660XSL_TRY_ACTION
(
pulses
->
stop
(),
start_trigger
->
stop
(),
"stop"
,
"PulseGeneration::stop"
,
this
->
set_internal_state
()
);
if
(
generation_type
.
compare
(
"RETRIG"
)
!=
0
&&
!
useExtStartTrigger
)
_NI660XSL_TRY_ACTION
(
start_trigger
->
stop
(),
pulses
->
stop
(),
"stop"
,
"PulseGeneration::stop"
,
this
->
set_internal_state
()
);
}
//reconfigure everything here because when using a start trigger
// the start trigger in taken into account only when executing the first Start.
this
->
init_counters
();
...
...
@@ -2381,7 +2363,9 @@ void PulseGeneration::init_counters(void)
{
pulses
->
release
();
if
(
!
useExtStartTrigger
&&
generation_type
.
compare
(
"RETRIG"
)
!=
0
)
{
start_trigger
->
release
();
}
}
catch
(...)
{
...
...
This diff is collapsed.
Click to expand it.
src/PulseGeneration.h
+
0
−
1
View file @
155a4390
...
...
@@ -770,7 +770,6 @@ protected :
void
init_counters
(
void
);
void
update_values
(
void
);
void
set_internal_state
(
void
);
static
void
wait_and_stop
(
void
*
me
);
ni660Xsl
::
OutputOperation
*
pulses
;
ni660Xsl
::
FinitePulseTrainGeneration
*
start_trigger
;
...
...
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