diff options
author | Friedemann Ludwig <frieludwig@hotmail.com> | 2014-11-11 11:49:51 +0100 |
---|---|---|
committer | Friedemann Ludwig <frieludwig@hotmail.com> | 2014-11-11 11:49:51 +0100 |
commit | 66bfd9a0bfec46dbce8bffb832fea734fbce125e (patch) | |
tree | 8da9c4373d5771b80e7efa900f22003bb4d84f65 | |
parent | c8a8305326f84cdfd92326b36241caee64b0c529 (diff) | |
parent | 88093ebf1af5483d8b5c218adb1ea0c4798ee21e (diff) | |
download | px4-firmware-66bfd9a0bfec46dbce8bffb832fea734fbce125e.tar.gz px4-firmware-66bfd9a0bfec46dbce8bffb832fea734fbce125e.tar.bz2 px4-firmware-66bfd9a0bfec46dbce8bffb832fea734fbce125e.zip |
Merge remote-tracking branch 'upstream/master' into no_beep
-rw-r--r-- | src/drivers/px4io/px4io.cpp | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp index 6d68d9f60..06faf49a4 100644 --- a/src/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -1245,41 +1245,42 @@ PX4IO::io_set_rc_config() * for compatibility reasons with existing * autopilots / GCS'. */ - 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] = 0; + /* ROLL */ + param_get(param_find("RC_MAP_ROLL"), &ichan); + if ((ichan > 0) && (ichan <= (int)_max_rc_input)) { + input_map[ichan - 1] = 0; + } + /* PITCH */ param_get(param_find("RC_MAP_PITCH"), &ichan); + if ((ichan > 0) && (ichan <= (int)_max_rc_input)) { + input_map[ichan - 1] = 1; + } - if ((ichan >= 0) && (ichan < (int)_max_rc_input)) - input_map[ichan] = 1; - + /* YAW */ param_get(param_find("RC_MAP_YAW"), &ichan); + if ((ichan > 0) && (ichan <= (int)_max_rc_input)) { + input_map[ichan - 1] = 2; + } - if ((ichan >= 0) && (ichan < (int)_max_rc_input)) - input_map[ichan] = 2; - + /* THROTTLE */ param_get(param_find("RC_MAP_THROTTLE"), &ichan); + if ((ichan > 0) && (ichan <= (int)_max_rc_input)) { + input_map[ichan - 1] = 3; + } - if ((ichan >= 0) && (ichan < (int)_max_rc_input)) - input_map[ichan] = 3; - + /* FLAPS */ param_get(param_find("RC_MAP_FLAPS"), &ichan); + if ((ichan > 0) && (ichan <= (int)_max_rc_input)) { + input_map[ichan - 1] = 4; + } - if ((ichan >= 0) && (ichan < (int)_max_rc_input)) - input_map[ichan] = 4; - + /* MAIN MODE SWITCH */ param_get(param_find("RC_MAP_MODE_SW"), &ichan); - - if ((ichan >= 0) && (ichan < (int)_max_rc_input)) { + if ((ichan > 0) && (ichan <= (int)_max_rc_input)) { /* use out of normal bounds index to indicate special channel */ - input_map[ichan] = PX4IO_P_RC_CONFIG_ASSIGNMENT_MODESWITCH; + input_map[ichan - 1] = PX4IO_P_RC_CONFIG_ASSIGNMENT_MODESWITCH; } /* |