Commit 6ca27fec authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #4675 from bluerobotics/param-version

Add firmware information to parameter file header
parents 115043d1 5fb93f48
......@@ -842,6 +842,17 @@ QString ParameterManager::readParametersFromStream(QTextStream& stream)
void ParameterManager::writeParametersToStream(QTextStream &stream)
{
stream << "# Onboard parameters for Vehicle " << _vehicle->id() << "\n";
stream << "#\n";
stream << "# Stack: " << _vehicle->firmwareTypeString() << "\n";
stream << "# Vehicle: " << _vehicle->vehicleTypeString() << "\n";
stream << "# Version: "
<< _vehicle->firmwareMajorVersion() << "."
<< _vehicle->firmwareMinorVersion() << "."
<< _vehicle->firmwarePatchVersion() << " "
<< _vehicle->firmwareVersionTypeString() << "\n";
stream << "# Git Revision: " << _vehicle->gitHash() << "\n";
stream << "#\n";
stream << "# Vehicle-Id Component-Id Name Value Type\n";
......
......@@ -679,7 +679,17 @@ void Vehicle::_handleAutopilotVersion(LinkInterface *link, mavlink_message_t& me
// Git hash
if (autopilotVersion.flight_custom_version[0] != 0) {
_gitHash = QString::fromUtf8((char*)autopilotVersion.flight_custom_version, 8);
// PX4 Firmware stores the first 16 characters of the git hash as binary, with the individual bytes in reverse order
if (px4Firmware()) {
_gitHash = "";
QByteArray array((char*)autopilotVersion.flight_custom_version, 8);
for (int i = 7; i >= 0; i--) {
_gitHash.append(QString("%1").arg(autopilotVersion.flight_custom_version[i], 2, 16, QChar('0')));
}
} else {
// APM Firmware stores the first 8 characters of the git hash as an ASCII character string
_gitHash = QString::fromUtf8((char*)autopilotVersion.flight_custom_version, 8);
}
emit gitHashChanged(_gitHash);
}
}
......
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