Browse Source

Show ESP8266 Firmware Version in Summary Panel

QGC4.4
dogmaphobic 9 years ago
parent
commit
c87e44f66f
  1. 18
      src/AutoPilotPlugins/Common/ESP8266ComponentController.cc
  2. 4
      src/AutoPilotPlugins/Common/ESP8266ComponentController.h
  3. 12
      src/AutoPilotPlugins/Common/ESP8266ComponentSummary.qml

18
src/AutoPilotPlugins/Common/ESP8266ComponentController.cc

@ -56,6 +56,8 @@ ESP8266ComponentController::ESP8266ComponentController()
connect(paswd, &Fact::valueChanged, this, &ESP8266ComponentController::_passwordChanged); connect(paswd, &Fact::valueChanged, this, &ESP8266ComponentController::_passwordChanged);
Fact* baud = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "UART_BAUDRATE"); Fact* baud = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "UART_BAUDRATE");
connect(baud, &Fact::valueChanged, this, &ESP8266ComponentController::_baudChanged); connect(baud, &Fact::valueChanged, this, &ESP8266ComponentController::_baudChanged);
Fact* ver = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "SW_VER");
connect(ver, &Fact::valueChanged, this, &ESP8266ComponentController::_versionChanged);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -66,6 +68,15 @@ ESP8266ComponentController::~ESP8266ComponentController()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
QString QString
ESP8266ComponentController::version()
{
uint32_t uv = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "SW_VER")->rawValue().toUInt();
QString versionString = QString("%1.%2.%3").arg(uv >> 24).arg((uv >> 16) & 0xFF).arg(uv & 0xFFFF);
return versionString;
}
//-----------------------------------------------------------------------------
QString
ESP8266ComponentController::wifiSSID() ESP8266ComponentController::wifiSSID()
{ {
uint32_t s1 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_SSID1")->rawValue().toUInt(); uint32_t s1 = getParameterFact(MAV_COMP_ID_UDP_BRIDGE, "WIFI_SSID1")->rawValue().toUInt();
@ -316,3 +327,10 @@ ESP8266ComponentController::_baudChanged(QVariant)
{ {
emit baudIndexChanged(); emit baudIndexChanged();
} }
//-----------------------------------------------------------------------------
void
ESP8266ComponentController::_versionChanged(QVariant)
{
emit versionChanged();
}

4
src/AutoPilotPlugins/Common/ESP8266ComponentController.h

@ -51,6 +51,7 @@ public:
~ESP8266ComponentController (); ~ESP8266ComponentController ();
Q_PROPERTY(int componentID READ componentID CONSTANT) Q_PROPERTY(int componentID READ componentID CONSTANT)
Q_PROPERTY(QString version READ version NOTIFY versionChanged)
Q_PROPERTY(QString wifiSSID READ wifiSSID WRITE setWifiSSID NOTIFY wifiSSIDChanged) Q_PROPERTY(QString wifiSSID READ wifiSSID WRITE setWifiSSID NOTIFY wifiSSIDChanged)
Q_PROPERTY(QString wifiPassword READ wifiPassword WRITE setWifiPassword NOTIFY wifiPasswordChanged) Q_PROPERTY(QString wifiPassword READ wifiPassword WRITE setWifiPassword NOTIFY wifiPasswordChanged)
Q_PROPERTY(QStringList wifiChannels READ wifiChannels CONSTANT) Q_PROPERTY(QStringList wifiChannels READ wifiChannels CONSTANT)
@ -62,6 +63,7 @@ public:
Q_INVOKABLE void reboot(); Q_INVOKABLE void reboot();
int componentID () { return MAV_COMP_ID_UDP_BRIDGE; } int componentID () { return MAV_COMP_ID_UDP_BRIDGE; }
QString version ();
QString wifiSSID (); QString wifiSSID ();
QString wifiPassword (); QString wifiPassword ();
QStringList wifiChannels () { return _channels; } QStringList wifiChannels () { return _channels; }
@ -74,6 +76,7 @@ public:
void setBaudIndex (int idx); void setBaudIndex (int idx);
signals: signals:
void versionChanged ();
void wifiSSIDChanged (); void wifiSSIDChanged ();
void wifiPasswordChanged (); void wifiPasswordChanged ();
void baudIndexChanged (); void baudIndexChanged ();
@ -85,6 +88,7 @@ private slots:
void _ssidChanged (QVariant value); void _ssidChanged (QVariant value);
void _passwordChanged (QVariant value); void _passwordChanged (QVariant value);
void _baudChanged (QVariant value); void _baudChanged (QVariant value);
void _versionChanged (QVariant value);
private: private:
void _reboot (); void _reboot ();

12
src/AutoPilotPlugins/Common/ESP8266ComponentSummary.qml

@ -29,6 +29,10 @@ FactPanel {
anchors.fill: parent anchors.fill: parent
anchors.margins: 8 anchors.margins: 8
VehicleSummaryRow { VehicleSummaryRow {
labelText: "Firmware Version:"
valueText: esp8266.version
}
VehicleSummaryRow {
labelText: "WiFi Channel:" labelText: "WiFi Channel:"
valueText: wifiChannel.valueString valueText: wifiChannel.valueString
} }
@ -41,14 +45,6 @@ FactPanel {
valueText: esp8266.wifiPassword valueText: esp8266.wifiPassword
} }
VehicleSummaryRow { VehicleSummaryRow {
labelText: "QGC UDP Port:"
valueText: wifiHostPort.valueString
}
VehicleSummaryRow {
labelText: "UAV UDP Port:"
valueText: wifiClientPort.valueString
}
VehicleSummaryRow {
labelText: "UART Baud Rate:" labelText: "UART Baud Rate:"
valueText: uartBaud.valueString valueText: uartBaud.valueString
} }

Loading…
Cancel
Save