Rover: Support for a GCS singleton

This commit is contained in:
Peter Barker 2016-05-31 11:43:42 +10:00 committed by Andrew Tridgell
parent 407e251e1d
commit 45e0765b97
3 changed files with 6 additions and 4 deletions

View File

@ -1567,7 +1567,7 @@ void Rover::gcs_update(void)
void Rover::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);
}
@ -1583,7 +1583,7 @@ void Rover::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);
}
@ -1594,7 +1594,7 @@ void Rover::gcs_send_text_fmt(MAV_SEVERITY severity, const char *fmt, ...)
void Rover::gcs_retry_deferred(void)
{
gcs_send_message(MSG_RETRY_DEFERRED);
GCS_MAVLINK::service_statustext();
gcs().service_statustext();
}
/*

View File

@ -186,6 +186,8 @@ private:
AP_SerialManager serial_manager;
const uint8_t num_gcs;
GCS_MAVLINK_Rover gcs_chan[MAVLINK_COMM_NUM_BUFFERS];
GCS _gcs; // avoid using this; use gcs()
GCS &gcs() { return _gcs; }
// relay support
AP_Relay relay;

View File

@ -92,7 +92,7 @@ void Rover::init_ardupilot()
// initialise stats module
g2.stats.init();
GCS_MAVLINK::set_dataflash(&DataFlash);
gcs().set_dataflash(&DataFlash);
mavlink_system.sysid = g.sysid_this_mav;