Skip to content

Commit

Permalink
feat(rmp): RMP navigation tuning (flybywiresim#7241)
Browse files Browse the repository at this point in the history
* fix: RMP behavior and lights [issue 344]

* Update src/instruments/src/EWD/elements/PseudoFWC.tsx

Requested changes

Co-authored-by: Benedict Etzel <[email protected]>

* Update src/instruments/src/Common/EWDMessages.tsx

Requested changes: code and VHF3 VOICE format

Co-authored-by: Benedict Etzel <[email protected]>

* Update src/instruments/src/EWD/elements/PseudoFWC.tsx

Requested changes: code VHF3 voice

Co-authored-by: Benedict Etzel <[email protected]>

* Update src/instruments/src/EWD/elements/PseudoFWC.tsx

Requested changes: code VHF3 voice

Co-authored-by: Benedict Etzel <[email protected]>

* Update RadioPanelDisplay.tsx

Requested changes: textDataModeVHF3 to TEXT_DATA_MODE_VHF3

* Fix bug with ANN LT involved

* Added comments about commented out code

* Fix RMPs elec buses

* add of SEL word backlight

* Default init of transmit and volume buttons

* fix SEL light behavior

* fix SEL light behavior #2

* Removal of commented out code

* SEL backlight code

* VOR, ILS, ADF tunable. MLS missing. Logic with NAV button

* Add of files

* ILS standby frequency to active

* Instruments knobs are now pushable

* VORs ident

* Fix due to double comment in the xml

* MKR ident

* ADF ident

* RADNAV page blank once NAV button pushed

* AUTO/MAN/RMP status in Navaids page

* Fix switch between NAV backup and radio tuning

* VOICE button

* fix: inhibit auto-tuning

* Changelog

* Changelog

* NAV 1/2 ADF 1 default volume set to 0

* NAV 3/4 ADF 2 (not existing yet) default volume set to 0

* Fix ILS and default values

* ILS/MLS DME distance not displayed if RMP tuned

* Display of M/R if manual/rmp tuned

* Display of M/R if manual/rmp tuned

* Revert "Display of M/R if manual/rmp tuned"

This reverts commit ec363f6.

* Reset of all nav frequencies when RMP tuning is cancelled

* Removal of MLS + somes fixes for ADF and tuning based on real life

* Change of default course value

* Removal of useless code

* Fix of display flickering when switching between ADF and VOR/ILS

* ILS/MLS volume knobs + fix

* Management greatest volume within pair of knobs

* Fix previous commit

* Fix previous commit

* Revert "Revert commit by mistake"

This reverts commit 556f5ac.

* Removal of useless newlines

* Table separator

* Merge similar simvars as requested

* French tooltips for knobs and voice button

* Use of default tooltips + update homemade ones + english tooltips

* Use of default tooltips + update homemade ones + english tooltips

* Revert "Revert commit pushed my mistake"

This reverts commit d61e0d5.

* Dim light

* ILS tunable only if both RMPs in nav backup mode. FCOM compliant

* Back to frequency mode when switching between receivers

* Fix for vPilot

* Changelog update

Removal of useless changelogs

* Changelog from 0.4.0 to 0.9.0 as requested

From 0.4.0 to 0.8.0 for another one

* Fix COM3 Transmit + it is now possible to transmit on no COM

* Fix knob animation

* Revert "Merge branch 'RMP_fix_behavior_lights'"

This reverts commit b21b690, reversing
changes made to b71ebfb.

* Reorder Changelog

* Fix simvars when switching between CALLS p/b

* Comment

* MLS disabled

* Fix bad merge

* Fix bad merge

* A32NX_RMP_ILS_MLS_TUNED to A32NX_RMP_ILS_TUNED

* Update a320-simvars.md

* Fix for vPilot

* Comment

* Inhibit at low altitude

* Knobs lights

* Revert on Rust files due to bad merge

* Copy changelog from master and add of my line

* Fix ILS tuning

* Comment

* Comment

* Fix knobs lit when cold & dark

Co-authored-by: Benedict Etzel <[email protected]>
Co-authored-by: Michael Corcoran <[email protected]>
Co-authored-by: Saschl <[email protected]>
Co-authored-by: Benjamin Dupont <[email protected]>
  • Loading branch information
5 people authored Dec 29, 2022
1 parent 248fe73 commit 07f20ce
Show file tree
Hide file tree
Showing 23 changed files with 1,173 additions and 316 deletions.
1 change: 1 addition & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
1. [HYD] Simple temperature simulation - @Crocket63 (crocket)
1. [FLIGHTMODEL] Reduced flap induced drag - @donstim (donbikes#4084)
1. [EFB] Fix and improve pushback system and add API documentation - @frankkopp (Frank Kopp)
1. [RMP] RMPs navigation backup - Julian Sebline (Julian Sebline#8476 on Discord)

## 0.9.0

Expand Down
49 changes: 49 additions & 0 deletions docs/a320-simvars.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,10 @@
- Number
- The current mode of the right radio management panel.

- A32NX_RMP_{L,R}_NAV_BUTTON_SELECTED
- Bool
- Whether the NAV push button on the corresponding RMP is pushed or not.

- A32NX_RMP_L_VHF2_STANDBY
- Hz
- The VHF 2 standby frequency for the left RMP.
Expand All @@ -408,6 +412,42 @@
- Hz
- The VHF 3 standby frequency for the right RMP.

- A32NX_RMP_{L,R}_SAVED_ACTIVE_FREQUENCY_VOR
- Hz
- The VOR active frequency that is saved for display for the left/right RMP.

- A32NX_RMP_{L,R}_SAVED_ACTIVE_FREQUENCY_ILS
- Hz
- The ILS active frequency that is saved for display for the left/right RMP.

- A32NX_RMP_{L,R}_SAVED_ACTIVE_FREQUENCY_ADF
- Hz
- The ADF active frequency that is saved for display for the left/right RMP.

- A32NX_RMP_{L,R}_SAVED_STANDBY_FREQUENCY_VOR
- Hz
- The VOR standby frequency that is saved for display for the left/right RMP.

- A32NX_RMP_{L,R}_SAVED_STANDBY_FREQUENCY_ILS
- Hz
- The ILS standby frequency that is saved for display for the left/right RMP.

- A32NX_RMP_{L,R}_SAVED_STANDBY_FREQUENCY_ADF
- Hz
- The ADF standby frequency that is saved for display for the left/right RMP.

- A32NX_RMP_{L,R}_SAVED_COURSE_VOR
- Number
- The VOR course tuned via the left/right RMP

- A32NX_RMP_{L,R}_SAVED_COURSE_ILS
- Number
- The ILS course tuned via the left/right RMP

- A32NX_RMP_ILS_TUNED
- Bool
- If the ILS is tuned via the RMP

- A32NX_TO_CONFIG_FLAPS_ENTERED
- Bool
- True if the pilot has entered a FLAPS value in the PERF TAKE OFF takeoff
Expand Down Expand Up @@ -1047,6 +1087,15 @@
GOAROUND | 6
DONE | 7

- A32NX_FMGC_RADIONAV_TUNING_MODE
- Enum
- Hold the FMGCs current tuning mode
Value | Meaning
--- | ---
0 | AUTO
1 | MANUAL
2 | REMOTE VIA RMPs

- A32NX_FLAPS_HANDLE_INDEX
- Number
- Indicates the physical flaps handle position
Expand Down
339 changes: 337 additions & 2 deletions flybywire-aircraft-a320-neo/ModelBehaviorDefs/A32NX/AirlinerCommon.xml

Large diffs are not rendered by default.

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions flybywire-aircraft-a320-neo/en-US.locPak
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@
"COCKPIT.TOOLTIPS.LIGHTING_KNOB_L_PFD_INCREASE": "Increase left PFD brightness",
"COCKPIT.TOOLTIPS.LIGHTING_KNOB_R_PFD_DECREASE": "Decrease right PFD brightness",
"COCKPIT.TOOLTIPS.LIGHTING_KNOB_R_PFD_INCREASE": "Increase right PFD brightness",
"COCKPIT.TOOLTIPS.NAV_PUSHBUTTON_VOICE_OFF": "Allow morse ident",
"COCKPIT.TOOLTIPS.NAV_PUSHBUTTON_VOICE_ON": "Inhibit morse ident",
"COCKPIT.TOOLTIPS.NAV_KNOB_MARKERS_VOLUME_INCREASE": "Increase the volume of the ident of the Markers beacons",
"COCKPIT.TOOLTIPS.NAV_KNOB_MARKERS_VOLUME_DECREASE": "Decrease the volume of the ident of the Markers beacons",
"COCKPIT.TOOLTIPS.NAV_KNOB_MARKERS_IDENT_ENABLE": "Turn on the ident of the Markers beacons",
"COCKPIT.TOOLTIPS.NAV_KNOB_MARKERS_IDENT_DISABLE": "Turn off the ident of the Markers beacons",
"COCKPIT.TOOLTIPS.NAV_KNOB_ILS_VOLUME_INCREASE": "Increase the volume of the ident of the ILS",
"COCKPIT.TOOLTIPS.NAV_KNOB_ILS_VOLUME_DECREASE": "Decrease the volume of the ident of the ILS",
"COCKPIT.TOOLTIPS.NAV_KNOB_ILS_IDENT_ENABLE": "Turn on the ident of the ILS",
"COCKPIT.TOOLTIPS.NAV_KNOB_ILS_IDENT_DISABLE": "Turn off the ident of the ILS",
"COCKPIT.TOOLTIPS.LIGHTS_NOSMOKE_AUTO": "Set \"no smoke\" prompt light to AUTO",
"COCKPIT.TOOLTIPS.APU_AVAILABLE": "APU available",
"A32NX.LOADING.TIPS.A320NEO_001": "The FlyByWire A32NX is a collaboration between hundreds of individual contributors.",
Expand Down
10 changes: 10 additions & 0 deletions flybywire-aircraft-a320-neo/fr-FR.locPak
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@
"COCKPIT.TOOLTIPS.LIGHTING_KNOB_L_PFD_INCREASE": "Augmenter la luminosité du PFD gauche",
"COCKPIT.TOOLTIPS.LIGHTING_KNOB_R_PFD_DECREASE": "Réduire la luminosité du PDF droit",
"COCKPIT.TOOLTIPS.LIGHTING_KNOB_R_PFD_INCREASE": "Augmenter la luminosité du PDF droit",
"COCKPIT.TOOLTIPS.NAV_PUSHBUTTON_VOICE_OFF": "Autoriser l'identification morse",
"COCKPIT.TOOLTIPS.NAV_PUSHBUTTON_VOICE_ON": "Inhiber l'identification morse",
"COCKPIT.TOOLTIPS.NAV_KNOB_MARKERS_VOLUME_INCREASE": "Augmenter le volume de l'identification des balises Markers",
"COCKPIT.TOOLTIPS.NAV_KNOB_MARKERS_VOLUME_DECREASE": "Diminuer le volume de l'identification des balises Marker",
"COCKPIT.TOOLTIPS.NAV_KNOB_MARKERS_IDENT_ENABLE": "Activer l'identification des balises Markers",
"COCKPIT.TOOLTIPS.NAV_KNOB_MARKERS_IDENT_DISABLE": "Désactiver l'identification des balises Markers",
"COCKPIT.TOOLTIPS.NAV_KNOB_ILS_VOLUME_INCREASE": "Augmenter le volume de l'identification de l'ILS",
"COCKPIT.TOOLTIPS.NAV_KNOB_ILS_VOLUME_DECREASE": "Diminuer le volume de l'identification de l'ILS",
"COCKPIT.TOOLTIPS.NAV_KNOB_ILS_IDENT_ENABLE": "Activer l'identification de l'ILS",
"COCKPIT.TOOLTIPS.NAV_KNOB_ILS_IDENT_DISABLE": "Désactiver l'identification de l'ILS",
"COCKPIT.TOOLTIPS.LIGHTS_NOSMOKE_AUTO": "Mettre le témoin d'interdiction de fumer en mode AUTO",
"A32NX.LOADING.TIPS.A320NEO_001": "Le FlyByWire A32NX est le fruit d'une collaboration entre des centaines de contributeurs individuels.",
"A32NX.LOADING.TIPS.A320NEO_002": "Le saviez-vous ? L'A320 peut atterrir par vent de travers jusqu'à 38 nœuds et avec un vent arrière jusqu'à 15 nœuds !",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ class CDUNavRadioPage {
mcdu.returnPageCallback = () => {
CDUNavRadioPage.ShowPage(mcdu);
};

const radioOn = mcdu.isRadioNavActive();
let vor1FrequencyCell = "";
let vor1CourseCell = "";
let ilsFrequencyCell = "";
let ilsCourseCell = "[ ]";
let ilsCourseCell = "";
let adf1FrequencyCell = "";
let adf1BfoOption = "";
let vor2FrequencyCell = "";
Expand All @@ -29,15 +30,24 @@ class CDUNavRadioPage {
}, mcdu.PageTimeout.Default);

if (!radioOn) {
vor1FrequencyCell = "[\xa0]/[\xa0\xa0.\xa0]";
const vor1Beacon = mcdu.radioNav.getVORBeacon(1);
const vor1Ident = vor1Beacon && vor1Beacon.ident.length >= 2 && vor1Beacon.ident.length <= 3 ? vor1Beacon.ident : "";
if (mcdu.vor1Frequency && !mcdu.vor1IdIsPilotEntered && mcdu.vor1FreqIsPilotEntered) {
vor1FrequencyCell = "{small}" + vor1Ident.padStart(3, "\xa0") + "{end}" + "/" + mcdu.vor1Frequency.toFixed(2);
} else if (mcdu.vor1Frequency && mcdu.vor1IdIsPilotEntered && !mcdu.vor1FreqIsPilotEntered) {
vor1FrequencyCell = mcdu.vor1IdPilotValue.padStart(3, "\xa0") + "/" + "{small}" + mcdu.vor1Frequency.toFixed(2) + "{end}";
if (!mcdu.backupNavTuning) {
vor1FrequencyCell = "[\xa0]/[\xa0\xa0.\xa0]";
const vor1Beacon = mcdu.radioNav.getVORBeacon(1);
const vor1Ident = vor1Beacon && vor1Beacon.ident.length >= 2 && vor1Beacon.ident.length <= 3 ? vor1Beacon.ident : "";
if (mcdu.vor1Frequency && !mcdu.vor1IdIsPilotEntered && mcdu.vor1FreqIsPilotEntered) {
vor1FrequencyCell = "{small}" + vor1Ident.padStart(3, "\xa0") + "{end}" + "/" + mcdu.vor1Frequency.toFixed(2);
} else if (mcdu.vor1Frequency && mcdu.vor1IdIsPilotEntered && !mcdu.vor1FreqIsPilotEntered) {
vor1FrequencyCell = mcdu.vor1IdPilotValue.padStart(3, "\xa0") + "/" + "{small}" + mcdu.vor1Frequency.toFixed(2) + "{end}";
}
}

mcdu.onLeftInput[0] = (value, scratchpadCallback) => {
if (mcdu.backupNavTuning) {
mcdu.setScratchpadMessage(NXSystemMessages.notAllowed);
scratchpadCallback();
return false;
}

const numValue = parseFloat(value);
if (value === FMCMainDisplay.clrValue) {
mcdu.vor1FreqIsPilotEntered = false;
Expand Down Expand Up @@ -97,11 +107,19 @@ class CDUNavRadioPage {
scratchpadCallback();
}
};
vor1CourseCell = "[\xa0]";
if (mcdu.vor1Course > 0) {
vor1CourseCell = mcdu.vor1Course.toFixed(0).padStart(3, "0");
if (!mcdu.backupNavTuning) {
vor1CourseCell = "[\xa0]";
if (mcdu.vor1Course > 0) {
vor1CourseCell = mcdu.vor1Course.toFixed(0).padStart(3, "0");
}
}
mcdu.onLeftInput[1] = (value, scratchpadCallback) => {
if (mcdu.backupNavTuning) {
mcdu.setScratchpadMessage(NXSystemMessages.notAllowed);
scratchpadCallback();
return false;
}

const numValue = parseFloat(value);
if (isFinite(numValue) && numValue > 0 && numValue <= 360) {
SimVar.SetSimVarValue("K:VOR1_SET", "number", numValue).then(() => {
Expand All @@ -118,26 +136,31 @@ class CDUNavRadioPage {
scratchpadCallback();
}
};
ilsFrequencyCell = "[\xa0\xa0]/[\xa0\xa0.\xa0]";
if (mcdu.ilsFrequency != 0) {
if (mcdu._ilsFrequencyPilotEntered) {
const ilsIdent = mcdu.radioNav.getILSBeacon(1);
ilsFrequencyCell = `{small}${ilsIdent.ident.trim().padStart(4, "\xa0")}{end}/${mcdu.ilsFrequency.toFixed(2)}`;
} else if (mcdu._ilsIdentPilotEntered) {
ilsFrequencyCell = `${mcdu._ilsIdent.trim().padStart(4, "\xa0")}/{small}${mcdu.ilsFrequency.toFixed(2)}{end}`;
} else if (mcdu.ilsAutoTuned) {
ilsFrequencyCell = `{small}${mcdu.ilsAutoIdent.padStart(4, "\xa0")}/${mcdu.ilsFrequency.toFixed(2)}{end}`;
}

const lsCourse = SimVar.GetSimVarValue('L:A32NX_FM_LS_COURSE', 'number');
if (lsCourse >= 0) {
ilsCourseCell = `{${mcdu.ilsCourse !== undefined ? 'big' : 'small'}}F${lsCourse.toFixed(0).padStart(3, "0")}{end}`;
} else if (mcdu._ilsFrequencyPilotEntered) {
ilsCourseCell = "{amber}____{end}";
if (!mcdu.backupNavTuning) {
ilsFrequencyCell = "[\xa0\xa0]/[\xa0\xa0.\xa0]";
if (mcdu.ilsFrequency != 0) {
if (mcdu._ilsFrequencyPilotEntered) {
const ilsIdent = mcdu.radioNav.getILSBeacon(1);
ilsFrequencyCell = `{small}${ilsIdent.ident.trim().padStart(4, "\xa0")}{end}/${mcdu.ilsFrequency.toFixed(2)}`;
} else if (mcdu._ilsIdentPilotEntered) {
ilsFrequencyCell = `${mcdu._ilsIdent.trim().padStart(4, "\xa0")}/{small}${mcdu.ilsFrequency.toFixed(2)}{end}`;
} else if (mcdu.ilsAutoTuned) {
ilsFrequencyCell = `{small}${mcdu.ilsAutoIdent.padStart(4, "\xa0")}/${mcdu.ilsFrequency.toFixed(2)}{end}`;
}

const lsCourse = SimVar.GetSimVarValue('L:A32NX_FM_LS_COURSE', 'number');
ilsCourseCell = "[\xa0]";
if (lsCourse >= 0) {
ilsCourseCell = `{${mcdu.ilsCourse !== undefined ? 'big' : 'small'}}F${lsCourse.toFixed(0).padStart(3, "0")}{end}`;
} else if (mcdu._ilsFrequencyPilotEntered) {
ilsCourseCell = "{amber}____{end}";
}
}
}

mcdu.onLeftInput[2] = (value, scratchpadCallback) => {
mcdu.setIlsFrequency(value, (result) => {
mcdu.setIlsFrequency(value, mcdu.backupNavTuning, (result) => {
if (result) {
mcdu.requestCall(() => {
CDUNavRadioPage.ShowPage(mcdu);
Expand All @@ -148,7 +171,7 @@ class CDUNavRadioPage {
});
};
mcdu.onLeftInput[3] = (value, scratchpadCallback) => {
mcdu.setLsCourse(value, (result) => {
mcdu.setLsCourse(value, mcdu.backupNavTuning, (result) => {
if (result) {
mcdu.requestCall(() => {
CDUNavRadioPage.ShowPage(mcdu);
Expand All @@ -158,16 +181,25 @@ class CDUNavRadioPage {
}
});
};
adf1FrequencyCell = "[\xa0]/[\xa0\xa0\xa0.]";
const adf1Ident = SimVar.GetSimVarValue(`ADF IDENT:1`, "string");
if (mcdu.adf1Frequency != 0 && !mcdu.adf1IdIsPilotEntered && mcdu.adf1FreqIsPilotEntered) {
adf1FrequencyCell = "{small}" + adf1Ident.padStart(3, "\xa0") + "{end}" + "/" + mcdu.adf1Frequency.toFixed(1);
adf1BfoOption = "<ADF1 BFO";
} else if (mcdu.adf1Frequency != 0 && mcdu.adf1IdIsPilotEntered && !mcdu.adf1FreqIsPilotEntered) {
adf1FrequencyCell = mcdu.adf1IdPilotValue.padStart(3, "\xa0") + "/" + "{small}" + mcdu.adf1Frequency.toFixed(1) + "{end}";
adf1BfoOption = "<ADF1 BFO";

if (!mcdu.backupNavTuning) {
adf1FrequencyCell = "[\xa0]/[\xa0\xa0\xa0.]";
const adf1Ident = SimVar.GetSimVarValue(`ADF IDENT:1`, "string");
if (mcdu.adf1Frequency != 0 && !mcdu.adf1IdIsPilotEntered && mcdu.adf1FreqIsPilotEntered) {
adf1FrequencyCell = "{small}" + adf1Ident.padStart(3, "\xa0") + "{end}" + "/" + mcdu.adf1Frequency.toFixed(1);
adf1BfoOption = "<ADF1 BFO";
} else if (mcdu.adf1Frequency != 0 && mcdu.adf1IdIsPilotEntered && !mcdu.adf1FreqIsPilotEntered) {
adf1FrequencyCell = mcdu.adf1IdPilotValue.padStart(3, "\xa0") + "/" + "{small}" + mcdu.adf1Frequency.toFixed(1) + "{end}";
adf1BfoOption = "<ADF1 BFO";
}
}
mcdu.onLeftInput[4] = (value, scratchpadCallback) => {
if (mcdu.backupNavTuning) {
mcdu.setScratchpadMessage(NXSystemMessages.notAllowed);
scratchpadCallback();
return false;
}

const numValue = parseFloat(value);
if (!isFinite(numValue) && value.length >= 2 && value.length <= 3) {
mcdu.getOrSelectNDBsByIdent(value, (navaids) => {
Expand Down Expand Up @@ -218,15 +250,24 @@ class CDUNavRadioPage {
}

if (!radioOn) {
vor2FrequencyCell = "[\xa0\xa0.\xa0]/[\xa0]";
const vor2Beacon = mcdu.radioNav.getVORBeacon(2);
const vor2Ident = vor2Beacon && vor2Beacon.ident.length >= 2 && vor2Beacon.ident.length <= 3 ? vor2Beacon.ident : "";
if (mcdu.vor2Frequency != 0 && mcdu.vor2FreqIsPilotEntered && !mcdu.vor2IdIsPilotEntered) {
vor2FrequencyCell = mcdu.vor2Frequency.toFixed(2) + "/" + "{small}" + vor2Ident.padEnd(3, "\xa0") + "{end}";
} else if (mcdu.vor2Frequency != 0 && !mcdu.vor2FreqIsPilotEntered && mcdu.vor2IdIsPilotEntered) {
vor2FrequencyCell = "{small}" + mcdu.vor2Frequency.toFixed(2) + "{end}" + "/" + mcdu.vor2IdPilotValue.padEnd(3, "\xa0");
if (!mcdu.backupNavTuning) {
vor2FrequencyCell = "[\xa0\xa0.\xa0]/[\xa0]";
const vor2Beacon = mcdu.radioNav.getVORBeacon(2);
const vor2Ident = vor2Beacon && vor2Beacon.ident.length >= 2 && vor2Beacon.ident.length <= 3 ? vor2Beacon.ident : "";
if (mcdu.vor2Frequency != 0 && mcdu.vor2FreqIsPilotEntered && !mcdu.vor2IdIsPilotEntered) {
vor2FrequencyCell = mcdu.vor2Frequency.toFixed(2) + "/" + "{small}" + vor2Ident.padEnd(3, "\xa0") + "{end}";
} else if (mcdu.vor2Frequency != 0 && !mcdu.vor2FreqIsPilotEntered && mcdu.vor2IdIsPilotEntered) {
vor2FrequencyCell = "{small}" + mcdu.vor2Frequency.toFixed(2) + "{end}" + "/" + mcdu.vor2IdPilotValue.padEnd(3, "\xa0");
}
}

mcdu.onRightInput[0] = (value, scratchpadCallback) => {
if (mcdu.backupNavTuning) {
mcdu.setScratchpadMessage(NXSystemMessages.notAllowed);
scratchpadCallback();
return false;
}

const numValue = parseFloat(value);
if (value === FMCMainDisplay.clrValue) {
mcdu.vor2FreqIsPilotEntered = false;
Expand Down Expand Up @@ -286,11 +327,20 @@ class CDUNavRadioPage {
scratchpadCallback();
}
};
vor2CourseCell = "[\xa0]";
if (mcdu.vor2Course > 0) {
vor2CourseCell = mcdu.vor2Course.toFixed(0).padStart(3, "0");

if (!mcdu.backupNavTuning) {
vor2CourseCell = "[\xa0]";
if (mcdu.vor2Course > 0) {
vor2CourseCell = mcdu.vor2Course.toFixed(0).padStart(3, "0");
}
}
mcdu.onRightInput[1] = (value, scratchpadCallback) => {
if (mcdu.backupNavTuning) {
mcdu.setScratchpadMessage(NXSystemMessages.notAllowed);
scratchpadCallback();
return false;
}

const numValue = parseFloat(value);
if (isFinite(numValue) && numValue > 0 && numValue <= 360) {
SimVar.SetSimVarValue("K:VOR2_SET", "number", numValue).then(() => {
Expand All @@ -307,16 +357,25 @@ class CDUNavRadioPage {
scratchpadCallback();
}
};
adf2FrequencyCell = "[\xa0\xa0\xa0.]/[\xa0]";
const adf2Ident = SimVar.GetSimVarValue(`ADF IDENT:2`, "string");
if (mcdu.adf2Frequency > 0 && mcdu.adf2FreqIsPilotEntered && !mcdu.adf2IdIsPilotEntered) {
adf2FrequencyCell = mcdu.adf2Frequency.toFixed(1) + "/" + "{small}" + adf2Ident.padEnd(3, "\xa0") + "{end}";
adf2BfoOption = "ADF2 BFO>";
} else if (mcdu.adf2Frequency > 0 && !mcdu.adf2FreqIsPilotEntered && mcdu.adf2IdIsPilotEntered) {
adf2FrequencyCell = "{small}" + mcdu.adf2Frequency.toFixed(1) + "{end}" + "/" + mcdu.adf2IdPilotValue.padEnd(3, "\xa0");
adf2BfoOption = "ADF2 BFO>";

if (!mcdu.backupNavTuning) {
adf2FrequencyCell = "[\xa0\xa0\xa0.]/[\xa0]";
const adf2Ident = SimVar.GetSimVarValue(`ADF IDENT:2`, "string");
if (mcdu.adf2Frequency > 0 && mcdu.adf2FreqIsPilotEntered && !mcdu.adf2IdIsPilotEntered) {
adf2FrequencyCell = mcdu.adf2Frequency.toFixed(1) + "/" + "{small}" + adf2Ident.padEnd(3, "\xa0") + "{end}";
adf2BfoOption = "ADF2 BFO>";
} else if (mcdu.adf2Frequency > 0 && !mcdu.adf2FreqIsPilotEntered && mcdu.adf2IdIsPilotEntered) {
adf2FrequencyCell = "{small}" + mcdu.adf2Frequency.toFixed(1) + "{end}" + "/" + mcdu.adf2IdPilotValue.padEnd(3, "\xa0");
adf2BfoOption = "ADF2 BFO>";
}
}
mcdu.onRightInput[4] = (value, scratchpadCallback) => {
if (mcdu.backupNavTuning) {
mcdu.setScratchpadMessage(NXSystemMessages.notAllowed);
scratchpadCallback();
return false;
}

const numValue = parseFloat(value);
if (!isFinite(numValue) && value.length >= 2 && value.length <= 3) {
mcdu.adf2FreqIsPilotEntered = false;
Expand Down
Loading

0 comments on commit 07f20ce

Please sign in to comment.