Tracker: Support for a GCS singleton

This commit is contained in:
Peter Barker 2016-05-31 11:50:15 +10:00 committed by Andrew Tridgell
parent 14470573f6
commit e12e51f502
3 changed files with 6 additions and 4 deletions

View File

@ -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();
}

View File

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

View File

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