From 6f88da07aa641305daa77ee971ced9938007781d Mon Sep 17 00:00:00 2001 From: stefanlynka Date: Mon, 13 Jun 2016 17:44:23 +0900 Subject: [PATCH] Tracker: Adding alt_source enum --- AntennaTracker/GCS_Mavlink.cpp | 2 +- AntennaTracker/defines.h | 6 ++++++ AntennaTracker/tracking.cpp | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/AntennaTracker/GCS_Mavlink.cpp b/AntennaTracker/GCS_Mavlink.cpp index ab1cc4c59d..5393017b9b 100644 --- a/AntennaTracker/GCS_Mavlink.cpp +++ b/AntennaTracker/GCS_Mavlink.cpp @@ -129,7 +129,7 @@ void Tracker::send_waypoint_request(mavlink_channel_t chan) void Tracker::send_nav_controller_output(mavlink_channel_t chan) { - float alt_diff = (g.alt_source == 0) ? nav_status.alt_difference_baro : nav_status.alt_difference_gps; + float alt_diff = (g.alt_source == ALT_SOURCE_BARO) ? nav_status.alt_difference_baro : nav_status.alt_difference_gps; mavlink_msg_nav_controller_output_send( chan, diff --git a/AntennaTracker/defines.h b/AntennaTracker/defines.h index bfcb30ad3b..795349da8e 100644 --- a/AntennaTracker/defines.h +++ b/AntennaTracker/defines.h @@ -24,6 +24,12 @@ enum ServoType { SERVO_TYPE_CR=2 }; +enum AltSource{ + ALT_SOURCE_BARO=0, + ALT_SOURCE_GPS=1 + +}; + // Logging parameters #define MASK_LOG_ATTITUDE (1<<0) #define MASK_LOG_GPS (1<<1) diff --git a/AntennaTracker/tracking.cpp b/AntennaTracker/tracking.cpp index 750444860f..451ac4de8d 100644 --- a/AntennaTracker/tracking.cpp +++ b/AntennaTracker/tracking.cpp @@ -66,7 +66,7 @@ void Tracker::update_bearing_and_distance() // calculate pitch to vehicle // To-Do: remove need for check of control_mode if (control_mode != SCAN && !nav_status.manual_control_pitch) { - if (g.alt_source == 0) { + if (g.alt_source == ALT_SOURCE_BARO) { nav_status.pitch = degrees(atan2f(nav_status.alt_difference_baro, nav_status.distance)); } else { nav_status.pitch = degrees(atan2f(nav_status.alt_difference_gps, nav_status.distance));