Commit 9a35dbf7 authored by Jacob Walser's avatar Jacob Walser

Add git hash property to vehicle

parent c62e1fbb
......@@ -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)
......@@ -666,6 +667,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)
......
......@@ -346,6 +346,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 ();
......@@ -616,6 +617,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);
......@@ -706,6 +709,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
......@@ -938,6 +943,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