Commit 02011a1e authored by Mark Whitehorn's avatar Mark Whitehorn

add FMUV3 to compatibility check

parent 369f76a4
...@@ -194,6 +194,24 @@ bool FirmwareImage::_ihxLoad(const QString& ihxFilename) ...@@ -194,6 +194,24 @@ bool FirmwareImage::_ihxLoad(const QString& ihxFilename)
return true; return true;
} }
bool FirmwareImage::isCompatible(uint32_t boardId, uint32_t firmwareId) {
bool result = false;
if (boardId == firmwareId ) {
result = true;
}
switch(boardId) {
case Bootloader::boardIDAUAVX2_1: // AUAVX2.1 is compatible with px4-v2/v3
if (firmwareId == 9) result = true;
break;
case Bootloader::boardIDPX4FMUV3:
if (firmwareId == 9) result = true;
break;
default:
break;
}
return result;
}
bool FirmwareImage::_px4Load(const QString& imageFilename) bool FirmwareImage::_px4Load(const QString& imageFilename)
{ {
_imageSize = 0; _imageSize = 0;
...@@ -237,8 +255,7 @@ bool FirmwareImage::_px4Load(const QString& imageFilename) ...@@ -237,8 +255,7 @@ bool FirmwareImage::_px4Load(const QString& imageFilename)
} }
uint32_t firmwareBoardId = (uint32_t)px4Json.value(_jsonBoardIdKey).toInt(); uint32_t firmwareBoardId = (uint32_t)px4Json.value(_jsonBoardIdKey).toInt();
uint32_t actualBoardId = _boardId == Bootloader::boardIDPX4FMUV3 ? Bootloader::boardIDPX4FMUV2 : _boardId;; if (!isCompatible(_boardId, firmwareBoardId)) {
if (!isCompatible(actualBoardId, firmwareBoardId)) {
emit statusMessage(QString("Downloaded firmware board id does not match hardware board id: %1 != %2").arg(firmwareBoardId).arg(_boardId)); emit statusMessage(QString("Downloaded firmware board id does not match hardware board id: %1 != %2").arg(firmwareBoardId).arg(_boardId));
return false; return false;
} }
......
...@@ -57,20 +57,7 @@ public: ...@@ -57,20 +57,7 @@ public:
bool ihxGetBlock(uint16_t index, uint16_t& address, QByteArray& bytes) const; bool ihxGetBlock(uint16_t index, uint16_t& address, QByteArray& bytes) const;
/// @return true: actual boardId is compatible with firmware boardId /// @return true: actual boardId is compatible with firmware boardId
bool isCompatible(uint32_t boardId, uint32_t firmwareId) { bool isCompatible(uint32_t boardId, uint32_t firmwareId);
bool result = false;
if (boardId == firmwareId ) {
result = true;
}
switch(boardId) {
case 33: // AUAVX2.1 is compatible with px4-v2/v3
if (firmwareId == 9) result = true;
break;
default:
break;
}
return result;
}
signals: signals:
void errorMessage(const QString& errorString); void errorMessage(const QString& errorString);
......
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