Commit a1920505 authored by Don Gagne's avatar Don Gagne

Add SILabs radio vid/pid

parent 177f6583
......@@ -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