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 {
labelText: qsTr("Firmware Version:")
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,
, _firmwareMajorVersion(versionNotSetValue)
, _firmwareMinorVersion(versionNotSetValue)
, _firmwarePatchVersion(versionNotSetValue)
, _gitHash(versionNotSetValue)
, _rollFact (0, _rollFactName, FactMetaData::valueTypeDouble)
, _pitchFact (0, _pitchFactName, FactMetaData::valueTypeDouble)
, _headingFact (0, _headingFactName, FactMetaData::valueTypeDouble)
......@@ -671,6 +672,12 @@ void Vehicle::_handleAutopilotVersion(LinkInterface *link, mavlink_message_t& me
versionType = (FIRMWARE_VERSION_TYPE)((autopilotVersion.flight_sw_version >> (8*0)) & 0xFF);
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)
......
......@@ -347,6 +347,7 @@ public:
Q_PROPERTY(int firmwarePatchVersion READ firmwarePatchVersion NOTIFY firmwarePatchVersionChanged)
Q_PROPERTY(int firmwareVersionType READ firmwareVersionType NOTIFY firmwareVersionTypeChanged)
Q_PROPERTY(QString firmwareVersionTypeString READ firmwareVersionTypeString NOTIFY firmwareVersionTypeChanged)
Q_PROPERTY(QString gitHash READ gitHash NOTIFY gitHashChanged)
/// Resets link status counters
Q_INVOKABLE void resetCounters ();
......@@ -618,6 +619,8 @@ public:
void setFirmwareVersion(int majorVersion, int minorVersion, int patchVersion, FIRMWARE_VERSION_TYPE versionType = FIRMWARE_VERSION_TYPE_OFFICIAL);
static const int versionNotSetValue = -1;
QString gitHash(void) const { return _gitHash; }
bool soloFirmware(void) const { return _soloFirmware; }
void setSoloFirmware(bool soloFirmware);
......@@ -711,6 +714,8 @@ signals:
void firmwarePatchVersionChanged(int patch);
void firmwareVersionTypeChanged(int type);
void gitHashChanged(QString hash);
/// New RC channel values
/// @param channelCount Number of available channels, cMaxRcChannels max
/// @param pwmValues -1 signals channel not available
......@@ -943,6 +948,8 @@ private:
int _firmwarePatchVersion;
FIRMWARE_VERSION_TYPE _firmwareVersionType;
QString _gitHash;
static const int _lowBatteryAnnounceRepeatMSecs; // Amount of time in between each low battery announcement
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