Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orbit fixes #12278

Merged
merged 2 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/FlightDisplay/GuidedActionsController.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions src/FlightDisplay/GuidedValueSlider.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -108,7 +108,7 @@ Item {
}

function getOutputValue() {
return _clampedSliderValue(_sliderValue)
return parseFloat(_clampedSliderValueString(_sliderValue))
}

DeadMouseArea {
Expand Down Expand Up @@ -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 ?
Expand All @@ -265,7 +265,7 @@ Item {
QGCMouseArea {
anchors.fill: parent
onClicked: {
sliderValueTextField.text = _clampedSliderValue(_sliderValue)
sliderValueTextField.text = _clampedSliderValueString(_sliderValue)
sliderValueTextField.visible = true
sliderValueTextField.forceActiveFocus()
}
Expand All @@ -282,7 +282,7 @@ Item {
onEditingFinished: {
visible = false
focus = false
setCurrentValue(_clampedSliderValue(parseFloat(text)))
setCurrentValue(parseFloat(_clampedSliderValueString(parseFloat(text))))
}

Connections {
Expand Down
Loading