From 5f0ee66deaa4036a81d70991329c819f13b4b634 Mon Sep 17 00:00:00 2001 From: Bryant Mairs Date: Tue, 17 Apr 2012 14:33:25 -0700 Subject: [PATCH] Replaced the autopilot-specific inclusion of MAVLink to be more generic. Now if you have no actual QGC modifications to make and just want your messages to be available for viewing/logging you can just create the user_config.pri file and override MAVLINK_CONF. --- qgroundcontrol.pro | 52 +++++++++--------------------------------------- src/comm/QGCMAVLink.h | 16 ++------------- src/ui/MAVLinkDecoder.cc | 2 -- 3 files changed, 11 insertions(+), 59 deletions(-) diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index e14f0d2..a0c0308 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -92,58 +92,24 @@ INCLUDEPATH += \ # If the user config file exists, it will be included. # if the variable MAVLINK_CONF contains the name of an # additional project, QGroundControl includes the support -# of custom MAVLink messages of this project +# of custom MAVLink messages of this project. It will also +# create a QGC_USE_{AUTOPILOT_NAME}_MESSAGES macro for use +# within the actual code. exists(user_config.pri) { include(user_config.pri) message("----- USING CUSTOM USER QGROUNDCONTROL CONFIG FROM user_config.pri -----") message("Adding support for additional MAVLink messages for: " $$MAVLINK_CONF) message("------------------------------------------------------------------------") } -INCLUDEPATH += $$MAVLINKPATH/common INCLUDEPATH += $$MAVLINKPATH -contains(MAVLINK_CONF, pixhawk) { - # Remove the default set - it is included anyway - INCLUDEPATH -= $$MAVLINKPATH/common - - # PIXHAWK SPECIAL MESSAGES - INCLUDEPATH += $$MAVLINKPATH/pixhawk - DEFINES += QGC_USE_PIXHAWK_MESSAGES -} -contains(MAVLINK_CONF, slugs) { - # Remove the default set - it is included anyway - INCLUDEPATH -= $$MAVLINKPATH/common - - # SLUGS SPECIAL MESSAGES - INCLUDEPATH += $$MAVLINKPATH/slugs - DEFINES += QGC_USE_SLUGS_MESSAGES -} -contains(MAVLINK_CONF, ualberta) { - # Remove the default set - it is included anyway - INCLUDEPATH -= $$MAVLINKPATH/common - - # UALBERTA SPECIAL MESSAGES - INCLUDEPATH += $$MAVLINKPATH/ualberta - DEFINES += QGC_USE_UALBERTA_MESSAGES -} -contains(MAVLINK_CONF, ardupilotmega) { - # Remove the default set - it is included anyway - INCLUDEPATH -= $$MAVLINKPATH/common - INCLUDEPATH -= $$BASEDIR/mavlink/include/v1.0/common - - # UALBERTA SPECIAL MESSAGES - INCLUDEPATH += $$MAVLINKPATH/ardupilotmega - DEFINES += QGC_USE_ARDUPILOTMEGA_MESSAGES -} -contains(MAVLINK_CONF, senseSoar) { - # Remove the default set - it is included anyway - INCLUDEPATH -= $$MAVLINKPATH/common - - # SENSESOAR SPECIAL MESSAGES - INCLUDEPATH += $$MAVLINKPATH/SenseSoar - DEFINES += QGC_USE_SENSESOAR_MESSAGES +isEmpty(MAVLINK_CONF) { + INCLUDEPATH += $$MAVLINKPATH/common +} else { + INCLUDEPATH += $$MAVLINKPATH/$$MAVLINK_CONF + DEFINES += 'MAVLINK_CONF="$${MAVLINK_CONF}.h"' + DEFINES += $$sprintf('QGC_USE_%1_MESSAGES', $$upper($$MAVLINK_CONF)) } - # Include general settings for QGroundControl # necessary as last include to override any non-acceptable settings # done by the plugins above diff --git a/src/comm/QGCMAVLink.h b/src/comm/QGCMAVLink.h index b03e72e..a73c452 100644 --- a/src/comm/QGCMAVLink.h +++ b/src/comm/QGCMAVLink.h @@ -33,20 +33,8 @@ This file is part of the QGROUNDCONTROL project #include #include -#ifdef QGC_USE_PIXHAWK_MESSAGES -#include -#endif - -#ifdef QGC_USE_SLUGS_MESSAGES -#include -#endif - -#ifdef QGC_USE_UALBERTA_MESSAGES -#include -#endif - -#ifdef QGC_USE_ARDUPILOTMEGA_MESSAGES -#include +#ifdef MAVLINK_CONF +#include MAVLINK_CONF #endif diff --git a/src/ui/MAVLinkDecoder.cc b/src/ui/MAVLinkDecoder.cc index 091b2f4..462bd6b 100644 --- a/src/ui/MAVLinkDecoder.cc +++ b/src/ui/MAVLinkDecoder.cc @@ -14,8 +14,6 @@ MAVLinkDecoder::MAVLinkDecoder(MAVLinkProtocol* protocol, QObject *parent) : onboardTimeOffset[i] = 0; } - - // Fill filter messageFilter.insert(MAVLINK_MSG_ID_HEARTBEAT, false); messageFilter.insert(MAVLINK_MSG_ID_SYS_STATUS, false);