diff --git a/src/VehicleSetup/Bootloader.h b/src/VehicleSetup/Bootloader.h index ccd0355..c5eefbb 100644 --- a/src/VehicleSetup/Bootloader.h +++ b/src/VehicleSetup/Bootloader.h @@ -76,6 +76,7 @@ public: // Supported bootloader board ids static const int boardIDPX4FMUV1 = 5; ///< PX4 V1 board static const int boardIDPX4FMUV2 = 9; ///< PX4 V2 board + static const int boardIDPX4FMUV4 = 11; ///< PX4 V4 board static const int boardIDPX4Flow = 6; ///< PX4 Flow board static const int boardIDAeroCore = 98; ///< Gumstix AeroCore board static const int boardID3DRRadio = 78; ///< 3DR Radio @@ -128,7 +129,7 @@ private: INFO_BL_REV = 1, ///< bootloader protocol revision BL_REV_MIN = 2, ///< Minimum supported bootlader protocol - BL_REV_MAX = 4, ///< Maximum supported bootloader protocol + BL_REV_MAX = 5, ///< Maximum supported bootloader protocol INFO_BOARD_ID = 2, ///< board type INFO_BOARD_REV = 3, ///< board revision INFO_FLASH_SIZE = 4, ///< max firmware size in bytes diff --git a/src/VehicleSetup/FirmwareUpgradeController.cc b/src/VehicleSetup/FirmwareUpgradeController.cc index c6a01bf..4a3bcab 100644 --- a/src/VehicleSetup/FirmwareUpgradeController.cc +++ b/src/VehicleSetup/FirmwareUpgradeController.cc @@ -118,6 +118,7 @@ void FirmwareUpgradeController::_foundBoard(bool firstAttempt, const QSerialPort _startFlashWhenBootloaderFound = false; break; case QGCSerialPortInfo::BoardTypePX4FMUV2: + case QGCSerialPortInfo::BoardTypePX4FMUV4: _foundBoardType = "Pixhawk"; _startFlashWhenBootloaderFound = false; break; @@ -187,6 +188,16 @@ void FirmwareUpgradeController::_initFirmwareHash() return; } + //////////////////////////////////// PX4FMUV4 firmwares ////////////////////////////////////////////////// + FirmwareToUrlElement_t rgPX4FMV4FirmwareArray[] = { + { AutoPilotStackPX4, StableFirmware, DefaultVehicleFirmware, "http://px4-travis.s3.amazonaws.com/Firmware/stable/px4fmu-v4_default.px4"}, + { AutoPilotStackPX4, BetaFirmware, DefaultVehicleFirmware, "http://px4-travis.s3.amazonaws.com/Firmware/beta/px4fmu-v4_default.px4"}, + { AutoPilotStackPX4, DeveloperFirmware, DefaultVehicleFirmware, "http://px4-travis.s3.amazonaws.com/Firmware/master/px4fmu-v4_default.px4"}, + { AutoPilotStackAPM, StableFirmware, QuadFirmware, "http://firmware.diydrones.com/Copter/stable/PX4-quad/ArduCopter-v4.px4"}, + { AutoPilotStackAPM, BetaFirmware, QuadFirmware, "http://firmware.diydrones.com/Copter/beta/PX4-quad/ArduCopter-v4.px4"}, + { AutoPilotStackAPM, DeveloperFirmware, QuadFirmware, "http://firmware.diydrones.com/Copter/latest/PX4-quad/ArduCopter-v4.px4"} + }; + //////////////////////////////////// PX4FMUV2 firmwares ////////////////////////////////////////////////// FirmwareToUrlElement_t rgPX4FMV2FirmwareArray[] = { { AutoPilotStackPX4, StableFirmware, DefaultVehicleFirmware, "http://px4-travis.s3.amazonaws.com/Firmware/stable/px4fmu-v2_default.px4"}, @@ -273,7 +284,13 @@ void FirmwareUpgradeController::_initFirmwareHash() }; // populate hashes now - int size = sizeof(rgPX4FMV2FirmwareArray)/sizeof(rgPX4FMV2FirmwareArray[0]); + int size = sizeof(rgPX4FMV4FirmwareArray)/sizeof(rgPX4FMV4FirmwareArray[0]); + for (int i = 0; i < size; i++) { + const FirmwareToUrlElement_t& element = rgPX4FMV4FirmwareArray[i]; + _rgPX4FMUV4Firmware.insert(FirmwareIdentifier(element.stackType, element.firmwareType, element.vehicleType), element.url); + } + + size = sizeof(rgPX4FMV2FirmwareArray)/sizeof(rgPX4FMV2FirmwareArray[0]); for (int i = 0; i < size; i++) { const FirmwareToUrlElement_t& element = rgPX4FMV2FirmwareArray[i]; _rgPX4FMUV2Firmware.insert(FirmwareIdentifier(element.stackType, element.firmwareType, element.vehicleType), element.url); @@ -333,6 +350,10 @@ void FirmwareUpgradeController::_getFirmwareFile(FirmwareIdentifier firmwareId) case Bootloader::boardIDPX4FMUV2: prgFirmware = _rgPX4FMUV2Firmware; break; + + case Bootloader::boardIDPX4FMUV4: + prgFirmware = _rgPX4FMUV4Firmware; + break; case Bootloader::boardIDAeroCore: prgFirmware = _rgAeroCoreFirmware; diff --git a/src/VehicleSetup/FirmwareUpgradeController.h b/src/VehicleSetup/FirmwareUpgradeController.h index d7f7c9d..b65b09e 100644 --- a/src/VehicleSetup/FirmwareUpgradeController.h +++ b/src/VehicleSetup/FirmwareUpgradeController.h @@ -177,6 +177,7 @@ private: QString _portDescription; // firmware hashes + QHash _rgPX4FMUV4Firmware; QHash _rgPX4FMUV2Firmware; QHash _rgAeroCoreFirmware; QHash _rgPX4FMUV1Firmware; diff --git a/src/comm/LinkManager.cc b/src/comm/LinkManager.cc index 4b6ee1f..959f2a2 100644 --- a/src/comm/LinkManager.cc +++ b/src/comm/LinkManager.cc @@ -497,6 +497,7 @@ void LinkManager::_updateAutoConnectLinks(void) switch (boardType) { case QGCSerialPortInfo::BoardTypePX4FMUV1: case QGCSerialPortInfo::BoardTypePX4FMUV2: + case QGCSerialPortInfo::BoardTypePX4FMUV4: if (_autoconnectPixhawk) { pSerialConfig = new SerialConfiguration(QString("Pixhawk on %1").arg(portInfo.portName().trimmed())); } diff --git a/src/comm/QGCSerialPortInfo.cc b/src/comm/QGCSerialPortInfo.cc index 3ca0faa..4169721 100644 --- a/src/comm/QGCSerialPortInfo.cc +++ b/src/comm/QGCSerialPortInfo.cc @@ -47,7 +47,10 @@ QGCSerialPortInfo::BoardType_t QGCSerialPortInfo::boardType(void) const switch (vendorIdentifier()) { case px4VendorId: - if (productIdentifier() == pixhawkFMUV2ProductId || productIdentifier() == pixhawkFMUV2OldBootloaderProductId) { + if (productIdentifier() == pixhawkFMUV4ProductId) { + qCDebug(QGCSerialPortInfoLog) << "Found PX4 FMU V4"; + boardType = BoardTypePX4FMUV4; + } else if (productIdentifier() == pixhawkFMUV2ProductId || productIdentifier() == pixhawkFMUV2OldBootloaderProductId) { qCDebug(QGCSerialPortInfoLog) << "Found PX4 FMU V2"; boardType = BoardTypePX4FMUV2; } else if (productIdentifier() == pixhawkFMUV1ProductId) { @@ -72,7 +75,10 @@ QGCSerialPortInfo::BoardType_t QGCSerialPortInfo::boardType(void) const if (boardType == BoardTypeUnknown) { // Fall back to port name matching which could lead to incorrect board mapping. But in some cases the // vendor and product id do not come through correctly so this is used as a last chance detection method. - if (description() == "PX4 FMU v2.x" || description() == "PX4 BL FMU v2.x") { + if (description() == "PX4 FMU v4.x" || description() == "PX4 BL FMU v4.x") { + qCDebug(QGCSerialPortInfoLog) << "Found PX4 FMU V4 (by name matching fallback)"; + boardType = BoardTypePX4FMUV4; + } else if (description() == "PX4 FMU v2.x" || description() == "PX4 BL FMU v2.x") { qCDebug(QGCSerialPortInfoLog) << "Found PX4 FMU V2 (by name matching fallback)"; boardType = BoardTypePX4FMUV2; } else if (description() == "PX4 FMU v1.x" || description() == "PX4 BL FMU v1.x") { diff --git a/src/comm/QGCSerialPortInfo.h b/src/comm/QGCSerialPortInfo.h index 1fa6e31..27a614c 100644 --- a/src/comm/QGCSerialPortInfo.h +++ b/src/comm/QGCSerialPortInfo.h @@ -42,6 +42,7 @@ public: typedef enum { BoardTypePX4FMUV1, BoardTypePX4FMUV2, + BoardTypePX4FMUV4, BoardTypePX4Flow, BoardType3drRadio, BoardTypeAeroCore, @@ -52,6 +53,7 @@ public: static const int px4VendorId = 9900; ///< Vendor ID for Pixhawk board (V2 and V1) and PX4 Flow + static const int pixhawkFMUV4ProductId = 18; ///< Product ID for Pixhawk V2 board static const int pixhawkFMUV2ProductId = 17; ///< Product ID for Pixhawk V2 board static const int pixhawkFMUV2OldBootloaderProductId = 22; ///< Product ID for Bootloader on older Pixhawk V2 boards static const int pixhawkFMUV1ProductId = 16; ///< Product ID for PX4 FMU V1 board