From 5a03aed725d58673431d4a444c91749ce0e0c35c Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Mon, 11 Apr 2016 21:04:49 -0700 Subject: [PATCH] Plumb ublox RTK device ids through QGCSerialPortInfo --- src/VehicleSetup/FirmwareUpgradeController.cc | 4 ++-- src/VehicleSetup/PX4FirmwareUpgradeThread.cc | 2 +- src/comm/QGCSerialPortInfo.cc | 8 ++++++++ src/comm/QGCSerialPortInfo.h | 7 +++++++ 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/VehicleSetup/FirmwareUpgradeController.cc b/src/VehicleSetup/FirmwareUpgradeController.cc index 3d195f7e5..a8a27d803 100644 --- a/src/VehicleSetup/FirmwareUpgradeController.cc +++ b/src/VehicleSetup/FirmwareUpgradeController.cc @@ -416,8 +416,8 @@ QHash* FirmwareUpgradeCo case QGCSerialPortInfo::BoardTypeSikRadio: boardId = Bootloader::boardID3DRRadio; break; - case QGCSerialPortInfo::BoardTypeUnknown: - qWarning() << "Internal error"; + default: + qWarning() << "Internal error: invalid board type for flashing" << boardType; boardId = Bootloader::boardIDPX4FMUV2; break; } diff --git a/src/VehicleSetup/PX4FirmwareUpgradeThread.cc b/src/VehicleSetup/PX4FirmwareUpgradeThread.cc index 6b7b78300..6bf362866 100644 --- a/src/VehicleSetup/PX4FirmwareUpgradeThread.cc +++ b/src/VehicleSetup/PX4FirmwareUpgradeThread.cc @@ -141,7 +141,7 @@ bool PX4FirmwareUpgradeThreadWorker::_findBoardFromPorts(QGCSerialPortInfo& port qCDebug(FirmwareUpgradeVerboseLog) << "\tproduct ID:" << info.productIdentifier(); boardType = info.boardType(); - if (boardType != QGCSerialPortInfo::BoardTypeUnknown) { + if (info.canFlash()) { portInfo = info; return true; } diff --git a/src/comm/QGCSerialPortInfo.cc b/src/comm/QGCSerialPortInfo.cc index ee5908e7e..0b6ef9193 100644 --- a/src/comm/QGCSerialPortInfo.cc +++ b/src/comm/QGCSerialPortInfo.cc @@ -39,6 +39,7 @@ static const struct VIDPIDMapInfo_s { { QGCSerialPortInfo::px4VendorId, QGCSerialPortInfo::AeroCoreProductId, QGCSerialPortInfo::BoardTypeAeroCore, "Found AeroCore" }, { 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" }, }; QGCSerialPortInfo::QGCSerialPortInfo(void) : @@ -128,3 +129,10 @@ bool QGCSerialPortInfo::isBootloader(void) const // FIXME: Check SerialLink bootloade detect code which is different return boardTypePixhawk() && description().contains("BL"); } + +bool QGCSerialPortInfo::canFlash(void) +{ + BoardType_t boardType = this->boardType(); + + return boardType != QGCSerialPortInfo::BoardTypeUnknown && boardType != QGCSerialPortInfo::BoardTypeRTKGPS; +} diff --git a/src/comm/QGCSerialPortInfo.h b/src/comm/QGCSerialPortInfo.h index 10ec2fb2b..8e95afa59 100644 --- a/src/comm/QGCSerialPortInfo.h +++ b/src/comm/QGCSerialPortInfo.h @@ -46,6 +46,7 @@ public: BoardTypePX4Flow, BoardTypeSikRadio, BoardTypeAeroCore, + BoardTypeRTKGPS, BoardTypeUnknown } BoardType_t; @@ -68,6 +69,9 @@ public: static const int siLabsRadioVendorId = 0x10c4; ///< Vendor ID for SILabs Radio static const int siLabsRadioProductId = 0xea60; ///< Product ID for SILabs Radio + static const int ubloxRTKVendorId = 5446; ///< Vendor ID for ublox RTK + static const int ubloxRTKProductId = 424; ///< Product ID for ublox RTK + QGCSerialPortInfo(void); QGCSerialPortInfo(const QSerialPort & port); @@ -76,6 +80,9 @@ public: BoardType_t boardType(void) const; + /// @return true: we can flash this board type + bool canFlash(void); + /// @return true: board is a Pixhawk board bool boardTypePixhawk(void) const; -- 2.22.0