From 5be07f4819a0ec6c3ecef59f439cfcb0c63eae5c Mon Sep 17 00:00:00 2001 From: Gus Grubba Date: Sat, 8 Dec 2018 22:32:02 -0400 Subject: [PATCH] CP - Skip serial related code if serial links are disabled. --- qgroundcontrol.pro | 8 ++++---- src/QGCApplication.cc | 2 ++ src/comm/LinkManager.cc | 6 ++++++ src/comm/LinkManager.h | 2 ++ src/main.cc | 4 ++++ 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index 1903f1aab..c9331d622 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -922,13 +922,13 @@ HEADERS+= \ src/Vehicle/Vehicle.h \ src/VehicleSetup/VehicleComponent.h \ -!MobileBuild { +!MobileBuild { !NoSerialBuild { HEADERS += \ src/VehicleSetup/Bootloader.h \ src/VehicleSetup/FirmwareImage.h \ src/VehicleSetup/FirmwareUpgradeController.h \ src/VehicleSetup/PX4FirmwareUpgradeThread.h \ -} +}} SOURCES += \ src/AutoPilotPlugins/AutoPilotPlugin.cc \ @@ -948,13 +948,13 @@ SOURCES += \ src/Vehicle/Vehicle.cc \ src/VehicleSetup/VehicleComponent.cc \ -!MobileBuild { +!MobileBuild { !NoSerialBuild { SOURCES += \ src/VehicleSetup/Bootloader.cc \ src/VehicleSetup/FirmwareImage.cc \ src/VehicleSetup/FirmwareUpgradeController.cc \ src/VehicleSetup/PX4FirmwareUpgradeThread.cc \ -} +}} # ArduPilot FirmwarePlugin diff --git a/src/QGCApplication.cc b/src/QGCApplication.cc index bd8def319..5aa0bb9bb 100644 --- a/src/QGCApplication.cc +++ b/src/QGCApplication.cc @@ -440,7 +440,9 @@ void QGCApplication::_initCommon(void) #ifndef __mobile__ qmlRegisterType (kQGCControllers, 1, 0, "ViewWidgetController"); qmlRegisterType (kQGCControllers, 1, 0, "CustomCommandWidgetController"); +#ifndef NO_SERIAL_LINK qmlRegisterType (kQGCControllers, 1, 0, "FirmwareUpgradeController"); +#endif qmlRegisterType (kQGCControllers, 1, 0, "GeoTagController"); qmlRegisterType (kQGCControllers, 1, 0, "MavlinkConsoleController"); #endif diff --git a/src/comm/LinkManager.cc b/src/comm/LinkManager.cc index 753c61532..a0ba291f4 100644 --- a/src/comm/LinkManager.cc +++ b/src/comm/LinkManager.cc @@ -52,8 +52,10 @@ LinkManager::LinkManager(QGCApplication* app, QGCToolbox* toolbox) , _autoConnectSettings(NULL) , _mavlinkProtocol(NULL) #ifndef __mobile__ +#ifndef NO_SERIAL_LINK , _nmeaPort(NULL) #endif +#endif { qmlRegisterUncreatableType ("QGroundControl", 1, 0, "LinkManager", "Reference only"); qmlRegisterUncreatableType ("QGroundControl", 1, 0, "LinkConfiguration", "Reference only"); @@ -69,8 +71,10 @@ LinkManager::LinkManager(QGCApplication* app, QGCToolbox* toolbox) LinkManager::~LinkManager() { #ifndef __mobile__ +#ifndef NO_SERIAL_LINK delete _nmeaPort; #endif +#endif } void LinkManager::setToolbox(QGCToolbox *toolbox) @@ -513,6 +517,7 @@ void LinkManager::_updateAutoConnectLinks(void) QGCSerialPortInfo::BoardType_t boardType; QString boardName; +#ifndef NO_SERIAL_LINK #ifndef __mobile__ if (portInfo.systemLocation().trimmed() == _autoConnectSettings->autoConnectNmeaPort()->cookedValueString()) { if (portInfo.systemLocation().trimmed() != _nmeaDeviceName) { @@ -538,6 +543,7 @@ void LinkManager::_updateAutoConnectLinks(void) qCDebug(LinkManagerLog) << "Configuring nmea baudrate" << _nmeaBaud; } } else +#endif #endif if (portInfo.getBoardInfo(boardType, boardName)) { if (portInfo.isBootloader()) { diff --git a/src/comm/LinkManager.h b/src/comm/LinkManager.h index 7aeb62e9b..f09360142 100644 --- a/src/comm/LinkManager.h +++ b/src/comm/LinkManager.h @@ -237,9 +237,11 @@ private: // NMEA GPS device for GCS position #ifndef __mobile__ +#ifndef NO_SERIAL_LINK QString _nmeaDeviceName; QSerialPort* _nmeaPort; uint32_t _nmeaBaud; #endif +#endif }; diff --git a/src/main.cc b/src/main.cc index 1811b876a..62457d014 100644 --- a/src/main.cc +++ b/src/main.cc @@ -56,8 +56,10 @@ #endif #ifndef __mobile__ +#ifndef NO_SERIAL_LINK Q_DECLARE_METATYPE(QGCSerialPortInfo) #endif +#endif #ifdef Q_OS_WIN @@ -159,7 +161,9 @@ int main(int argc, char *argv[]) #endif qRegisterMetaType(); #ifndef __mobile__ +#ifndef NO_SERIAL_LINK qRegisterMetaType(); +#endif #endif // We statically link our own QtLocation plugin -- 2.22.0