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

Fix radius reset when editing FW Landing Patterns #12544

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 3 additions & 7 deletions src/PlanView/FWLandingPatternEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Rectangle {
property string _setToVehicleLocationStr: qsTr("Set to vehicle location")
property bool _showCameraSection: !_missionVehicle.apmFirmware
property int _altitudeMode: missionItem.altitudesAreRelative ? QGroundControl.AltitudeModeRelative : QGroundControl.AltitudeModeAbsolute
property real _previousLoiterRadius: 0
property real _previousLoiterRadius: missionItem.loiterRadius.rawValue

Column {
id: editorColumn
Expand Down Expand Up @@ -74,12 +74,8 @@ Rectangle {
// glide slope heading correctly
onCheckedChanged: {
if (checked) {
// Restore the previous loiter radius or set the default value
if (_previousLoiterRadius > 0) {
missionItem.loiterRadius.rawValue = _previousLoiterRadius
} else {
missionItem.loiterRadius.rawValue = missionItem.loiterRadius.defaultValue
}
// Restore the previous loiter radius
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incorrect. If the item starts without loiter to altitude off. Then the previous loiter radius is 0. Then the user decides they want to use loiter to alt. The old code would set the radius to the default when they turned it on. Now it stays at 0. What's the exact sequence of events which cause the problem?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I'll fix it when I can.

The sequence of events this PR fixes is:

  1. Load a flight plan with a Landing Sequence that uses a non-default loiter radius.
  2. Click/tap the Landing Sequence to start the editor.
  3. The loiter radius will have gone back to the default value.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, ok. The way I've tended to handle stuff like in the past is like this:

property bool _initialLoadComplete: false
Component.onCompleted: _initialLoadComplete = true
...
if (_initialLoadComplete) {
   // do stuff which should only happen after the initial loads finishes all the signalling it might cause
}
'''

missionItem.loiterRadius.rawValue = _previousLoiterRadius
} else {
_previousLoiterRadius = missionItem.loiterRadius.rawValue
missionItem.loiterRadius.rawValue = 0
Expand Down
Loading