Commit 59a2947d authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #5731 from kd0aij/auavx21

add support for flashing APM to AUAVX2.1
parents 06dfe6d9 02011a1e
...@@ -122,7 +122,8 @@ LinuxBuild { ...@@ -122,7 +122,8 @@ LinuxBuild {
libQt5Svg.so.5 \ libQt5Svg.so.5 \
libQt5Test.so.5 \ libQt5Test.so.5 \
libQt5Widgets.so.5 \ libQt5Widgets.so.5 \
libQt5XcbQpa.so.5 libQt5XcbQpa.so.5 \
libQt5TextToSpeech.so.5
!contains(DEFINES, __rasp_pi2__) { !contains(DEFINES, __rasp_pi2__) {
QT_LIB_LIST += \ QT_LIB_LIST += \
......
...@@ -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 (firmwareBoardId != actualBoardId) {
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;
} }
......
...@@ -56,6 +56,9 @@ public: ...@@ -56,6 +56,9 @@ public:
/// @return true: block retrieved /// @return true: block retrieved
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
bool isCompatible(uint32_t boardId, uint32_t firmwareId);
signals: signals:
void errorMessage(const QString& errorString); void errorMessage(const QString& errorString);
void statusMessage(const QString& warningtring); void statusMessage(const QString& warningtring);
......
...@@ -324,6 +324,21 @@ void FirmwareUpgradeController::_initFirmwareHash() ...@@ -324,6 +324,21 @@ void FirmwareUpgradeController::_initFirmwareHash()
{ AutoPilotStackPX4, StableFirmware, DefaultVehicleFirmware, "http://px4-travis.s3.amazonaws.com/Firmware/stable/auav-x21_default.px4"}, { AutoPilotStackPX4, StableFirmware, DefaultVehicleFirmware, "http://px4-travis.s3.amazonaws.com/Firmware/stable/auav-x21_default.px4"},
{ AutoPilotStackPX4, BetaFirmware, DefaultVehicleFirmware, "http://px4-travis.s3.amazonaws.com/Firmware/beta/auav-x21_default.px4"}, { AutoPilotStackPX4, BetaFirmware, DefaultVehicleFirmware, "http://px4-travis.s3.amazonaws.com/Firmware/beta/auav-x21_default.px4"},
{ AutoPilotStackPX4, DeveloperFirmware, DefaultVehicleFirmware, "http://px4-travis.s3.amazonaws.com/Firmware/master/auav-x21_default.px4"}, { AutoPilotStackPX4, DeveloperFirmware, DefaultVehicleFirmware, "http://px4-travis.s3.amazonaws.com/Firmware/master/auav-x21_default.px4"},
{ AutoPilotStackAPM, StableFirmware, CopterFirmware, "http://firmware.ardupilot.org/Copter/stable/PX4/ArduCopter-v3.px4"},
{ AutoPilotStackAPM, StableFirmware, HeliFirmware, "http://firmware.ardupilot.org/Copter/stable/PX4-heli/ArduCopter-v3.px4"},
{ AutoPilotStackAPM, StableFirmware, PlaneFirmware, "http://firmware.ardupilot.org/Plane/stable/PX4/ArduPlane-v2.px4"},
{ AutoPilotStackAPM, StableFirmware, RoverFirmware, "http://firmware.ardupilot.org/Rover/stable/PX4/APMrover2-v2.px4"},
{ AutoPilotStackAPM, StableFirmware, SubFirmware, "http://firmware.ardupilot.org/Sub/stable/PX4/ArduSub-v2.px4"},
{ AutoPilotStackAPM, BetaFirmware, CopterFirmware, "http://firmware.ardupilot.org/Copter/beta/PX4/ArduCopter-v3.px4"},
{ AutoPilotStackAPM, BetaFirmware, HeliFirmware, "http://firmware.ardupilot.org/Copter/beta/PX4-heli/ArduCopter-v3.px4"},
{ AutoPilotStackAPM, BetaFirmware, PlaneFirmware, "http://firmware.ardupilot.org/Plane/beta/PX4/ArduPlane-v3.px4"},
{ AutoPilotStackAPM, BetaFirmware, RoverFirmware, "http://firmware.ardupilot.org/Rover/beta/PX4/APMrover2-v3.px4"},
{ AutoPilotStackAPM, BetaFirmware, SubFirmware, "http://firmware.ardupilot.org/Sub/beta/PX4/ArduSub-v3.px4"},
{ AutoPilotStackAPM, DeveloperFirmware, CopterFirmware, "http://firmware.ardupilot.org/Copter/latest/PX4/ArduCopter-v3.px4"},
{ AutoPilotStackAPM, DeveloperFirmware, HeliFirmware, "http://firmware.ardupilot.org/Copter/latest/PX4-heli/ArduCopter-v3.px4"},
{ AutoPilotStackAPM, DeveloperFirmware, PlaneFirmware, "http://firmware.ardupilot.org/Plane/latest/PX4/ArduPlane-v3.px4"},
{ AutoPilotStackAPM, DeveloperFirmware, RoverFirmware, "http://firmware.ardupilot.org/Rover/latest/PX4/APMrover2-v3.px4"},
{ AutoPilotStackAPM, DeveloperFirmware, SubFirmware, "http://firmware.ardupilot.org/Sub/latest/PX4/ArduSub-v3.px4"}
}; };
//////////////////////////////////// MindPXFMUV2 firmwares ////////////////////////////////////////////////// //////////////////////////////////// MindPXFMUV2 firmwares //////////////////////////////////////////////////
FirmwareToUrlElement_t rgMindPXFMUV2FirmwareArray[] = { FirmwareToUrlElement_t rgMindPXFMUV2FirmwareArray[] = {
......
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