From a704acc2a20936d7e6d6828ae0ddf2cf7dc3578b Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 23 Feb 2013 12:02:00 +0100 Subject: Out of memory warning, flash and RAM optimizations --- apps/px4io/sbus.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'apps/px4io/sbus.c') 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) */ -- cgit v1.2.3