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(cdu): correct tmply fpln activation logic in airways page #9562

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

robertxing2004
Copy link
Contributor

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

  1. Spawn anywhere and start a fpln from the mcdu
  2. After entering a STAR and transition, enter the airways page and make modifications
  3. Verify that there is no option to erase or insert until a terminating waypoint or intersecting airway has been entered
  4. Returning any time before the above two conditions should not create a tmpy fpln

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.

  1. Make sure you are signed in to GitHub
  2. Click on the Checks tab on the PR
  3. On the left side, find and click on the PR Build tab
  4. Click on either flybywire-aircraft-a320-neo, flybywire-aircraft-a380-842 (4K) or flybywire-aircraft-a380-842 (8K) download link at the bottom of the page

@2hwk 2hwk added A32NX Related to the A32NX aircraft Needs Changelog Needs Code Review labels Nov 21, 2024
@2hwk 2hwk added this to the v0.13.0 milestone Nov 21, 2024
mcdu.flightPlanService.startAirwayEntry(prevFpIndex, forPlan, inAlternate);
}

const targetPlan = mcdu.flightPlan(forPlan, inAlternate);
Copy link
Member

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?

Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 🟡 Code Review: Ready for Review
Development

Successfully merging this pull request may close these issues.

3 participants