Commit 5cbe79b7 authored by DonLakeFlyer's avatar DonLakeFlyer

Allow both PX4 and APM specific optical flow flashing

parent 77b6dc5e
......@@ -170,16 +170,20 @@ SetupPage {
if (_singleFirmwareMode) {
controller.flashSingleFirmwareMode(controller.selectedFirmwareType)
} else {
var stack = apmFlightStack.checked ? FirmwareUpgradeController.AutoPilotStackAPM : FirmwareUpgradeController.AutoPilotStackPX4
if (px4Flow) {
stack = FirmwareUpgradeController.PX4Flow
}
var stack
var firmwareType = firmwareVersionCombo.model.get(firmwareVersionCombo.currentIndex).firmwareType
var vehicleType = FirmwareUpgradeController.DefaultVehicleFirmware
if (apmFlightStack.checked) {
vehicleType = controller.vehicleTypeFromVersionIndex(vehicleTypeSelectionCombo.currentIndex)
if (px4Flow) {
stack = px4FlowTypeSelectionCombo.model.get(px4FlowTypeSelectionCombo.currentIndex).stackType
vehicleType = FirmwareUpgradeController.DefaultVehicleFirmware
} else {
stack = apmFlightStack.checked ? FirmwareUpgradeController.AutoPilotStackAPM : FirmwareUpgradeController.AutoPilotStackPX4
if (apmFlightStack.checked) {
vehicleType = controller.vehicleTypeFromVersionIndex(vehicleTypeSelectionCombo.currentIndex)
}
}
controller.flash(stack, firmwareType, vehicleType)
}
}
......@@ -214,6 +218,19 @@ SetupPage {
}
}
ListModel {
id: px4FlowFirmwareList
ListElement {
text: qsTr("PX4 Pro")
stackType: FirmwareUpgradeController.PX4FlowPX4
}
ListElement {
text: qsTr("ArduPilot")
stackType: FirmwareUpgradeController.PX4FlowAPM
}
}
ListModel {
id: px4FlowTypeList
......@@ -249,7 +266,7 @@ SetupPage {
wrapMode: Text.WordWrap
text: _singleFirmwareMode ? _singleFirmwareLabel : (px4Flow ? _px4FlowLabel : _pixhawkLabel)
readonly property string _px4FlowLabel: qsTr("Detected PX4 Flow board. You can select from the following firmware:")
readonly property string _px4FlowLabel: qsTr("Detected PX4 Flow board. The firmware you use on the PX4 Flow must match the AutoPilot firmware type you are using on the vehicle:")
readonly property string _pixhawkLabel: qsTr("Detected Pixhawk board. You can select from the following flight stacks:")
readonly property string _singleFirmwareLabel: qsTr("Press Ok to upgrade your vehicle.")
}
......@@ -301,10 +318,19 @@ SetupPage {
id: vehicleTypeSelectionCombo
anchors.left: parent.left
anchors.right: parent.right
visible: apmFlightStack.checked
visible: !px4Flow && apmFlightStack.checked
model: controller.apmAvailableVersions
}
QGCComboBox {
id: px4FlowTypeSelectionCombo
anchors.left: parent.left
anchors.right: parent.right
visible: px4Flow
model: px4FlowFirmwareList
currentIndex: _defaultFirmwareIsPX4 ? 0 : 1
}
Row {
width: parent.width
spacing: ScreenTools.defaultFontPixelWidth / 2
......@@ -349,7 +375,7 @@ SetupPage {
anchors.left: parent.left
anchors.right: parent.right
visible: showFirmwareTypeSelection
model: _singleFirmwareMode ? singleFirmwareModeTypeList: (px4Flow ? px4FlowTypeList : firmwareTypeList)
model: _singleFirmwareMode ? singleFirmwareModeTypeList : (px4Flow ? px4FlowTypeList : firmwareTypeList)
currentIndex: controller.selectedFirmwareType
onActivated: {
......
......@@ -99,6 +99,7 @@ void FirmwareUpgradeController::flash(AutoPilotStackType_t stackType,
FirmwareType_t firmwareType,
FirmwareVehicleType_t vehicleType)
{
qCDebug(FirmwareUpgradeLog) << "_flash stackType:firmwareType:vehicleType" << stackType << firmwareType << vehicleType;
FirmwareIdentifier firmwareId = FirmwareIdentifier(stackType, firmwareType, vehicleType);
if (_bootloaderFound) {
_getFirmwareFile(firmwareId);
......@@ -351,7 +352,8 @@ void FirmwareUpgradeController::_initFirmwareHash()
/////////////////////////////// px4flow firmwares ///////////////////////////////////////
FirmwareToUrlElement_t rgPX4FLowFirmwareArray[] = {
{ PX4Flow, StableFirmware, DefaultVehicleFirmware, "http://px4-travis.s3.amazonaws.com/Flow/master/px4flow.px4" },
{ PX4FlowPX4, StableFirmware, DefaultVehicleFirmware, "http://px4-travis.s3.amazonaws.com/Flow/master/px4flow.px4" },
{ PX4FlowAPM, StableFirmware, DefaultVehicleFirmware, "http://px4-travis.s3.amazonaws.com/Flow/master/px4flowAPM.px4" },
};
/////////////////////////////// 3dr radio firmwares ///////////////////////////////////////
......
......@@ -40,7 +40,8 @@ public:
typedef enum {
AutoPilotStackPX4,
AutoPilotStackAPM,
PX4Flow,
PX4FlowPX4,
PX4FlowAPM,
ThreeDRRadio,
SingleFirmwareMode
} AutoPilotStackType_t;
......
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