Browse Source

Refactor sub default param loading, allow loading params for sub 4.0

QGC4.4
Willian Galvani 4 years ago committed by Jacob Walser
parent
commit
36118d69be
  1. 20
      src/AutoPilotPlugins/APM/APMSubFrameComponent.qml

20
src/AutoPilotPlugins/APM/APMSubFrameComponent.qml

@ -189,6 +189,20 @@ SetupPage {
} }
Flow { Flow {
function getParametersFile(frame) {
const filename = frame === "heavy" ? "Sub/bluerov2-heavy" : "Sub/bluerov2"
if (globals.activeVehicle.versionCompare(4 ,0 ,0) >= 0) {
return filename + "-4_0_0.params"
}
if (globals.activeVehicle.versionCompare(3 ,5 ,4) >= 0) {
return filename + "-3_5_4.params"
}
if (globals.activeVehicle.versionCompare(3 ,5 ,2) >= 0) {
return filename + "-3_5_2.params"
}
return filename + "-3_5.params"
}
anchors.margins: _margins anchors.margins: _margins
anchors.top: applyParamsText.bottom anchors.top: applyParamsText.bottom
anchors.left: parent.left anchors.left: parent.left
@ -200,10 +214,9 @@ SetupPage {
QGCButton { QGCButton {
width: parent.width width: parent.width
text: "Blue Robotics BlueROV2" text: "Blue Robotics BlueROV2"
property var file: _oldFW ? "Sub/bluerov2-3_5.params" : "Sub/bluerov2-3_5_2.params"
onClicked : { onClicked : {
controller.loadParameters(file) controller.loadParameters(parent.getParametersFile())
hideDialog() hideDialog()
} }
} }
@ -211,10 +224,9 @@ SetupPage {
QGCButton { QGCButton {
width: parent.width width: parent.width
text: "Blue Robotics BlueROV2 Heavy" text: "Blue Robotics BlueROV2 Heavy"
property var file: "Sub/bluerov2-heavy-3_5_2.params"
onClicked : { onClicked : {
controller.loadParameters(file) controller.loadParameters(parent.getParametersFile("heavy"))
hideDialog() hideDialog()
} }
} }

Loading…
Cancel
Save