Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/Comms/QGCSerialPortInfo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,12 @@ bool QGCSerialPortInfo::canFlash() const
return false;
}

static const QList<BoardType_t> flashable = {
BoardTypePixhawk,
BoardTypeSiKRadio
};
return _isBoardTypeFlashable(boardType);
}

bool QGCSerialPortInfo::_isBoardTypeFlashable(BoardType_t boardType)
{
static const QList<BoardType_t> flashable = {BoardTypePixhawk, BoardTypeSiKRadio};

return flashable.contains(boardType);
}
1 change: 1 addition & 0 deletions src/Comms/QGCSerialPortInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class QGCSerialPortInfo : public QSerialPortInfo
static bool _loadJsonData();
static BoardType_t _boardClassStringToType(const QString &boardClass);
static QString _boardTypeToString(BoardType_t boardType);
static bool _isBoardTypeFlashable(BoardType_t boardType);

static bool _jsonLoaded;
static bool _jsonDataValid;
Expand Down
2 changes: 2 additions & 0 deletions src/Comms/USBBoardInfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
{ "vendorID": 12677, "productID": 61, "boardClass": "Pixhawk", "name": "ARK FMU V6S" },
{ "vendorID": 12677, "productID": 62, "boardClass": "Pixhawk", "name": "ARK FMU V6XRT" },

{ "vendorID": 7504, "productID": 24992, "boardClass": "Pixhawk", "name": "AMOVLAB Flycore" },

{ "vendorID": 1155, "productID": 22336, "boardClass": "Pixhawk", "name": "ArduPilot ChibiOS" },
{ "vendorID": 4617, "productID": 22336, "boardClass": "Pixhawk", "name": "ArduPilot ChibiOS" },
{ "vendorID": 4617, "productID": 22337, "boardClass": "Pixhawk", "name": "ArduPilot ChibiOS" },
Expand Down
1 change: 1 addition & 0 deletions src/Vehicle/VehicleSetup/FirmwareUpgradeController.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ static QMap<int, QString> px4_board_name_map {
{1110, "jfb_jfb110_default"},
{1200, "jfb_jfb200_default"},
{1209, "gearup_airbrainh743_default"},
{1218, "amovlab_flycore_default"},
{1198, "aedrox_aedroxh7_default"},
{1123, "siyi_n7_default"},
{1124, "3dr_ctrl-zero-h7-oem-revg_default"},
Expand Down
27 changes: 27 additions & 0 deletions test/Comms/QGCSerialPortInfoTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,33 @@ void QGCSerialPortInfoTest::_testBoardInfoListEntriesAreWellFormed()
}
}

void QGCSerialPortInfoTest::_testFlycoreBoardInfo()
{
QVERIFY(QGCSerialPortInfo::_loadJsonData());

static constexpr int flycoreVendorId = 0x1d50;
static constexpr int flycoreProductId = 0x61a0;

const QGCSerialPortInfo::BoardInfo_t* flycoreInfo = nullptr;
int matchCount = 0;
for (const QGCSerialPortInfo::BoardInfo_t& entry : QGCSerialPortInfo::_boardInfoList) {
if ((entry.vendorId == flycoreVendorId) && (entry.productId == flycoreProductId)) {
flycoreInfo = &entry;
matchCount++;
}
}

QCOMPARE(matchCount, 1);
QVERIFY(flycoreInfo);
QCOMPARE(flycoreInfo->boardType, QGCSerialPortInfo::BoardTypePixhawk);
QCOMPARE(flycoreInfo->name, QStringLiteral("AMOVLAB Flycore"));
QVERIFY(QGCSerialPortInfo::_isBoardTypeFlashable(flycoreInfo->boardType));

for (const QGCSerialPortInfo::BoardRegExpFallback_t& entry : QGCSerialPortInfo::_boardManufacturerFallbackList) {
QVERIFY(!entry.regExp.match(QStringLiteral("Amovlab")).hasMatch());
}
}

void QGCSerialPortInfoTest::_testFallbackRegexesCompile()
{
QVERIFY(QGCSerialPortInfo::_loadJsonData());
Expand Down
1 change: 1 addition & 0 deletions test/Comms/QGCSerialPortInfoTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ private slots:
void _testBoardClassStringToTypeCaseInsensitivity();
void _testBoardTypeStringRoundTrip();
void _testBoardInfoListEntriesAreWellFormed();
void _testFlycoreBoardInfo();
void _testFallbackRegexesCompile();
};
20 changes: 20 additions & 0 deletions test/Vehicle/FirmwareUpgradeControllerTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,24 @@ void FirmwareUpgradeControllerTest::_px4ReleasesCompleteOnlyStableKeepsBetaEmpty
QVERIFY(controller._px4BetaVersion.isEmpty());
}

void FirmwareUpgradeControllerTest::_flycoreBoardIdMapsToPX4Firmware()
{
FirmwareUpgradeController controller;
const QHash<FirmwareUpgradeController::FirmwareIdentifier, QString>* firmwareUrls =
controller._firmwareHashForBoardId(1218);

QCOMPARE(firmwareUrls->size(), 3);
QCOMPARE(
firmwareUrls->value({FirmwareUpgradeController::AutoPilotStackPX4, FirmwareUpgradeController::StableFirmware,
FirmwareUpgradeController::DefaultVehicleFirmware}),
QStringLiteral("http://px4-travis.s3.amazonaws.com/Firmware/stable/amovlab_flycore_default.px4"));
QCOMPARE(firmwareUrls->value({FirmwareUpgradeController::AutoPilotStackPX4, FirmwareUpgradeController::BetaFirmware,
FirmwareUpgradeController::DefaultVehicleFirmware}),
QStringLiteral("http://px4-travis.s3.amazonaws.com/Firmware/beta/amovlab_flycore_default.px4"));
QCOMPARE(
firmwareUrls->value({FirmwareUpgradeController::AutoPilotStackPX4, FirmwareUpgradeController::DeveloperFirmware,
FirmwareUpgradeController::DefaultVehicleFirmware}),
QStringLiteral("http://px4-travis.s3.amazonaws.com/Firmware/master/amovlab_flycore_default.px4"));
}

UT_REGISTER_TEST(FirmwareUpgradeControllerTest, TestLabel::Unit, TestLabel::Vehicle)
1 change: 1 addition & 0 deletions test/Vehicle/FirmwareUpgradeControllerTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ private slots:
void _px4ReleasesCompleteBadJsonKeepsPreviousVersions();
void _px4ReleasesCompleteNonArrayJsonKeepsPreviousVersions();
void _px4ReleasesCompleteOnlyStableKeepsBetaEmpty();
void _flycoreBoardIdMapsToPX4Firmware();
};
Loading