aboutsummaryrefslogtreecommitdiff
path: root/apps/px4io/mixer.c
diff options
context:
space:
mode:
authorpx4dev <px4@purgatory.org>2012-12-01 00:50:39 -0800
committerpx4dev <px4@purgatory.org>2012-12-01 00:50:39 -0800
commitea8872f5456dbba566fb4167ec66b4afa183b3e1 (patch)
tree40def937aa4253700cb78c07b0e70b0963537da1 /apps/px4io/mixer.c
parentefd3b9dea689ef4244a3a2fd9f4217a544b254ee (diff)
parentef4a54666d760a18b18800163a24faf5883c1e61 (diff)
downloadpx4-firmware-ea8872f5456dbba566fb4167ec66b4afa183b3e1.tar.gz
px4-firmware-ea8872f5456dbba566fb4167ec66b4afa183b3e1.tar.bz2
px4-firmware-ea8872f5456dbba566fb4167ec66b4afa183b3e1.zip
Merge branch 'sbus' of https://github.com/PX4/Firmware into #61-px4io-spektrum-decoder
Diffstat (limited to 'apps/px4io/mixer.c')
-rw-r--r--apps/px4io/mixer.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/apps/px4io/mixer.c b/apps/px4io/mixer.c
index fb553bc6e..483e9fe4d 100644
--- a/apps/px4io/mixer.c
+++ b/apps/px4io/mixer.c
@@ -170,17 +170,26 @@ mixer_update(int mixer, uint16_t *inputs, int input_count)
static void
mixer_get_rc_input(void)
{
-
/* if we haven't seen any new data in 200ms, assume we have lost input and tell FMU */
if ((hrt_absolute_time() - ppm_last_valid_decode) > 200000) {
- system_state.rc_channels = 0;
- system_state.fmu_report_due = true;
+
+ /* input was ok and timed out, mark as update */
+ if (system_state.ppm_input_ok) {
+ system_state.ppm_input_ok = false;
+ system_state.fmu_report_due = true;
+ }
return;
}
- /* otherwise, copy channel data */
- system_state.rc_channels = ppm_decoded_channels;
- for (unsigned i = 0; i < ppm_decoded_channels; i++)
- system_state.rc_channel_data[i] = ppm_buffer[i];
- system_state.fmu_report_due = true;
+ /* mark PPM as valid */
+ system_state.ppm_input_ok = true;
+
+ /* check if no DSM and S.BUS data is available */
+ if (!system_state.sbus_input_ok && !system_state.dsm_input_ok) {
+ /* otherwise, copy channel data */
+ system_state.rc_channels = ppm_decoded_channels;
+ for (unsigned i = 0; i < ppm_decoded_channels; i++)
+ system_state.rc_channel_data[i] = ppm_buffer[i];
+ system_state.fmu_report_due = true;
+ }
}