Unverified Commit 36186141 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #6494 from DonLakeFlyer/AltModeHelp

Better help for alt mode
parents 117e3dde 5c93e8d4
...@@ -706,13 +706,16 @@ void SimpleMissionItem::_terrainAltChanged(void) ...@@ -706,13 +706,16 @@ void SimpleMissionItem::_terrainAltChanged(void)
} }
if (qIsNaN(terrainAltitude())) { if (qIsNaN(terrainAltitude())) {
qDebug() << "1";
// Set NaNs to signal we are waiting on terrain data // Set NaNs to signal we are waiting on terrain data
_missionItem._param7Fact.setRawValue(qQNaN()); _missionItem._param7Fact.setRawValue(qQNaN());
_amslAltAboveTerrainFact.setRawValue(qQNaN()); _amslAltAboveTerrainFact.setRawValue(qQNaN());
} else { } else {
double newAboveTerrain = terrainAltitude() + _altitudeFact.rawValue().toDouble(); double newAboveTerrain = terrainAltitude() + _altitudeFact.rawValue().toDouble();
double oldAboveTerrain = _amslAltAboveTerrainFact.rawValue().toDouble(); double oldAboveTerrain = _amslAltAboveTerrainFact.rawValue().toDouble();
qDebug() << "2" << newAboveTerrain << oldAboveTerrain;
if (qIsNaN(oldAboveTerrain) || !qFuzzyCompare(newAboveTerrain, oldAboveTerrain)) { if (qIsNaN(oldAboveTerrain) || !qFuzzyCompare(newAboveTerrain, oldAboveTerrain)) {
qDebug() << "3";
_missionItem._param7Fact.setRawValue(newAboveTerrain); _missionItem._param7Fact.setRawValue(newAboveTerrain);
_amslAltAboveTerrainFact.setRawValue(newAboveTerrain); _amslAltAboveTerrainFact.setRawValue(newAboveTerrain);
} }
......
...@@ -29,7 +29,10 @@ Rectangle { ...@@ -29,7 +29,10 @@ Rectangle {
ExclusiveGroup { ExclusiveGroup {
id: altRadios id: altRadios
onCurrentChanged: missionItem.altitudeMode = current.altModeValue onCurrentChanged: {
altModeLabel.text = Qt.binding(function() { return current.helpText })
missionItem.altitudeMode = current.altModeValue
}
} }
Column { Column {
...@@ -104,29 +107,36 @@ Rectangle { ...@@ -104,29 +107,36 @@ Rectangle {
text: qsTr("Rel") text: qsTr("Rel")
exclusiveGroup: altRadios exclusiveGroup: altRadios
checked: missionItem.altitudeMode === altModeValue checked: missionItem.altitudeMode === altModeValue
readonly property int altModeValue: _altModeRelative
readonly property int altModeValue: _altModeRelative
readonly property string helpText: qsTr("Relative to home altitude")
} }
QGCRadioButton { QGCRadioButton {
text: qsTr("Abs") text: qsTr("Abs")
exclusiveGroup: altRadios exclusiveGroup: altRadios
checked: missionItem.altitudeMode === altModeValue checked: missionItem.altitudeMode === altModeValue
visible: QGroundControl.corePlugin.options.showMissionAbsoluteAltitude || missionItem.altitudeMode === altModeValue visible: QGroundControl.corePlugin.options.showMissionAbsoluteAltitude || missionItem.altitudeMode === altModeValue
readonly property int altModeValue: _altModeAbsolute
readonly property int altModeValue: _altModeAbsolute
readonly property string helpText: qsTr("Absolute WGS84")
} }
QGCRadioButton { QGCRadioButton {
text: qsTr("AGL") text: qsTr("AGL")
exclusiveGroup: altRadios exclusiveGroup: altRadios
checked: missionItem.altitudeMode === altModeValue checked: missionItem.altitudeMode === altModeValue
readonly property int altModeValue: _altModeAboveTerrain
readonly property int altModeValue: _altModeAboveTerrain
property string helpText: qsTr("Calculated from terrain data\nAbs Alt ") + missionItem.amslAltAboveTerrain.valueString + " " + missionItem.amslAltAboveTerrain.units
} }
QGCRadioButton { QGCRadioButton {
text: qsTr("TerrF") text: qsTr("TerrF")
exclusiveGroup: altRadios exclusiveGroup: altRadios
checked: missionItem.altitudeMode === altModeValue checked: missionItem.altitudeMode === altModeValue
visible: missionItem.supportsTerrainFrame || missionItem.altitudeMode === altModeValue visible: missionItem.supportsTerrainFrame || missionItem.altitudeMode === altModeValue
readonly property int altModeValue: _altModeTerrainFrame
} readonly property int altModeValue: _altModeTerrainFrame
readonly property string helpText: qsTr("Using terrain reference frame")
}
} }
FactValueSlider { FactValueSlider {
...@@ -135,23 +145,12 @@ Rectangle { ...@@ -135,23 +145,12 @@ Rectangle {
incrementSlots: 1 incrementSlots: 1
} }
RowLayout {
spacing: _margin
visible: missionItem.altitudeMode === _altModeAboveTerrain
QGCLabel {
text: qsTr("Calculated Abs Alt")
font.pointSize: ScreenTools.smallFontPointSize
}
QGCLabel {
text: missionItem.amslAltAboveTerrain.valueString + " " + missionItem.amslAltAboveTerrain.units
}
}
QGCLabel { QGCLabel {
text: qsTr("Using terrain reference frame") id: altModeLabel
anchors.left: parent.left
anchors.right: parent.right
wrapMode: Text.WordWrap
font.pointSize: ScreenTools.smallFontPointSize font.pointSize: ScreenTools.smallFontPointSize
visible: missionItem.altitudeMode === _altModeTerrainFrame
} }
} }
} }
......
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