Skip to content

Commit

Permalink
Merge pull request #234 from 747-4EVER/Port-1.17.3.0
Browse files Browse the repository at this point in the history
Port 1.17.3.0
  • Loading branch information
747-4EVER authored Jun 28, 2021
2 parents 248033f + 9bcb815 commit 8b50afb
Show file tree
Hide file tree
Showing 9 changed files with 463 additions and 338 deletions.
539 changes: 278 additions & 261 deletions salty-747/SimObjects/Airplanes/Asobo_B747_8i/model/747_8I.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -1056,24 +1056,26 @@ class B747_8_FMC_MainDisplay extends Boeing_FMC {
Coherent.call("HEADING_BUG_SET", 2, this._headingHoldValue);
}
if (!this.flightPlanManager.isActiveApproach() && this.currentFlightPhase != FlightPhase.FLIGHT_PHASE_APPROACH) {
let activeWaypoint = this.flightPlanManager.getActiveWaypoint();
let nextActiveWaypoint = this.flightPlanManager.getNextActiveWaypoint();
if (activeWaypoint && nextActiveWaypoint) {
let pathAngle = nextActiveWaypoint.bearingInFP - activeWaypoint.bearingInFP;
while (pathAngle < 180) {
pathAngle += 360;
}
while (pathAngle > 180) {
pathAngle -= 360;
}
let absPathAngle = 180 - Math.abs(pathAngle);
let airspeed = Simplane.getIndicatedSpeed();
if (airspeed < 400) {
let turnRadius = airspeed * 360 / (1091 * 0.36 / airspeed) / 3600 / 2 / Math.PI;
let activateDistance = Math.pow(90 / absPathAngle, 1.6) * turnRadius * 1.2;
let distanceToActive = Avionics.Utils.computeGreatCircleDistance(planeCoordinates, activeWaypoint.infos.coordinates);
if (distanceToActive < activateDistance) {
this.flightPlanManager.setActiveWaypointIndex(this.flightPlanManager.getActiveWaypointIndex() + 1);
if (this.flightPlanManager.getWaypointsCount() > 3) {
let activeWaypoint = this.flightPlanManager.getActiveWaypoint();
let nextActiveWaypoint = this.flightPlanManager.getNextActiveWaypoint();
if (activeWaypoint && nextActiveWaypoint) {
let pathAngle = nextActiveWaypoint.bearingInFP - activeWaypoint.bearingInFP;
while (pathAngle < 180) {
pathAngle += 360;
}
while (pathAngle > 180) {
pathAngle -= 360;
}
let absPathAngle = 180 - Math.abs(pathAngle);
let airspeed = Simplane.getIndicatedSpeed();
if (airspeed < 400) {
let turnRadius = airspeed * 360 / (1091 * 0.36 / airspeed) / 3600 / 2 / Math.PI;
let activateDistance = Math.pow(90 / absPathAngle, 1.6) * turnRadius * 1.2;
let distanceToActive = Avionics.Utils.computeGreatCircleDistance(planeCoordinates, activeWaypoint.infos.coordinates);
if (distanceToActive < activateDistance) {
this.flightPlanManager.setActiveWaypointIndex(this.flightPlanManager.getActiveWaypointIndex() + 1);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class B747_8_FMC_NavRadioPage {
ilsFrequencyCell = "[]/ ";
ilsCourseCell = "[]";
let approach = fmc.flightPlanManager.getApproach();
if (approach && approach.name && approach.name.indexOf("ILS") !== -1) {
if (approach && approach.name && approach.isLocalizer()) {
ilsFrequencyCell = Avionics.Utils.formatRunway(approach.name, true) + "/ ";
let runway = fmc.flightPlanManager.getApproachRunway();
if (runway) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class FMCMainDisplay extends BaseAirliners {
this._pre2Frequency = 0;
this._atc1Frequency = 0;
this._radioNavOn = false;
this._approachInitialized = false;
this._fuelVarsUpdatedGrossWeight = 0;
this._fuelVarsUpdatedTripCons = 0;
this._debug = 0;
Expand Down Expand Up @@ -687,7 +688,7 @@ class FMCMainDisplay extends BaseAirliners {
if (isFinite(frequency)) {
let freq = Math.round(frequency * 100) / 100;
let approach = this.flightPlanManager.getApproach();
if (approach && approach.name && approach.name.indexOf("ILS") !== -1) {
if (approach && approach.name && approach.isLocalizer()) {
if (this.connectIlsFrequency(freq)) {
SimVar.SetSimVarValue("L:FLIGHTPLAN_APPROACH_ILS", "number", freq);
let runway = this.flightPlanManager.getApproachRunway();
Expand Down Expand Up @@ -2150,23 +2151,7 @@ class FMCMainDisplay extends BaseAirliners {
this.flightPlanManager.onCurrentGameFlightLoaded(() => {
this.flightPlanManager.updateFlightPlan(() => {
this.flightPlanManager.updateCurrentApproach(() => {
let frequency = this.flightPlanManager.getApproachNavFrequency();
if (isFinite(frequency)) {
let freq = Math.round(frequency * 100) / 100;
let approach = this.flightPlanManager.getApproach();
if (approach && approach.name && approach.name.indexOf("ILS") !== -1) {
if (this.connectIlsFrequency(freq)) {
SimVar.SetSimVarValue("L:FLIGHTPLAN_APPROACH_ILS", "number", freq);
let runway = this.flightPlanManager.getApproachRunway();
if (runway) {
SimVar.SetSimVarValue("L:FLIGHTPLAN_APPROACH_COURSE", "number", runway.direction);
}
}
}
else {
this.vor1Frequency = freq;
}
}
this.onApproachUpdated();
if (Simplane.getAltitude() > 1000) {
if (this.flightPlanManager.getWaypoints().length === 2) {
Coherent.call("GET_RUNWAY_ARRIVAL").then((runwayArrivalIndex) => {
Expand All @@ -2175,8 +2160,7 @@ class FMCMainDisplay extends BaseAirliners {
let runwayArrival = destination.infos.unsortedOneWayRunways[runwayArrivalIndex];
if (runwayArrival) {
let ilsApproachIndex = destination.infos.approaches.findIndex(approach => {
return approach.name.indexOf("ILS") != -1 && approach.name.indexOf(runwayArrival.designation) != -1;
});
return approach.isLocalizer() && approach.name.indexOf(runwayArrival.designation) != -1; });
if (ilsApproachIndex) {
this.setApproachIndex(ilsApproachIndex, () => {
this.insertTemporaryFlightPlan();
Expand Down Expand Up @@ -2211,6 +2195,30 @@ class FMCMainDisplay extends BaseAirliners {
});
this.recalculateTHRRedAccTransAlt();
}
onApproachUpdated() {
if (this._approachInitialized) {
return;
}
let frequency = this.flightPlanManager.getApproachNavFrequency();
if (isFinite(frequency)) {
let freq = Math.round(frequency * 100) / 100;
let approach = this.flightPlanManager.getApproach();
if (approach && approach.name && approach.name.indexOf("ILS") != -1) {
if (this.connectIlsFrequency(freq)) {
SimVar.SetSimVarValue("L:FLIGHTPLAN_APPROACH_ILS", "number", freq);
let runway = this.flightPlanManager.getApproachRunway();
if (runway) {
SimVar.SetSimVarValue("L:FLIGHTPLAN_APPROACH_COURSE", "number", runway.direction);
}
}
}
else {
console.log("FMCMainDisplay - Frequency is a VOR FREQUENCY");
this.vor1Frequency = freq;
}
this._approachInitialized = true;
}
}
onFMCFlightPlanLoaded() {
}
recalculateTHRRedAccTransAlt() {
Expand Down Expand Up @@ -2319,7 +2327,9 @@ class FMCMainDisplay extends BaseAirliners {
if (this._checkFlightPlan <= 0) {
this._checkFlightPlan = 60;
this.flightPlanManager.updateFlightPlan();
this.flightPlanManager.updateCurrentApproach();
this.flightPlanManager.updateCurrentApproach(() => {
this.onApproachUpdated();
});
}
this._checkUpdateFuel -= _deltaTime / 1000;
if (this._checkUpdateFuel <= 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ class MapInstrument extends ISvgMapRootElement {
this.scrollDisp.y = 0;
if (this.bingMap) {
if (this.isDisplayingWeather()) {
this.navMap.setRange(this.getWeatherRange());
this.navMap.setRange(this.getWeatherRange() * this.overdrawFactor);
}
else {
this.navMap.setRange(this.getDisplayRange() * this.overdrawFactor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,17 @@ class Jet_MFD_NDInfo extends HTMLElement {
this.waypointDistance.textContent = this.currentWaypointDistance.toFixed(0);
}
}
if ((_eta != this.currentWaypointTimeETA) || _force) {
let groundSpeed = Simplane.getGroundSpeed();
if (groundSpeed < 10) {
if (this.waypointTime != null) {
this.waypointTime.textContent = "--:--";
}
}
else if ((_eta != this.currentWaypointTimeETA) || _force) {
this.currentWaypointTimeETA = _eta;
let localETA = _eta;
let timeZoneOffset = Simplane.getCurrentTimeDeviation();
localETA += timeZoneOffset;
if (this.waypointTime != null) {
var hours = Math.floor(localETA / 3600);
var minutes = Math.floor((localETA - (hours * 3600)) / 60);
Expand Down
Loading

1 comment on commit 8b50afb

@dcherrie
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@747-4EVER There is no actual change in model/747_8I.xml is there? Just formatting?

Please sign in to comment.