1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

First pass on using the uavo hash to check compatability between GCS and FW

This commit is contained in:
PT_Dreamer 2012-09-15 23:02:45 +01:00
parent 6d7fa8a083
commit fa2aa81079
5 changed files with 13 additions and 10 deletions

View File

@ -52,8 +52,10 @@ const char * const GCS_YEAR = "2012";
const char * const GCS_HELP = "http://wiki.openpilot.org";
#ifdef GCS_REVISION
const char * const GCS_REVISION_STR = STRINGIFY(GCS_REVISION);
const char * const UAVOSHA1_STR = STRINGIFY(UAVO_HASH);
#else
const char * const GCS_REVISION_STR = "";
const char * const UAVOSHA1_STR = "";
#endif
#undef GCS_VERSION

View File

@ -8,6 +8,7 @@ public:
QString gitHash;
QString gitDate;
QString gitTag;
QString uavoHash;
int boardType;
int boardRevision;
static QString idToBoardName(int id)

View File

@ -641,7 +641,8 @@ bool UAVObjectUtilManager::descriptionToStructure(QByteArray desc, deviceDescrip
* 26 bytes: commit tag if it is there, otherwise "Unreleased". Zero-padded
* ---- 40 bytes limit ---
* 20 bytes: SHA1 sum of the firmware.
* 40 bytes: free for now.
* 20 bytes: SHA1 sum of the UAVO definition files.
* 20 bytes: free for now.
*/
// Note: the ARM binary is big-endian:
@ -667,6 +668,7 @@ bool UAVObjectUtilManager::descriptionToStructure(QByteArray desc, deviceDescrip
struc->boardType = (int)targetPlatform.at(0);
struc->boardRevision = (int)targetPlatform.at(1);
struc->uavoHash=desc.mid(46,20);
return true;
}
return false;

View File

@ -651,16 +651,14 @@ void UploaderGadgetWidget::versionMatchCheck()
UAVObjectUtilManager *utilMngr = pm->getObject<UAVObjectUtilManager>();
deviceDescriptorStruct boardDescription = utilMngr->getBoardDescriptionStruct();
QString gcsDescription = QString::fromLatin1(Core::Constants::GCS_REVISION_STR);
QString gcsGitHash = gcsDescription.mid(gcsDescription.indexOf(":")+1, 8);
gcsGitHash.remove( QRegExp("^[0]*") );
QString gcsGitDate = gcsDescription.mid(gcsDescription.indexOf(" ")+1, 14);
QString gcsVersion = gcsGitDate + " (" + gcsGitHash + ")";
QString fwVersion = boardDescription.gitDate + " (" + boardDescription.gitHash + ")";
QString uavoHash = QString::fromLatin1(Core::Constants::UAVOSHA1_STR);
uavoHash.remove( QRegExp("^[0]*") );
QString gcsVersion = uavoHash;
QString fwVersion = boardDescription.gitHash;
if (boardDescription.gitHash != gcsGitHash) {
if (boardDescription.uavoHash != uavoHash) {
QString warning = QString(tr(
"GCS and firmware versions do not match which can cause configuration problems. "
"GCS and firmware versions of the UAV object set do not match which can cause configuration problems. "
"GCS version: %1. Firmware version: %2.")).arg(gcsVersion).arg(fwVersion);
msg->showMessage(warning);
}

View File

@ -26,7 +26,7 @@
*/
#define GCS_REVISION ${TAG_OR_BRANCH}:${HASH8}${DIRTY} ${DATETIME}
#define UAVO_HASH ${UAVOSHA1}
/**
* @}
*/