Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
Lima
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LimaGroup
Lima
Commits
3f81011c
Commit
3f81011c
authored
13 years ago
by
Sebastien Petitdemange
Browse files
Options
Downloads
Patches
Plain Diff
- fixed active flag init into CtVideo
- pass status callback evaluation
parent
c90e03dd
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
control/include/CtControl.h
+2
-2
2 additions, 2 deletions
control/include/CtControl.h
control/src/CtControl.cpp
+44
-54
44 additions, 54 deletions
control/src/CtControl.cpp
control/src/CtVideo.cpp
+2
-1
2 additions, 1 deletion
control/src/CtVideo.cpp
with
48 additions
and
57 deletions
control/include/CtControl.h
+
2
−
2
View file @
3f81011c
...
...
@@ -211,14 +211,14 @@ namespace lima
ApplyPolicy
m_policy
;
bool
m_ready
;
bool
m_autosave
;
bool
m_running
;
#ifdef WITH_SPS_IMAGE
bool
m_display_active_flag
;
#endif
mutable
bool
m_started
;
ImageStatusCallback
*
m_img_status_cb
;
inline
bool
_checkOverrun
(
Data
&
)
const
;
inline
void
_calcAcqStatus
();
};
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
...
...
This diff is collapsed.
Click to expand it.
control/src/CtControl.cpp
+
44
−
54
View file @
3f81011c
...
...
@@ -108,7 +108,7 @@ CtControl::CtControl(HwInterface *hw) :
m_images_ready
(
CtControl
::
ltData
()),
m_images_buffer_size
(
16
),
m_policy
(
All
),
m_ready
(
false
),
m_autosave
(
false
),
m_
started
(
false
),
m_autosave
(
false
),
m_
running
(
false
),
m_img_status_cb
(
NULL
)
{
DEB_CONSTRUCTOR
();
...
...
@@ -181,6 +181,12 @@ void CtControl::prepareAcq()
{
DEB_MEMBER_FUNCT
();
Status
aStatus
;
getStatus
(
aStatus
);
if
(
aStatus
.
AcquisitionStatus
!=
AcqReady
)
throw
LIMA_CTL_EXC
(
Error
,
"Acquisition not finnished"
);
resetStatus
(
false
);
DEB_TRACE
()
<<
"Apply hardware bin/roi"
;
...
...
@@ -260,6 +266,7 @@ void CtControl::startAcq()
if
(
!
m_ready
)
throw
LIMA_CTL_EXC
(
Error
,
"Run prepareAcq before starting acquisition"
);
m_running
=
true
;
TrigMode
trigMode
;
m_ct_acq
->
getTriggerMode
(
trigMode
);
...
...
@@ -281,8 +288,7 @@ void CtControl::startAcq()
}
m_hw
->
startAcq
();
m_started
=
true
;
m_status
.
AcquisitionStatus
=
AcqRunning
;
DEB_TRACE
()
<<
"Hardware Acquisition started"
;
}
...
...
@@ -291,72 +297,53 @@ void CtControl::stopAcq()
DEB_MEMBER_FUNCT
();
m_hw
->
stopAcq
();
m_started
=
false
;
m_ready
=
false
;
m_running
=
false
;
DEB_TRACE
()
<<
"Hardware Acquisition Stopped"
;
_calcAcqStatus
();
}
void
CtControl
::
getStatus
(
Status
&
status
)
const
{
DEB_MEMBER_FUNCT
();
AutoMutex
aLock
(
m_cond
.
mutex
());
DEB_TRACE
()
<<
DEB_VAR2
(
m_status
.
AcquisitionStatus
,
m_started
);
bool
fault
=
(
m_status
.
AcquisitionStatus
==
AcqFault
);
if
(
!
fault
&&
m_started
)
status
=
m_status
;
if
(
status
.
AcquisitionStatus
==
AcqReady
)
{
const
ImageStatus
&
anImageCnt
=
m_status
.
ImageCounters
;
// Check if save has finnished
CtSaving
::
SavingMode
aSavemode
;
m_ct_saving
->
getSavingMode
(
aSavemode
);
bool
aSavingIdleFlag
=
true
;
if
(
aSavemode
!=
CtSaving
::
Manual
)
aSavingIdleFlag
=
anImageCnt
.
LastImageAcquired
==
anImageCnt
.
LastImageSaved
;
// End Check Save
HwInterface
::
Status
aHwStatus
;
m_hw
->
getStatus
(
aHwStatus
);
DEB_TRACE
()
<<
DEB_VAR1
(
aHwStatus
);
status
.
AcquisitionStatus
=
aHwStatus
.
acq
;
}
}
// Check if processing has finnished
bool
aProcessingIdle
=
anImageCnt
.
LastImageAcquired
==
anImageCnt
.
LastImageReady
;
/** @brief an event arrived, calc the new status
*/
void
CtControl
::
_calcAcqStatus
()
{
DEB_MEMBER_FUNCT
();
if
(
aSavingIdleFlag
&&
aProcessingIdle
)
AutoMutex
aLock
(
m_cond
.
mutex
());
if
(
m_status
.
AcquisitionStatus
==
AcqRunning
)
{
const
ImageStatus
&
anImageCnt
=
m_status
.
ImageCounters
;
int
acq_nb_frames
;
m_ct_acq
->
getAcqNbFrames
(
acq_nb_frames
);
if
((
!
m_running
||
anImageCnt
.
LastImageAcquired
==
(
acq_nb_frames
-
1
))
&&
// we reach the nb frames asked
anImageCnt
.
LastImageAcquired
==
anImageCnt
.
LastImageReady
)
// processing has finnished
{
HwInterface
::
Status
aHwStatus
;
m_hw
->
getStatus
(
aHwStatus
);
DEB_TRACE
()
<<
DEB_VAR1
(
aHwStatus
);
// set the status to hw acquisition status
m_status
.
AcquisitionStatus
=
aHwStatus
.
acq
;
AcqMode
anAcqMode
;
m_ct_acq
->
getAcqMode
(
anAcqMode
);
if
(
anAcqMode
!=
Accumulation
)
if
(
m_ct_saving
->
hasAutoSaveMode
())
{
int
last_hw_frame
=
m_hw
->
getNbAcquiredFrames
()
-
1
;
bool
aFalseIdle
=
((
aHwStatus
.
acq
==
AcqReady
)
&&
(
anImageCnt
.
LastImageAcquired
!=
last_hw_frame
));
if
(
aFalseIdle
)
m_status
.
AcquisitionStatus
=
AcqRunning
;
// Saving is finnished
if
(
anImageCnt
.
LastImageAcquired
==
anImageCnt
.
LastImageSaved
)
m_status
.
AcquisitionStatus
=
AcqReady
;
}
else
{
int
last_frame_id
;
m_ct_acq
->
getAcqNbFrames
(
last_frame_id
);
last_frame_id
-=
1
;
if
(
anImageCnt
.
LastImageAcquired
!=
last_frame_id
)
m_status
.
AcquisitionStatus
=
AcqRunning
;
}
m_status
.
AcquisitionStatus
=
AcqReady
;
DEB_TRACE
()
<<
DEB_VAR1
(
m_status
);
}
else
m_status
.
AcquisitionStatus
=
AcqRunning
;
}
else
if
(
!
fault
)
m_status
.
AcquisitionStatus
=
AcqReady
;
status
=
m_status
;
if
(
m_status
.
AcquisitionStatus
==
AcqReady
)
m_started
=
false
;
DEB_RETURN
()
<<
DEB_VAR1
(
status
);
}
void
CtControl
::
getImageStatus
(
ImageStatus
&
status
)
const
...
...
@@ -473,6 +460,7 @@ void CtControl::reset()
m_ct_sps_image
->
reset
();
#endif
resetStatus
(
false
);
m_status
.
AcquisitionStatus
=
AcqReady
;
}
void
CtControl
::
resetStatus
(
bool
only_acq_status
)
...
...
@@ -519,6 +507,7 @@ bool CtControl::newFrameReady(Data& fdata)
if
(
m_img_status_cb
)
m_img_status_cb
->
imageStatusChanged
(
m_status
.
ImageCounters
);
_calcAcqStatus
();
}
return
aContinueFlag
;
}
...
...
@@ -576,7 +565,7 @@ void CtControl::newBaseImageReady(Data &aData)
if
(
img_status_changed
&&
m_img_status_cb
)
m_img_status_cb
->
imageStatusChanged
(
m_status
.
ImageCounters
);
_calcAcqStatus
();
}
void
CtControl
::
newImageReady
(
Data
&
aData
)
...
...
@@ -623,7 +612,7 @@ void CtControl::newImageReady(Data &aData)
if
(
m_img_status_cb
&&
img_status_changed
)
m_img_status_cb
->
imageStatusChanged
(
m_status
.
ImageCounters
);
_calcAcqStatus
();
}
void
CtControl
::
newCounterReady
(
Data
&
)
...
...
@@ -645,6 +634,7 @@ void CtControl::newImageSaved(Data&)
if
(
m_img_status_cb
)
m_img_status_cb
->
imageStatusChanged
(
m_status
.
ImageCounters
);
_calcAcqStatus
();
}
void
CtControl
::
newFrameToSave
(
Data
&
fdata
)
...
...
This diff is collapsed.
Click to expand it.
control/src/CtVideo.cpp
+
2
−
1
View file @
3f81011c
...
...
@@ -254,7 +254,8 @@ CtVideo::CtVideo(CtControl &ct) :
m_image_callback
(
NULL
),
m_internal_image_callback
(
NULL
),
m_ct
(
ct
),
m_stopping_live
(
false
)
m_stopping_live
(
false
),
m_active_flag
(
false
)
{
HwInterface
*
hw
=
ct
.
hwInterface
();
m_has_video
=
hw
->
getHwCtrlObj
(
m_video
);
...
...
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