aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2014-02-21 07:50:36 +0100
committerLorenz Meier <lm@inf.ethz.ch>2014-02-21 08:07:49 +0100
commit9828d5ede474723d83b189c394397d78c7050b7a (patch)
treeebea5145801e02c5e48c581dfcf2139e51ed4ddc
parent2d97dff35c2976c7ba98e97a66b4a141cfb8960e (diff)
downloadpx4-firmware-9828d5ede474723d83b189c394397d78c7050b7a.tar.gz
px4-firmware-9828d5ede474723d83b189c394397d78c7050b7a.tar.bz2
px4-firmware-9828d5ede474723d83b189c394397d78c7050b7a.zip
Fix copyright, do not return junk channel #13 that Spektrum gives us.
-rw-r--r--src/modules/px4iofirmware/dsm.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/modules/px4iofirmware/dsm.c b/src/modules/px4iofirmware/dsm.c
index 70f31240a..0d3eb2606 100644
--- a/src/modules/px4iofirmware/dsm.c
+++ b/src/modules/px4iofirmware/dsm.c
@@ -1,6 +1,6 @@
/****************************************************************************
*
- * Copyright (C) 2012 PX4 Development Team. All rights reserved.
+ * Copyright (c) 2012-2014 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -401,6 +401,15 @@ dsm_decode(hrt_abstime frame_time, uint16_t *values, uint16_t *num_values)
values[channel] = value;
}
+ /*
+ * Spektrum likes to send junk in higher channel numbers to fill
+ * their packets. We don't know about a 13 channel model in their TX
+ * lines, so if we get a channel count of 13, we'll return 12 (the last
+ * data index that is stable).
+ */
+ if (*num_values == 13)
+ *num_values = 12;
+
if (dsm_channel_shift == 11) {
/* Set the 11-bit data indicator */
*num_values |= 0x8000;