From 9c6a392687b531c8ed9a1f34b2e8a9cfeb68f80a Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Mon, 7 Nov 2016 09:36:53 +0900 Subject: [PATCH] Copter: only log proximity if sensor is enabled --- ArduCopter/Log.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ArduCopter/Log.cpp b/ArduCopter/Log.cpp index 407211b775..80c0dd1609 100644 --- a/ArduCopter/Log.cpp +++ b/ArduCopter/Log.cpp @@ -767,6 +767,11 @@ struct PACKED log_Proximity { void Copter::Log_Write_Proximity() { #if PROXIMITY_ENABLED == ENABLED + // exit immediately if not enabled + if (g2.proximity.get_status() == AP_Proximity::Proximity_NotConnected) { + return; + } + float sector_distance[8] = {0,0,0,0,0,0,0,0}; g2.proximity.get_horizontal_distance(0, sector_distance[0]); g2.proximity.get_horizontal_distance(45, sector_distance[1]);