fix(a32nx/fcu) Fixed FCU ALT selector immediately switching to 1000s when interval selected #9784
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #9699
Summary of Changes
Updated FcuComputer.cpp so that it doesn't run the code if number of turns of the ALT knob are 0 (which is the case where the increment knob is turned). Also had to add logic so that if the currently selected altitude is in hundreds (interval=1000ft), when the ALT knob is moved it doesn't jump by more than 1000ft - e.g. the code would have gone from 6300ft straight to 5000ft when dialling the altitude down with the previous version of the code as round(6300ft - 1000ft) = 5000ft - but we just want 6300ft to go to 6000ft on the first turn of the knob.
Screenshots (if necessary)
References
Behaviour observed on IRL aircraft
Additional context
First time contributing to an opensource project - so I hope I've followed the process right, but I was software engineer at Thales before my 320 TR flying for about 5 years now so hopefully I can contribute a little more going forward.
Discord username (if different from GitHub):
Testing instructions
Select an altitude in 100s of feet. Change the interval selector to 1000s of feet. Note the selected altitude doesn't change, it remains in 100s of feet.
Select an altitude with 100s of feet between 100 and 400ft. Change the interval selector to 1000s of feet. Turn the ALT selector knob to increase altitude, observe it increases the altitude to the next thousand. Repeat, but turn the ALT selector knob to decrease altitude, observe the altitude is just rounded down.
Select an altitude with 100s of feet between 600 and 900ft. Change the interval selector to 1000s of feet. Turn the ALT selector knob to increase altitude, observe it increases the altitude to the next thousand. Repeat, but turn the ALT selector knob to decrease altitude, observe the altitude is rounded down.
Select an altitude with 100s of feet with 500ft (e.g. 1500ft). Change the interval selector to 1000s of feet. Turn the ALT selector knob to increase altitude, observe it increases the altitude to the next thousand. Repeat, but turn the ALT selector knob to decrease altitude, observe the altitude is rounded down.
General testing of other altitude selection behaviour, also check that the minimum selection of 100ft and maximum of 49000ft has been unaffected.
How to download the PR for QA
Every new commit to this PR will cause new A32NX and A380X artifacts to be created, built, and uploaded.