Commit b1686c1f authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #4621 from bluerobotics/git-hash

Extract git hash from AUTOPILOT_VERSION message
parents 9dbcf365 70bd3c71
...@@ -53,5 +53,10 @@ FactPanel { ...@@ -53,5 +53,10 @@ FactPanel {
labelText: qsTr("Firmware Version:") labelText: qsTr("Firmware Version:")
valueText: activeVehicle.firmwareMajorVersion == -1 ? qsTr("Unknown") : activeVehicle.firmwareMajorVersion + "." + activeVehicle.firmwareMinorVersion + "." + activeVehicle.firmwarePatchVersion + "-" + activeVehicle.firmwareVersionTypeString valueText: activeVehicle.firmwareMajorVersion == -1 ? qsTr("Unknown") : activeVehicle.firmwareMajorVersion + "." + activeVehicle.firmwareMinorVersion + "." + activeVehicle.firmwarePatchVersion + "-" + activeVehicle.firmwareVersionTypeString
} }
VehicleSummaryRow {
labelText: qsTr("Git Revision:")
valueText: activeVehicle.gitHash == -1 ? qsTr("Unknown") : activeVehicle.gitHash
}
} }
} }
...@@ -290,6 +290,7 @@ Vehicle::Vehicle(MAV_AUTOPILOT firmwareType, ...@@ -290,6 +290,7 @@ Vehicle::Vehicle(MAV_AUTOPILOT firmwareType,
, _firmwareMajorVersion(versionNotSetValue) , _firmwareMajorVersion(versionNotSetValue)
, _firmwareMinorVersion(versionNotSetValue) , _firmwareMinorVersion(versionNotSetValue)
, _firmwarePatchVersion(versionNotSetValue) , _firmwarePatchVersion(versionNotSetValue)
, _gitHash(versionNotSetValue)
, _rollFact (0, _rollFactName, FactMetaData::valueTypeDouble) , _rollFact (0, _rollFactName, FactMetaData::valueTypeDouble)
, _pitchFact (0, _pitchFactName, FactMetaData::valueTypeDouble) , _pitchFact (0, _pitchFactName, FactMetaData::valueTypeDouble)
, _headingFact (0, _headingFactName, FactMetaData::valueTypeDouble) , _headingFact (0, _headingFactName, FactMetaData::valueTypeDouble)
...@@ -671,6 +672,12 @@ void Vehicle::_handleAutopilotVersion(LinkInterface *link, mavlink_message_t& me ...@@ -671,6 +672,12 @@ void Vehicle::_handleAutopilotVersion(LinkInterface *link, mavlink_message_t& me
versionType = (FIRMWARE_VERSION_TYPE)((autopilotVersion.flight_sw_version >> (8*0)) & 0xFF); versionType = (FIRMWARE_VERSION_TYPE)((autopilotVersion.flight_sw_version >> (8*0)) & 0xFF);
setFirmwareVersion(majorVersion, minorVersion, patchVersion, versionType); setFirmwareVersion(majorVersion, minorVersion, patchVersion, versionType);
} }
// Git hash
if (autopilotVersion.flight_custom_version[0] != 0) {
_gitHash = QString::fromUtf8((char*)autopilotVersion.flight_custom_version, 8);
emit gitHashChanged(_gitHash);
}
} }
void Vehicle::_handleHilActuatorControls(mavlink_message_t &message) void Vehicle::_handleHilActuatorControls(mavlink_message_t &message)
......
...@@ -347,6 +347,7 @@ public: ...@@ -347,6 +347,7 @@ public:
Q_PROPERTY(int firmwarePatchVersion READ firmwarePatchVersion NOTIFY firmwarePatchVersionChanged) Q_PROPERTY(int firmwarePatchVersion READ firmwarePatchVersion NOTIFY firmwarePatchVersionChanged)
Q_PROPERTY(int firmwareVersionType READ firmwareVersionType NOTIFY firmwareVersionTypeChanged) Q_PROPERTY(int firmwareVersionType READ firmwareVersionType NOTIFY firmwareVersionTypeChanged)
Q_PROPERTY(QString firmwareVersionTypeString READ firmwareVersionTypeString NOTIFY firmwareVersionTypeChanged) Q_PROPERTY(QString firmwareVersionTypeString READ firmwareVersionTypeString NOTIFY firmwareVersionTypeChanged)
Q_PROPERTY(QString gitHash READ gitHash NOTIFY gitHashChanged)
/// Resets link status counters /// Resets link status counters
Q_INVOKABLE void resetCounters (); Q_INVOKABLE void resetCounters ();
...@@ -618,6 +619,8 @@ public: ...@@ -618,6 +619,8 @@ public:
void setFirmwareVersion(int majorVersion, int minorVersion, int patchVersion, FIRMWARE_VERSION_TYPE versionType = FIRMWARE_VERSION_TYPE_OFFICIAL); void setFirmwareVersion(int majorVersion, int minorVersion, int patchVersion, FIRMWARE_VERSION_TYPE versionType = FIRMWARE_VERSION_TYPE_OFFICIAL);
static const int versionNotSetValue = -1; static const int versionNotSetValue = -1;
QString gitHash(void) const { return _gitHash; }
bool soloFirmware(void) const { return _soloFirmware; } bool soloFirmware(void) const { return _soloFirmware; }
void setSoloFirmware(bool soloFirmware); void setSoloFirmware(bool soloFirmware);
...@@ -711,6 +714,8 @@ signals: ...@@ -711,6 +714,8 @@ signals:
void firmwarePatchVersionChanged(int patch); void firmwarePatchVersionChanged(int patch);
void firmwareVersionTypeChanged(int type); void firmwareVersionTypeChanged(int type);
void gitHashChanged(QString hash);
/// New RC channel values /// New RC channel values
/// @param channelCount Number of available channels, cMaxRcChannels max /// @param channelCount Number of available channels, cMaxRcChannels max
/// @param pwmValues -1 signals channel not available /// @param pwmValues -1 signals channel not available
...@@ -943,6 +948,8 @@ private: ...@@ -943,6 +948,8 @@ private:
int _firmwarePatchVersion; int _firmwarePatchVersion;
FIRMWARE_VERSION_TYPE _firmwareVersionType; FIRMWARE_VERSION_TYPE _firmwareVersionType;
QString _gitHash;
static const int _lowBatteryAnnounceRepeatMSecs; // Amount of time in between each low battery announcement static const int _lowBatteryAnnounceRepeatMSecs; // Amount of time in between each low battery announcement
QElapsedTimer _lowBatteryAnnounceTimer; QElapsedTimer _lowBatteryAnnounceTimer;
......
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