aboutsummaryrefslogtreecommitdiff
path: root/apps/px4io/sbus.c
diff options
context:
space:
mode:
authorpx4dev <px4@purgatory.org>2012-12-03 23:20:28 -0800
committerpx4dev <px4@purgatory.org>2012-12-03 23:20:28 -0800
commit1485a4ec1aa8328cc50d99a1195b20df2b11045e (patch)
treef67ead58c92cc4febae6faa65ef4523581b511f1 /apps/px4io/sbus.c
parent6e328b4d7ab31faef5796956cffb985a9859549d (diff)
downloadpx4-firmware-1485a4ec1aa8328cc50d99a1195b20df2b11045e.tar.gz
px4-firmware-1485a4ec1aa8328cc50d99a1195b20df2b11045e.tar.bz2
px4-firmware-1485a4ec1aa8328cc50d99a1195b20df2b11045e.zip
Fix breakage to the DSM parser introduced with the input prioritisation logic. Back out to a "any input wins" strategy; connecting multiple receivers to I/O at the same time is currently not supported (read: strange things will happen).
Diffstat (limited to 'apps/px4io/sbus.c')
-rw-r--r--apps/px4io/sbus.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/apps/px4io/sbus.c b/apps/px4io/sbus.c
index c3949f2b0..25fe0cf38 100644
--- a/apps/px4io/sbus.c
+++ b/apps/px4io/sbus.c
@@ -195,17 +195,16 @@ sbus_decode(hrt_abstime frame_time)
/* check frame boundary markers to avoid out-of-sync cases */
if ((frame[0] != 0x0f) || (frame[24] != 0x00)) {
sbus_frame_drops++;
- system_state.sbus_input_ok = false;
return;
}
- /* if the failsafe bit is set, we consider that a loss of RX signal */
+ /* if the failsafe bit is set, we consider the frame invalid */
if (frame[23] & (1 << 4)) {
- system_state.sbus_input_ok = false;
return;
}
- unsigned chancount = (PX4IO_INPUT_CHANNELS > 16) ? 16 : PX4IO_INPUT_CHANNELS;
+ unsigned chancount = (PX4IO_INPUT_CHANNELS > SBUS_INPUT_CHANNELS) ?
+ SBUS_INPUT_CHANNELS : PX4IO_INPUT_CHANNELS;
/* use the decoder matrix to extract channel data */
for (unsigned channel = 0; channel < chancount; channel++) {
@@ -228,14 +227,16 @@ sbus_decode(hrt_abstime frame_time)
}
if (PX4IO_INPUT_CHANNELS >= 18) {
- /* decode two switch channels */
chancount = 18;
+ /* XXX decode the two switch channels */
}
+ /* note the number of channels decoded */
system_state.rc_channels = chancount;
- system_state.sbus_input_ok = true;
- system_state.fmu_report_due = true;
/* and note that we have received data from the R/C controller */
system_state.rc_channels_timestamp = frame_time;
+
+ /* trigger an immediate report to the FMU */
+ system_state.fmu_report_due = true;
}