forked from Archive/PX4-Autopilot
Hotfix: Check all channel mappings for valid ranges
This commit is contained in:
parent
22efca262d
commit
14bbecfd7a
|
@ -1403,7 +1403,7 @@ check_mode_switches(struct manual_control_setpoint_s *sp_man, struct vehicle_sta
|
||||||
{
|
{
|
||||||
/* main mode switch */
|
/* main mode switch */
|
||||||
if (!isfinite(sp_man->mode_switch)) {
|
if (!isfinite(sp_man->mode_switch)) {
|
||||||
warnx("mode sw not finite");
|
/* default to manual if signal is invalid */
|
||||||
current_status->mode_switch = MODE_SWITCH_MANUAL;
|
current_status->mode_switch = MODE_SWITCH_MANUAL;
|
||||||
|
|
||||||
} else if (sp_man->mode_switch > STICK_ON_OFF_LIMIT) {
|
} else if (sp_man->mode_switch > STICK_ON_OFF_LIMIT) {
|
||||||
|
|
|
@ -1406,16 +1406,24 @@ Sensors::rc_poll()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* mode switch input */
|
/* mode switch input */
|
||||||
manual_control.mode_switch = limit_minus_one_to_one(_rc.chan[_rc.function[MODE]].scaled);
|
if (_rc.function[MODE] >= 0) {
|
||||||
|
manual_control.mode_switch = limit_minus_one_to_one(_rc.chan[_rc.function[MODE]].scaled);
|
||||||
|
}
|
||||||
|
|
||||||
/* land switch input */
|
/* land switch input */
|
||||||
manual_control.return_switch = limit_minus_one_to_one(_rc.chan[_rc.function[RETURN]].scaled);
|
if (_rc.function[MODE] >= 0) {
|
||||||
|
manual_control.return_switch = limit_minus_one_to_one(_rc.chan[_rc.function[RETURN]].scaled);
|
||||||
|
}
|
||||||
|
|
||||||
/* assisted switch input */
|
/* assisted switch input */
|
||||||
manual_control.assisted_switch = limit_minus_one_to_one(_rc.chan[_rc.function[ASSISTED]].scaled);
|
if (_rc.function[MODE] >= 0) {
|
||||||
|
manual_control.assisted_switch = limit_minus_one_to_one(_rc.chan[_rc.function[ASSISTED]].scaled);
|
||||||
|
}
|
||||||
|
|
||||||
/* mission switch input */
|
/* mission switch input */
|
||||||
manual_control.mission_switch = limit_minus_one_to_one(_rc.chan[_rc.function[MISSION]].scaled);
|
if (_rc.function[MODE] >= 0) {
|
||||||
|
manual_control.mission_switch = limit_minus_one_to_one(_rc.chan[_rc.function[MISSION]].scaled);
|
||||||
|
}
|
||||||
|
|
||||||
/* flaps */
|
/* flaps */
|
||||||
if (_rc.function[FLAPS] >= 0) {
|
if (_rc.function[FLAPS] >= 0) {
|
||||||
|
|
Loading…
Reference in New Issue