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

Commit

Permalink
update 3 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
kaosfere committed Dec 22, 2020
1 parent 77ec837 commit dc5ef0e
Show file tree
Hide file tree
Showing 7 changed files with 169 additions and 113 deletions.
2 changes: 1 addition & 1 deletion PackageDefinitions/workingtitle-g1000-metapackage.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<AssetPackage Name="workingtitle-g1000" Version="0.3.2">
<AssetPackage Name="workingtitle-g1000" Version="0.3.3">
<ItemSettings>
<ContentType>CUSTOM</ContentType>
<Title>Working Title G1000</Title>
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ class AS1000_MFD extends BaseAS1000 {
super.onUpdate(_deltaTime);
SimVar.SetSimVarValue("L:Glasscockpit_MFD_Started", "number", this.isStarted ? 1 : 0);
}

reboot() {
super.reboot();
if (this.engineDisplay)
this.engineDisplay.reset();
}
loadSavedMapOrientation() {
let state = WTDataStore.get("MFD.TrackUp", false);
this.setMapOrientation(state);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const { runInThisContext } = require("vm");

class AS1000_PFD extends BaseAS1000 {
constructor() {
super();
Expand All @@ -19,12 +21,14 @@ class AS1000_PFD extends BaseAS1000 {
let bgTimer = new AS1000_PFD_BackgroundTimer();
let timerRef = new AS1000_PFD_TMRREF();
timerRef.backgroundTimer = bgTimer;
this.warnings = new PFD_Warnings();
this.engines = new Engine("Engine", "EngineDisplay")
this.addIndependentElementContainer(new NavSystemElementContainer("InnerMap", "InnerMap", new PFD_InnerMap()));
this.addIndependentElementContainer(new NavSystemElementContainer("Transponder", "XPDRTimeBox", new PFD_XPDR()));
this.addIndependentElementContainer(new NavSystemElementContainer("WindData", "WindData", new PFD_WindData()));
this.addIndependentElementContainer(new NavSystemElementContainer("Warnings", "Warnings", new PFD_Warnings()));
this.addIndependentElementContainer(new NavSystemElementContainer("Warnings", "Warnings", this.warnings));
this.addIndependentElementContainer(new NavSystemElementContainer("BackGroundTimer", "", bgTimer));
this.addIndependentElementContainer(new Engine("Engine", "EngineDisplay"));
this.addIndependentElementContainer(this.engines);
this.addEventLinkedPopupWindow(new NavSystemEventLinkedPopUpWindow("Nearest Airports", "NearestAirports", new AS1000_PFD_NearestAirports(), "SoftKey_NRST"));
this.addEventLinkedPopupWindow(new NavSystemEventLinkedPopUpWindow("ADF/DME", "AdfDme", new PFD_ADF_DME(), "SoftKey_ADF_DME"));
this.addEventLinkedPopupWindow(new NavSystemEventLinkedPopUpWindow("Alerts", "AlertsWindow", new AS1000_Alerts(), "Toggle_Alerts"));
Expand Down Expand Up @@ -139,6 +143,15 @@ class AS1000_PFD extends BaseAS1000 {
disconnectedCallback() {
super.disconnectedCallback();
}
reboot() {
super.reboot();
if (this.warnings)
this.warnings.reset();
if (this.mainPage)
this.mainPage.reset();
if (this.engines)
this.engines.reset();
}
}
class AS1000_PFD_MainPage extends NavSystemPage {
constructor() {
Expand Down Expand Up @@ -312,7 +325,10 @@ class AS1000_PFD_MainPage extends NavSystemPage {
];
this.softKeys = this.rootMenu;
}

reset() {
if (this.annunciations)
this.annunciations.reset();
}
switchToMenu(_menu) {
this.softKeys = _menu;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ var AS1000;
this.nav1ActiveValue = nav1ActiveValue;
}
}
Avionics.Utils.diffAndSet(this.nav1IdentElement, SimVar.GetSimVarValue("NAV IDENT:1", "string"));
Avionics.Utils.diffAndSet(this.nav1IdentElement, SimVar.GetSimVarValue("NAV SIGNAL:1", "number") > 0 ? SimVar.GetSimVarValue("NAV IDENT:1", "string") : "");
var nav2Active = SimVar.GetSimVarValue("NAV ACTIVE FREQUENCY:2", "MHz");
if (nav2Active) {
var nav2ActiveValue = nav2Active.toFixed(2);
Expand All @@ -92,7 +92,7 @@ var AS1000;
this.nav2ActiveValue = nav2ActiveValue;
}
}
Avionics.Utils.diffAndSet(this.nav2IdentElement, SimVar.GetSimVarValue("NAV IDENT:2", "string"));
Avionics.Utils.diffAndSet(this.nav2IdentElement, SimVar.GetSimVarValue("NAV SIGNAL:2", "number") > 0 ? SimVar.GetSimVarValue("NAV IDENT:2", "string") : "");
var nav1Sby = SimVar.GetSimVarValue("NAV STANDBY FREQUENCY:1", "MHz");
if (nav1Sby) {
var nav1SbyValue = nav1Sby.toFixed(2);
Expand Down Expand Up @@ -400,8 +400,8 @@ class Engine extends NavSystemElementContainer {
this.addGauge().Set(_engine.querySelector(".Turbo_IttGauge"), this.settings.ITTEngineOff, this.getItt.bind(this, _index), "ITT", "°C");
this.addGauge().Set(_engine.querySelector(".Turbo_OilPressGauge"), this.settings.OilPressure, this.getOilPress.bind(this, _index), "OIL PRESS", "");
this.addGauge().Set(_engine.querySelector(".Turbo_OilTempGauge"), this.settings.OilTemperature, this.getOilTempCelsius.bind(this, _index), "OIL TEMP", "");
let CAS = new Engine_Annunciations();
this.allElements.push(CAS);
this.engineAnnunciations = new Engine_Annunciations();
this.allElements.push(this.engineAnnunciations);
break;
}
}
Expand All @@ -410,6 +410,10 @@ class Engine extends NavSystemElementContainer {
this.element = new NavSystemElementGroup(this.allElements);
}
}
reset() {
if (this.engineAnnunciations)
this.engineAnnunciations.reset();
}
onUpdate(_deltaTime) {
super.onUpdate(_deltaTime);
if (this.xmlEngineDisplay) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class PFD_Airspeed extends NavSystemElement {
this.lastSpeed = indicatedSpeed;
this.airspeedElement.setAttribute("airspeed-trend", (this.acceleration).toString());
let crossSpeed = SimVar.GetGameVarValue("AIRCRAFT CROSSOVER SPEED", "Knots");
let cruiseMach = SimVar.GetGameVarValue("AIRCRAFT CRUISE MACH", "mach");
let cruiseMach = SimVar.GetSimVarValue("MACH MAX OPERATE", "mach");
let crossSpeedFactor = Simplane.getCrossoverSpeedFactor(this.maxSpeed, cruiseMach);
if (crossSpeed != 0) {
this.airspeedElement.setAttribute("max-speed", (Math.min(crossSpeedFactor, 1) * this.maxSpeed).toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,22 @@ class FacilityLoader {
}
addFacility(_data) {
_data.icaoTrimed = _data.icao.trim();
this.loadedFacilities.push(_data);
while (this.loadedFacilities.length > 1000) {
this.loadedFacilities.splice(0, 1);
let isLoaded = this.loadedFacilities.findIndex(f => {
if (f.icao === _data.icao) {
if (_data.routes != undefined && f.routes != undefined) {
return true;
}
if (_data.routes === undefined && f.routes === undefined) {
return true;
}
}
return false;
}) != -1;
if (!isLoaded) {
this.loadedFacilities.push(_data);
while (this.loadedFacilities.length > 1000) {
this.loadedFacilities.splice(0, 1);
}
}
}
getFacilityCB(icao, callback) {
Expand Down Expand Up @@ -885,7 +898,7 @@ class FacilityLoader {
loadedVorsCallback();
});
}
async getAllAirways(intersection, maxLength = 100) {
async getAllAirways(intersection, maxLength = 10) {
await this.waitRegistration();
let airways = [];
let intersectionInfo;
Expand All @@ -896,7 +909,7 @@ class FacilityLoader {
intersectionInfo = intersection;
}
if (intersectionInfo instanceof WayPointInfo) {
let datas = await this.getAllAirwaysData(intersectionInfo);
let datas = await this.getAllAirwaysData(intersectionInfo, maxLength);
for (let i = 0; i < datas.length; i++) {
let airway = new Airway();
airway.SetFromIAirwayData(datas[i]);
Expand All @@ -905,7 +918,7 @@ class FacilityLoader {
}
return airways;
}
async getAllAirwaysData(intersectionInfo, maxLength = 100) {
async getAllAirwaysData(intersectionInfo, maxLength = 10) {
await this.waitRegistration();
let airways = [];
if (intersectionInfo.routes) {
Expand Down

0 comments on commit dc5ef0e

Please sign in to comment.