GCS_MAVLink: eliminate redundant static pointer to serialmanager

This commit is contained in:
Peter Barker 2019-01-23 15:19:00 +11:00 committed by Andrew Tridgell
parent f3c1791341
commit 45fab82345
3 changed files with 3 additions and 11 deletions

View File

@ -805,8 +805,6 @@ private:
// mavlink routing object
static MAVLink_routing routing;
static const AP_SerialManager *serialmanager_p;
struct pending_param_request {
mavlink_channel_t chan;
int16_t param_index;

View File

@ -107,8 +107,6 @@ GCS_MAVLINK::init(AP_HAL::UARTDriver *port, mavlink_channel_t mav_chan)
void
GCS_MAVLINK::setup_uart(const AP_SerialManager& serial_manager, AP_SerialManager::SerialProtocol protocol, uint8_t instance)
{
serialmanager_p = &serial_manager;
// search for serial port
AP_HAL::UARTDriver *uart;
@ -152,7 +150,7 @@ GCS_MAVLINK::setup_uart(const AP_SerialManager& serial_manager, AP_SerialManager
// and init the gcs instance
init(uart, mav_chan);
AP_SerialManager::SerialProtocol mavlink_protocol = serialmanager_p->get_mavlink_protocol(mav_chan);
AP_SerialManager::SerialProtocol mavlink_protocol = AP::serialmanager().get_mavlink_protocol(mav_chan);
mavlink_status_t *status = mavlink_get_channel_status(chan);
if (status == nullptr) {
return;
@ -1686,8 +1684,7 @@ void GCS_MAVLINK::packetReceived(const mavlink_status_t &status,
}
if (!(status.flags & MAVLINK_STATUS_FLAG_IN_MAVLINK1) &&
(status.flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) &&
serialmanager_p &&
serialmanager_p->get_mavlink_protocol(chan) == AP_SerialManager::SerialProtocol_MAVLink2) {
AP::serialmanager().get_mavlink_protocol(chan) == AP_SerialManager::SerialProtocol_MAVLink2) {
// if we receive any MAVLink2 packets on a connection
// currently sending MAVLink1 then switch to sending
// MAVLink2
@ -4926,7 +4923,7 @@ uint64_t GCS_MAVLINK::capabilities() const
{
uint64_t ret = 0;
AP_SerialManager::SerialProtocol mavlink_protocol = serialmanager_p->get_mavlink_protocol(chan);
AP_SerialManager::SerialProtocol mavlink_protocol = AP::serialmanager().get_mavlink_protocol(chan);
if (mavlink_protocol == AP_SerialManager::SerialProtocol_MAVLink2) {
ret |= MAV_PROTOCOL_CAPABILITY_MAVLINK2;
}

View File

@ -51,9 +51,6 @@ static uint8_t mavlink_locked_mask;
// routing table
MAVLink_routing GCS_MAVLINK::routing;
// static AP_SerialManager pointer
const AP_SerialManager *GCS_MAVLINK::serialmanager_p;
/*
lock a channel, preventing use by MAVLink
*/