mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-23 09:08:30 -04:00
Plane: move fence disable code to a function to enable reusability
This commit is contained in:
parent
fef8b37b11
commit
4f7ffc5eb1
@ -929,6 +929,7 @@ private:
|
|||||||
// fence.cpp
|
// fence.cpp
|
||||||
void fence_check();
|
void fence_check();
|
||||||
bool fence_stickmixing() const;
|
bool fence_stickmixing() const;
|
||||||
|
void disable_fence_for_landing(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ArduPlane.cpp
|
// ArduPlane.cpp
|
||||||
|
@ -383,21 +383,8 @@ void Plane::do_land(const AP_Mission::Mission_Command& cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if AC_FENCE == ENABLED
|
#if AC_FENCE == ENABLED
|
||||||
switch(fence.auto_enabled()) {
|
disable_fence_for_landing();
|
||||||
case AC_Fence::AutoEnable::ALWAYS_ENABLED:
|
|
||||||
fence.enable(false);
|
|
||||||
gcs().send_text(MAV_SEVERITY_NOTICE, "Fence disabled (auto disable)");
|
|
||||||
break;
|
|
||||||
case AC_Fence::AutoEnable::ENABLE_DISABLE_FLOOR_ONLY:
|
|
||||||
fence.disable_floor();
|
|
||||||
gcs().send_text(MAV_SEVERITY_NOTICE, "Fence floor disabled (auto disable)");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// fence does not auto-disable in other landing conditions
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plane::do_landing_vtol_approach(const AP_Mission::Mission_Command& cmd)
|
void Plane::do_landing_vtol_approach(const AP_Mission::Mission_Command& cmd)
|
||||||
|
@ -126,4 +126,22 @@ bool Plane::fence_stickmixing(void) const
|
|||||||
// normal mixing rules
|
// normal mixing rules
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Plane::disable_fence_for_landing(void)
|
||||||
|
{
|
||||||
|
switch (fence.auto_enabled()) {
|
||||||
|
case AC_Fence::AutoEnable::ALWAYS_ENABLED:
|
||||||
|
fence.enable(false);
|
||||||
|
gcs().send_text(MAV_SEVERITY_NOTICE, "Fence disabled (auto disable)");
|
||||||
|
break;
|
||||||
|
case AC_Fence::AutoEnable::ENABLE_DISABLE_FLOOR_ONLY:
|
||||||
|
fence.disable_floor();
|
||||||
|
gcs().send_text(MAV_SEVERITY_NOTICE, "Fence floor disabled (auto disable)");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// fence does not auto-disable in other landing conditions
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -1306,7 +1306,9 @@ void QuadPlane::init_qland(void)
|
|||||||
#if LANDING_GEAR_ENABLED == ENABLED
|
#if LANDING_GEAR_ENABLED == ENABLED
|
||||||
plane.g2.landing_gear.deploy_for_landing();
|
plane.g2.landing_gear.deploy_for_landing();
|
||||||
#endif
|
#endif
|
||||||
|
#if AC_FENCE == ENABLED
|
||||||
plane.disable_fence_for_landing();
|
plane.disable_fence_for_landing();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user