From 6215e6c7ec3ed47327730da3ee38fb3bb71e7451 Mon Sep 17 00:00:00 2001 From: RomanBapst Date: Thu, 6 May 2021 14:42:32 +0300 Subject: [PATCH] navigator: do not emit geofence warnings if system is not armed Signed-off-by: RomanBapst --- src/modules/navigator/navigator_main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/navigator/navigator_main.cpp b/src/modules/navigator/navigator_main.cpp index 469792dbd4..a093147f06 100644 --- a/src/modules/navigator/navigator_main.cpp +++ b/src/modules/navigator/navigator_main.cpp @@ -767,8 +767,8 @@ void Navigator::geofence_breach_check(bool &have_geofence_position_data) /* inform other apps via the mission result */ _geofence_result.geofence_violated = true; - /* Issue a warning about the geofence violation once */ - if (!_geofence_violation_warning_sent) { + /* Issue a warning about the geofence violation once and only if we are armed */ + if (!_geofence_violation_warning_sent && _vstatus.arming_state == vehicle_status_s::ARMING_STATE_ARMED) { mavlink_log_critical(&_mavlink_log_pub, "Approaching on Geofence"); // we have predicted a geofence violation and if the action is to loiter then