|
|
|
@ -21,6 +21,7 @@
@@ -21,6 +21,7 @@
|
|
|
|
|
#include "UDPLink.h" |
|
|
|
|
#include "TCPLink.h" |
|
|
|
|
#include "SettingsManager.h" |
|
|
|
|
#include "PositionManager.h" |
|
|
|
|
#ifdef QGC_ENABLE_BLUETOOTH |
|
|
|
|
#include "BluetoothLink.h" |
|
|
|
|
#endif |
|
|
|
@ -50,6 +51,7 @@ LinkManager::LinkManager(QGCApplication* app, QGCToolbox* toolbox)
@@ -50,6 +51,7 @@ LinkManager::LinkManager(QGCApplication* app, QGCToolbox* toolbox)
|
|
|
|
|
, _mavlinkChannelsUsedBitMask(1) // We never use channel 0 to avoid sequence numbering problems
|
|
|
|
|
, _autoConnectSettings(NULL) |
|
|
|
|
, _mavlinkProtocol(NULL) |
|
|
|
|
, _nmeaPort(NULL) |
|
|
|
|
{ |
|
|
|
|
qmlRegisterUncreatableType<LinkManager> ("QGroundControl", 1, 0, "LinkManager", "Reference only"); |
|
|
|
|
qmlRegisterUncreatableType<LinkConfiguration> ("QGroundControl", 1, 0, "LinkConfiguration", "Reference only"); |
|
|
|
@ -64,7 +66,7 @@ LinkManager::LinkManager(QGCApplication* app, QGCToolbox* toolbox)
@@ -64,7 +66,7 @@ LinkManager::LinkManager(QGCApplication* app, QGCToolbox* toolbox)
|
|
|
|
|
|
|
|
|
|
LinkManager::~LinkManager() |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
delete _nmeaPort; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void LinkManager::setToolbox(QGCToolbox *toolbox) |
|
|
|
@ -500,8 +502,30 @@ void LinkManager::_updateAutoConnectLinks(void)
@@ -500,8 +502,30 @@ void LinkManager::_updateAutoConnectLinks(void)
|
|
|
|
|
QGCSerialPortInfo::BoardType_t boardType; |
|
|
|
|
QString boardName; |
|
|
|
|
|
|
|
|
|
if (portInfo.getBoardInfo(boardType, boardName)) { |
|
|
|
|
if (portInfo.systemLocation().trimmed() == _autoConnectSettings->autoConnectNmeaPort()->cookedValueString()) { |
|
|
|
|
if (portInfo.systemLocation().trimmed() != _nmeaDeviceName) { |
|
|
|
|
_nmeaDeviceName = portInfo.systemLocation().trimmed(); |
|
|
|
|
qCDebug(LinkManagerLog) << "Configuring nmea port" << _nmeaDeviceName; |
|
|
|
|
QSerialPort* newPort = new QSerialPort(portInfo); |
|
|
|
|
|
|
|
|
|
_nmeaBaud = _autoConnectSettings->autoConnectNmeaBaud()->cookedValue().toUInt(); |
|
|
|
|
newPort->setBaudRate(_nmeaBaud); |
|
|
|
|
qCDebug(LinkManagerLog) << "Configuring nmea baudrate" << _nmeaBaud; |
|
|
|
|
|
|
|
|
|
// This will stop polling old device if previously set
|
|
|
|
|
_toolbox->qgcPositionManager()->setNmeaSourceDevice(newPort); |
|
|
|
|
|
|
|
|
|
if (_nmeaPort) { |
|
|
|
|
delete _nmeaPort; |
|
|
|
|
} |
|
|
|
|
_nmeaPort = newPort; |
|
|
|
|
|
|
|
|
|
} else if (_autoConnectSettings->autoConnectNmeaBaud()->cookedValue().toUInt() != _nmeaBaud) { |
|
|
|
|
_nmeaBaud = _autoConnectSettings->autoConnectNmeaBaud()->cookedValue().toUInt(); |
|
|
|
|
_nmeaPort->setBaudRate(_nmeaBaud); |
|
|
|
|
qCDebug(LinkManagerLog) << "Configuring nmea baudrate" << _nmeaBaud; |
|
|
|
|
} |
|
|
|
|
} else if (portInfo.getBoardInfo(boardType, boardName)) { |
|
|
|
|
if (portInfo.isBootloader()) { |
|
|
|
|
// Don't connect to bootloader
|
|
|
|
|
qCDebug(LinkManagerLog) << "Waiting for bootloader to finish" << portInfo.systemLocation(); |
|
|
|
|