From 7cd77f266ef4678350224949bc4980126b9b3d25 Mon Sep 17 00:00:00 2001 From: rishabsingh3003 Date: Mon, 22 Aug 2022 23:10:26 +0530 Subject: [PATCH] AP_Arming: shift pre-arm check to AP_Proximity --- libraries/AP_Arming/AP_Arming.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/libraries/AP_Arming/AP_Arming.cpp b/libraries/AP_Arming/AP_Arming.cpp index 2323acec7d..cbbfbaffde 100644 --- a/libraries/AP_Arming/AP_Arming.cpp +++ b/libraries/AP_Arming/AP_Arming.cpp @@ -1078,15 +1078,12 @@ bool AP_Arming::proximity_checks(bool report) const if (proximity == nullptr) { return true; } - if (proximity->get_status() == AP_Proximity::Status::NotConnected) { - return true; - } - - // return false if proximity sensor unhealthy - if (proximity->get_status() < AP_Proximity::Status::Good) { - check_failed(report, "check proximity sensor"); + char buffer[MAVLINK_MSG_STATUSTEXT_FIELD_TEXT_LEN+1]; + if (!proximity->prearm_healthy(buffer, ARRAY_SIZE(buffer))) { + check_failed(report, "%s", buffer); return false; } + return true; #endif return true;