From 0b01bb531d580d1c0b1001eebb66f45ed139b0cf Mon Sep 17 00:00:00 2001 From: Rishabh Date: Sun, 23 Feb 2020 13:59:23 +0530 Subject: [PATCH] Plane: Remove unutilized case --- ArduPlane/is_flying.cpp | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/ArduPlane/is_flying.cpp b/ArduPlane/is_flying.cpp index 9d40ade53d..819c158b7e 100644 --- a/ArduPlane/is_flying.cpp +++ b/ArduPlane/is_flying.cpp @@ -295,23 +295,13 @@ void Plane::crash_detection_update(void) } else if ((now_ms - crash_state.debounce_timer_ms >= crash_state.debounce_time_total_ms) && !crash_state.is_crashed) { crash_state.is_crashed = true; - - if (aparm.crash_detection_enable == CRASH_DETECT_ACTION_BITMASK_DISABLED) { - if (crashed_near_land_waypoint) { - gcs().send_text(MAV_SEVERITY_CRITICAL, "Hard landing detected. No action taken"); - } else { - gcs().send_text(MAV_SEVERITY_EMERGENCY, "Crash detected. No action taken"); - } + if (aparm.crash_detection_enable & CRASH_DETECT_ACTION_BITMASK_DISARM) { + arming.disarm(AP_Arming::Method::CRASH); } - else { - if (aparm.crash_detection_enable & CRASH_DETECT_ACTION_BITMASK_DISARM) { - arming.disarm(AP_Arming::Method::CRASH); - } - if (crashed_near_land_waypoint) { - gcs().send_text(MAV_SEVERITY_CRITICAL, "Hard landing detected"); - } else { - gcs().send_text(MAV_SEVERITY_EMERGENCY, "Crash detected"); - } + if (crashed_near_land_waypoint) { + gcs().send_text(MAV_SEVERITY_CRITICAL, "Hard landing detected"); + } else { + gcs().send_text(MAV_SEVERITY_EMERGENCY, "Crash detected"); } } }