aboutsummaryrefslogtreecommitdiff
path: root/apps/px4io/controls.c
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2012-12-13 10:23:02 +0100
committerLorenz Meier <lm@inf.ethz.ch>2012-12-13 10:23:02 +0100
commit03076a72ca75917cf62d7889c6c6d0de36866b04 (patch)
treecd47c9885bfe7e7c80bd616a612db2a5f8ae564c /apps/px4io/controls.c
parent154035279fbfbe14be208d5ec957089f11f6447d (diff)
downloadpx4-firmware-03076a72ca75917cf62d7889c6c6d0de36866b04.tar.gz
px4-firmware-03076a72ca75917cf62d7889c6c6d0de36866b04.tar.bz2
px4-firmware-03076a72ca75917cf62d7889c6c6d0de36866b04.zip
Added required additional fields: If system is ok to launch (required for LED indicator), if system is ok to override fully by RC (required for multirotors which should not support this), desired PWM output rate in Hz (again required for some multirotors).
Diffstat (limited to 'apps/px4io/controls.c')
-rw-r--r--apps/px4io/controls.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/apps/px4io/controls.c b/apps/px4io/controls.c
index d4eace3df..03c8182b2 100644
--- a/apps/px4io/controls.c
+++ b/apps/px4io/controls.c
@@ -78,7 +78,43 @@ controls_main(void)
if (fds[0].revents & POLLIN)
dsm_input();
if (fds[1].revents & POLLIN)
+<<<<<<< Updated upstream
sbus_input();
+=======
+ locked |= sbus_input();
+
+ /*
+ * If we don't have lock from one of the serial receivers,
+ * look for PPM. It shares an input with S.bus, so there's
+ * a possibility it will mis-parse an S.bus frame.
+ *
+ * XXX each S.bus frame will cause a PPM decoder interrupt
+ * storm (lots of edges). It might be sensible to actually
+ * disable the PPM decoder completely if we have an alternate
+ * receiver lock.
+ */
+ if (!locked)
+ ppm_input();
+
+ /* check for manual override status */
+ if (system_state.rc_channel_data[4] > RC_CHANNEL_HIGH_THRESH) {
+ /* force manual input override */
+ system_state.mixer_manual_override = true;
+ } else {
+ /* override not engaged, use FMU */
+ system_state.mixer_manual_override = false;
+ }
+
+ /*
+ * If we haven't seen any new control data in 200ms, assume we
+ * have lost input and tell FMU.
+ */
+ if ((hrt_absolute_time() - system_state.rc_channels_timestamp) > 200000) {
+
+ /* set the number of channels to zero - no inputs */
+ system_state.rc_channels = 0;
+ system_state.rc_lost = true;
+>>>>>>> Stashed changes
/* XXX do ppm processing, bypass mode, etc. here */