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