Skip to content

Commit

Permalink
Support airways revision on SEC plan
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjozork committed Jul 15, 2023
1 parent 84e1298 commit c31449b
Showing 1 changed file with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ class A320_Neo_CDU_AirwaysFromWaypointPage {
mcdu.clearDisplay();
mcdu.page.Current = mcdu.page.AirwaysFromWaypointPage;

/** @type {FlightPlan} */
const targetPlan = mcdu.flightPlan(forPlan, inAlternate);
const waypoint = targetPlan.legElementAt(reviseIndex);

const fpIsSec = forPlan >= Fmgc.FlightPlanIndex.FirstSecondary;
const fpIsTmpy = forPlan === Fmgc.FlightPlanIndex.Active && mcdu.flightPlanService.hasTemporary;

let prevIcao = waypoint.definition.waypoint.databaseId;
Expand All @@ -21,9 +24,25 @@ class A320_Neo_CDU_AirwaysFromWaypointPage {
const rows = [["----"], [""], [""], [""], [""]];
const subRows = [["VIA", ""], [""], [""], [""], [""]];
const allRows = lastIndex ? A320_Neo_CDU_AirwaysFromWaypointPage._GetAllRows(targetPlan) : [];

let rowBottomLine = ["<RETURN"];
mcdu.onLeftInput[5] = () => {
targetPlan.pendingAirways = undefined;

CDULateralRevisionPage.ShowPage(mcdu, targetPlan.elementAt(reviseIndex), reviseIndex, forPlan, inAlternate);
};

if (fpIsSec && targetPlan.pendingAirways && targetPlan.pendingAirways.elements.length > 0) {
rowBottomLine = ["<RETURN", "INSERT*[color]cyan"];

if (fpIsTmpy) {
mcdu.onRightInput[5] = async () => {
targetPlan.pendingAirways.finalize(); // TODO replace with fps call (fms-v2)

mcdu.updateConstraints();

CDUFlightPlanPage.ShowPage(mcdu, 0, forPlan);
};
} else if (fpIsTmpy && targetPlan.pendingAirways && targetPlan.pendingAirways.elements.length > 0) {
rowBottomLine = ["{ERASE[color]amber", "INSERT*[color]amber"];

mcdu.onLeftInput[5] = async () => {
Expand Down

0 comments on commit c31449b

Please sign in to comment.