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

feat(a32nx/fms): add h4 db swap confirm #9802

Merged
merged 5 commits into from
Feb 1, 2025
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
1. [A32NX/FMS] Add terminal area database holds for MSFS2024 - @tracernz (Mike)
1. [EFB] Set EFB Auto Brightness to default to On - @MrJigs7 (MrJigs)
1. [FMS] Allow airport to be loaded as fixes in instrument procedures - @tracernz (Mike)
1. [A32NX/FMS] Added nav database swap confirmation - @tracernz (Mike)

## 0.12.0

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The following aircraft configurations are currently simulated or targeted:
Model A320-251N
Engine CFM LEAP 1A-26
APU APS3200
FMS Honeywell Release H3
FMS Honeywell Release H4
FWC Std. H2F13
RA Honeywell ALA-52B
TAWS Honeywell EGPWS
Expand Down Expand Up @@ -67,7 +67,7 @@ Our [known issues](https://docs.flybywiresim.com/aircraft/support/known-issues/)

### What liveries are available?

Liveries for the A32NX can be found on [Flightsim.to](https://flightsim.to/c/liveries/flybywire-a32nx/).
Liveries for the A32NX can be found on [Flightsim.to](https://flightsim.to/c/liveries/flybywire-a32nx/).

Liveries for the A380X can be found on [Flightsim.to](https://flightsim.to/liveries/flybywire-a380x/).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ const DB_MONTHS = Object.freeze({
'12': "DEC"
});

// Honeywell H4+ feature only
const confirmDataBaseSwitch = false;

function calculateActiveDate(dbIdent) {
const effDay = dbIdent.effectiveFrom.substring(8);
const effMonth = dbIdent.effectiveFrom.substring(5, 7);
Expand All @@ -29,6 +26,13 @@ function calculateActiveDate(dbIdent) {
return `${effDay}${DB_MONTHS[effMonth]}-${expDay}${DB_MONTHS[expMonth]}`;
}

function calculateSecondDate(dbIdent) {
const [effYear, effMonth, effDay] = dbIdent.effectiveFrom.split('-');
const [expYear, expMonth, expDay] = dbIdent.effectiveTo.split('-');

return `${effDay}${DB_MONTHS[effMonth]}${effYear}-${expDay}${DB_MONTHS[expMonth]}${expYear}`;
}

async function switchDataBase(mcdu) {
await mcdu.switchNavDatabase();
}
Expand Down Expand Up @@ -96,40 +100,29 @@ class CDUIdentPage {
}

const dbCycle = mcdu.getNavDatabaseIdent();
const navCycleDates = dbCycle === null ? '' : calculateActiveDate(dbCycle);
const activeCycleDates = dbCycle === null ? '' : calculateActiveDate(dbCycle);
const secondCycleDates = dbCycle === null ? '' : calculateSecondDate(dbCycle);
const navSerial = dbCycle === null ? '' : `${dbCycle.provider.substring(0, 2).toUpperCase()}${dbCycle.airacCycle}0001`;

// H4+ only confirm prompt
if (confirmDataBaseSwitch) {
secondaryDBTopLine =
confirmType === ConfirmType.SwitchDataBase
? `{amber}{small}\xa0${navCycleDates}{end}`
: "\xa0SECOND\xa0NAV\xa0DATA\xa0BASE";
secondaryDBSubLine =
confirmType === ConfirmType.SwitchDataBase
? "{amber}{CANCEL\xa0\xa0\xa0\xa0SWAP\xa0CONFIRM*{end}"
: `{small}{cyan}{${navCycleDates}{end}{end}`;
} else {
secondaryDBTopLine = "\xa0SECOND\xa0NAV\xa0DATA\xa0BASE";
secondaryDBSubLine =
`{small}{cyan}{${navCycleDates}{end}{end}`;
}
// H4+ only confirm prompt + year on second dates
secondaryDBTopLine =
confirmType === ConfirmType.SwitchDataBase
? `{amber}{small}\xa0${secondCycleDates}{end}`
: "\xa0SECOND\xa0NAV\xa0DATA\xa0BASE";
secondaryDBSubLine =
confirmType === ConfirmType.SwitchDataBase
? "{amber}{CANCEL\xa0\xa0\xa0SWAP\xa0\xa0CONFIRM*{end}"
: `{small}{cyan}{${secondCycleDates}{end}{end}`;

mcdu.leftInputDelay[2] = () => {
return mcdu.getDelaySwitchPage();
};

mcdu.onLeftInput[2] = () => {
if (confirmDataBaseSwitch) {
if (confirmType === ConfirmType.SwitchDataBase) {
CDUIdentPage.ShowPage(mcdu);
} else {
CDUIdentPage.ShowPage(mcdu, ConfirmType.SwitchDataBase);
}
if (confirmType === ConfirmType.SwitchDataBase) {
CDUIdentPage.ShowPage(mcdu);
} else {
switchDataBase(mcdu).then(() => {
CDUIdentPage.ShowPage(mcdu);
});
CDUIdentPage.ShowPage(mcdu, ConfirmType.SwitchDataBase);
}
};

Expand All @@ -146,22 +139,22 @@ class CDUIdentPage {
};

mcdu.setTemplate([
["A320-200"], //This aircraft code is correct and does not include the engine type.
["A320-200\xa0\xa0\xa0\xa0"], //This aircraft code is correct and does not include the engine type.
["\xa0ENG"],
["LEAP-1A26[color]green"],
["\xa0ACTIVE NAV DATA BASE"],
[
`{cyan}\xa0${navCycleDates}{end}`,
`{cyan}\xa0${activeCycleDates}{end}`,
`{green}${navSerial}{end}`,
],
[secondaryDBTopLine],
[secondaryDBSubLine],
["", storedTitleCell],
["", storedRoutesRunwaysCell],
["CHG CODE", storedWaypointsNavaidsCell],
["{small}[ ]{end}[color]inop", storedDeleteCell],
["IDLE/PERF", "SOFTWARE"],
["+0.0/+0.0[color]green", "STATUS/XLOAD>[color]inop"],
["[\xa0][color]inop", storedDeleteCell],
["IDLE/PERF", "SOFTWARE\xa0\xa0"],
["{small}{green}+0.0/+0.0{end}{end}", "STATUS/XLOAD>[color]inop"],
]);
}
}
Loading