diff --git a/src/Vehicle/Vehicle.cc b/src/Vehicle/Vehicle.cc index c2d265162d51c8fe19118b774976daef3afcb056..9c267d65a0a1c56490ef5c0b3eacf7ededb9018d 100644 --- a/src/Vehicle/Vehicle.cc +++ b/src/Vehicle/Vehicle.cc @@ -675,7 +675,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); } }