Copter: only log proximity if sensor is enabled

This commit is contained in:
Randy Mackay 2016-11-07 09:36:53 +09:00
parent 6abe6448d6
commit 9c6a392687
1 changed files with 5 additions and 0 deletions

View File

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