APM: implement FENCE_ACTION_REPORT

when FENCE_ACTION is set to FENCE_ACTION_REPORT a fence breach is
reported, but the flight mode is not changed
This commit is contained in:
Andrew Tridgell 2012-08-15 11:17:38 +10:00
parent 299711f4a9
commit 817017658d
2 changed files with 7 additions and 3 deletions

View File

@ -129,8 +129,8 @@ const AP_Param::Info var_info[] PROGMEM = {
#if GEOFENCE_ENABLED == ENABLED
// @Param: FENCE_ACTION
// @DisplayName: Action on geofence breach
// @Description: Defines the distance from the waypoint center, the plane will maintain during a loiter
// @Values: 0:None,1:GuidedMode
// @Description: What to do on fence breach
// @Values: 0:None,1:GuidedMode,2:ReportOnly
// @User: Standard
GSCALAR(fence_action, "FENCE_ACTION", 0),

View File

@ -235,7 +235,8 @@ static void geofence_check(bool altitude_check_only)
}
// we are outside the fence
if (geofence_state->fence_triggered && control_mode == GUIDED) {
if (geofence_state->fence_triggered &&
(control_mode == GUIDED || g.fence_action == FENCE_ACTION_REPORT)) {
// we have already triggered, don't trigger again until the
// user disables/re-enables using the fence channel switch
return;
@ -256,6 +257,9 @@ static void geofence_check(bool altitude_check_only)
// see what action the user wants
switch (g.fence_action) {
case FENCE_ACTION_REPORT:
break;
case FENCE_ACTION_GUIDED:
// fly to the return point, with an altitude half way between
// min and max