diff --git a/APMrover2/GCS_Mavlink.pde b/APMrover2/GCS_Mavlink.pde index 29e450c32f..29b74487a3 100644 --- a/APMrover2/GCS_Mavlink.pde +++ b/APMrover2/GCS_Mavlink.pde @@ -2008,18 +2008,3 @@ static void gcs_send_text_fmt(const prog_char_t *fmt, ...) } } -// this code was moved from libraries/GCS_MAVLink to allow compile -// time selection of MAVLink 1.0 -BetterStream *mavlink_comm_0_port; -BetterStream *mavlink_comm_1_port; - -mavlink_system_t mavlink_system = {7,1,0,0}; - -uint8_t mavlink_check_target(uint8_t sysid, uint8_t compid) -{ - if (sysid != mavlink_system.sysid) - return 1; - // Currently we are not checking for correct compid since APM is not passing mavlink info to any subsystem - // If it is addressed to our system ID we assume it is for us - return 0; // no error -} diff --git a/ArduCopter/GCS_Mavlink.pde b/ArduCopter/GCS_Mavlink.pde index 9f428db2fb..b422080519 100644 --- a/ArduCopter/GCS_Mavlink.pde +++ b/ArduCopter/GCS_Mavlink.pde @@ -2038,18 +2038,3 @@ static void gcs_send_text_fmt(const prog_char_t *fmt, ...) } } -// this code was moved from libraries/GCS_MAVLink to allow compile -// time selection of MAVLink 1.0 -BetterStream *mavlink_comm_0_port; -BetterStream *mavlink_comm_1_port; - -mavlink_system_t mavlink_system = {7,1,0,0}; - -uint8_t mavlink_check_target(uint8_t sysid, uint8_t compid) -{ - if (sysid != mavlink_system.sysid) - return 1; - // Currently we are not checking for correct compid since APM is not passing mavlink info to any subsystem - // If it is addressed to our system ID we assume it is for us - return 0; // no error -} diff --git a/ArduPlane/GCS_Mavlink.pde b/ArduPlane/GCS_Mavlink.pde index 2cc319fae9..eb10a9d09e 100644 --- a/ArduPlane/GCS_Mavlink.pde +++ b/ArduPlane/GCS_Mavlink.pde @@ -1998,18 +1998,3 @@ static void gcs_send_text_fmt(const prog_char_t *fmt, ...) } } -// this code was moved from libraries/GCS_MAVLink to allow compile -// time selection of MAVLink 1.0 -BetterStream *mavlink_comm_0_port; -BetterStream *mavlink_comm_1_port; - -mavlink_system_t mavlink_system = {7,1,0,0}; - -uint8_t mavlink_check_target(uint8_t sysid, uint8_t compid) -{ - if (sysid != mavlink_system.sysid) - return 1; - // Currently we are not checking for correct compid since APM is not passing mavlink info to any subsystem - // If it is addressed to our system ID we assume it is for us - return 0; // no error -} diff --git a/Tools/VARTest/VARTest.pde b/Tools/VARTest/VARTest.pde index 0476002e6f..4fa3375ed7 100644 --- a/Tools/VARTest/VARTest.pde +++ b/Tools/VARTest/VARTest.pde @@ -60,10 +60,6 @@ AP_Baro_BMP085_HIL barometer; SITL sitl; -BetterStream *mavlink_comm_0_port; -BetterStream *mavlink_comm_1_port; -mavlink_system_t mavlink_system = {7,1,0,0}; - FastSerialPort0(Serial); FastSerialPort1(Serial1); // GPS port diff --git a/libraries/AP_Math/examples/location/location.pde b/libraries/AP_Math/examples/location/location.pde index b0e08aa841..fdf32697b2 100644 --- a/libraries/AP_Math/examples/location/location.pde +++ b/libraries/AP_Math/examples/location/location.pde @@ -27,9 +27,6 @@ Arduino_Mega_ISR_Registry isr_registry; AP_Baro_BMP085_HIL barometer; AP_Compass_HIL compass; SITL sitl; -BetterStream *mavlink_comm_0_port; -BetterStream *mavlink_comm_1_port; -mavlink_system_t mavlink_system; #endif FastSerialPort(Serial, 0); diff --git a/libraries/Filter/examples/Derivative/Derivative.pde b/libraries/Filter/examples/Derivative/Derivative.pde index d108a68ebc..9247368b8f 100644 --- a/libraries/Filter/examples/Derivative/Derivative.pde +++ b/libraries/Filter/examples/Derivative/Derivative.pde @@ -28,9 +28,6 @@ Arduino_Mega_ISR_Registry isr_registry; AP_Baro_BMP085_HIL barometer; AP_Compass_HIL compass; SITL sitl; -BetterStream *mavlink_comm_0_port; -BetterStream *mavlink_comm_1_port; -mavlink_system_t mavlink_system; #endif FastSerialPort0(Serial); // FTDI/console diff --git a/libraries/GCS_MAVLink/GCS_MAVLink.cpp b/libraries/GCS_MAVLink/GCS_MAVLink.cpp new file mode 100644 index 0000000000..efbb462cf2 --- /dev/null +++ b/libraries/GCS_MAVLink/GCS_MAVLink.cpp @@ -0,0 +1,31 @@ +// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: t -*- + +/// @file GCS_MAVLink.cpp + +/* +This provides some support code and variables for MAVLink enabled sketches + +This firmware is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. +*/ + +#include +#include +#include + + +BetterStream *mavlink_comm_0_port; +BetterStream *mavlink_comm_1_port; + +mavlink_system_t mavlink_system = {7,1,0,0}; + +uint8_t mavlink_check_target(uint8_t sysid, uint8_t compid) +{ + if (sysid != mavlink_system.sysid) + return 1; + // Currently we are not checking for correct compid since APM is not passing mavlink info to any subsystem + // If it is addressed to our system ID we assume it is for us + return 0; // no error +}