Commit 56190d75 authored by Lorenz Meier's avatar Lorenz Meier

HIL fixes

parent 2ead9b7d
...@@ -42,6 +42,8 @@ This file is part of the QGROUNDCONTROL project ...@@ -42,6 +42,8 @@ This file is part of the QGROUNDCONTROL project
QGCXPlaneLink::QGCXPlaneLink(UASInterface* mav, QString remoteHost, QHostAddress localHost, quint16 localPort) : QGCXPlaneLink::QGCXPlaneLink(UASInterface* mav, QString remoteHost, QHostAddress localHost, quint16 localPort) :
mav(mav), mav(mav),
remoteHost(QHostAddress("127.0.0.1")),
remotePort(49000),
socket(NULL), socket(NULL),
process(NULL), process(NULL),
terraSync(NULL), terraSync(NULL),
...@@ -72,7 +74,7 @@ void QGCXPlaneLink::loadSettings() ...@@ -72,7 +74,7 @@ void QGCXPlaneLink::loadSettings()
settings.sync(); settings.sync();
settings.beginGroup("QGC_XPLANE_LINK"); settings.beginGroup("QGC_XPLANE_LINK");
setRemoteHost(settings.value("REMOTE_HOST", QString("%1:%2").arg(remoteHost.toString()).arg(remotePort)).toString()); 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()); selectPlane(settings.value("AIRFRAME", "default").toString());
settings.endGroup(); settings.endGroup();
} }
...@@ -115,11 +117,12 @@ void QGCXPlaneLink::setVersion(const QString& version) ...@@ -115,11 +117,12 @@ void QGCXPlaneLink::setVersion(const QString& version)
} }
} }
//void QGCXPlaneLink::setVersion(unsigned int version) void QGCXPlaneLink::setVersion(unsigned int version)
//{ {
//// bool changed = (xPlaneVersion != version); bool changed = (xPlaneVersion != version);
// xPlaneVersion = version; xPlaneVersion = version;
//} if (changed) emit versionChanged(QString("X-Plane %1").arg(xPlaneVersion));
}
/** /**
...@@ -174,6 +177,9 @@ QString QGCXPlaneLink::getRemoteHost() ...@@ -174,6 +177,9 @@ QString QGCXPlaneLink::getRemoteHost()
*/ */
void QGCXPlaneLink::setRemoteHost(const QString& newHost) void QGCXPlaneLink::setRemoteHost(const QString& newHost)
{ {
if (newHost.length() == 0)
return;
if (newHost.contains(":")) if (newHost.contains(":"))
{ {
//qDebug() << "HOST: " << newHost.split(":").first(); //qDebug() << "HOST: " << newHost.split(":").first();
...@@ -204,6 +210,7 @@ void QGCXPlaneLink::setRemoteHost(const QString& newHost) ...@@ -204,6 +210,7 @@ void QGCXPlaneLink::setRemoteHost(const QString& newHost)
{ {
// Add newHost // Add newHost
remoteHost = info.addresses().first(); remoteHost = info.addresses().first();
if (remotePort == 0) remotePort = 49000;
} }
} }
......
...@@ -102,6 +102,8 @@ public slots: ...@@ -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); 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 */ /** @brief Set the simulator version as text string */
void setVersion(const QString& version); void setVersion(const QString& version);
/** @brief Set the simulator version as integer */
void setVersion(unsigned int version);
QString getVersion() QString getVersion()
{ {
return QString("X-Plane %1").arg(xPlaneVersion); return QString("X-Plane %1").arg(xPlaneVersion);
......
...@@ -101,6 +101,9 @@ ...@@ -101,6 +101,9 @@
</item> </item>
<item row="0" column="1" colspan="3"> <item row="0" column="1" colspan="3">
<widget class="QComboBox" name="simComboBox"> <widget class="QComboBox" name="simComboBox">
<property name="editable">
<bool>true</bool>
</property>
<item> <item>
<property name="text"> <property name="text">
<string>X-Plane 10</string> <string>X-Plane 10</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment