From 0efe4351f1371b68ea630d7acee6f3d7301b9584 Mon Sep 17 00:00:00 2001 From: rishabsingh3003 Date: Mon, 4 Mar 2024 13:54:40 -0500 Subject: [PATCH] AP_Proximity: Improve get_status handling --- libraries/AP_Proximity/AP_Proximity.cpp | 20 ++++++++++++++------ libraries/AP_Proximity/AP_Proximity.h | 2 ++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/libraries/AP_Proximity/AP_Proximity.cpp b/libraries/AP_Proximity/AP_Proximity.cpp index 82dc97e791..753b7eb0bc 100644 --- a/libraries/AP_Proximity/AP_Proximity.cpp +++ b/libraries/AP_Proximity/AP_Proximity.cpp @@ -308,17 +308,19 @@ AP_Proximity::Status AP_Proximity::get_instance_status(uint8_t instance) const return state[instance].status; } +// Returns status of first good sensor. If no good sensor found, returns status of last instance sensor AP_Proximity::Status AP_Proximity::get_status() const { + Status sensors_status = Status::NotConnected; for (uint8_t i=0; i