-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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(cdu): correct tmply fpln activation logic in airways page #9562
base: master
Are you sure you want to change the base?
fix(cdu): correct tmply fpln activation logic in airways page #9562
Conversation
mcdu.flightPlanService.startAirwayEntry(prevFpIndex, forPlan, inAlternate); | ||
} | ||
|
||
const targetPlan = mcdu.flightPlan(forPlan, inAlternate); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is targetPlan
different from currentPlan
? Will targetPlan
be a temporary plan?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They're the same thing; I originally was not declaring currentPlan
, and only declaring targetPlan
.
I ran into an issue where if I only assigned const targetPlan = mcdu.flightPlan...
once, either at the top or after the startAirwayEntry
then the respective results would be that either targetPlan.pendingAirways.thenAirway
would be undefined or if (!targetPlan.pendingAirways) {...}
would be undefined.
I'm pretty sure it's because const targetPlan = mcdu.flightPlan...
needs to be assigned after mcdu.flightPlanService.startAirwayEntry(prevFpIndex, forPlan, inAlternate);
or it won't pick up the new pending airway entry. At the same time though, if I don't assign mcdu.flightPlan
before doing if (!targetPlan.pendingAirways) {...}
then that if statement is undefined because targetPlan
is shadowed under mcdu.onLeftInput
and out of scope of mcdu.onRightInput
.
Of course, I can't use the same variable name twice here if I'm reassigning, hence the two different names, and I'm admittedly not seeing a way of preserving the logic without redeclaring the variable.
Summary of Changes
Extension of #9148
The airways page now only creates a tmpy fpln after a valid segment is entered; either an airway and a terminating waypoint, or an airway followed by an intersecting airway. Prior to either of these two conditions being met, there is no pending flight plan, and pressing return will not result in a false tmpy state on the fpln page.
Screenshots (if necessary)
References
Additional context
While troubleshooting this issue, I discovered bugs #9560 and #9561, but as it stands this PR only fixes the tmpy fpln activation logic. Those bugs can be addressed in a separate PR.
Discord username (if different from GitHub):
robeet
Testing instructions
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.