diff --git a/src/comm/QGCXPlaneLink.cc b/src/comm/QGCXPlaneLink.cc index 89bc2ecaa2ba5c7d1c8480b0e1a1e278545210c0..2dfc452225befe6fb590270098dc0ee627255d96 100644 --- a/src/comm/QGCXPlaneLink.cc +++ b/src/comm/QGCXPlaneLink.cc @@ -42,6 +42,8 @@ This file is part of the QGROUNDCONTROL project QGCXPlaneLink::QGCXPlaneLink(UASInterface* mav, QString remoteHost, QHostAddress localHost, quint16 localPort) : mav(mav), + remoteHost(QHostAddress("127.0.0.1")), + remotePort(49000), socket(NULL), process(NULL), terraSync(NULL), @@ -72,7 +74,7 @@ void QGCXPlaneLink::loadSettings() settings.sync(); settings.beginGroup("QGC_XPLANE_LINK"); setRemoteHost(settings.value("REMOTE_HOST", QString("%1:%2").arg(remoteHost.toString()).arg(remotePort)).toString()); - setVersion(settings.value("XPLANE_VERSION", 10).toString()); + setVersion(settings.value("XPLANE_VERSION", 10).toInt()); selectPlane(settings.value("AIRFRAME", "default").toString()); settings.endGroup(); } @@ -115,11 +117,12 @@ void QGCXPlaneLink::setVersion(const QString& version) } } -//void QGCXPlaneLink::setVersion(unsigned int version) -//{ -//// bool changed = (xPlaneVersion != version); -// xPlaneVersion = version; -//} +void QGCXPlaneLink::setVersion(unsigned int version) +{ + bool changed = (xPlaneVersion != version); + xPlaneVersion = version; + if (changed) emit versionChanged(QString("X-Plane %1").arg(xPlaneVersion)); +} /** @@ -174,6 +177,9 @@ QString QGCXPlaneLink::getRemoteHost() */ void QGCXPlaneLink::setRemoteHost(const QString& newHost) { + if (newHost.length() == 0) + return; + if (newHost.contains(":")) { //qDebug() << "HOST: " << newHost.split(":").first(); @@ -204,6 +210,7 @@ void QGCXPlaneLink::setRemoteHost(const QString& newHost) { // Add newHost remoteHost = info.addresses().first(); + if (remotePort == 0) remotePort = 49000; } } diff --git a/src/comm/QGCXPlaneLink.h b/src/comm/QGCXPlaneLink.h index 14eec118be048deda78ac9f19b7dbd415e12b749..f2f202a7704987976f93977d6d2800a92a031ddf 100644 --- a/src/comm/QGCXPlaneLink.h +++ b/src/comm/QGCXPlaneLink.h @@ -102,6 +102,8 @@ public slots: void updateActuators(uint64_t time, float act1, float act2, float act3, float act4, float act5, float act6, float act7, float act8); /** @brief Set the simulator version as text string */ void setVersion(const QString& version); + /** @brief Set the simulator version as integer */ + void setVersion(unsigned int version); QString getVersion() { return QString("X-Plane %1").arg(xPlaneVersion); diff --git a/src/ui/QGCHilConfiguration.ui b/src/ui/QGCHilConfiguration.ui index 29d5f0036b337146380275aa6e8b59bafeb910e8..04e65c12420902e9f2cb65fbb46687c14687d579 100644 --- a/src/ui/QGCHilConfiguration.ui +++ b/src/ui/QGCHilConfiguration.ui @@ -101,6 +101,9 @@ + + true + X-Plane 10