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]);