aboutsummaryrefslogtreecommitdiff
path: root/apps/px4io/sbus.c
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2013-02-23 12:02:00 +0100
committerLorenz Meier <lm@inf.ethz.ch>2013-02-23 12:02:00 +0100
commita704acc2a20936d7e6d6828ae0ddf2cf7dc3578b (patch)
tree277132c96eab5b3433a22277dbe7739f1a780322 /apps/px4io/sbus.c
parentbe408451779dc53220ec94499a7acbe5ff3b8e7f (diff)
downloadpx4-firmware-a704acc2a20936d7e6d6828ae0ddf2cf7dc3578b.tar.gz
px4-firmware-a704acc2a20936d7e6d6828ae0ddf2cf7dc3578b.tar.bz2
px4-firmware-a704acc2a20936d7e6d6828ae0ddf2cf7dc3578b.zip
Out of memory warning, flash and RAM optimizations
Diffstat (limited to 'apps/px4io/sbus.c')
-rw-r--r--apps/px4io/sbus.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/apps/px4io/sbus.c b/apps/px4io/sbus.c
index d199a9361..073ddeaba 100644
--- a/apps/px4io/sbus.c
+++ b/apps/px4io/sbus.c
@@ -53,7 +53,7 @@
#include "debug.h"
#define SBUS_FRAME_SIZE 25
-#define SBUS_INPUT_CHANNELS 18
+#define SBUS_INPUT_CHANNELS 16
static int sbus_fd = -1;
@@ -239,7 +239,9 @@ sbus_decode(hrt_abstime frame_time, uint16_t *values, uint16_t *num_values)
}
/* decode switch channels if data fields are wide enough */
- if (chancount > 17) {
+ if (PX4IO_INPUT_CHANNELS > 17 && chancount > 15) {
+ chancount = 18;
+
/* channel 17 (index 16) */
values[16] = (frame[23] & (1 << 0)) * 1000 + 998;
/* channel 18 (index 17) */