From 6b46438888a284b2e2ca96e17a9a8b9246679c89 Mon Sep 17 00:00:00 2001 From: Henry Zhang Date: Sat, 21 May 2016 04:01:35 -0500 Subject: [PATCH] support MindPX v2. (#3382) --- src/VehicleSetup/Bootloader.h | 1 + src/VehicleSetup/FirmwareUpgrade.qml | 2 +- src/VehicleSetup/FirmwareUpgradeController.cc | 21 +++++++++++++++++++ src/VehicleSetup/FirmwareUpgradeController.h | 1 + src/comm/LinkManager.cc | 6 ++++++ src/comm/QGCSerialPortInfo.cc | 8 ++++++- src/comm/QGCSerialPortInfo.h | 3 +++ 7 files changed, 40 insertions(+), 2 deletions(-) diff --git a/src/VehicleSetup/Bootloader.h b/src/VehicleSetup/Bootloader.h index 35af29fbc..27ae6a142 100644 --- a/src/VehicleSetup/Bootloader.h +++ b/src/VehicleSetup/Bootloader.h @@ -80,6 +80,7 @@ public: static const int boardIDPX4Flow = 6; ///< PX4 Flow board static const int boardIDAeroCore = 98; ///< Gumstix AeroCore board static const int boardID3DRRadio = 78; ///< 3DR Radio + static const int boardIDMINDPXFMUV2 = 88; ///< MindPX V2 board signals: /// @brief Signals progress indicator for long running bootloader utility routines diff --git a/src/VehicleSetup/FirmwareUpgrade.qml b/src/VehicleSetup/FirmwareUpgrade.qml index abf3e114c..6cce0ceb1 100644 --- a/src/VehicleSetup/FirmwareUpgrade.qml +++ b/src/VehicleSetup/FirmwareUpgrade.qml @@ -110,7 +110,7 @@ QGCView { } else { // We end up here when we detect a board plugged in after we've started upgrade statusTextArea.append(highlightPrefix + qsTr("Found device") + highlightSuffix + ": " + controller.boardType) - if (controller.boardType == "Pixhawk" || controller.boardType == "AeroCore" || controller.boardType == "PX4 Flow" || controller.boardType == "PX4 FMU V1") { + if (controller.boardType == "Pixhawk" || controller.boardType == "AeroCore" || controller.boardType == "PX4 Flow" || controller.boardType == "PX4 FMU V1" || controller.boardType == "MindPX") { showDialog(pixhawkFirmwareSelectDialog, title, qgcView.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel) } } diff --git a/src/VehicleSetup/FirmwareUpgradeController.cc b/src/VehicleSetup/FirmwareUpgradeController.cc index a8a27d803..deff7b62d 100644 --- a/src/VehicleSetup/FirmwareUpgradeController.cc +++ b/src/VehicleSetup/FirmwareUpgradeController.cc @@ -143,6 +143,10 @@ void FirmwareUpgradeController::_foundBoard(bool firstAttempt, const QSerialPort _foundBoardTypeName = "AeroCore"; _startFlashWhenBootloaderFound = false; break; + case QGCSerialPortInfo::BoardTypeMINDPXFMUV2: + _foundBoardTypeName = "MindPX"; + _startFlashWhenBootloaderFound = false; + break; case QGCSerialPortInfo::BoardTypePX4Flow: _foundBoardTypeName = "PX4 Flow"; _startFlashWhenBootloaderFound = false; @@ -318,6 +322,12 @@ void FirmwareUpgradeController::_initFirmwareHash() { AutoPilotStackAPM, DeveloperFirmware, RoverFirmware, "http://firmware.ardupilot.org/Rover/latest/PX4/APMrover2-v1.px4"} }; + //////////////////////////////////// MindPXFMUV2 firmwares ////////////////////////////////////////////////// + FirmwareToUrlElement_t rgMindPXFMUV2FirmwareArray[] = { + { AutoPilotStackPX4, StableFirmware, DefaultVehicleFirmware, "http://px4-travis.s3.amazonaws.com/Firmware/stable/mindpx-v2_default.px4"}, + { AutoPilotStackPX4, BetaFirmware, DefaultVehicleFirmware, "http://px4-travis.s3.amazonaws.com/Firmware/beta/mindpx-v2_default.px4"}, + { AutoPilotStackPX4, DeveloperFirmware, DefaultVehicleFirmware, "http://px4-travis.s3.amazonaws.com/Firmware/master/mindpx-v2_default.px4"}, + }; /////////////////////////////// px4flow firmwares /////////////////////////////////////// FirmwareToUrlElement_t rgPX4FLowFirmwareArray[] = { { PX4Flow, StableFirmware, DefaultVehicleFirmware, "http://px4-travis.s3.amazonaws.com/Flow/master/px4flow.px4" }, @@ -353,6 +363,12 @@ void FirmwareUpgradeController::_initFirmwareHash() _rgPX4FMUV1Firmware.insert(FirmwareIdentifier(element.stackType, element.firmwareType, element.vehicleType), element.url); } + size = sizeof(rgMindPXFMUV2FirmwareArray)/sizeof(rgMindPXFMUV2FirmwareArray[0]); + for (int i = 0; i < size; i++) { + const FirmwareToUrlElement_t& element = rgMindPXFMUV2FirmwareArray[i]; + _rgMindPXFMUV2Firmware.insert(FirmwareIdentifier(element.stackType, element.firmwareType, element.vehicleType), element.url); + } + size = sizeof(rgPX4FLowFirmwareArray)/sizeof(rgPX4FLowFirmwareArray[0]); for (int i = 0; i < size; i++) { const FirmwareToUrlElement_t& element = rgPX4FLowFirmwareArray[i]; @@ -386,6 +402,8 @@ QHash* FirmwareUpgradeCo return &_rgPX4FMUV4Firmware; case Bootloader::boardIDAeroCore: return &_rgAeroCoreFirmware; + case Bootloader::boardIDMINDPXFMUV2: + return &_rgMindPXFMUV2Firmware; case Bootloader::boardID3DRRadio: return &_rg3DRRadioFirmware; default: @@ -410,6 +428,9 @@ QHash* FirmwareUpgradeCo case QGCSerialPortInfo::BoardTypeAeroCore: boardId = Bootloader::boardIDAeroCore; break; + case QGCSerialPortInfo::BoardTypeMINDPXFMUV2: + boardId = Bootloader::boardIDMINDPXFMUV2; + break; case QGCSerialPortInfo::BoardTypePX4Flow: boardId = Bootloader::boardIDPX4Flow; break; diff --git a/src/VehicleSetup/FirmwareUpgradeController.h b/src/VehicleSetup/FirmwareUpgradeController.h index 8de263ae7..07357d6a8 100644 --- a/src/VehicleSetup/FirmwareUpgradeController.h +++ b/src/VehicleSetup/FirmwareUpgradeController.h @@ -197,6 +197,7 @@ private: QHash _rgPX4FMUV2Firmware; QHash _rgAeroCoreFirmware; QHash _rgPX4FMUV1Firmware; + QHash _rgMindPXFMUV2Firmware; QHash _rgPX4FLowFirmware; QHash _rg3DRRadioFirmware; diff --git a/src/comm/LinkManager.cc b/src/comm/LinkManager.cc index 83103e0ad..84a290bec 100644 --- a/src/comm/LinkManager.cc +++ b/src/comm/LinkManager.cc @@ -549,6 +549,12 @@ void LinkManager::_updateAutoConnectLinks(void) pSerialConfig->setUsbDirect(true); } break; + case QGCSerialPortInfo::BoardTypeMINDPXFMUV2: + if (_autoconnectPixhawk) { + pSerialConfig = new SerialConfiguration(QString("MindPX on %1").arg(portInfo.portName().trimmed())); + pSerialConfig->setUsbDirect(true); + } + break; case QGCSerialPortInfo::BoardTypePX4Flow: if (_autoconnectPX4Flow) { pSerialConfig = new SerialConfiguration(QString("PX4Flow on %1").arg(portInfo.portName().trimmed())); diff --git a/src/comm/QGCSerialPortInfo.cc b/src/comm/QGCSerialPortInfo.cc index 0b6ef9193..14420cb51 100644 --- a/src/comm/QGCSerialPortInfo.cc +++ b/src/comm/QGCSerialPortInfo.cc @@ -37,6 +37,7 @@ static const struct VIDPIDMapInfo_s { { QGCSerialPortInfo::px4VendorId, QGCSerialPortInfo::pixhawkFMUV1ProductId, QGCSerialPortInfo::BoardTypePX4FMUV1, "Found PX4 FMU V1" }, { QGCSerialPortInfo::px4VendorId, QGCSerialPortInfo::px4FlowProductId, QGCSerialPortInfo::BoardTypePX4Flow, "Found PX4 Flow" }, { QGCSerialPortInfo::px4VendorId, QGCSerialPortInfo::AeroCoreProductId, QGCSerialPortInfo::BoardTypeAeroCore, "Found AeroCore" }, + { QGCSerialPortInfo::px4VendorId, QGCSerialPortInfo::MindPXFMUV2ProductId, QGCSerialPortInfo::BoardTypeMINDPXFMUV2,"Found MindPX FMU V2" }, { QGCSerialPortInfo::threeDRRadioVendorId, QGCSerialPortInfo::threeDRRadioProductId, QGCSerialPortInfo::BoardTypeSikRadio, "Found SiK Radio" }, { QGCSerialPortInfo::siLabsRadioVendorId, QGCSerialPortInfo::siLabsRadioProductId, QGCSerialPortInfo::BoardTypeSikRadio, "Found SiK Radio" }, { QGCSerialPortInfo::ubloxRTKVendorId, QGCSerialPortInfo::ubloxRTKProductId, QGCSerialPortInfo::BoardTypeRTKGPS, "Found RTK GPS" }, @@ -90,6 +91,9 @@ QGCSerialPortInfo::BoardType_t QGCSerialPortInfo::boardType(void) const } else if (description().contains(QRegExp("PX4.*Flow", Qt::CaseInsensitive))) { qCDebug(QGCSerialPortInfoLog) << "Found possible px4 flow camera (by name matching fallback)"; boardType = BoardTypePX4Flow; + } else if (description() == "MindPX FMU v2.x" || description() == "MindPX BL FMU v2.x") { + qCDebug(QGCSerialPortInfoLog) << "Found MindPX FMU V2 (by name matching fallback)"; + boardType = BoardTypeMINDPXFMUV2; } else if (description() == "FT231X USB UART") { qCDebug(QGCSerialPortInfoLog) << "Found possible Radio (by name matching fallback)"; boardType = BoardTypeSikRadio; @@ -121,7 +125,9 @@ bool QGCSerialPortInfo::boardTypePixhawk(void) const { BoardType_t boardType = this->boardType(); - return boardType == BoardTypePX4FMUV1 || boardType == BoardTypePX4FMUV2 || boardType == BoardTypePX4FMUV4 || boardType == BoardTypeAeroCore; + return boardType == BoardTypePX4FMUV1 || boardType == BoardTypePX4FMUV2 + || boardType == BoardTypePX4FMUV4 || boardType == BoardTypeAeroCore + || boardType == BoardTypeMINDPXFMUV2; } bool QGCSerialPortInfo::isBootloader(void) const diff --git a/src/comm/QGCSerialPortInfo.h b/src/comm/QGCSerialPortInfo.h index 8e95afa59..78af7e1f5 100644 --- a/src/comm/QGCSerialPortInfo.h +++ b/src/comm/QGCSerialPortInfo.h @@ -47,6 +47,7 @@ public: BoardTypeSikRadio, BoardTypeAeroCore, BoardTypeRTKGPS, + BoardTypeMINDPXFMUV2, BoardTypeUnknown } BoardType_t; @@ -63,6 +64,8 @@ public: static const int px4FlowProductId = 21; ///< Product ID for PX4 Flow board + static const int MindPXFMUV2ProductId = 48; ///< Product ID for the MindPX V2 board + static const int threeDRRadioVendorId = 1027; ///< Vendor ID for 3DR Radio static const int threeDRRadioProductId = 24597; ///< Product ID for 3DR Radio -- 2.22.0