aboutsummaryrefslogtreecommitdiff
path: root/apps/px4io/mixer.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/mixer.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/mixer.c')
-rw-r--r--apps/px4io/mixer.c44
1 files changed, 3 insertions, 41 deletions
diff --git a/apps/px4io/mixer.c b/apps/px4io/mixer.c
index 483e9fe4d..f02e98ae4 100644
--- a/apps/px4io/mixer.c
+++ b/apps/px4io/mixer.c
@@ -50,8 +50,6 @@
#include <drivers/drv_pwm_output.h>
-#include <systemlib/ppm_decode.h>
-
#include "px4io.h"
/*
@@ -59,10 +57,6 @@
*/
static unsigned fmu_input_drops;
#define FMU_INPUT_DROP_LIMIT 20
-/*
- * Collect RC input data from the controller source(s).
- */
-static void mixer_get_rc_input(void);
/*
* Update a mixer based on the current control signals.
@@ -89,12 +83,6 @@ mixer_tick(void)
bool should_arm;
/*
- * Start by looking for R/C control inputs.
- * This updates system_state with any control inputs received.
- */
- mixer_get_rc_input();
-
- /*
* Decide which set of inputs we're using.
*/
if (system_state.mixer_use_fmu) {
@@ -122,8 +110,10 @@ mixer_tick(void)
} else {
/* we have no control input */
+ /* XXX builtin failsafe would activate here */
control_count = 0;
}
+
/*
* Tickle each mixer, if we have control data.
*/
@@ -142,8 +132,7 @@ mixer_tick(void)
/*
* Decide whether the servos should be armed right now.
*/
-
- should_arm = system_state.armed && system_state.arm_ok && (control_count > 0) && system_state.mixer_use_fmu;
+ should_arm = system_state.armed && system_state.arm_ok && (control_count > 0);
if (should_arm && !mixer_servos_armed) {
/* need to arm, but not armed */
up_pwm_servo_arm(true);
@@ -166,30 +155,3 @@ mixer_update(int mixer, uint16_t *inputs, int input_count)
mixers[mixer].current_value = 0;
}
}
-
-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) {
-
- /* 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;
- }
-
- /* 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;
- }
-}