Unverified Commit 1423da76 authored by Gus Grubba's avatar Gus Grubba Committed by GitHub

Merge pull request #7295 from MatejFranceskin/pr-microhard-remove-unneeded-config

PR Remove Microhard configuration for air and ground unit IPs as they're not needed.
parents 27a70b81 5863ef99
...@@ -15,13 +15,12 @@ ...@@ -15,13 +15,12 @@
#include <QSettings> #include <QSettings>
#define LONG_TIMEOUT 5000 #define SHORT_TIMEOUT 2500
#define LONG_TIMEOUT 5000
static const char *kMICROHARD_GROUP = "Microhard"; static const char *kMICROHARD_GROUP = "Microhard";
static const char *kLOCAL_IP = "LocalIP"; static const char *kLOCAL_IP = "LocalIP";
static const char *kREMOTE_IP = "RemoteIP"; static const char *kREMOTE_IP = "RemoteIP";
static const char *kGROUND_IP = "GroundIP";
static const char *kAIR_IP = "AirIP";
static const char *kNET_MASK = "NetMask"; static const char *kNET_MASK = "NetMask";
static const char *kCFG_PASSWORD = "ConfigPassword"; static const char *kCFG_PASSWORD = "ConfigPassword";
static const char *kENC_KEY = "EncryptionKey"; static const char *kENC_KEY = "EncryptionKey";
...@@ -38,8 +37,6 @@ MicrohardManager::MicrohardManager(QGCApplication* app, QGCToolbox* toolbox) ...@@ -38,8 +37,6 @@ MicrohardManager::MicrohardManager(QGCApplication* app, QGCToolbox* toolbox)
settings.beginGroup(kMICROHARD_GROUP); settings.beginGroup(kMICROHARD_GROUP);
_localIPAddr = settings.value(kLOCAL_IP, QString("192.168.168.1")).toString(); _localIPAddr = settings.value(kLOCAL_IP, QString("192.168.168.1")).toString();
_remoteIPAddr = settings.value(kREMOTE_IP, QString("192.168.168.2")).toString(); _remoteIPAddr = settings.value(kREMOTE_IP, QString("192.168.168.2")).toString();
_groundIPAddr = settings.value(kGROUND_IP, QString("192.168.168.101")).toString();
_airIPAddr = settings.value(kAIR_IP, QString("192.168.168.213")).toString();
_netMask = settings.value(kNET_MASK, QString("255.255.255.0")).toString(); _netMask = settings.value(kNET_MASK, QString("255.255.255.0")).toString();
_configPassword = settings.value(kCFG_PASSWORD, QString("admin")).toString(); _configPassword = settings.value(kCFG_PASSWORD, QString("admin")).toString();
_encryptionKey = settings.value(kENC_KEY, QString("1234567890")).toString(); _encryptionKey = settings.value(kENC_KEY, QString("1234567890")).toString();
...@@ -117,10 +114,10 @@ MicrohardManager::setToolbox(QGCToolbox* toolbox) ...@@ -117,10 +114,10 @@ MicrohardManager::setToolbox(QGCToolbox* toolbox)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
MicrohardManager::setIPSettings(QString localIP_, QString remoteIP_, QString groundIP_, QString airIP_, QString netMask_, QString cfgPassword_, QString encryptionKey_) MicrohardManager::setIPSettings(QString localIP_, QString remoteIP_, QString netMask_, QString cfgPassword_, QString encryptionKey_)
{ {
if (_localIPAddr != localIP_ || _remoteIPAddr != remoteIP_ || _netMask != netMask_ || if (_localIPAddr != localIP_ || _remoteIPAddr != remoteIP_ || _netMask != netMask_ ||
_configPassword != cfgPassword_ || _encryptionKey != encryptionKey_ || _groundIPAddr != groundIP_ || _airIPAddr != airIP_) _configPassword != cfgPassword_ || _encryptionKey != encryptionKey_)
{ {
if (_mhSettingsLoc && _encryptionKey != encryptionKey_) { if (_mhSettingsLoc && _encryptionKey != encryptionKey_) {
_mhSettingsLoc->setEncryptionKey(encryptionKey_); _mhSettingsLoc->setEncryptionKey(encryptionKey_);
...@@ -128,8 +125,6 @@ MicrohardManager::setIPSettings(QString localIP_, QString remoteIP_, QString gro ...@@ -128,8 +125,6 @@ MicrohardManager::setIPSettings(QString localIP_, QString remoteIP_, QString gro
_localIPAddr = localIP_; _localIPAddr = localIP_;
_remoteIPAddr = remoteIP_; _remoteIPAddr = remoteIP_;
_groundIPAddr = groundIP_;
_airIPAddr = airIP_;
_netMask = netMask_; _netMask = netMask_;
_configPassword = cfgPassword_; _configPassword = cfgPassword_;
_encryptionKey = encryptionKey_; _encryptionKey = encryptionKey_;
...@@ -138,8 +133,6 @@ MicrohardManager::setIPSettings(QString localIP_, QString remoteIP_, QString gro ...@@ -138,8 +133,6 @@ MicrohardManager::setIPSettings(QString localIP_, QString remoteIP_, QString gro
settings.beginGroup(kMICROHARD_GROUP); settings.beginGroup(kMICROHARD_GROUP);
settings.setValue(kLOCAL_IP, localIP_); settings.setValue(kLOCAL_IP, localIP_);
settings.setValue(kREMOTE_IP, remoteIP_); settings.setValue(kREMOTE_IP, remoteIP_);
settings.setValue(kGROUND_IP, groundIP_);
settings.setValue(kAIR_IP, airIP_);
settings.setValue(kNET_MASK, netMask_); settings.setValue(kNET_MASK, netMask_);
settings.setValue(kCFG_PASSWORD, cfgPassword_); settings.setValue(kCFG_PASSWORD, cfgPassword_);
settings.setValue(kENC_KEY, encryptionKey_); settings.setValue(kENC_KEY, encryptionKey_);
...@@ -169,7 +162,7 @@ MicrohardManager::_setEnabled() ...@@ -169,7 +162,7 @@ MicrohardManager::_setEnabled()
connect(_mhSettingsRem, &MicrohardSettings::connected, this, &MicrohardManager::_connectedRem); connect(_mhSettingsRem, &MicrohardSettings::connected, this, &MicrohardManager::_connectedRem);
connect(_mhSettingsRem, &MicrohardSettings::rssiUpdated, this, &MicrohardManager::_rssiUpdatedRem); connect(_mhSettingsRem, &MicrohardSettings::rssiUpdated, this, &MicrohardManager::_rssiUpdatedRem);
} }
_workTimer.start(1000); _workTimer.start(SHORT_TIMEOUT);
} else { } else {
//-- Stop everything //-- Stop everything
_close(); _close();
...@@ -268,5 +261,5 @@ MicrohardManager::_checkMicrohard() ...@@ -268,5 +261,5 @@ MicrohardManager::_checkMicrohard()
_mhSettingsRem->getStatus(); _mhSettingsRem->getStatus();
} }
} }
_workTimer.start(_isConnected ? 1000 : LONG_TIMEOUT); _workTimer.start(_isConnected ? SHORT_TIMEOUT : LONG_TIMEOUT);
} }
...@@ -32,13 +32,11 @@ public: ...@@ -32,13 +32,11 @@ public:
Q_PROPERTY(int downlinkRSSI READ downlinkRSSI NOTIFY linkChanged) Q_PROPERTY(int downlinkRSSI READ downlinkRSSI NOTIFY linkChanged)
Q_PROPERTY(QString localIPAddr READ localIPAddr NOTIFY localIPAddrChanged) Q_PROPERTY(QString localIPAddr READ localIPAddr NOTIFY localIPAddrChanged)
Q_PROPERTY(QString remoteIPAddr READ remoteIPAddr NOTIFY remoteIPAddrChanged) Q_PROPERTY(QString remoteIPAddr READ remoteIPAddr NOTIFY remoteIPAddrChanged)
Q_PROPERTY(QString groundIPAddr READ groundIPAddr NOTIFY groundIPAddrChanged)
Q_PROPERTY(QString airIPAddr READ airIPAddr NOTIFY airIPAddrChanged)
Q_PROPERTY(QString netMask READ netMask NOTIFY netMaskChanged) Q_PROPERTY(QString netMask READ netMask NOTIFY netMaskChanged)
Q_PROPERTY(QString configPassword READ configPassword NOTIFY configPasswordChanged) Q_PROPERTY(QString configPassword READ configPassword NOTIFY configPasswordChanged)
Q_PROPERTY(QString encryptionKey READ encryptionKey NOTIFY encryptionKeyChanged) Q_PROPERTY(QString encryptionKey READ encryptionKey NOTIFY encryptionKeyChanged)
Q_INVOKABLE bool setIPSettings (QString localIP, QString remoteIP, QString groundIP, QString airIP, QString netMask, QString cfgPassword, QString encyrptionKey); Q_INVOKABLE bool setIPSettings (QString localIP, QString remoteIP, QString netMask, QString cfgPassword, QString encyrptionKey);
explicit MicrohardManager (QGCApplication* app, QGCToolbox* toolbox); explicit MicrohardManager (QGCApplication* app, QGCToolbox* toolbox);
~MicrohardManager () override; ~MicrohardManager () override;
...@@ -51,8 +49,6 @@ public: ...@@ -51,8 +49,6 @@ public:
int downlinkRSSI () { return _uplinkRSSI; } int downlinkRSSI () { return _uplinkRSSI; }
QString localIPAddr () { return _localIPAddr; } QString localIPAddr () { return _localIPAddr; }
QString remoteIPAddr () { return _remoteIPAddr; } QString remoteIPAddr () { return _remoteIPAddr; }
QString airIPAddr () { return _airIPAddr; }
QString groundIPAddr () { return _groundIPAddr; }
QString netMask () { return _netMask; } QString netMask () { return _netMask; }
QString configPassword () { return _configPassword; } QString configPassword () { return _configPassword; }
QString encryptionKey () { return _encryptionKey; } QString encryptionKey () { return _encryptionKey; }
...@@ -63,8 +59,6 @@ signals: ...@@ -63,8 +59,6 @@ signals:
void connectedChanged (); void connectedChanged ();
void localIPAddrChanged (); void localIPAddrChanged ();
void remoteIPAddrChanged (); void remoteIPAddrChanged ();
void airIPAddrChanged ();
void groundIPAddrChanged ();
void netMaskChanged (); void netMaskChanged ();
void configPasswordChanged (); void configPasswordChanged ();
void encryptionKeyChanged (); void encryptionKeyChanged ();
...@@ -98,8 +92,6 @@ private: ...@@ -98,8 +92,6 @@ private:
int _uplinkRSSI = 0; int _uplinkRSSI = 0;
QString _localIPAddr; QString _localIPAddr;
QString _remoteIPAddr; QString _remoteIPAddr;
QString _groundIPAddr;
QString _airIPAddr;
QString _netMask; QString _netMask;
QString _configPassword; QString _configPassword;
QString _encryptionKey; QString _encryptionKey;
......
...@@ -205,27 +205,6 @@ QGCView { ...@@ -205,27 +205,6 @@ QGCView {
inputMethodHints: Qt.ImhFormattedNumbersOnly inputMethodHints: Qt.ImhFormattedNumbersOnly
Layout.minimumWidth: _valueWidth Layout.minimumWidth: _valueWidth
} }
QGCLabel {
text: qsTr("Ground Unit IP Address:")
Layout.minimumWidth: _labelWidth
}
QGCTextField {
id: groundIP
text: QGroundControl.microhardManager.groundIPAddr
enabled: true
inputMethodHints: Qt.ImhFormattedNumbersOnly
Layout.minimumWidth: _valueWidth
}
QGCLabel {
text: qsTr("Air Unit IP Address:")
}
QGCTextField {
id: airIP
text: QGroundControl.microhardManager.airIPAddr
enabled: true
inputMethodHints: Qt.ImhFormattedNumbersOnly
Layout.minimumWidth: _valueWidth
}
QGCLabel { QGCLabel {
text: qsTr("Network Mask:") text: qsTr("Network Mask:")
} }
...@@ -270,16 +249,12 @@ QGCView { ...@@ -270,16 +249,12 @@ QGCView {
function testEnabled() { function testEnabled() {
if(localIP.text === QGroundControl.microhardManager.localIPAddr && if(localIP.text === QGroundControl.microhardManager.localIPAddr &&
remoteIP.text === QGroundControl.microhardManager.remoteIPAddr && remoteIP.text === QGroundControl.microhardManager.remoteIPAddr &&
groundIP.text === QGroundControl.microhardManager.groundIPAddr &&
airIP.text === QGroundControl.microhardManager.airIPAddr &&
netMask.text === QGroundControl.microhardManager.netMask && netMask.text === QGroundControl.microhardManager.netMask &&
configPassword.text === QGroundControl.microhardManager.configPassword && configPassword.text === QGroundControl.microhardManager.configPassword &&
encryptionKey.text === QGroundControl.microhardManager.encryptionKey) encryptionKey.text === QGroundControl.microhardManager.encryptionKey)
return false return false
if(!validateIPaddress(localIP.text)) return false if(!validateIPaddress(localIP.text)) return false
if(!validateIPaddress(remoteIP.text)) return false if(!validateIPaddress(remoteIP.text)) return false
if(!validateIPaddress(groundIP.text)) return false
if(!validateIPaddress(airIP.text)) return false
if(!validateIPaddress(netMask.text)) return false if(!validateIPaddress(netMask.text)) return false
return true return true
} }
...@@ -287,7 +262,7 @@ QGCView { ...@@ -287,7 +262,7 @@ QGCView {
text: qsTr("Apply") text: qsTr("Apply")
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
onClicked: { onClicked: {
QGroundControl.microhardManager.setIPSettings(localIP.text, remoteIP.text, groundIP.text, airIP.text, netMask.text, configPassword.text, encryptionKey.text) QGroundControl.microhardManager.setIPSettings(localIP.text, remoteIP.text, netMask.text, configPassword.text, encryptionKey.text)
} }
} }
......
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