Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
Ardupilot
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
OpenSource
Ardupilot
Commits
33e4f444
Commit
33e4f444
authored
10 years ago
by
Kirill A. Kornilov
Committed by
Andrew Tridgell
10 years ago
Browse files
Options
Downloads
Patches
Plain Diff
RC_Channel: added set_radio_trimmed()
take into account trim value in set_radio()
parent
8d543686
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libraries/RC_Channel/RC_Channel_aux.cpp
+18
-0
18 additions, 0 deletions
libraries/RC_Channel/RC_Channel_aux.cpp
libraries/RC_Channel/RC_Channel_aux.h
+3
-0
3 additions, 0 deletions
libraries/RC_Channel/RC_Channel_aux.h
with
21 additions
and
0 deletions
libraries/RC_Channel/RC_Channel_aux.cpp
+
18
−
0
View file @
33e4f444
...
...
@@ -162,6 +162,24 @@ RC_Channel_aux::set_radio(RC_Channel_aux::Aux_servo_function_t function, int16_t
}
}
/*
set radio_out for all channels matching the given function type, allow radio_trim to center servo
*/
void
RC_Channel_aux
::
set_radio_trimmed
(
RC_Channel_aux
::
Aux_servo_function_t
function
,
int16_t
value
)
{
if
(
!
function_assigned
(
function
))
{
return
;
}
for
(
uint8_t
i
=
0
;
i
<
RC_AUX_MAX_CHANNELS
;
i
++
)
{
if
(
_aux_channels
[
i
]
&&
_aux_channels
[
i
]
->
function
.
get
()
==
function
)
{
int16_t
value2
=
value
-
1500
+
_aux_channels
[
i
]
->
radio_trim
;
_aux_channels
[
i
]
->
radio_out
=
constrain_int16
(
value2
,
_aux_channels
[
i
]
->
radio_min
,
_aux_channels
[
i
]
->
radio_max
);
_aux_channels
[
i
]
->
output
();
}
}
}
/*
set and save the trim value to radio_in for all channels matching
the given function type
...
...
This diff is collapsed.
Click to expand it.
libraries/RC_Channel/RC_Channel_aux.h
+
3
−
0
View file @
33e4f444
...
...
@@ -82,6 +82,9 @@ public:
// set radio_out for a function channel
static
void
set_radio
(
Aux_servo_function_t
function
,
int16_t
value
);
// set radio_out for all channels matching the given function type, allow radio_trim to center servo
static
void
set_radio_trimmed
(
Aux_servo_function_t
function
,
int16_t
value
);
// set and save the trim for a function channel to radio_in
static
void
set_radio_trim
(
Aux_servo_function_t
function
);
...
...
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