Plane: set landing params as private and use accessors

This commit is contained in:
Tom Pittenger 2016-11-23 02:18:21 -08:00 committed by Tom Pittenger
parent c7bbb6998a
commit ac1dced3bf
3 changed files with 13 additions and 13 deletions

View File

@ -972,7 +972,7 @@ void Plane::update_flight_stage(void)
set_flight_stage(AP_SpdHgtControl::FLIGHT_TAKEOFF);
} else if (mission.get_current_nav_cmd().id == MAV_CMD_NAV_LAND) {
if ((g.land_abort_throttle_enable && channel_throttle->get_control_in() >= 90) ||
if ((landing.get_abort_throttle_enable() && channel_throttle->get_control_in() >= 90) ||
landing.commanded_go_around ||
flight_stage == AP_SpdHgtControl::FLIGHT_LAND_ABORT){
// abort mode is sticky, it must complete while executing NAV_LAND
@ -1052,13 +1052,13 @@ void Plane::update_optical_flow(void)
*/
void Plane::disarm_if_autoland_complete()
{
if (g.land_disarm_delay > 0 &&
if (landing.get_disarm_delay() > 0 &&
landing.complete &&
!is_flying() &&
arming.arming_required() != AP_Arming::NO &&
arming.is_armed()) {
/* we have auto disarm enabled. See if enough time has passed */
if (millis() - auto_state.last_flying_ms >= g.land_disarm_delay*1000UL) {
if (millis() - auto_state.last_flying_ms >= landing.get_disarm_delay()*1000UL) {
if (disarm_motors()) {
gcs_send_text(MAV_SEVERITY_INFO,"Auto disarmed");
}

View File

@ -108,9 +108,9 @@ void Plane::calc_airspeed_errors()
case AP_SpdHgtControl::FLIGHT_LAND_PREFLARE:
case AP_SpdHgtControl::FLIGHT_LAND_FINAL:
if (landing.pre_flare && landing.pre_flare_airspeed > 0) {
if (landing.pre_flare && landing.get_pre_flare_airspeed() > 0) {
// if we just preflared then continue using the pre-flare airspeed during final flare
target_airspeed_cm = landing.pre_flare_airspeed * 100;
target_airspeed_cm = landing.get_pre_flare_airspeed() * 100;
} else if (land_airspeed >= 0) {
target_airspeed_cm = land_airspeed * 100;
}

View File

@ -28,9 +28,9 @@ void Plane::throttle_slew_limit(int16_t last_throttle)
if (control_mode==AUTO) {
if (auto_state.takeoff_complete == false && g.takeoff_throttle_slewrate != 0) {
slewrate = g.takeoff_throttle_slewrate;
} else if (g.land_throttle_slewrate != 0 &&
} else if (landing.get_throttle_slewrate() != 0 &&
(flight_stage == AP_SpdHgtControl::FLIGHT_LAND_APPROACH || flight_stage == AP_SpdHgtControl::FLIGHT_LAND_FINAL || flight_stage == AP_SpdHgtControl::FLIGHT_LAND_PREFLARE)) {
slewrate = g.land_throttle_slewrate;
slewrate = landing.get_throttle_slewrate();
}
}
// if slew limit rate is set to zero then do not slew limit
@ -575,8 +575,8 @@ void Plane::set_servos_flaps(void)
case AP_SpdHgtControl::FLIGHT_LAND_APPROACH:
case AP_SpdHgtControl::FLIGHT_LAND_PREFLARE:
case AP_SpdHgtControl::FLIGHT_LAND_FINAL:
if (g.land_flap_percent != 0) {
auto_flap_percent = g.land_flap_percent;
if (landing.get_flap_percent() != 0) {
auto_flap_percent = landing.get_flap_percent();
}
break;
default:
@ -771,18 +771,18 @@ void Plane::set_servos(void)
}
#endif
if (g.land_then_servos_neutral > 0 &&
if (landing.get_then_servos_neutral() > 0 &&
control_mode == AUTO &&
g.land_disarm_delay > 0 &&
landing.get_disarm_delay() > 0 &&
landing.complete &&
!arming.is_armed()) {
// after an auto land and auto disarm, set the servos to be neutral just
// in case we're upside down or some crazy angle and straining the servos.
if (g.land_then_servos_neutral == 1) {
if (landing.get_then_servos_neutral() == 1) {
channel_roll->set_radio_out(channel_roll->get_radio_trim());
channel_pitch->set_radio_out(channel_pitch->get_radio_trim());
channel_rudder->set_radio_out(channel_rudder->get_radio_trim());
} else if (g.land_then_servos_neutral == 2) {
} else if (landing.get_then_servos_neutral() == 2) {
channel_roll->disable_out();
channel_pitch->disable_out();
channel_rudder->disable_out();