mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-15 02:23:34 +08:00
commander: use C API for MC_AIRMODE & RC_MAP_ARM_SW to remove multirotor modules dependency
This commit is contained in:
@@ -1200,6 +1200,9 @@ Commander::run()
|
||||
param_t _param_fmode_5 = param_find("COM_FLTMODE5");
|
||||
param_t _param_fmode_6 = param_find("COM_FLTMODE6");
|
||||
|
||||
param_t _param_airmode = param_find("MC_AIRMODE");
|
||||
param_t _param_rc_map_arm_switch = param_find("RC_MAP_ARM_SW");
|
||||
|
||||
/* failsafe response to loss of navigation accuracy */
|
||||
param_t _param_posctl_nav_loss_act = param_find("COM_POSCTL_NAVL");
|
||||
|
||||
@@ -1391,6 +1394,8 @@ Commander::run()
|
||||
int32_t geofence_action = 0;
|
||||
|
||||
int32_t flight_uuid = 0;
|
||||
int32_t airmode = 0;
|
||||
int32_t rc_map_arm_switch = 0;
|
||||
|
||||
/* RC override auto modes */
|
||||
int32_t rc_override = 0;
|
||||
@@ -1527,10 +1532,15 @@ Commander::run()
|
||||
param_get(_param_takeoff_finished_action, &takeoff_complete_act);
|
||||
|
||||
/* check for unsafe Airmode settings: yaw airmode requires the use of an arming switch */
|
||||
if (_airmode.get() == 2 && _rc_map_arm_switch.get() == 0) {
|
||||
_airmode.set(1); // change to roll/pitch airmode
|
||||
_airmode.commit();
|
||||
mavlink_log_critical(&mavlink_log_pub, "Yaw Airmode requires the use of an Arm Switch")
|
||||
if (_param_airmode != PARAM_INVALID && _param_rc_map_arm_switch != PARAM_INVALID) {
|
||||
param_get(_param_airmode, &airmode);
|
||||
param_get(_param_rc_map_arm_switch, &rc_map_arm_switch);
|
||||
|
||||
if (airmode == 2 && rc_map_arm_switch == 0) {
|
||||
airmode = 1; // change to roll/pitch airmode
|
||||
param_set(_param_airmode, &airmode);
|
||||
mavlink_log_critical(&mavlink_log_pub, "Yaw Airmode requires the use of an Arm Switch")
|
||||
}
|
||||
}
|
||||
|
||||
param_init_forced = false;
|
||||
|
||||
@@ -110,10 +110,7 @@ private:
|
||||
(ParamInt<px4::params::COM_POS_FS_GAIN>) _failsafe_pos_gain,
|
||||
|
||||
(ParamInt<px4::params::COM_LOW_BAT_ACT>) _low_bat_action,
|
||||
(ParamFloat<px4::params::COM_DISARM_LAND>) _disarm_when_landed_timeout,
|
||||
|
||||
(ParamInt<px4::params::MC_AIRMODE>) _airmode,
|
||||
(ParamInt<px4::params::RC_MAP_ARM_SW>) _rc_map_arm_switch
|
||||
(ParamFloat<px4::params::COM_DISARM_LAND>) _disarm_when_landed_timeout
|
||||
)
|
||||
|
||||
const int64_t POSVEL_PROBATION_MIN = 1_s; /**< minimum probation duration (usec) */
|
||||
|
||||
Reference in New Issue
Block a user