From 51a5939074457f50e813a6e7de07d3e7e49242de Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Fri, 3 Jan 2025 12:33:29 -0800 Subject: [PATCH 1/2] Return floats instead of strings from getOutputValue --- src/FlightDisplay/GuidedValueSlider.qml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/FlightDisplay/GuidedValueSlider.qml b/src/FlightDisplay/GuidedValueSlider.qml index 71ba8f96062..63d16ba148a 100644 --- a/src/FlightDisplay/GuidedValueSlider.qml +++ b/src/FlightDisplay/GuidedValueSlider.qml @@ -99,7 +99,7 @@ Item { setCurrentValue(currentValue, false) } - function _clampedSliderValue(value) { + function _clampedSliderValueString(value) { var decimalPlaces = 0 if (_unitsSettings.verticalDistanceUnits.rawValue === UnitsSettings.VerticalDistanceUnitsMeters) { decimalPlaces = 1 @@ -108,7 +108,7 @@ Item { } function getOutputValue() { - return _clampedSliderValue(_sliderValue) + return parseFloat(_clampedSliderValueString(_sliderValue)) } DeadMouseArea { @@ -254,7 +254,7 @@ Item { anchors.verticalCenter: parent.verticalCenter horizontalAlignment: Text.AlignRight verticalAlignment: Text.AlignVCenter - text: _clampedSliderValue(_sliderValue) + " " + unitsString + text: _clampedSliderValueString(_sliderValue) + " " + unitsString font.pointSize: ScreenTools.largeFontPointSize property var unitsString: _sliderType === GuidedValueSlider.Speed ? @@ -265,7 +265,7 @@ Item { QGCMouseArea { anchors.fill: parent onClicked: { - sliderValueTextField.text = _clampedSliderValue(_sliderValue) + sliderValueTextField.text = _clampedSliderValueString(_sliderValue) sliderValueTextField.visible = true sliderValueTextField.forceActiveFocus() } @@ -282,7 +282,7 @@ Item { onEditingFinished: { visible = false focus = false - setCurrentValue(_clampedSliderValue(parseFloat(text))) + setCurrentValue(parseFloat(_clampedSliderValueString(parseFloat(text)))) } Connections { From 487bdb4aede5a3a2d241e3c891914bc003b82526 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Fri, 3 Jan 2025 12:33:51 -0800 Subject: [PATCH 2/2] Fix orbit altitude to use correct AMSL --- src/FlightDisplay/GuidedActionsController.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/FlightDisplay/GuidedActionsController.qml b/src/FlightDisplay/GuidedActionsController.qml index 881742c7378..a8381956a6d 100644 --- a/src/FlightDisplay/GuidedActionsController.qml +++ b/src/FlightDisplay/GuidedActionsController.qml @@ -145,7 +145,7 @@ Item { property bool showPause: _guidedActionsEnabled && _vehicleArmed && _activeVehicle.pauseVehicleSupported && _vehicleFlying && !_vehiclePaused && !_fixedWingOnApproach property bool showChangeAlt: _guidedActionsEnabled && _vehicleFlying && _activeVehicle.guidedModeSupported && _vehicleArmed && !_missionActive property bool showChangeSpeed: _guidedActionsEnabled && _vehicleFlying && _activeVehicle.guidedModeSupported && _vehicleArmed && !_missionActive && _speedLimitsAvailable - property bool showOrbit: _guidedActionsEnabled && _vehicleFlying && __orbitSupported && !_missionActive + property bool showOrbit: _guidedActionsEnabled && _vehicleFlying && __orbitSupported && !_missionActive && _activeVehicle.homePosition.isValid && !isNaN(_activeVehicle.homePosition.altitude) property bool showROI: _guidedActionsEnabled && _vehicleFlying && __roiSupported property bool showLandAbort: _guidedActionsEnabled && _vehicleFlying && _fixedWingOnApproach property bool showGotoLocation: _guidedActionsEnabled && _vehicleFlying @@ -627,7 +627,7 @@ Item { break case actionOrbit: var valueInMeters = _unitsConversion.appSettingsVerticalDistanceUnitsToMeters(sliderOutputValue) - _activeVehicle.guidedModeOrbit(orbitMapCircle.center, orbitMapCircle.radius() * (orbitMapCircle.clockwiseRotation ? 1 : -1), _activeVehicle.altitudeRelative.rawValue + valueInMeters) + _activeVehicle.guidedModeOrbit(orbitMapCircle.center, orbitMapCircle.radius() * (orbitMapCircle.clockwiseRotation ? 1 : -1), _activeVehicle.homePosition.altitude + valueInMeters) break case actionLandAbort: _activeVehicle.abortLanding(50) // hardcoded value for climbOutAltitude that is currently ignored