mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-27 03:53:33 +08:00
Added NONE = not mapped state for mission and return switches
This commit is contained in:
@@ -1392,7 +1392,7 @@ check_mode_switches(struct manual_control_setpoint_s *sp_man, struct vehicle_sta
|
|||||||
current_status->mode_switch = MODE_SWITCH_ASSISTED;
|
current_status->mode_switch = MODE_SWITCH_ASSISTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* land switch */
|
/* return switch */
|
||||||
if (!isfinite(sp_man->return_switch)) {
|
if (!isfinite(sp_man->return_switch)) {
|
||||||
current_status->return_switch = RETURN_SWITCH_NONE;
|
current_status->return_switch = RETURN_SWITCH_NONE;
|
||||||
|
|
||||||
@@ -1400,7 +1400,7 @@ check_mode_switches(struct manual_control_setpoint_s *sp_man, struct vehicle_sta
|
|||||||
current_status->return_switch = RETURN_SWITCH_RETURN;
|
current_status->return_switch = RETURN_SWITCH_RETURN;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
current_status->return_switch = RETURN_SWITCH_NONE;
|
current_status->return_switch = RETURN_SWITCH_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* assisted switch */
|
/* assisted switch */
|
||||||
@@ -1416,10 +1416,10 @@ check_mode_switches(struct manual_control_setpoint_s *sp_man, struct vehicle_sta
|
|||||||
|
|
||||||
/* mission switch */
|
/* mission switch */
|
||||||
if (!isfinite(sp_man->mission_switch)) {
|
if (!isfinite(sp_man->mission_switch)) {
|
||||||
current_status->mission_switch = MISSION_SWITCH_MISSION;
|
current_status->mission_switch = MISSION_SWITCH_NONE;
|
||||||
|
|
||||||
} else if (sp_man->mission_switch > STICK_ON_OFF_LIMIT) {
|
} else if (sp_man->mission_switch > STICK_ON_OFF_LIMIT) {
|
||||||
current_status->mission_switch = MISSION_SWITCH_NONE;
|
current_status->mission_switch = MISSION_SWITCH_LOITER;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
current_status->mission_switch = MISSION_SWITCH_MISSION;
|
current_status->mission_switch = MISSION_SWITCH_MISSION;
|
||||||
|
|||||||
@@ -1372,18 +1372,6 @@ Sensors::rc_poll()
|
|||||||
manual_control.yaw *= _parameters.rc_scale_yaw;
|
manual_control.yaw *= _parameters.rc_scale_yaw;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* mode switch input */
|
|
||||||
manual_control.mode_switch = limit_minus_one_to_one(_rc.chan[_rc.function[MODE]].scaled);
|
|
||||||
|
|
||||||
/* land switch input */
|
|
||||||
manual_control.return_switch = limit_minus_one_to_one(_rc.chan[_rc.function[RETURN]].scaled);
|
|
||||||
|
|
||||||
/* assisted switch input */
|
|
||||||
manual_control.assisted_switch = limit_minus_one_to_one(_rc.chan[_rc.function[ASSISTED]].scaled);
|
|
||||||
|
|
||||||
/* mission switch input */
|
|
||||||
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) {
|
||||||
|
|
||||||
@@ -1394,14 +1382,26 @@ Sensors::rc_poll()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* mode switch input */
|
||||||
if (_rc.function[MODE] >= 0) {
|
if (_rc.function[MODE] >= 0) {
|
||||||
manual_control.mode_switch = limit_minus_one_to_one(_rc.chan[_rc.function[MODE]].scaled);
|
manual_control.mode_switch = limit_minus_one_to_one(_rc.chan[_rc.function[MODE]].scaled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* assisted switch input */
|
||||||
|
if (_rc.function[ASSISTED] >= 0) {
|
||||||
|
manual_control.assisted_switch = limit_minus_one_to_one(_rc.chan[_rc.function[ASSISTED]].scaled);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* mission switch input */
|
||||||
if (_rc.function[MISSION] >= 0) {
|
if (_rc.function[MISSION] >= 0) {
|
||||||
manual_control.mission_switch = limit_minus_one_to_one(_rc.chan[_rc.function[MISSION]].scaled);
|
manual_control.mission_switch = limit_minus_one_to_one(_rc.chan[_rc.function[MISSION]].scaled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* return switch input */
|
||||||
|
if (_rc.function[RETURN] >= 0) {
|
||||||
|
manual_control.return_switch = limit_minus_one_to_one(_rc.chan[_rc.function[RETURN]].scaled);
|
||||||
|
}
|
||||||
|
|
||||||
// if (_rc.function[OFFBOARD_MODE] >= 0) {
|
// if (_rc.function[OFFBOARD_MODE] >= 0) {
|
||||||
// manual_control.auto_offboard_input_switch = limit_minus_one_to_one(_rc.chan[_rc.function[OFFBOARD_MODE]].scaled);
|
// manual_control.auto_offboard_input_switch = limit_minus_one_to_one(_rc.chan[_rc.function[OFFBOARD_MODE]].scaled);
|
||||||
// }
|
// }
|
||||||
|
|||||||
@@ -99,11 +99,13 @@ typedef enum {
|
|||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
RETURN_SWITCH_NONE = 0,
|
RETURN_SWITCH_NONE = 0,
|
||||||
|
RETURN_SWITCH_NORMAL,
|
||||||
RETURN_SWITCH_RETURN
|
RETURN_SWITCH_RETURN
|
||||||
} return_switch_pos_t;
|
} return_switch_pos_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
MISSION_SWITCH_NONE = 0,
|
MISSION_SWITCH_NONE = 0,
|
||||||
|
MISSION_SWITCH_LOITER,
|
||||||
MISSION_SWITCH_MISSION
|
MISSION_SWITCH_MISSION
|
||||||
} mission_switch_pos_t;
|
} mission_switch_pos_t;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user