Commit c72bea3a authored by Don Gagne's avatar Don Gagne

Merge pull request #3069 from DonLakeFlyer/SerialIDS

Add SILabs serial ids for radio
parents 7b112b32 a1920505
......@@ -147,7 +147,7 @@ void FirmwareUpgradeController::_foundBoard(bool firstAttempt, const QSerialPort
_foundBoardTypeName = "PX4 Flow";
_startFlashWhenBootloaderFound = false;
break;
case QGCSerialPortInfo::BoardType3drRadio:
case QGCSerialPortInfo::BoardTypeSikRadio:
_foundBoardTypeName = "SiK Radio";
if (!firstAttempt) {
// Radio always flashes latest firmware, so we can start right away without
......@@ -413,7 +413,7 @@ QHash<FirmwareUpgradeController::FirmwareIdentifier, QString>* FirmwareUpgradeCo
case QGCSerialPortInfo::BoardTypePX4Flow:
boardId = Bootloader::boardIDPX4Flow;
break;
case QGCSerialPortInfo::BoardType3drRadio:
case QGCSerialPortInfo::BoardTypeSikRadio:
boardId = Bootloader::boardID3DRRadio;
break;
case QGCSerialPortInfo::BoardTypeUnknown:
......
......@@ -106,7 +106,7 @@ void PX4FirmwareUpgradeThreadWorker::_findBoardOnce(void)
_foundBoardPortInfo = portInfo;
emit foundBoard(_findBoardFirstAttempt, portInfo, boardType);
if (!_findBoardFirstAttempt) {
if (boardType == QGCSerialPortInfo::BoardType3drRadio) {
if (boardType == QGCSerialPortInfo::BoardTypeSikRadio) {
_3drRadioForceBootloader(portInfo);
return;
} else {
......
......@@ -536,7 +536,7 @@ void LinkManager::_updateAutoConnectLinks(void)
pSerialConfig = new SerialConfiguration(QString("PX4Flow on %1").arg(portInfo.portName().trimmed()));
}
break;
case QGCSerialPortInfo::BoardType3drRadio:
case QGCSerialPortInfo::BoardTypeSikRadio:
if (_autoconnect3DRRadio) {
pSerialConfig = new SerialConfiguration(QString("SiK Radio on %1").arg(portInfo.portName().trimmed()));
}
......@@ -548,7 +548,7 @@ void LinkManager::_updateAutoConnectLinks(void)
if (pSerialConfig) {
qCDebug(LinkManagerLog) << "New auto-connect port added: " << pSerialConfig->name() << portInfo.systemLocation();
pSerialConfig->setBaud(boardType == QGCSerialPortInfo::BoardType3drRadio ? 57600 : 115200);
pSerialConfig->setBaud(boardType == QGCSerialPortInfo::BoardTypeSikRadio ? 57600 : 115200);
pSerialConfig->setDynamic(true);
pSerialConfig->setPortName(portInfo.systemLocation());
_autoconnectConfigurations.append(pSerialConfig);
......
......@@ -25,6 +25,22 @@
QGC_LOGGING_CATEGORY(QGCSerialPortInfoLog, "QGCSerialPortInfoLog")
static const struct VIDPIDMapInfo_s {
int vendorId;
int productId;
QGCSerialPortInfo::BoardType_t boardType;
const char * boardString;
} s_rgVIDPIDMappings[] = {
{ QGCSerialPortInfo::px4VendorId, QGCSerialPortInfo::pixhawkFMUV4ProductId, QGCSerialPortInfo::BoardTypePX4FMUV4, "Found PX4 FMU V4" },
{ QGCSerialPortInfo::px4VendorId, QGCSerialPortInfo::pixhawkFMUV2ProductId, QGCSerialPortInfo::BoardTypePX4FMUV2, "Found PX4 FMU V2" },
{ QGCSerialPortInfo::px4VendorId, QGCSerialPortInfo::pixhawkFMUV2OldBootloaderProductId, QGCSerialPortInfo::BoardTypePX4FMUV2, "Found PX4 FMU V2"},
{ 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::threeDRRadioVendorId, QGCSerialPortInfo::threeDRRadioProductId, QGCSerialPortInfo::BoardTypeSikRadio, "Found SiK Radio" },
{ QGCSerialPortInfo::siLabsRadioVendorId, QGCSerialPortInfo::siLabsRadioProductId, QGCSerialPortInfo::BoardTypeSikRadio, "Found SiK Radio" },
};
QGCSerialPortInfo::QGCSerialPortInfo(void) :
QSerialPortInfo()
{
......@@ -45,31 +61,14 @@ QGCSerialPortInfo::BoardType_t QGCSerialPortInfo::boardType(void) const
BoardType_t boardType = BoardTypeUnknown;
switch (vendorIdentifier()) {
case px4VendorId:
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) {
qCDebug(QGCSerialPortInfoLog) << "Found PX4 FMU V1";
boardType = BoardTypePX4FMUV1;
} else if (productIdentifier() == px4FlowProductId) {
qCDebug(QGCSerialPortInfoLog) << "Found PX4 Flow";
boardType = BoardTypePX4Flow;
} else if (productIdentifier() == AeroCoreProductId) {
qCDebug(QGCSerialPortInfoLog) << "Found AeroCore";
boardType = BoardTypeAeroCore;
}
break;
case threeDRRadioVendorId:
if (productIdentifier() == threeDRRadioProductId) {
qCDebug(QGCSerialPortInfoLog) << "Found SiK Radio";
boardType = BoardType3drRadio;
}
for (size_t i=0; i<sizeof(s_rgVIDPIDMappings)/sizeof(s_rgVIDPIDMappings[0]); i++) {
const struct VIDPIDMapInfo_s* pIDMap = &s_rgVIDPIDMappings[i];
if (vendorIdentifier() == pIDMap->vendorId && productIdentifier() == pIDMap->productId) {
boardType = pIDMap->boardType;
qCDebug(QGCSerialPortInfoLog) << pIDMap->boardString;
break;
}
}
if (boardType == BoardTypeUnknown) {
......@@ -92,13 +91,13 @@ QGCSerialPortInfo::BoardType_t QGCSerialPortInfo::boardType(void) const
boardType = BoardTypePX4Flow;
} else if (description() == "FT231X USB UART") {
qCDebug(QGCSerialPortInfoLog) << "Found possible Radio (by name matching fallback)";
boardType = BoardType3drRadio;
boardType = BoardTypeSikRadio;
#ifdef __android__
} else if (description().endsWith("USB UART")) {
// This is a fairly broad fallbacks for radios which will also catch most FTDI devices. That would
// cause problems on desktop due to incorrect connections. Since mobile is more anal about connecting
// it will work fine here.
boardType = BoardType3drRadio;
boardType = BoardTypeSikRadio;
#endif
}
}
......
......@@ -44,7 +44,7 @@ public:
BoardTypePX4FMUV2,
BoardTypePX4FMUV4,
BoardTypePX4Flow,
BoardType3drRadio,
BoardTypeSikRadio,
BoardTypeAeroCore,
BoardTypeUnknown
} BoardType_t;
......@@ -65,6 +65,9 @@ public:
static const int threeDRRadioVendorId = 1027; ///< Vendor ID for 3DR Radio
static const int threeDRRadioProductId = 24597; ///< Product ID for 3DR Radio
static const int siLabsRadioVendorId = 0x10c4; ///< Vendor ID for SILabs Radio
static const int siLabsRadioProductId = 0xea60; ///< Product ID for SILabs Radio
QGCSerialPortInfo(void);
QGCSerialPortInfo(const QSerialPort & port);
......@@ -79,6 +82,7 @@ public:
/// @return true: Board is currently in bootloader
bool isBootloader(void) const;
private:
};
#endif
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