Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #746 from Working-Title-MSFS-Mods/features/cj4-holds
Browse files Browse the repository at this point in the history
CJ4: Holds
  • Loading branch information
cwburnett authored Jan 1, 2021
2 parents ccaa43e + 8f62a9d commit 3acb8bb
Show file tree
Hide file tree
Showing 16 changed files with 1,748 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,19 @@ class Jet_MFD_NDInfo extends HTMLElement {
forceUpdate = true;
}

this.setWaypoint(Simplane.getNextWaypointName(), Math.round(Simplane.getNextWaypointTrack()), Simplane.getNextWaypointDistance(), Simplane.getNextWaypointETA(), forceUpdate);
const holdIndex = SimVar.GetSimVarValue('L:WT_NAV_HOLD_INDEX', 'number');
const holdFix = FlightPlanManager.DEBUG_INSTANCE.getFlightPlan(0).getWaypoint(holdIndex);
if (holdFix && holdFix.holdDetails) {
const waypointName = holdFix.ident;
const waypointTrack = holdFix.holdDetails.holdCourse;

const distance = SimVar.GetSimVarValue("L:WT_CJ4_WPT_DISTANCE", "number");
this.setWaypoint(waypointName, Math.round(waypointTrack), distance, Simplane.getNextWaypointETA(), forceUpdate);
}
else {
this.setWaypoint(Simplane.getNextWaypointName(), Math.round(Simplane.getNextWaypointTrack()), Simplane.getNextWaypointDistance(), Simplane.getNextWaypointETA(), forceUpdate);
}

this._previousNavMode = this._navMode;
}
setGroundSpeed(_speed, _force = false) {
Expand Down Expand Up @@ -699,7 +711,15 @@ class VORDMENavAid {
* @param {Jet_NDCompass_Navigation} parentNavMode The navigation mode of the parent PFD/MFD map.
*/
handleFMSModeUpdate(parentNavMode) {
const waypointName = Simplane.getNextWaypointName();

let waypointName = Simplane.getNextWaypointName();

const holdIndex = SimVar.GetSimVarValue('L:WT_NAV_HOLD_INDEX', 'number');
const holdFix = FlightPlanManager.DEBUG_INSTANCE.getFlightPlan(0).getWaypoint(holdIndex);
if (holdFix && holdFix.holdDetails) {
waypointName = holdFix.ident;
}

const hasNav = waypointName !== null && waypointName !== undefined && waypointName !== '';

if (this.hasNav !== hasNav) {
Expand All @@ -708,8 +728,14 @@ class VORDMENavAid {
}

let hideDistance = parentNavMode === Jet_NDCompass_Navigation.NAV;
this.setDistanceValue(hideDistance ? 0 : Simplane.getNextWaypointDistance());

if (holdFix && holdFix.holdDetails) {
this.setDistanceValue(hideDistance ? 0 : SimVar.GetSimVarValue("L:WT_CJ4_WPT_DISTANCE", "number"));
}
else {
this.setDistanceValue(hideDistance ? 0 : Simplane.getNextWaypointDistance());
}

if (hasNav) {
const waypointBearing = Simplane.getNextWaypointTrack();
const planeHeading = Simplane.getHeadingMagnetic();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
<script type="text/html" import-script="/Pages/VCockpit/Instruments/Airliners/CJ4/FMC/WT_FMC_Renderer.js"></script>
<script type="text/html" import-script="/Pages/VCockpit/Instruments/Airliners/CJ4/Shared/Autopilot/CJ4NavModeSelector.js"></script>
<script type="text/html" import-script="/Pages/VCockpit/Instruments/Airliners/CJ4/Shared/Autopilot/WT_BaseVnav.js"></script>
<script type="text/html" import-script="/Pages/VCockpit/Instruments/Airliners/CJ4/Shared/Autopilot/AutopilotMath.js"></script>
<script type="text/html" import-script="/Pages/VCockpit/Instruments/Airliners/CJ4/Shared/Autopilot/HoldsDirector.js"></script>
<script type="text/html" import-script="/Pages/VCockpit/Instruments/Airliners/CJ4/Shared/Autopilot/WT_BaseLnav.js"></script>
<script type="text/html" import-script="/Pages/VCockpit/Instruments/Airliners/CJ4/Shared/Autopilot/WT_VnavAutopilot.js"></script>

Expand All @@ -55,6 +57,7 @@
<script type="text/html" import-script="/Pages/VCockpit/Instruments/Airliners/CJ4/FMC/CJ4_FMC_NavRadioPage.js"></script>
<script type="text/html" import-script="/Pages/VCockpit/Instruments/Airliners/CJ4/FMC/CJ4_FMC_FMCCommPage.js"></script>
<script type="text/html" import-script="/Pages/VCockpit/Instruments/Airliners/CJ4/FMC/CJ4_FMC_LegsPage.js"></script>
<script type="text/html" import-script="/Pages/VCockpit/Instruments/Airliners/CJ4/FMC/CJ4_FMC_HoldsPage.js"></script>
<script type="text/html" import-script="/Pages/VCockpit/Instruments/Airliners/CJ4/FMC/CJ4_FMC_DsplMenuPage.js"></script>
<script type="text/html" import-script="/Pages/VCockpit/Instruments/Airliners/CJ4/FMC/CJ4_FMC_MfdAdvPage.js"></script>
<script type="text/html" import-script="/Pages/VCockpit/Instruments/Airliners/CJ4/FMC/CJ4_FMC_SelectWptPage.js"></script>
Expand Down
Loading

0 comments on commit 3acb8bb

Please sign in to comment.