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
58309fd6
Commit
58309fd6
authored
12 years ago
by
px4dev
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of
https://github.com/PX4/Firmware
parents
6ae9f035
532c694e
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
apps/px4io/sbus.c
+16
-10
16 additions, 10 deletions
apps/px4io/sbus.c
with
16 additions
and
10 deletions
apps/px4io/sbus.c
+
16
−
10
View file @
58309fd6
...
...
@@ -53,7 +53,7 @@
#include
"debug.h"
#define SBUS_FRAME_SIZE 25
#define SBUS_INPUT_CHANNELS 1
6
#define SBUS_INPUT_CHANNELS 1
8
static
int
sbus_fd
=
-
1
;
...
...
@@ -87,10 +87,9 @@ sbus_init(const char *device)
partial_frame_count
=
0
;
last_rx_time
=
hrt_absolute_time
();
debug
(
"Sbus: ready"
);
debug
(
"S.Bus: ready"
);
}
else
{
debug
(
"S
b
us: open failed"
);
debug
(
"S
.B
us: open failed"
);
}
return
sbus_fd
;
...
...
@@ -208,9 +207,13 @@ sbus_decode(hrt_abstime frame_time)
return
;
}
/* if the failsafe bit is set, we consider the frame invalid */
if
(
frame
[
23
]
&
(
1
<<
4
))
{
return
;
/* if the failsafe or connection lost bit is set, we consider the frame invalid */
if
((
frame
[
23
]
&
(
1
<<
2
))
&&
/* signal lost */
(
frame
[
23
]
&
(
1
<<
3
)))
{
/* failsafe */
/* actively announce signal loss */
system_state
.
rc_channels
=
0
;
return
1
;
}
/* we have received something we think is a frame */
...
...
@@ -240,9 +243,12 @@ sbus_decode(hrt_abstime frame_time)
system_state
.
rc_channel_data
[
channel
]
=
(
value
/
2
)
+
998
;
}
if
(
PX4IO_INPUT_CHANNELS
>=
18
)
{
chancount
=
18
;
/* XXX decode the two switch channels */
/* decode switch channels if data fields are wide enough */
if
(
chancount
>
17
)
{
/* channel 17 (index 16) */
system_state
.
rc_channel_data
[
16
]
=
(
frame
[
23
]
&
(
1
<<
0
))
*
1000
+
998
;
/* channel 18 (index 17) */
system_state
.
rc_channel_data
[
17
]
=
(
frame
[
23
]
&
(
1
<<
1
))
*
1000
+
998
;
}
/* note the number of channels decoded */
...
...
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