Commit 6331f7bc authored by Gus Grubba's avatar Gus Grubba

Restored FirmwareUpgrade.qml as it was beyond repair. Also fixed some issues...

Restored FirmwareUpgrade.qml as it was beyond repair. Also fixed some issues that were present in the original, master version.
Added "hasAPMSupport" to QGroundControl global control. This is to determine if APM support is enabled or not.
parent 7eb9fbc6
...@@ -92,6 +92,7 @@ public: ...@@ -92,6 +92,7 @@ public:
// MavLink Protocol // MavLink Protocol
Q_PROPERTY(bool isVersionCheckEnabled READ isVersionCheckEnabled WRITE setIsVersionCheckEnabled NOTIFY isVersionCheckEnabledChanged) Q_PROPERTY(bool isVersionCheckEnabled READ isVersionCheckEnabled WRITE setIsVersionCheckEnabled NOTIFY isVersionCheckEnabledChanged)
Q_PROPERTY(int mavlinkSystemID READ mavlinkSystemID WRITE setMavlinkSystemID NOTIFY mavlinkSystemIDChanged) Q_PROPERTY(int mavlinkSystemID READ mavlinkSystemID WRITE setMavlinkSystemID NOTIFY mavlinkSystemIDChanged)
Q_PROPERTY(bool hasAPMSupport READ hasAPMSupport CONSTANT)
Q_PROPERTY(QGeoCoordinate flightMapPosition READ flightMapPosition WRITE setFlightMapPosition NOTIFY flightMapPositionChanged) Q_PROPERTY(QGeoCoordinate flightMapPosition READ flightMapPosition WRITE setFlightMapPosition NOTIFY flightMapPositionChanged)
Q_PROPERTY(double flightMapZoom READ flightMapZoom WRITE setFlightMapZoom NOTIFY flightMapZoomChanged) Q_PROPERTY(double flightMapZoom READ flightMapZoom WRITE setFlightMapZoom NOTIFY flightMapZoomChanged)
...@@ -195,6 +196,11 @@ public: ...@@ -195,6 +196,11 @@ public:
bool isVersionCheckEnabled () { return _toolbox->mavlinkProtocol()->versionCheckEnabled(); } bool isVersionCheckEnabled () { return _toolbox->mavlinkProtocol()->versionCheckEnabled(); }
int mavlinkSystemID () { return _toolbox->mavlinkProtocol()->getSystemId(); } int mavlinkSystemID () { return _toolbox->mavlinkProtocol()->getSystemId(); }
#if defined(NO_ARDUPILOT_DIALECT)
bool hasAPMSupport () { return false; }
#else
bool hasAPMSupport () { return true; }
#endif
int supportedFirmwareCount (); int supportedFirmwareCount ();
bool px4ProFirmwareSupported (); bool px4ProFirmwareSupported ();
......
...@@ -44,7 +44,6 @@ SetupPage { ...@@ -44,7 +44,6 @@ SetupPage {
// User visible strings // User visible strings
readonly property string title: qsTr("Firmware Setup") // Popup dialog title readonly property string title: qsTr("Firmware Setup") // Popup dialog title
readonly property string highlightPrefix: "<font color=\"" + qgcPal.warningText + "\">" readonly property string highlightPrefix: "<font color=\"" + qgcPal.warningText + "\">"
readonly property string highlightSuffix: "</font>" readonly property string highlightSuffix: "</font>"
readonly property string welcomeText: qsTr("%1 can upgrade the firmware on Pixhawk devices, SiK Radios and PX4 Flow Smart Cameras.").arg(QGroundControl.appName) readonly property string welcomeText: qsTr("%1 can upgrade the firmware on Pixhawk devices, SiK Radios and PX4 Flow Smart Cameras.").arg(QGroundControl.appName)
...@@ -63,6 +62,7 @@ SetupPage { ...@@ -63,6 +62,7 @@ SetupPage {
property bool _defaultFirmwareIsPX4: true property bool _defaultFirmwareIsPX4: true
property string firmwareWarningMessage property string firmwareWarningMessage
property bool firmwareWarningMessageVisible: false
property bool initialBoardSearch: true property bool initialBoardSearch: true
property string firmwareName property string firmwareName
...@@ -78,18 +78,6 @@ SetupPage { ...@@ -78,18 +78,6 @@ SetupPage {
controller.startBoardSearch() controller.startBoardSearch()
_defaultFirmwareIsPX4 = _defaultFirmwareFact.rawValue === _defaultFimwareTypePX4 // we don't want this to be bound and change as radios are selected _defaultFirmwareIsPX4 = _defaultFirmwareFact.rawValue === _defaultFimwareTypePX4 // we don't want this to be bound and change as radios are selected
} }
function firmwareVersionChanged(model) {
firmwareVersionWarningLabel.visible = false
// All of this bizarre, setting model to null and index to 1 and then to 0 is to work around
// strangeness in the combo box implementation. This sequence of steps correctly changes the combo model
// without generating any warnings and correctly updates the combo text with the new selection.
firmwareBuildTypeCombo.model = null
firmwareBuildTypeCombo.model = model
firmwareBuildTypeCombo.currentIndex = 1
firmwareBuildTypeCombo.currentIndex = 0
}
QGCPalette { id: qgcPal; colorGroupEnabled: true }
FirmwareUpgradeController { FirmwareUpgradeController {
id: controller id: controller
...@@ -149,6 +137,17 @@ SetupPage { ...@@ -149,6 +137,17 @@ SetupPage {
property bool showFirmwareTypeSelection: _advanced.checked property bool showFirmwareTypeSelection: _advanced.checked
property bool px4Flow: controller.px4FlowBoard property bool px4Flow: controller.px4FlowBoard
function firmwareVersionChanged(model) {
firmwareWarningMessageVisible = false
// All of this bizarre, setting model to null and index to 1 and then to 0 is to work around
// strangeness in the combo box implementation. This sequence of steps correctly changes the combo model
// without generating any warnings and correctly updates the combo text with the new selection.
firmwareBuildTypeCombo.model = null
firmwareBuildTypeCombo.model = model
firmwareBuildTypeCombo.currentIndex = 1
firmwareBuildTypeCombo.currentIndex = 0
}
function updatePX4VersionDisplay() { function updatePX4VersionDisplay() {
var versionString = "" var versionString = ""
if (_advanced.checked) { if (_advanced.checked) {
...@@ -284,17 +283,10 @@ SetupPage { ...@@ -284,17 +283,10 @@ SetupPage {
anchors.fill: parent anchors.fill: parent
spacing: defaultTextHeight spacing: defaultTextHeight
Component.onCompleted: {
if(!QGroundControl.hasAPMSupport) {
_defaultFirmwareFact.rawValue = _defaultFimwareTypePX4
firmwareVersionChanged(firmwareTypeList)
}
}
QGCLabel { QGCLabel {
width: parent.width width: parent.width
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
text: (_singleFirmwareMode || !QGroundControl.hasAPMSupport) ? _singleFirmwareLabel : (px4Flow ? _px4FlowLabel : _pixhawkLabel) text: _singleFirmwareMode ? _singleFirmwareLabel : (px4Flow ? _px4FlowLabel : _pixhawkLabel)
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 _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:")
...@@ -303,17 +295,10 @@ SetupPage { ...@@ -303,17 +295,10 @@ SetupPage {
QGCLabel { text: qsTr("Flight Stack") } QGCLabel { text: qsTr("Flight Stack") }
RowLayout { Column {
spacing: _margins
layoutDirection: px4FlightStackRadio.checked ? Qt.LeftToRight : Qt.RightToLeft
// The following craziness of three radio buttons to represent two radio buttons is so that the
// order can be changed such that the default firmware button is always on the top
//-- Visible only if you have an option. If it's the only option, it's already setup.
QGCRadioButton { QGCRadioButton {
id: px4FlightStackRadio id: px4FlightStackRadio
exclusiveGroup: firmwareGroup
text: qsTr("PX4 Pro ") text: qsTr("PX4 Pro ")
textBold: _defaultFirmwareIsPX4 textBold: _defaultFirmwareIsPX4
checked: _defaultFirmwareIsPX4 checked: _defaultFirmwareIsPX4
...@@ -327,11 +312,10 @@ SetupPage { ...@@ -327,11 +312,10 @@ SetupPage {
QGCRadioButton { QGCRadioButton {
id: apmFlightStack id: apmFlightStack
exclusiveGroup: firmwareGroup
text: qsTr("ArduPilot") text: qsTr("ArduPilot")
textBold: !_defaultFirmwareIsPX4 textBold: !_defaultFirmwareIsPX4
checked: !_defaultFirmwareIsPX4 checked: !_defaultFirmwareIsPX4
visible: !_singleFirmwareMode && !px4Flow && QGroundControl.hasAPMSupport visible: !_singleFirmwareMode && !px4Flow
onClicked: { onClicked: {
_defaultFirmwareFact.rawValue = _defaultFimwareTypeAPM _defaultFirmwareFact.rawValue = _defaultFimwareTypeAPM
...@@ -411,7 +395,7 @@ SetupPage { ...@@ -411,7 +395,7 @@ SetupPage {
onClicked: { onClicked: {
firmwareBuildTypeCombo.currentIndex = 0 firmwareBuildTypeCombo.currentIndex = 0
firmwareVersionWarningLabel.visible = false firmwareWarningMessageVisible = false
updatePX4VersionDisplay() updatePX4VersionDisplay()
} }
} }
...@@ -442,13 +426,13 @@ SetupPage { ...@@ -442,13 +426,13 @@ SetupPage {
onActivated: { onActivated: {
controller.selectedFirmwareBuildType = model.get(index).firmwareType controller.selectedFirmwareBuildType = model.get(index).firmwareType
if (model.get(index).firmwareType === FirmwareUpgradeController.BetaFirmware) { if (model.get(index).firmwareType === FirmwareUpgradeController.BetaFirmware) {
firmwareVersionWarningLabel.visible = true firmwareWarningMessageVisible = true
firmwareVersionWarningLabel.text = qsTr("WARNING: BETA FIRMWARE. ") + firmwareVersionWarningLabel.text = qsTr("WARNING: BETA FIRMWARE. ") +
qsTr("This firmware version is ONLY intended for beta testers. ") + qsTr("This firmware version is ONLY intended for beta testers. ") +
qsTr("Although it has received FLIGHT TESTING, it represents actively changed code. ") + qsTr("Although it has received FLIGHT TESTING, it represents actively changed code. ") +
qsTr("Do NOT use for normal operation.") qsTr("Do NOT use for normal operation.")
} else if (model.get(index).firmwareType === FirmwareUpgradeController.DeveloperFirmware) { } else if (model.get(index).firmwareType === FirmwareUpgradeController.DeveloperFirmware) {
firmwareVersionWarningLabel.visible = true firmwareWarningMessageVisible = true
firmwareVersionWarningLabel.text = qsTr("WARNING: CONTINUOUS BUILD FIRMWARE. ") + firmwareVersionWarningLabel.text = qsTr("WARNING: CONTINUOUS BUILD FIRMWARE. ") +
qsTr("This firmware has NOT BEEN FLIGHT TESTED. ") + qsTr("This firmware has NOT BEEN FLIGHT TESTED. ") +
qsTr("It is only intended for DEVELOPERS. ") + qsTr("It is only intended for DEVELOPERS. ") +
...@@ -456,7 +440,7 @@ SetupPage { ...@@ -456,7 +440,7 @@ SetupPage {
qsTr("Do NOT fly this without additional safety precautions. ") + qsTr("Do NOT fly this without additional safety precautions. ") +
qsTr("Follow the mailing list actively when using it.") qsTr("Follow the mailing list actively when using it.")
} else { } else {
firmwareVersionWarningLabel.visible = false firmwareWarningMessageVisible = false
} }
updatePX4VersionDisplay() updatePX4VersionDisplay()
} }
...@@ -466,7 +450,7 @@ SetupPage { ...@@ -466,7 +450,7 @@ SetupPage {
id: firmwareVersionWarningLabel id: firmwareVersionWarningLabel
width: parent.width width: parent.width
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
visible: false visible: firmwareWarningMessageVisible
} }
} // Column } // Column
} // QGCViewDialog } // QGCViewDialog
......
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