From 0a94e9a959eeae97bff1d8e840e94c8f3a5fd6e5 Mon Sep 17 00:00:00 2001
From: Michael Day <mday299@yahoo.com>
Date: Tue, 8 Dec 2015 15:02:55 -0800
Subject: [PATCH] Plane: battery autoland failsafe checks for ACS prelanding
 state now.

Therefore, the battery failsafe will not interrupt an already landing
plane.
---
 ArduPlane/events.cpp | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/ArduPlane/events.cpp b/ArduPlane/events.cpp
index f6bbaeab8..41c3e9549 100644
--- a/ArduPlane/events.cpp
+++ b/ArduPlane/events.cpp
@@ -134,11 +134,13 @@ void Plane::low_battery_event(void)
     if (flight_stage != AP_SpdHgtControl::FLIGHT_LAND_FINAL &&
         flight_stage != AP_SpdHgtControl::FLIGHT_LAND_APPROACH) {
 #if AP_ACS_USE == TRUE
-        gcs_send_text_P(MAV_SEVERITY_CRITICAL,PSTR("Battery low: auto-landing."));
+        if (! acs.preland_started()) {
+            gcs_send_text_P(MAV_SEVERITY_CRITICAL,PSTR("Battery low: auto-landing."));
 
-        //start landing if not already (ACS-specific behavior -- land vice RTL)
-        if (! jump_to_landing_sequence()) {
-            gcs_send_text_P(MAV_SEVERITY_CRITICAL,PSTR("Failed to start emergency land sequence!!"));
+            //start landing if not already (ACS-specific behavior -- land vice RTL)
+            if (! jump_to_landing_sequence()) {
+                gcs_send_text_P(MAV_SEVERITY_CRITICAL,PSTR("Failed to start emergency land sequence!!"));
+            }
         }
 #else
         set_mode(RTL);
-- 
GitLab