Commit 5cbe79b7 authored by DonLakeFlyer's avatar DonLakeFlyer

Allow both PX4 and APM specific optical flow flashing

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