From e12e51f5029cee31dfba6f80d1ba731334243f6d Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Tue, 31 May 2016 11:50:15 +1000 Subject: [PATCH] Tracker: Support for a GCS singleton --- AntennaTracker/GCS_Mavlink.cpp | 6 +++--- AntennaTracker/Tracker.h | 2 ++ AntennaTracker/system.cpp | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/AntennaTracker/GCS_Mavlink.cpp b/AntennaTracker/GCS_Mavlink.cpp index b6c8574112..3579f2d594 100644 --- a/AntennaTracker/GCS_Mavlink.cpp +++ b/AntennaTracker/GCS_Mavlink.cpp @@ -950,7 +950,7 @@ void Tracker::gcs_update(void) void Tracker::gcs_send_text(MAV_SEVERITY severity, const char *str) { - GCS_MAVLINK::send_statustext(severity, 0xFF, str); + gcs().send_statustext(severity, 0xFF, str); notify.send_text(str); } @@ -966,7 +966,7 @@ void Tracker::gcs_send_text_fmt(MAV_SEVERITY severity, const char *fmt, ...) va_start(arg_list, fmt); hal.util->vsnprintf((char *)str, sizeof(str), fmt, arg_list); va_end(arg_list); - GCS_MAVLINK::send_statustext(severity, 0xFF, str); + gcs().send_statustext(severity, 0xFF, str); notify.send_text(str); } @@ -976,5 +976,5 @@ void Tracker::gcs_send_text_fmt(MAV_SEVERITY severity, const char *fmt, ...) void Tracker::gcs_retry_deferred(void) { gcs_send_message(MSG_RETRY_DEFERRED); - GCS_MAVLINK::service_statustext(); + gcs().service_statustext(); } diff --git a/AntennaTracker/Tracker.h b/AntennaTracker/Tracker.h index 43e431c772..0af4db0627 100644 --- a/AntennaTracker/Tracker.h +++ b/AntennaTracker/Tracker.h @@ -140,6 +140,8 @@ private: AP_SerialManager serial_manager; const uint8_t num_gcs = MAVLINK_COMM_NUM_BUFFERS; GCS_MAVLINK_Tracker gcs_chan[MAVLINK_COMM_NUM_BUFFERS]; + GCS _gcs; // avoid using this; use GCS::instance() + GCS &gcs() { return _gcs; } AP_BoardConfig BoardConfig; diff --git a/AntennaTracker/system.cpp b/AntennaTracker/system.cpp index 10585a4b41..b94a7b431a 100644 --- a/AntennaTracker/system.cpp +++ b/AntennaTracker/system.cpp @@ -26,7 +26,7 @@ void Tracker::init_tracker() // Check the EEPROM format version before loading any parameters from EEPROM load_parameters(); - GCS_MAVLINK::set_dataflash(&DataFlash); + gcs().set_dataflash(&DataFlash); mavlink_system.sysid = g.sysid_this_mav;