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:
parent
6d7fa8a083
commit
fa2aa81079
@ -52,8 +52,10 @@ const char * const GCS_YEAR = "2012";
|
|||||||
const char * const GCS_HELP = "http://wiki.openpilot.org";
|
const char * const GCS_HELP = "http://wiki.openpilot.org";
|
||||||
#ifdef GCS_REVISION
|
#ifdef GCS_REVISION
|
||||||
const char * const GCS_REVISION_STR = STRINGIFY(GCS_REVISION);
|
const char * const GCS_REVISION_STR = STRINGIFY(GCS_REVISION);
|
||||||
|
const char * const UAVOSHA1_STR = STRINGIFY(UAVO_HASH);
|
||||||
#else
|
#else
|
||||||
const char * const GCS_REVISION_STR = "";
|
const char * const GCS_REVISION_STR = "";
|
||||||
|
const char * const UAVOSHA1_STR = "";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef GCS_VERSION
|
#undef GCS_VERSION
|
||||||
|
@ -8,6 +8,7 @@ public:
|
|||||||
QString gitHash;
|
QString gitHash;
|
||||||
QString gitDate;
|
QString gitDate;
|
||||||
QString gitTag;
|
QString gitTag;
|
||||||
|
QString uavoHash;
|
||||||
int boardType;
|
int boardType;
|
||||||
int boardRevision;
|
int boardRevision;
|
||||||
static QString idToBoardName(int id)
|
static QString idToBoardName(int id)
|
||||||
|
@ -641,7 +641,8 @@ bool UAVObjectUtilManager::descriptionToStructure(QByteArray desc, deviceDescrip
|
|||||||
* 26 bytes: commit tag if it is there, otherwise "Unreleased". Zero-padded
|
* 26 bytes: commit tag if it is there, otherwise "Unreleased". Zero-padded
|
||||||
* ---- 40 bytes limit ---
|
* ---- 40 bytes limit ---
|
||||||
* 20 bytes: SHA1 sum of the firmware.
|
* 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:
|
// Note: the ARM binary is big-endian:
|
||||||
@ -667,6 +668,7 @@ bool UAVObjectUtilManager::descriptionToStructure(QByteArray desc, deviceDescrip
|
|||||||
struc->boardType = (int)targetPlatform.at(0);
|
struc->boardType = (int)targetPlatform.at(0);
|
||||||
struc->boardRevision = (int)targetPlatform.at(1);
|
struc->boardRevision = (int)targetPlatform.at(1);
|
||||||
|
|
||||||
|
struc->uavoHash=desc.mid(46,20);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -651,16 +651,14 @@ void UploaderGadgetWidget::versionMatchCheck()
|
|||||||
UAVObjectUtilManager *utilMngr = pm->getObject<UAVObjectUtilManager>();
|
UAVObjectUtilManager *utilMngr = pm->getObject<UAVObjectUtilManager>();
|
||||||
deviceDescriptorStruct boardDescription = utilMngr->getBoardDescriptionStruct();
|
deviceDescriptorStruct boardDescription = utilMngr->getBoardDescriptionStruct();
|
||||||
|
|
||||||
QString gcsDescription = QString::fromLatin1(Core::Constants::GCS_REVISION_STR);
|
QString uavoHash = QString::fromLatin1(Core::Constants::UAVOSHA1_STR);
|
||||||
QString gcsGitHash = gcsDescription.mid(gcsDescription.indexOf(":")+1, 8);
|
uavoHash.remove( QRegExp("^[0]*") );
|
||||||
gcsGitHash.remove( QRegExp("^[0]*") );
|
QString gcsVersion = uavoHash;
|
||||||
QString gcsGitDate = gcsDescription.mid(gcsDescription.indexOf(" ")+1, 14);
|
QString fwVersion = boardDescription.gitHash;
|
||||||
QString gcsVersion = gcsGitDate + " (" + gcsGitHash + ")";
|
|
||||||
QString fwVersion = boardDescription.gitDate + " (" + boardDescription.gitHash + ")";
|
|
||||||
|
|
||||||
if (boardDescription.gitHash != gcsGitHash) {
|
if (boardDescription.uavoHash != uavoHash) {
|
||||||
QString warning = QString(tr(
|
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);
|
"GCS version: %1. Firmware version: %2.")).arg(gcsVersion).arg(fwVersion);
|
||||||
msg->showMessage(warning);
|
msg->showMessage(warning);
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define GCS_REVISION ${TAG_OR_BRANCH}:${HASH8}${DIRTY} ${DATETIME}
|
#define GCS_REVISION ${TAG_OR_BRANCH}:${HASH8}${DIRTY} ${DATETIME}
|
||||||
|
#define UAVO_HASH ${UAVOSHA1}
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user