aboutsummaryrefslogtreecommitdiff
path: root/src/drivers/px4io/px4io.cpp
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2014-11-05 17:17:34 +0100
committerLorenz Meier <lm@inf.ethz.ch>2014-11-05 17:17:34 +0100
commit182c1c1d52ef370a42b99c825e3f45a03ecbcdc9 (patch)
tree4f22470a3bde5b281850772c65ca44eece48bfe6 /src/drivers/px4io/px4io.cpp
parent25df841118316d51fbd6a1f36b56712147911a2b (diff)
downloadpx4-firmware-182c1c1d52ef370a42b99c825e3f45a03ecbcdc9.tar.gz
px4-firmware-182c1c1d52ef370a42b99c825e3f45a03ecbcdc9.tar.bz2
px4-firmware-182c1c1d52ef370a42b99c825e3f45a03ecbcdc9.zip
Fix RC mapping indices - 0 index induces issues right now
Diffstat (limited to 'src/drivers/px4io/px4io.cpp')
-rw-r--r--src/drivers/px4io/px4io.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp
index fd9eb4170..c6543982e 100644
--- a/src/drivers/px4io/px4io.cpp
+++ b/src/drivers/px4io/px4io.cpp
@@ -1247,28 +1247,33 @@ PX4IO::io_set_rc_config()
*/
param_get(param_find("RC_MAP_ROLL"), &ichan);
+ /* subtract one from 1-based index - this might be
+ * a negative number now
+ */
+ ichan -= 1;
+
if ((ichan >= 0) && (ichan < (int)_max_rc_input))
- input_map[ichan - 1] = 0;
+ input_map[ichan] = 0;
param_get(param_find("RC_MAP_PITCH"), &ichan);
if ((ichan >= 0) && (ichan < (int)_max_rc_input))
- input_map[ichan - 1] = 1;
+ input_map[ichan] = 1;
param_get(param_find("RC_MAP_YAW"), &ichan);
if ((ichan >= 0) && (ichan < (int)_max_rc_input))
- input_map[ichan - 1] = 2;
+ input_map[ichan] = 2;
param_get(param_find("RC_MAP_THROTTLE"), &ichan);
if ((ichan >= 0) && (ichan < (int)_max_rc_input))
- input_map[ichan - 1] = 3;
+ input_map[ichan] = 3;
param_get(param_find("RC_MAP_FLAPS"), &ichan);
if ((ichan >= 0) && (ichan < (int)_max_rc_input))
- input_map[ichan - 1] = 4;
+ input_map[ichan] = 4;
param_get(param_find("RC_MAP_MODE_SW"), &ichan);