mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
Made failsafe more intuitive. Default (0) maps to whatever channel is throttle. If a non-zero value is entered, a direct channel map is used so use
This commit is contained in:
parent
81c03154b9
commit
971e8fc4ff
@ -538,28 +538,13 @@ PARAM_DEFINE_INT32(RC_MAP_PITCH, 2);
|
||||
/**
|
||||
* Failsafe channel mapping.
|
||||
*
|
||||
* The RC mapping index indicates which rc function
|
||||
* should be used for detecting the failsafe condition
|
||||
* The RC mapping index indicates which channel is used for failsafe
|
||||
* If 0, whichever channel is mapped to throttle is used
|
||||
* otherwise the value indicates the specific rc channel to use
|
||||
*
|
||||
* @min 0
|
||||
* @max 14
|
||||
* @max 18
|
||||
*
|
||||
* mapping (from rc_channels.h)
|
||||
* THROTTLE = 0,
|
||||
ROLL = 1,
|
||||
PITCH = 2,
|
||||
YAW = 3,
|
||||
MODE = 4,
|
||||
RETURN = 5,
|
||||
ASSISTED = 6,
|
||||
MISSION = 7,
|
||||
OFFBOARD_MODE = 8,
|
||||
FLAPS = 9,
|
||||
AUX_1 = 10,
|
||||
AUX_2 = 11,
|
||||
AUX_3 = 12,
|
||||
AUX_4 = 13,
|
||||
AUX_5 = 14,
|
||||
*
|
||||
*/
|
||||
PARAM_DEFINE_INT32(RC_MAP_FAILSAFE, 0); //Default to throttle function
|
||||
|
||||
@ -1379,7 +1379,10 @@ Sensors::rc_poll()
|
||||
signal_lost = false;
|
||||
|
||||
/* check failsafe */
|
||||
int8_t fs_ch = _rc.function[_parameters.rc_map_failsafe];
|
||||
int8_t fs_ch = _rc.function[_parameters.rc_map_failsafe]; // get channel mapped to throttle
|
||||
if (_parameters.rc_map_failsafe>0){ // if not 0, use channel number instead of rc.function mapping
|
||||
fs_ch = _parameters.rc_map_failsafe - 1;
|
||||
}
|
||||
if (_parameters.rc_fails_thr > 0 && fs_ch >= 0) {
|
||||
/* failsafe configured */
|
||||
if ((_parameters.rc_fails_thr < _parameters.min[fs_ch] && rc_input.values[fs_ch] < _parameters.rc_fails_thr) ||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user