Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Firmware
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
Package registry
Model registry
Operate
Environments
Terraform modules
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alberto Ruiz Garcia
Firmware
Commits
9ed21afd
Commit
9ed21afd
authored
8 years ago
by
Beat Küng
Browse files
Options
Downloads
Patches
Plain Diff
vmount: simplify initialization
parent
021b808f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/drivers/vmount/vmount.cpp
+12
-34
12 additions, 34 deletions
src/drivers/vmount/vmount.cpp
with
12 additions
and
34 deletions
src/drivers/vmount/vmount.cpp
+
12
−
34
View file @
9ed21afd
...
...
@@ -220,55 +220,27 @@ static int vmount_thread_main(int argc, char *argv[])
case
0
:
// Automatic
if
(
!
thread_data
.
input_objs
[
0
])
{
thread_data
.
input_objs
[
0
]
=
new
InputMavlinkCmdMount
();
if
(
!
thread_data
.
input_objs
[
0
])
{
alloc_failed
=
true
;
}
}
if
(
!
thread_data
.
input_objs
[
1
])
{
thread_data
.
input_objs
[
1
]
=
new
InputMavlinkROI
();
if
(
!
thread_data
.
input_objs
[
1
])
{
alloc_failed
=
true
;
}
}
thread_data
.
input_objs
[
0
]
=
new
InputMavlinkCmdMount
();
thread_data
.
input_objs
[
1
]
=
new
InputMavlinkROI
();
// RC is on purpose last here so that if there are any mavlink
// messages, they will take precedence over RC.
// This logic is done further below while update() is called.
if
(
!
thread_data
.
input_objs
[
2
])
{
thread_data
.
input_objs
[
2
]
=
new
InputRC
(
params
.
mnt_man_roll
,
params
.
mnt_man_pitch
,
params
.
mnt_man_yaw
);
if
(
!
thread_data
.
input_objs
[
2
])
{
alloc_failed
=
true
;
}
}
thread_data
.
input_objs
[
2
]
=
new
InputRC
(
params
.
mnt_man_roll
,
params
.
mnt_man_pitch
,
params
.
mnt_man_yaw
);
thread_data
.
input_objs_len
=
3
;
break
;
case
1
:
//RC
if
(
!
thread_data
.
input_objs
[
0
])
{
thread_data
.
input_objs
[
0
]
=
new
InputRC
(
params
.
mnt_man_roll
,
params
.
mnt_man_pitch
,
params
.
mnt_man_yaw
);
if
(
!
thread_data
.
input_objs
[
0
])
{
alloc_failed
=
true
;
}
}
thread_data
.
input_objs
[
0
]
=
new
InputRC
(
params
.
mnt_man_roll
,
params
.
mnt_man_pitch
,
params
.
mnt_man_yaw
);
break
;
case
2
:
//MAVLINK_ROI
if
(
!
thread_data
.
input_objs
[
0
])
{
thread_data
.
input_objs
[
0
]
=
new
InputMavlinkROI
();
if
(
!
thread_data
.
input_objs
[
0
])
{
alloc_failed
=
true
;
}
}
thread_data
.
input_objs
[
0
]
=
new
InputMavlinkROI
();
break
;
case
3
:
//MAVLINK_DO_MOUNT
if
(
!
thread_data
.
input_objs
[
0
])
{
thread_data
.
input_objs
[
0
]
=
new
InputMavlinkCmdMount
();
if
(
!
thread_data
.
input_objs
[
0
])
{
alloc_failed
=
true
;
}
}
thread_data
.
input_objs
[
0
]
=
new
InputMavlinkCmdMount
();
break
;
default:
...
...
@@ -277,6 +249,12 @@ static int vmount_thread_main(int argc, char *argv[])
}
}
for
(
int
i
=
0
;
i
<
thread_data
.
input_objs_len
;
++
i
)
{
if
(
!
thread_data
.
input_objs
[
i
])
{
alloc_failed
=
true
;
}
}
switch
(
params
.
mnt_mode_out
)
{
case
0
:
//AUX
thread_data
.
output_obj
=
new
OutputRC
(
output_config
);
...
...
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