Merge branch 'dev' into rework
This commit is contained in:
commit
e1f4c230cc
20 changed files with 482 additions and 515 deletions
|
@ -23,39 +23,15 @@ var spinning = maketimer(0.05, func {
|
||||||
var failReset = func {
|
var failReset = func {
|
||||||
systems.ELEC.resetFail();
|
systems.ELEC.resetFail();
|
||||||
systems.PNEU.resetFail();
|
systems.PNEU.resetFail();
|
||||||
|
fbw.FBW.resetFail();
|
||||||
|
systems.HYD.resetFail();
|
||||||
}
|
}
|
||||||
|
|
||||||
var failResetOld = func {
|
var failResetOld = func {
|
||||||
setprop("/systems/failures/fctl/elac1", 0);
|
|
||||||
setprop("/systems/failures/fctl/elac2", 0);
|
|
||||||
setprop("/systems/failures/fctl/sec1", 0);
|
|
||||||
setprop("/systems/failures/fctl/sec2", 0);
|
|
||||||
setprop("/systems/failures/fctl/sec3", 0);
|
|
||||||
setprop("/systems/failures/fctl/fac1", 0);
|
|
||||||
setprop("/systems/failures/fctl/fac2", 0);
|
|
||||||
setprop("/systems/failures/fctl/rtlu-1", 0);
|
|
||||||
setprop("/systems/failures/fctl/rtlu-2", 0);
|
|
||||||
setprop("/systems/failures/aileron-left", 0);
|
setprop("/systems/failures/aileron-left", 0);
|
||||||
setprop("/systems/failures/aileron-right", 0);
|
setprop("/systems/failures/aileron-right", 0);
|
||||||
setprop("/systems/failures/elevator-left", 0);
|
setprop("/systems/failures/elevator-left", 0);
|
||||||
setprop("/systems/failures/elevator-right", 0);
|
setprop("/systems/failures/elevator-right", 0);
|
||||||
setprop("/systems/failures/spoilers/spoiler-l1", 0);
|
|
||||||
setprop("/systems/failures/spoilers/spoiler-l2", 0);
|
|
||||||
setprop("/systems/failures/spoilers/spoiler-l3", 0);
|
|
||||||
setprop("/systems/failures/spoilers/spoiler-l4", 0);
|
|
||||||
setprop("/systems/failures/spoilers/spoiler-l5", 0);
|
|
||||||
setprop("/systems/failures/spoilers/spoiler-r1", 0);
|
|
||||||
setprop("/systems/failures/spoilers/spoiler-r2", 0);
|
|
||||||
setprop("/systems/failures/spoilers/spoiler-r3", 0);
|
|
||||||
setprop("/systems/failures/spoilers/spoiler-r4", 0);
|
|
||||||
setprop("/systems/failures/spoilers/spoiler-r5", 0);
|
|
||||||
setprop("/systems/failures/hyd-blue", 0);
|
|
||||||
setprop("/systems/failures/hyd-green", 0);
|
|
||||||
setprop("/systems/failures/hyd-yellow", 0);
|
|
||||||
setprop("/systems/failures/pump-blue", 0);
|
|
||||||
setprop("/systems/failures/pump-green", 0);
|
|
||||||
setprop("/systems/failures/pump-yellow-eng", 0);
|
|
||||||
setprop("/systems/failures/pump-yellow-elec", 0);
|
|
||||||
setprop("/systems/failures/fire/cargo-aft-fire", 0);
|
setprop("/systems/failures/fire/cargo-aft-fire", 0);
|
||||||
setprop("/systems/failures/fire/cargo-fwd-fire", 0);
|
setprop("/systems/failures/fire/cargo-fwd-fire", 0);
|
||||||
setprop("/systems/failures/fire/engine-left-fire", 0);
|
setprop("/systems/failures/fire/engine-left-fire", 0);
|
||||||
|
@ -65,6 +41,7 @@ var failResetOld = func {
|
||||||
}
|
}
|
||||||
|
|
||||||
failResetOld();
|
failResetOld();
|
||||||
|
|
||||||
setprop("/systems/acconfig/autoconfig-running", 0);
|
setprop("/systems/acconfig/autoconfig-running", 0);
|
||||||
setprop("/systems/acconfig/spinning", 0);
|
setprop("/systems/acconfig/spinning", 0);
|
||||||
setprop("/systems/acconfig/spin", "-");
|
setprop("/systems/acconfig/spin", "-");
|
||||||
|
@ -115,7 +92,8 @@ var revisionFile = (getprop("/sim/aircraft-dir") ~ "/revision.txt");
|
||||||
var current_revision = io.readfile(revisionFile);
|
var current_revision = io.readfile(revisionFile);
|
||||||
print("A320-family Revision: " ~ current_revision);
|
print("A320-family Revision: " ~ current_revision);
|
||||||
setprop("/systems/acconfig/revision", current_revision);
|
setprop("/systems/acconfig/revision", current_revision);
|
||||||
setprop("/systems/acconfig/options/fo-view", 0);
|
|
||||||
|
var foViewNode = props.globals.initNode("/systems/acconfig/options/fo-view", 0, "BOOL");
|
||||||
setprop("/systems/acconfig/options/simbrief-username", "");
|
setprop("/systems/acconfig/options/simbrief-username", "");
|
||||||
|
|
||||||
setlistener("/systems/acconfig/new-revision", func {
|
setlistener("/systems/acconfig/new-revision", func {
|
||||||
|
@ -180,7 +158,7 @@ setlistener("/sim/signals/fdm-initialized", func {
|
||||||
writeSettings();
|
writeSettings();
|
||||||
if (getprop("/options/system/save-state") == 1)
|
if (getprop("/options/system/save-state") == 1)
|
||||||
{
|
{
|
||||||
save.restore(save.default, getprop("/sim/fg-home") ~ "/Export/" ~ getprop("/sim/aircraft") ~ "-save.xml");
|
save.restore(save.default, pts.Sim.fgHome.getValue() ~ "/Export/" ~ pts.Sim.aircraft.getValue() ~ "-save.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getprop("/options/system/fo-view") == 1) {
|
if (getprop("/options/system/fo-view") == 1) {
|
||||||
|
@ -191,7 +169,7 @@ setlistener("/sim/signals/fdm-initialized", func {
|
||||||
});
|
});
|
||||||
|
|
||||||
setlistener("/sim/signals/exit", func {
|
setlistener("/sim/signals/exit", func {
|
||||||
save.save(save.default, getprop("/sim/fg-home") ~ "/Export/" ~ getprop("/sim/aircraft") ~ "-save.xml");
|
save.save(save.default, pts.Sim.fgHome.getValue() ~ "/Export/" ~ pts.Sim.aircraft.getValue() ~ "-save.xml");
|
||||||
});
|
});
|
||||||
|
|
||||||
var renderingSettings = {
|
var renderingSettings = {
|
||||||
|
@ -224,7 +202,7 @@ var renderingSettings = {
|
||||||
};
|
};
|
||||||
|
|
||||||
var readSettings = func {
|
var readSettings = func {
|
||||||
io.read_properties(getprop("/sim/fg-home") ~ "/Export/A320-family-config.xml", "/systems/acconfig/options");
|
io.read_properties(pts.Sim.fgHome.getValue() ~ "/Export/A320-family-config.xml", "/systems/acconfig/options");
|
||||||
setprop("/options/system/keyboard-mode", getprop("/systems/acconfig/options/keyboard-mode"));
|
setprop("/options/system/keyboard-mode", getprop("/systems/acconfig/options/keyboard-mode"));
|
||||||
setprop("/options/system/weight-kgs", getprop("/systems/acconfig/options/weight-kgs"));
|
setprop("/options/system/weight-kgs", getprop("/systems/acconfig/options/weight-kgs"));
|
||||||
setprop("/options/system/save-state", getprop("/systems/acconfig/options/save-state"));
|
setprop("/options/system/save-state", getprop("/systems/acconfig/options/save-state"));
|
||||||
|
@ -232,7 +210,7 @@ var readSettings = func {
|
||||||
setprop("/systems/apu/oil/allow-oil-consumption", getprop("/systems/acconfig/options/allow-oil-consumption"));
|
setprop("/systems/apu/oil/allow-oil-consumption", getprop("/systems/acconfig/options/allow-oil-consumption"));
|
||||||
setprop("/sim/model/autopush/route/show", getprop("/systems/acconfig/options/autopush/show-route"));
|
setprop("/sim/model/autopush/route/show", getprop("/systems/acconfig/options/autopush/show-route"));
|
||||||
setprop("/sim/model/autopush/route/show-wingtip", getprop("/systems/acconfig/options/autopush/show-wingtip"));
|
setprop("/sim/model/autopush/route/show-wingtip", getprop("/systems/acconfig/options/autopush/show-wingtip"));
|
||||||
setprop("/options/system/fo-view", getprop("/systems/acconfig/options/fo-view"));
|
setprop("/options/system/fo-view", foViewNode.getValue());
|
||||||
setprop("/FMGC/simbrief-username", getprop("/systems/acconfig/options/simbrief-username"));
|
setprop("/FMGC/simbrief-username", getprop("/systems/acconfig/options/simbrief-username"));
|
||||||
setprop("/systems/atsu/atis-server", getprop("/systems/acconfig/options/atis-server"));
|
setprop("/systems/atsu/atis-server", getprop("/systems/acconfig/options/atis-server"));
|
||||||
setprop("/systems/atsu/wxr-server", getprop("/systems/acconfig/options/wxr-server"));
|
setprop("/systems/atsu/wxr-server", getprop("/systems/acconfig/options/wxr-server"));
|
||||||
|
@ -246,11 +224,11 @@ var writeSettings = func {
|
||||||
setprop("/systems/acconfig/options/allow-oil-consumption", getprop("/systems/apu/oil/allow-oil-consumption"));
|
setprop("/systems/acconfig/options/allow-oil-consumption", getprop("/systems/apu/oil/allow-oil-consumption"));
|
||||||
setprop("/systems/acconfig/options/autopush/show-route", getprop("/sim/model/autopush/route/show"));
|
setprop("/systems/acconfig/options/autopush/show-route", getprop("/sim/model/autopush/route/show"));
|
||||||
setprop("/systems/acconfig/options/autopush/show-wingtip", getprop("/sim/model/autopush/route/show-wingtip"));
|
setprop("/systems/acconfig/options/autopush/show-wingtip", getprop("/sim/model/autopush/route/show-wingtip"));
|
||||||
setprop("/systems/acconfig/options/fo-view", getprop("/options/system/fo-view"));
|
foViewNode.setValue(getprop("/options/system/fo-view"));
|
||||||
setprop("/systems/acconfig/options/simbrief-username", getprop("/FMGC/simbrief-username"));
|
setprop("/systems/acconfig/options/simbrief-username", getprop("/FMGC/simbrief-username"));
|
||||||
setprop("/systems/acconfig/options/atis-server", getprop("/systems/atsu/atis-server"));
|
setprop("/systems/acconfig/options/atis-server", getprop("/systems/atsu/atis-server"));
|
||||||
setprop("/systems/acconfig/options/wxr-server", getprop("/systems/atsu/wxr-server"));
|
setprop("/systems/acconfig/options/wxr-server", getprop("/systems/atsu/wxr-server"));
|
||||||
io.write_properties(getprop("/sim/fg-home") ~ "/Export/A320-family-config.xml", "/systems/acconfig/options");
|
io.write_properties(pts.Sim.fgHome.getValue() ~ "/Export/A320-family-config.xml", "/systems/acconfig/options");
|
||||||
}
|
}
|
||||||
|
|
||||||
################
|
################
|
||||||
|
|
|
@ -346,7 +346,7 @@
|
||||||
<animation>
|
<animation>
|
||||||
<type>rotate</type>
|
<type>rotate</type>
|
||||||
<object-name>brakes_lb_psi</object-name>
|
<object-name>brakes_lb_psi</object-name>
|
||||||
<property>systems/hydraulic/brakes/pressure-left-psi</property>
|
<property>systems/hydraulic/brakes/pressure-left-psi-output</property>
|
||||||
<factor>-0.03</factor>
|
<factor>-0.03</factor>
|
||||||
<condition>
|
<condition>
|
||||||
<or>
|
<or>
|
||||||
|
@ -378,7 +378,7 @@
|
||||||
<animation>
|
<animation>
|
||||||
<type>rotate</type>
|
<type>rotate</type>
|
||||||
<object-name>brakes_rb_psi</object-name>
|
<object-name>brakes_rb_psi</object-name>
|
||||||
<property>systems/hydraulic/brakes/pressure-right-psi</property>
|
<property>systems/hydraulic/brakes/pressure-right-psi-output</property>
|
||||||
<factor>0.03</factor>
|
<factor>0.03</factor>
|
||||||
<condition>
|
<condition>
|
||||||
<or>
|
<or>
|
||||||
|
@ -410,7 +410,7 @@
|
||||||
<animation>
|
<animation>
|
||||||
<type>rotate</type>
|
<type>rotate</type>
|
||||||
<object-name>brakes_accum_psi</object-name>
|
<object-name>brakes_accum_psi</object-name>
|
||||||
<property>systems/hydraulic/yellow-accumulator-psi</property>
|
<property>systems/hydraulic/yellow-accumulator-psi-output</property>
|
||||||
<interpolation>
|
<interpolation>
|
||||||
<entry><ind>0</ind><dep>0</dep></entry>
|
<entry><ind>0</ind><dep>0</dep></entry>
|
||||||
<entry><ind>700</ind><dep>-20</dep></entry>
|
<entry><ind>700</ind><dep>-20</dep></entry>
|
||||||
|
|
|
@ -41,7 +41,6 @@ var easeArrow = {
|
||||||
#me.element.hide();
|
#me.element.hide();
|
||||||
me.duration = 0;
|
me.duration = 0;
|
||||||
me.changed = 1;
|
me.changed = 1;
|
||||||
print("VOR reset");
|
|
||||||
},
|
},
|
||||||
setzero: func {
|
setzero: func {
|
||||||
me.duration = 0;
|
me.duration = 0;
|
||||||
|
|
|
@ -2155,7 +2155,7 @@ var messages_priority_2 = func {
|
||||||
ECAM_controller.warningReset(athr_lim_1);
|
ECAM_controller.warningReset(athr_lim_1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getprop("/instrumentation/tcas/serviceable") == 0 and phaseVar2 != 1 and phaseVar2 != 3 and phaseVar2 != 4 and phaseVar2 != 5 and phaseVar2 != 7 and phaseVar2 != 8 and phaseVar2 != 10 and systems.ELEC.Bus.ac1.getValue() >= 110 and pts.Instrumentation.TCAS.Inputs.mode.getValue() != 1 and tcasFault.clearFlag == 0) {
|
if (pts.Instrumentation.TCAS.servicable.getValue() == 0 and phaseVar2 != 1 and phaseVar2 != 3 and phaseVar2 != 4 and phaseVar2 != 5 and phaseVar2 != 7 and phaseVar2 != 8 and phaseVar2 != 10 and systems.ELEC.Bus.ac1.getValue() >= 110 and pts.Instrumentation.TCAS.Inputs.mode.getValue() != 1 and tcasFault.clearFlag == 0) {
|
||||||
tcasFault.active = 1;
|
tcasFault.active = 1;
|
||||||
} else {
|
} else {
|
||||||
ECAM_controller.warningReset(tcasFault);
|
ECAM_controller.warningReset(tcasFault);
|
||||||
|
|
|
@ -64,6 +64,9 @@ var FBW = {
|
||||||
sec3: props.globals.getNode("/systems/failures/fctl/sec3"),
|
sec3: props.globals.getNode("/systems/failures/fctl/sec3"),
|
||||||
fac1: props.globals.getNode("/systems/failures/fctl/fac1"),
|
fac1: props.globals.getNode("/systems/failures/fctl/fac1"),
|
||||||
fac2: props.globals.getNode("/systems/failures/fctl/fac2"),
|
fac2: props.globals.getNode("/systems/failures/fctl/fac2"),
|
||||||
|
rtlu1: props.globals.getNode("/systems/failures/fctl/rtlu-1"),
|
||||||
|
rtlu2: props.globals.getNode("/systems/failures/fctl/rtlu-2"),
|
||||||
|
rtlu2: props.globals.getNode("/systems/failures/fctl/rtlu-2"),
|
||||||
ths: props.globals.getNode("/systems/failures/fctl/ths-jam"),
|
ths: props.globals.getNode("/systems/failures/fctl/ths-jam"),
|
||||||
spoilerl1: props.globals.getNode("/systems/failures/spoilers/spoiler-l1"),
|
spoilerl1: props.globals.getNode("/systems/failures/spoilers/spoiler-l1"),
|
||||||
spoilerl2: props.globals.getNode("/systems/failures/spoilers/spoiler-l2"),
|
spoilerl2: props.globals.getNode("/systems/failures/spoilers/spoiler-l2"),
|
||||||
|
|
|
@ -2,37 +2,11 @@
|
||||||
# Copyright (c) 2020 Josh Davidson (Octal450), Jonathan Redpath (legoboyvdlp)
|
# Copyright (c) 2020 Josh Davidson (Octal450), Jonathan Redpath (legoboyvdlp)
|
||||||
|
|
||||||
# Nodes
|
# Nodes
|
||||||
var fd1 = props.globals.getNode("/it-autoflight/output/fd1", 1);
|
|
||||||
var fd2 = props.globals.getNode("/it-autoflight/output/fd2", 1);
|
|
||||||
var ap1 = props.globals.getNode("/it-autoflight/output/ap1", 1);
|
|
||||||
var ap2 = props.globals.getNode("/it-autoflight/output/ap2", 1);
|
|
||||||
var athr = props.globals.getNode("/it-autoflight/output/athr", 1);
|
|
||||||
var fd1Input = props.globals.getNode("/it-autoflight/input/fd1", 1);
|
|
||||||
var fd2Input = props.globals.getNode("/it-autoflight/input/fd2", 1);
|
|
||||||
var ap1Input = props.globals.getNode("/it-autoflight/input/ap1", 1);
|
|
||||||
var ap2Input = props.globals.getNode("/it-autoflight/input/ap2", 1);
|
|
||||||
var athrInput = props.globals.getNode("/it-autoflight/input/athr", 1);
|
|
||||||
var ktsMach = props.globals.getNode("/it-autoflight/input/kts-mach", 1);
|
|
||||||
var iasSet = props.globals.getNode("/it-autoflight/input/kts", 1);
|
|
||||||
var machSet = props.globals.getNode("/it-autoflight/input/mach", 1);
|
|
||||||
var hdgSet = props.globals.getNode("/it-autoflight/input/hdg", 1);
|
|
||||||
var altSet = props.globals.getNode("/it-autoflight/input/alt", 1);
|
|
||||||
var altSetMode = props.globals.getNode("/it-autoflight/config/altitude-dial-mode", 1);
|
var altSetMode = props.globals.getNode("/it-autoflight/config/altitude-dial-mode", 1);
|
||||||
var vsSet = props.globals.getNode("/it-autoflight/input/vs", 1);
|
var apOffSound = [props.globals.getNode("/it-autoflight/sound/apoffsound"),props.globals.getNode("/it-autoflight/sound/apoffsound2")];
|
||||||
var fpaSet = props.globals.getNode("/it-autoflight/input/fpa", 1);
|
var apWarningNode = props.globals.getNode("/it-autoflight/output/ap-warning");
|
||||||
var iasNow = props.globals.getNode("/instrumentation/airspeed-indicator/indicated-speed-kt", 1);
|
var athrWarningNode = props.globals.getNode("/it-autoflight/output/athr-warning");
|
||||||
var machNow = props.globals.getNode("/instrumentation/airspeed-indicator/indicated-mach", 1);
|
var apDiscBtn = props.globals.getNode("/sim/sounde/apdiscbtn");
|
||||||
var spdManaged = props.globals.getNode("/it-autoflight/input/spd-managed", 1);
|
|
||||||
var showHDG = props.globals.getNode("/it-autoflight/custom/show-hdg", 1);
|
|
||||||
var trkFpaSW = props.globals.getNode("/it-autoflight/custom/trk-fpa", 1);
|
|
||||||
var latMode = props.globals.getNode("/it-autoflight/output/lat", 1);
|
|
||||||
var vertMode = props.globals.getNode("/it-autoflight/output/vert", 1);
|
|
||||||
var fpaModeInput = props.globals.getNode("/it-autoflight/input/fpa", 1);
|
|
||||||
var latModeInput = props.globals.getNode("/it-autoflight/input/lat", 1);
|
|
||||||
var vertModeInput = props.globals.getNode("/it-autoflight/input/vert", 1);
|
|
||||||
var vsModeInput = props.globals.getNode("/it-autoflight/input/vs", 1);
|
|
||||||
var locArm = props.globals.getNode("/it-autoflight/output/loc-armed", 1);
|
|
||||||
var apprArm = props.globals.getNode("/it-autoflight/output/appr-armed", 1);
|
|
||||||
var FCUworkingNode = props.globals.initNode("/FMGC/FCU-working", 0, "BOOL");
|
var FCUworkingNode = props.globals.initNode("/FMGC/FCU-working", 0, "BOOL");
|
||||||
|
|
||||||
var FCU = {
|
var FCU = {
|
||||||
|
@ -99,8 +73,8 @@ var FCUController = {
|
||||||
},
|
},
|
||||||
AP1: func() {
|
AP1: func() {
|
||||||
if (me.FCUworking) {
|
if (me.FCUworking) {
|
||||||
if (!ap1.getBoolValue() and fbw.FBW.apOff == 0) {
|
if (!fmgc.Output.ap1.getBoolValue() and fbw.FBW.apOff == 0) {
|
||||||
ap1Input.setValue(1);
|
fmgc.Input.ap1.setValue(1);
|
||||||
ecam.apWarnNode.setValue(0);
|
ecam.apWarnNode.setValue(0);
|
||||||
pts.Controls.Flight.rudderTrim.setValue(0);
|
pts.Controls.Flight.rudderTrim.setValue(0);
|
||||||
} else {
|
} else {
|
||||||
|
@ -110,8 +84,8 @@ var FCUController = {
|
||||||
},
|
},
|
||||||
AP2: func() {
|
AP2: func() {
|
||||||
if (me.FCUworking) {
|
if (me.FCUworking) {
|
||||||
if (!ap2.getBoolValue() and fbw.FBW.apOff == 0) {
|
if (!fmgc.Output.ap2.getBoolValue() and fbw.FBW.apOff == 0) {
|
||||||
ap2Input.setValue(1);
|
fmgc.Input.ap2.setValue(1);
|
||||||
ecam.apWarnNode.setValue(0);
|
ecam.apWarnNode.setValue(0);
|
||||||
pts.Controls.Flight.rudderTrim.setValue(0);
|
pts.Controls.Flight.rudderTrim.setValue(0);
|
||||||
} else {
|
} else {
|
||||||
|
@ -121,8 +95,8 @@ var FCUController = {
|
||||||
},
|
},
|
||||||
ATHR: func() {
|
ATHR: func() {
|
||||||
if (me.FCUworking) {
|
if (me.FCUworking) {
|
||||||
if (!athr.getBoolValue() and !pts.FMGC.CasCompare.casRejectAll.getBoolValue() and fbw.FBW.apOff == 0) {
|
if (!fmgc.Output.athr.getBoolValue() and !pts.FMGC.CasCompare.casRejectAll.getBoolValue() and fbw.FBW.apOff == 0) {
|
||||||
athrInput.setValue(1);
|
fmgc.Input.athr.setValue(1);
|
||||||
} else {
|
} else {
|
||||||
athrOff("hard");
|
athrOff("hard");
|
||||||
}
|
}
|
||||||
|
@ -130,7 +104,7 @@ var FCUController = {
|
||||||
},
|
},
|
||||||
FD1: func() {
|
FD1: func() {
|
||||||
if (me.FCUworking) {
|
if (me.FCUworking) {
|
||||||
if (!fd1.getBoolValue()) {
|
if (!fmgc.Output.fd1.getBoolValue()) {
|
||||||
fd1Input.setValue(1);
|
fd1Input.setValue(1);
|
||||||
} else {
|
} else {
|
||||||
fd1Input.setValue(0);
|
fd1Input.setValue(0);
|
||||||
|
@ -139,7 +113,7 @@ var FCUController = {
|
||||||
},
|
},
|
||||||
FD2: func() {
|
FD2: func() {
|
||||||
if (me.FCUworking) {
|
if (me.FCUworking) {
|
||||||
if (!fd2.getBoolValue()) {
|
if (!fmgc.Output.fd2.getBoolValue()) {
|
||||||
fd2Input.setValue(1);
|
fd2Input.setValue(1);
|
||||||
} else {
|
} else {
|
||||||
fd2Input.setValue(0);
|
fd2Input.setValue(0);
|
||||||
|
@ -148,21 +122,21 @@ var FCUController = {
|
||||||
},
|
},
|
||||||
APDisc: func() {
|
APDisc: func() {
|
||||||
# physical button sound - so put it outside here as you get a sound even if it doesn't work!
|
# physical button sound - so put it outside here as you get a sound even if it doesn't work!
|
||||||
setprop("/sim/sounde/apdiscbtn", 1);
|
apDiscBtn.setValue(1);
|
||||||
settimer(func {
|
settimer(func {
|
||||||
setprop("/sim/sounde/apdiscbtn", 0);
|
apDiscBtn.setValue(0);
|
||||||
}, 0.5);
|
}, 0.5);
|
||||||
|
|
||||||
if (me.FCUworking) {
|
if (me.FCUworking) {
|
||||||
if (ap1.getBoolValue() or ap2.getBoolValue()) {
|
if (fmgc.Output.ap1.getBoolValue() or fmgc.Output.ap2.getBoolValue()) {
|
||||||
apOff("soft", 0);
|
apOff("soft", 0);
|
||||||
} else {
|
} else {
|
||||||
if (getprop("/it-autoflight/sound/apoffsound") == 1 or getprop("/it-autoflight/sound/apoffsound2") == 1) {
|
if (apOffSound[0].getValue() or apOffSound[1].getValue()) {
|
||||||
setprop("/it-autoflight/sound/apoffsound", 0);
|
apOffSound[0].setValue(0);
|
||||||
setprop("/it-autoflight/sound/apoffsound2", 0);
|
apOffSound[1].setValue(0);
|
||||||
}
|
}
|
||||||
if (getprop("/it-autoflight/output/ap-warning") != 0) {
|
if (apWarningNode.getValue() != 0) {
|
||||||
setprop("/it-autoflight/output/ap-warning", 0);
|
apWarningNode.setValue(0);
|
||||||
ecam.lights[0].setValue(0);
|
ecam.lights[0].setValue(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,18 +144,18 @@ var FCUController = {
|
||||||
},
|
},
|
||||||
ATDisc: func() {
|
ATDisc: func() {
|
||||||
# physical button sound - so put it outside here as you get a sound even if it doesn't work!
|
# physical button sound - so put it outside here as you get a sound even if it doesn't work!
|
||||||
setprop("/sim/sounde/apdiscbtn", 1);
|
apDiscBtn.setValue(1);
|
||||||
settimer(func {
|
settimer(func {
|
||||||
setprop("/sim/sounde/apdiscbtn", 0);
|
apDiscBtn.setValue(0);
|
||||||
}, 0.5);
|
}, 0.5);
|
||||||
|
|
||||||
if (me.FCUworking) {
|
if (me.FCUworking) {
|
||||||
if (athr.getBoolValue()) {
|
if (fmgc.Output.athr.getBoolValue()) {
|
||||||
athrOff("soft");
|
athrOff("soft");
|
||||||
ecam.lights[1].setValue(1);
|
ecam.lights[1].setValue(1);
|
||||||
} else {
|
} else {
|
||||||
if (getprop("/it-autoflight/output/athr-warning") == 1) {
|
if (athrWarningNode.getValue() == 1) {
|
||||||
setprop("/it-autoflight/output/athr-warning", 0);
|
athrWarningNode.setValue(0);
|
||||||
ecam.lights[1].setValue(0);
|
ecam.lights[1].setValue(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,84 +163,88 @@ var FCUController = {
|
||||||
},
|
},
|
||||||
IASMach: func() {
|
IASMach: func() {
|
||||||
if (me.FCUworking) {
|
if (me.FCUworking) {
|
||||||
if (ktsMach.getBoolValue()) {
|
if (fmgc.Input.ktsMach.getBoolValue()) {
|
||||||
ktsMach.setBoolValue(0);
|
fmgc.Input.ktsMach.setBoolValue(0);
|
||||||
} else {
|
} else {
|
||||||
ktsMach.setBoolValue(1);
|
fmgc.Input.ktsMach.setBoolValue(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
SPDPush: func() {
|
SPDPush: func() {
|
||||||
if (me.FCUworking) {
|
if (me.FCUworking) {
|
||||||
if (fmgc.FMGCInternal.crzSet and fmgc.FMGCInternal.costIndexSet) {
|
if (fmgc.FMGCInternal.crzSet and fmgc.FMGCInternal.costIndexSet) {
|
||||||
spdManaged.setBoolValue(1);
|
fmgc.Custom.Input.spdManaged.setBoolValue(1);
|
||||||
fmgc.ManagedSPD.start();
|
fmgc.ManagedSPD.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
ias: nil,
|
||||||
|
mach: nil,
|
||||||
SPDPull: func() {
|
SPDPull: func() {
|
||||||
if (me.FCUworking) {
|
if (me.FCUworking) {
|
||||||
spdManaged.setBoolValue(0);
|
fmgc.Custom.Input.spdManaged.setBoolValue(0);
|
||||||
fmgc.ManagedSPD.stop();
|
fmgc.ManagedSPD.stop();
|
||||||
var ias = iasNow.getValue();
|
me.ias = fmgc.Velocities.indicatedAirspeedKt.getValue();
|
||||||
var mach = machNow.getValue();
|
me.mach = fmgc.Velocities.indicatedMach.getValue();
|
||||||
if (!ktsMach.getBoolValue()) {
|
if (!fmgc.Input.ktsMach.getBoolValue()) {
|
||||||
if (ias >= 100 and ias <= 350) {
|
if (me.ias >= 100 and me.ias <= 350) {
|
||||||
iasSet.setValue(math.round(ias));
|
fmgc.Input.kts.setValue(math.round(me.ias));
|
||||||
} else if (ias < 100) {
|
} else if (me.ias < 100) {
|
||||||
iasSet.setValue(100);
|
fmgc.Input.kts.setValue(100);
|
||||||
} else if (ias > 350) {
|
} else if (me.ias > 350) {
|
||||||
iasSet.setValue(350);
|
fmgc.Input.kts.setValue(350);
|
||||||
}
|
}
|
||||||
} else if (ktsMach.getBoolValue()) {
|
} else if (fmgc.Input.ktsMach.getBoolValue()) {
|
||||||
if (mach >= 0.50 and mach <= 0.82) {
|
if (me.mach >= 0.50 and me.mach <= 0.82) {
|
||||||
machSet.setValue(math.round(mach, 0.001));
|
fmgc.Input.mach.setValue(math.round(me.mach, 0.001));
|
||||||
} else if (mach < 0.50) {
|
} else if (me.mach < 0.50) {
|
||||||
machSet.setValue(0.50);
|
fmgc.Input.mach.setValue(0.50);
|
||||||
} else if (mach > 0.82) {
|
} else if (me.mach > 0.82) {
|
||||||
machSet.setValue(0.82);
|
fmgc.Input.mach.setValue(0.82);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
machTemp: nil,
|
||||||
|
iasTemp: nil,
|
||||||
SPDAdjust: func(d) {
|
SPDAdjust: func(d) {
|
||||||
if (me.FCUworking) {
|
if (me.FCUworking) {
|
||||||
if (!spdManaged.getBoolValue()) {
|
if (!fmgc.Custom.Input.spdManaged.getBoolValue()) {
|
||||||
if (ktsMach.getBoolValue()) {
|
if (fmgc.Input.ktsMach.getBoolValue()) {
|
||||||
var machTemp = machSet.getValue();
|
me.machTemp = fmgc.Input.mach.getValue();
|
||||||
if (d == 1) {
|
if (d == 1) {
|
||||||
machTemp = math.round(machTemp + 0.001, 0.001); # Kill floating point error
|
me.machTemp = math.round(me.machTemp + 0.001, 0.001); # Kill floating point error
|
||||||
} else if (d == -1) {
|
} else if (d == -1) {
|
||||||
machTemp = math.round(machTemp - 0.001, 0.001); # Kill floating point error
|
me.machTemp = math.round(me.machTemp - 0.001, 0.001); # Kill floating point error
|
||||||
} else if (d == 10) {
|
} else if (d == 10) {
|
||||||
machTemp = math.round(machTemp + 0.01, 0.01); # Kill floating point error
|
me.machTemp = math.round(me.machTemp + 0.01, 0.01); # Kill floating point error
|
||||||
} else if (d == -10) {
|
} else if (d == -10) {
|
||||||
machTemp = math.round(machTemp - 0.01, 0.01); # Kill floating point error
|
me.machTemp = math.round(me.machTemp - 0.01, 0.01); # Kill floating point error
|
||||||
}
|
}
|
||||||
if (machTemp < 0.50) {
|
if (me.machTemp < 0.50) {
|
||||||
machSet.setValue(0.50);
|
fmgc.Input.mach.setValue(0.50);
|
||||||
} else if (machTemp > 0.82) {
|
} else if (me.machTemp > 0.82) {
|
||||||
machSet.setValue(0.82);
|
fmgc.Input.mach.setValue(0.82);
|
||||||
} else {
|
} else {
|
||||||
machSet.setValue(machTemp);
|
fmgc.Input.mach.setValue(me.machTemp);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var iasTemp = iasSet.getValue();
|
me.iasTemp = fmgc.Input.kts.getValue();
|
||||||
if (d == 1) {
|
if (d == 1) {
|
||||||
iasTemp = iasTemp + 1;
|
me.iasTemp = me.iasTemp + 1;
|
||||||
} else if (d == -1) {
|
} else if (d == -1) {
|
||||||
iasTemp = iasTemp - 1;
|
me.iasTemp = me.iasTemp - 1;
|
||||||
} else if (d == 10) {
|
} else if (d == 10) {
|
||||||
iasTemp = iasTemp + 10;
|
me.iasTemp = me.iasTemp + 10;
|
||||||
} else if (d == -10) {
|
} else if (d == -10) {
|
||||||
iasTemp = iasTemp - 10;
|
me.iasTemp = me.iasTemp - 10;
|
||||||
}
|
}
|
||||||
if (iasTemp < 100) {
|
if (me.iasTemp < 100) {
|
||||||
iasSet.setValue(100);
|
fmgc.Input.kts.setValue(100);
|
||||||
} else if (iasTemp > 350) {
|
} else if (me.iasTemp > 350) {
|
||||||
iasSet.setValue(350);
|
fmgc.Input.kts.setValue(350);
|
||||||
} else {
|
} else {
|
||||||
iasSet.setValue(iasTemp);
|
fmgc.Input.kts.setValue(me.iasTemp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -274,66 +252,68 @@ var FCUController = {
|
||||||
},
|
},
|
||||||
HDGPush: func() {
|
HDGPush: func() {
|
||||||
if (me.FCUworking) {
|
if (me.FCUworking) {
|
||||||
if (fd1.getBoolValue() or fd2.getBoolValue() or ap1.getBoolValue() or ap2.getBoolValue()) {
|
if (fmgc.Output.fd1.getBoolValue() or fmgc.Output.fd2.getBoolValue() or fmgc.Output.ap1.getBoolValue() or fmgc.Output.ap2.getBoolValue()) {
|
||||||
latModeInput.setValue(1);
|
fmgc.Input.lat.setValue(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
HDGPull: func() {
|
HDGPull: func() {
|
||||||
if (me.FCUworking) {
|
if (me.FCUworking) {
|
||||||
if (fd1.getBoolValue() or fd2.getBoolValue() or ap1.getBoolValue() or ap2.getBoolValue()) {
|
if (fmgc.Output.fd1.getBoolValue() or fmgc.Output.fd2.getBoolValue() or fmgc.Output.ap1.getBoolValue() or fmgc.Output.ap2.getBoolValue()) {
|
||||||
if (latMode.getValue() == 0 or !showHDG.getBoolValue()) {
|
if (fmgc.Output.lat.getValue() == 0 or !fmgc.Custom.showHdg.getBoolValue()) {
|
||||||
latModeInput.setValue(3);
|
fmgc.Input.lat.setValue(3);
|
||||||
} else {
|
} else {
|
||||||
latModeInput.setValue(0);
|
fmgc.Input.lat.setValue(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
hdgTemp: nil,
|
||||||
HDGAdjust: func(d) {
|
HDGAdjust: func(d) {
|
||||||
if (me.FCUworking) {
|
if (me.FCUworking) {
|
||||||
if (latMode.getValue() != 0) {
|
if (fmgc.Output.lat.getValue() != 0) {
|
||||||
hdgInput();
|
hdgInput();
|
||||||
}
|
}
|
||||||
if (showHDG.getBoolValue()) {
|
if (fmgc.Custom.showHdg.getBoolValue()) {
|
||||||
var hdgTemp = hdgSet.getValue();
|
me.hdgTemp = fmgc.Input.hdg.getValue();
|
||||||
if (d == 1) {
|
if (d == 1) {
|
||||||
hdgTemp = hdgTemp + 1;
|
me.hdgTemp = me.hdgTemp + 1;
|
||||||
} else if (d == -1) {
|
} else if (d == -1) {
|
||||||
hdgTemp = hdgTemp - 1;
|
me.hdgTemp = me.hdgTemp - 1;
|
||||||
} else if (d == 10) {
|
} else if (d == 10) {
|
||||||
hdgTemp = hdgTemp + 10;
|
me.hdgTemp = me.hdgTemp + 10;
|
||||||
} else if (d == -10) {
|
} else if (d == -10) {
|
||||||
hdgTemp = hdgTemp - 10;
|
me.hdgTemp = me.hdgTemp - 10;
|
||||||
}
|
}
|
||||||
if (hdgTemp < 0.5) {
|
if (me.hdgTemp < 0.5) {
|
||||||
hdgSet.setValue(hdgTemp + 360);
|
fmgc.Input.hdg.setValue(me.hdgTemp + 360);
|
||||||
} else if (hdgTemp >= 360.5) {
|
} else if (me.hdgTemp >= 360.5) {
|
||||||
hdgSet.setValue(hdgTemp - 360);
|
fmgc.Input.hdg.setValue(me.hdgTemp - 360);
|
||||||
} else {
|
} else {
|
||||||
hdgSet.setValue(hdgTemp);
|
fmgc.Input.hdg.setValue(me.hdgTemp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
vertTemp: nil,
|
||||||
LOCButton: func() {
|
LOCButton: func() {
|
||||||
if (me.FCUworking) {
|
if (me.FCUworking) {
|
||||||
var vertTemp = vertMode.getValue();
|
me.vertTemp = fmgc.Output.vert.getValue();
|
||||||
if ((locArm.getBoolValue() or latMode.getValue() == 2) and !apprArm.getBoolValue() and vertTemp != 2 and vertTemp != 6) {
|
if ((fmgc.Output.locArm.getBoolValue() or fmgc.Output.lat.getValue() == 2) and !fmgc.Output.apprArm.getBoolValue() and me.vertTemp != 2 and me.vertTemp != 6) {
|
||||||
if (latMode.getValue() == 2) {
|
if (fmgc.Output.lat.getValue() == 2) {
|
||||||
latModeInput.setValue(0);
|
fmgc.Input.lat.setValue(0);
|
||||||
} else {
|
} else {
|
||||||
fmgc.ITAF.disarmLOC();
|
fmgc.ITAF.disarmLOC();
|
||||||
}
|
}
|
||||||
if (vertTemp == 2 or vertTemp == 6) {
|
if (me.vertTemp == 2 or me.vertTemp == 6) {
|
||||||
me.VSPull();
|
me.VSPull();
|
||||||
} else {
|
} else {
|
||||||
fmgc.ITAF.disarmGS();
|
fmgc.ITAF.disarmGS();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (pts.Position.gearAglFt.getValue() >= 400 and vertTemp != 7) {
|
if (pts.Position.gearAglFt.getValue() >= 400 and me.vertTemp != 7) {
|
||||||
latModeInput.setValue(2);
|
fmgc.Input.lat.setValue(2);
|
||||||
if (vertTemp == 2 or vertTemp == 6) {
|
if (me.vertTemp == 2 or me.vertTemp == 6) {
|
||||||
me.VSPull();
|
me.VSPull();
|
||||||
} else {
|
} else {
|
||||||
fmgc.ITAF.disarmGS();
|
fmgc.ITAF.disarmGS();
|
||||||
|
@ -354,123 +334,126 @@ var FCUController = {
|
||||||
},
|
},
|
||||||
ALTPull: func() {
|
ALTPull: func() {
|
||||||
if (me.FCUworking) {
|
if (me.FCUworking) {
|
||||||
vertModeInput.setValue(4);
|
fmgc.Input.vert.setValue(4);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
altTemp: nil,
|
||||||
ALTAdjust: func(d) {
|
ALTAdjust: func(d) {
|
||||||
if (me.FCUworking) {
|
if (me.FCUworking) {
|
||||||
var altTemp = altSet.getValue();
|
me.altTemp = fmgc.Input.alt.getValue();
|
||||||
if (d == 1) {
|
if (d == 1) {
|
||||||
if (altSetMode.getBoolValue()) {
|
if (altSetMode.getBoolValue()) {
|
||||||
altTemp = altTemp + 1000;
|
me.altTemp = me.altTemp + 1000;
|
||||||
} else {
|
} else {
|
||||||
altTemp = altTemp + 100;
|
me.altTemp = me.altTemp + 100;
|
||||||
}
|
}
|
||||||
} else if (d == -1) {
|
} else if (d == -1) {
|
||||||
if (altSetMode.getBoolValue()) {
|
if (altSetMode.getBoolValue()) {
|
||||||
altTemp = altTemp - 1000;
|
me.altTemp = me.altTemp - 1000;
|
||||||
} else {
|
} else {
|
||||||
altTemp = altTemp - 100;
|
me.altTemp = me.altTemp - 100;
|
||||||
}
|
}
|
||||||
} else if (d == 2) {
|
} else if (d == 2) {
|
||||||
altTemp = altTemp + 100;
|
me.altTemp = me.altTemp + 100;
|
||||||
} else if (d == -2) {
|
} else if (d == -2) {
|
||||||
altTemp = altTemp - 100;
|
me.altTemp = me.altTemp - 100;
|
||||||
} else if (d == 10) {
|
} else if (d == 10) {
|
||||||
altTemp = altTemp + 1000;
|
me.altTemp = me.altTemp + 1000;
|
||||||
} else if (d == -10) {
|
} else if (d == -10) {
|
||||||
altTemp = altTemp - 1000;
|
me.altTemp = me.altTemp - 1000;
|
||||||
}
|
}
|
||||||
if (altTemp < 100) {
|
if (me.altTemp < 100) {
|
||||||
altSet.setValue(100);
|
fmgc.Input.alt.setValue(100);
|
||||||
} else if (altTemp > 49000) {
|
} else if (me.altTemp > 49000) {
|
||||||
altSet.setValue(49000);
|
fmgc.Input.alt.setValue(49000);
|
||||||
} else {
|
} else {
|
||||||
altSet.setValue(altTemp);
|
fmgc.Input.alt.setValue(me.altTemp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
VSPush: func() {
|
VSPush: func() {
|
||||||
if (me.FCUworking) {
|
if (me.FCUworking) {
|
||||||
if (trkFpaSW.getBoolValue()) {
|
if (fmgc.Custom.trkFpa.getBoolValue()) {
|
||||||
vertModeInput.setValue(5);
|
fmgc.Input.vert.setValue(5);
|
||||||
fpaModeInput.setValue(0);
|
fmgc.Input.fpa.setValue(0);
|
||||||
} else {
|
} else {
|
||||||
vertModeInput.setValue(1);
|
fmgc.Input.vert.setValue(1);
|
||||||
vsModeInput.setValue(0);
|
fmgc.Input.vs.setValue(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
VSPull: func() {
|
VSPull: func() {
|
||||||
if (me.FCUworking) {
|
if (me.FCUworking) {
|
||||||
if (trkFpaSW.getBoolValue()) {
|
if (fmgc.Custom.trkFpa.getBoolValue()) {
|
||||||
vertModeInput.setValue(5);
|
fmgc.Input.vert.setValue(5);
|
||||||
} else {
|
} else {
|
||||||
vertModeInput.setValue(1);
|
fmgc.Input.vert.setValue(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
vsTemp: nil,
|
||||||
|
fpaTemp: nil,
|
||||||
VSAdjust: func(d) {
|
VSAdjust: func(d) {
|
||||||
if (me.FCUworking) {
|
if (me.FCUworking) {
|
||||||
if (vertMode.getValue() == 1) {
|
if (fmgc.Output.vert.getValue() == 1) {
|
||||||
var vsTemp = vsSet.getValue();
|
me.vsTemp = fmgc.Input.vs.getValue();
|
||||||
if (d == 1) {
|
if (d == 1) {
|
||||||
vsTemp = vsTemp + 100;
|
me.vsTemp = me.vsTemp + 100;
|
||||||
} else if (d == -1) {
|
} else if (d == -1) {
|
||||||
vsTemp = vsTemp - 100;
|
me.vsTemp = me.vsTemp - 100;
|
||||||
} else if (d == 10) {
|
} else if (d == 10) {
|
||||||
vsTemp = vsTemp + 1000;
|
me.vsTemp = me.vsTemp + 1000;
|
||||||
} else if (d == -10) {
|
} else if (d == -10) {
|
||||||
vsTemp = vsTemp - 1000;
|
me.vsTemp = me.vsTemp - 1000;
|
||||||
}
|
}
|
||||||
if (vsTemp < -6000) {
|
if (me.vsTemp < -6000) {
|
||||||
vsSet.setValue(-6000);
|
fmgc.Input.vs.setValue(-6000);
|
||||||
} else if (vsTemp > 6000) {
|
} else if (me.vsTemp > 6000) {
|
||||||
vsSet.setValue(6000);
|
fmgc.Input.vs.setValue(6000);
|
||||||
} else {
|
} else {
|
||||||
vsSet.setValue(vsTemp);
|
fmgc.Input.vs.setValue(me.vsTemp);
|
||||||
}
|
}
|
||||||
} else if (vertMode.getValue() == 5) {
|
} else if (fmgc.Output.vert.getValue() == 5) {
|
||||||
var fpaTemp = fpaSet.getValue();
|
me.fpaTemp = fmgc.Input.fpa.getValue();
|
||||||
if (d == 1) {
|
if (d == 1) {
|
||||||
fpaTemp = math.round(fpaTemp + 0.1, 0.1);
|
me.fpaTemp = math.round(me.fpaTemp + 0.1, 0.1);
|
||||||
} else if (d == -1) {
|
} else if (d == -1) {
|
||||||
fpaTemp = math.round(fpaTemp - 0.1, 0.1);
|
me.fpaTemp = math.round(me.fpaTemp - 0.1, 0.1);
|
||||||
} else if (d == 10) {
|
} else if (d == 10) {
|
||||||
fpaTemp = fpaTemp + 1;
|
me.fpaTemp = me.fpaTemp + 1;
|
||||||
} else if (d == -10) {
|
} else if (d == -10) {
|
||||||
fpaTemp = fpaTemp - 1;
|
me.fpaTemp = me.fpaTemp - 1;
|
||||||
}
|
}
|
||||||
if (fpaTemp < -9.9) {
|
if (me.fpaTemp < -9.9) {
|
||||||
fpaSet.setValue(-9.9);
|
fmgc.Input.fpa.setValue(-9.9);
|
||||||
} else if (fpaTemp > 9.9) {
|
} else if (me.fpaTemp > 9.9) {
|
||||||
fpaSet.setValue(9.9);
|
fmgc.Input.fpa.setValue(9.9);
|
||||||
} else {
|
} else {
|
||||||
fpaSet.setValue(fpaTemp);
|
fmgc.Input.fpa.setValue(me.fpaTemp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((vertMode.getValue() != 1 and !trkFpaSW.getBoolValue()) or (vertMode.getValue() != 5 and trkFpaSW.getBoolValue())) {
|
if ((fmgc.Output.vert.getValue() != 1 and !fmgc.Custom.trkFpa.getBoolValue()) or (fmgc.Output.vert.getValue() != 5 and fmgc.Custom.trkFpa.getBoolValue())) {
|
||||||
me.VSPull();
|
me.VSPull();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
APPRButton: func() {
|
APPRButton: func() {
|
||||||
if (me.FCUworking) {
|
if (me.FCUworking) {
|
||||||
var vertTemp = vertMode.getValue();
|
me.vertTemp = fmgc.Output.vert.getValue();
|
||||||
if ((locArm.getBoolValue() or latMode.getValue() == 2) and (apprArm.getBoolValue() or vertTemp == 2 or vertTemp == 6)) {
|
if ((fmgc.Output.locArm.getBoolValue() or fmgc.Output.lat.getValue() == 2) and (fmgc.Output.apprArm.getBoolValue() or me.vertTemp == 2 or me.vertTemp == 6)) {
|
||||||
if (latMode.getValue() == 2) {
|
if (fmgc.Output.lat.getValue() == 2) {
|
||||||
latModeInput.setValue(0);
|
fmgc.Input.lat.setValue(0);
|
||||||
} else {
|
} else {
|
||||||
fmgc.ITAF.disarmLOC();
|
fmgc.ITAF.disarmLOC();
|
||||||
}
|
}
|
||||||
if (vertTemp == 2 or vertTemp == 6) {
|
if (me.vertTemp == 2 or me.vertTemp == 6) {
|
||||||
me.VSPull();
|
me.VSPull();
|
||||||
} else {
|
} else {
|
||||||
fmgc.ITAF.disarmGS();
|
fmgc.ITAF.disarmGS();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (pts.Position.gearAglFt.getValue() >= 400 and vertTemp != 7) {
|
if (pts.Position.gearAglFt.getValue() >= 400 and me.vertTemp != 7) {
|
||||||
vertModeInput.setValue(2);
|
fmgc.Input.vert.setValue(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -479,13 +462,13 @@ var FCUController = {
|
||||||
|
|
||||||
# Master / slave principle of operation depending on the autopilot / flight director engagement
|
# Master / slave principle of operation depending on the autopilot / flight director engagement
|
||||||
var updateActiveFMGC = func {
|
var updateActiveFMGC = func {
|
||||||
if (ap1.getBoolValue()) {
|
if (fmgc.Output.ap1.getBoolValue()) {
|
||||||
FCUController.activeFMGC.setValue(1);
|
FCUController.activeFMGC.setValue(1);
|
||||||
} elsif (ap2.getBoolValue()) {
|
} elsif (fmgc.Output.ap2.getBoolValue()) {
|
||||||
FCUController.activeFMGC.setValue(2);
|
FCUController.activeFMGC.setValue(2);
|
||||||
} elsif (fd1.getBoolValue()) {
|
} elsif (fmgc.Output.fd1.getBoolValue()) {
|
||||||
FCUController.activeFMGC.setValue(1);
|
FCUController.activeFMGC.setValue(1);
|
||||||
} elsif (fd2.getBoolValue()) {
|
} elsif (fmgc.Output.fd2.getBoolValue()) {
|
||||||
FCUController.activeFMGC.setValue(2);
|
FCUController.activeFMGC.setValue(2);
|
||||||
} else {
|
} else {
|
||||||
FCUController.activeFMGC.setValue(1);
|
FCUController.activeFMGC.setValue(1);
|
||||||
|
@ -494,36 +477,35 @@ var updateActiveFMGC = func {
|
||||||
|
|
||||||
# Autopilot Disconnection
|
# Autopilot Disconnection
|
||||||
var apOff = func(type, side) {
|
var apOff = func(type, side) {
|
||||||
if ((ap1Input.getValue() and (side == 1 or side == 0)) or (ap2Input.getValue() and (side == 2 or side == 0))) {
|
if ((fmgc.Input.ap1.getValue() and (side == 1 or side == 0)) or (fmgc.Input.ap2.getValue() and (side == 2 or side == 0))) {
|
||||||
ecam.doApWarn(type);
|
ecam.doApWarn(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (side == 0) {
|
if (side == 0) {
|
||||||
ap1Input.setValue(0);
|
fmgc.Input.ap1.setValue(0);
|
||||||
ap2Input.setValue(0);
|
fmgc.Input.ap2.setValue(0);
|
||||||
} elsif (side == 1) {
|
} elsif (side == 1) {
|
||||||
ap1Input.setValue(0);
|
fmgc.Input.ap1.setValue(0);
|
||||||
} elsif (side == 2) {
|
} elsif (side == 2) {
|
||||||
ap2Input.setValue(0);
|
fmgc.Input.ap2.setValue(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Autothrust Disconnection
|
# Autothrust Disconnection
|
||||||
var athrOff = func(type) {
|
var athrOff = func(type) {
|
||||||
if (athrInput.getValue() == 1) {
|
if (fmgc.Input.athr.getValue() == 1) {
|
||||||
if (type == "hard") {
|
if (type == "hard") {
|
||||||
fadec.lockThr();
|
fadec.lockThr();
|
||||||
}
|
}
|
||||||
athrInput.setValue(0);
|
fmgc.Input.athr.setValue(0);
|
||||||
ecam.doAthrWarn(type);
|
ecam.doAthrWarn(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# If the heading knob is turned while in nav mode, it will display heading for a period of time
|
# If the heading knob is turned while in nav mode, it will display heading for a period of time
|
||||||
var hdgInput = func {
|
var hdgInput = func {
|
||||||
if (latMode.getValue() != 0) {
|
if (fmgc.Output.lat.getValue() != 0) {
|
||||||
showHDG.setBoolValue(1);
|
fmgc.Custom.showHdg.setBoolValue(1);
|
||||||
var hdgnow = fmgc.Input.hdg.getValue();
|
|
||||||
fmgc.Custom.hdgTime.setValue(pts.Sim.Time.elapsedSec.getValue());
|
fmgc.Custom.hdgTime.setValue(pts.Sim.Time.elapsedSec.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -998,6 +998,7 @@ setlistener("/it-autoflight/input/lat", func {
|
||||||
Output.ap2Temp = Output.ap2.getBoolValue();
|
Output.ap2Temp = Output.ap2.getBoolValue();
|
||||||
Output.fd1Temp = Output.fd1.getBoolValue();
|
Output.fd1Temp = Output.fd1.getBoolValue();
|
||||||
Output.fd2Temp = Output.fd2.getBoolValue();
|
Output.fd2Temp = Output.fd2.getBoolValue();
|
||||||
|
|
||||||
if (!Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue()) {
|
if (!Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue()) {
|
||||||
if (Output.ap1Temp or Output.ap2Temp or Output.fd1Temp or Output.fd2Temp) {
|
if (Output.ap1Temp or Output.ap2Temp or Output.fd1Temp or Output.fd2Temp) {
|
||||||
ITAF.setLatMode(Input.latTemp);
|
ITAF.setLatMode(Input.latTemp);
|
||||||
|
@ -1026,12 +1027,12 @@ setlistener("/sim/signals/fdm-initialized", func {
|
||||||
});
|
});
|
||||||
|
|
||||||
# For Canvas Nav Display.
|
# For Canvas Nav Display.
|
||||||
setlistener("/it-autoflight/input/hdg", func {
|
setlistener("/it-autoflight/input/hdg", func() {
|
||||||
setprop("/autopilot/settings/heading-bug-deg", Input.hdg.getValue());
|
pts.Autopilot.Settings.headingBugDeg.setValue(Input.hdg.getValue());
|
||||||
}, 0, 0);
|
}, 0, 0);
|
||||||
|
|
||||||
setlistener("/it-autoflight/internal/alt", func {
|
setlistener("/it-autoflight/internal/alt", func() {
|
||||||
setprop("/autopilot/settings/target-altitude-ft", Internal.alt.getValue());
|
pts.Autopilot.Settings.targetAltitudeFt.setValue(Internal.alt.getValue());
|
||||||
}, 0, 0);
|
}, 0, 0);
|
||||||
|
|
||||||
var loopTimer = maketimer(0.1, ITAF, ITAF.loop);
|
var loopTimer = maketimer(0.1, ITAF, ITAF.loop);
|
||||||
|
|
|
@ -63,6 +63,8 @@ var crzFl = 0;
|
||||||
var windHdg = 0;
|
var windHdg = 0;
|
||||||
var windSpeed = 0;
|
var windSpeed = 0;
|
||||||
var windsDidChange = 0;
|
var windsDidChange = 0;
|
||||||
|
var tempOverspeed = nil;
|
||||||
|
|
||||||
setprop("position/gear-agl-ft", 0);
|
setprop("position/gear-agl-ft", 0);
|
||||||
setprop("/it-autoflight/settings/accel-agl-ft", 1500); #eventually set to 1500 above runway
|
setprop("/it-autoflight/settings/accel-agl-ft", 1500); #eventually set to 1500 above runway
|
||||||
setprop("/it-autoflight/internal/vert-speed-fpm", 0);
|
setprop("/it-autoflight/internal/vert-speed-fpm", 0);
|
||||||
|
@ -84,7 +86,6 @@ var FMGCinit = func {
|
||||||
FMGCInternal.minspeed = 0;
|
FMGCInternal.minspeed = 0;
|
||||||
FMGCInternal.maxspeed = 338;
|
FMGCInternal.maxspeed = 338;
|
||||||
FMGCInternal.phase = 0; # 0 is Preflight 1 is Takeoff 2 is Climb 3 is Cruise 4 is Descent 5 is Decel/Approach 6 is Go Around 7 is Done
|
FMGCInternal.phase = 0; # 0 is Preflight 1 is Takeoff 2 is Climb 3 is Cruise 4 is Descent 5 is Decel/Approach 6 is Go Around 7 is Done
|
||||||
FMGCNodes.phase.setValue(0);
|
|
||||||
FMGCInternal.mngSpd = 157;
|
FMGCInternal.mngSpd = 157;
|
||||||
FMGCInternal.mngSpdCmd = 157;
|
FMGCInternal.mngSpdCmd = 157;
|
||||||
FMGCInternal.mngKtsMach = 0;
|
FMGCInternal.mngKtsMach = 0;
|
||||||
|
@ -258,7 +259,6 @@ var FMGCNodes = {
|
||||||
toState: props.globals.initNode("/FMGC/internal/to-state", 0, "BOOL"),
|
toState: props.globals.initNode("/FMGC/internal/to-state", 0, "BOOL"),
|
||||||
v1: props.globals.initNode("/FMGC/internal/v1", 0, "DOUBLE"),
|
v1: props.globals.initNode("/FMGC/internal/v1", 0, "DOUBLE"),
|
||||||
v1set: props.globals.initNode("/FMGC/internal/v1-set", 0, "BOOL"),
|
v1set: props.globals.initNode("/FMGC/internal/v1-set", 0, "BOOL"),
|
||||||
phase: props.globals.initNode("/FMGC/internal/phase", 0, "INT"),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
############
|
############
|
||||||
|
@ -281,9 +281,9 @@ var trimReset = func {
|
||||||
###############
|
###############
|
||||||
|
|
||||||
var updateARPT = func {
|
var updateARPT = func {
|
||||||
setprop("autopilot/route-manager/departure/airport", FMGCInternal.depApt);
|
setprop("/autopilot/route-manager/departure/airport", FMGCInternal.depApt);
|
||||||
setprop("autopilot/route-manager/destination/airport", FMGCInternal.arrApt);
|
setprop("/autopilot/route-manager/destination/airport", FMGCInternal.arrApt);
|
||||||
setprop("autopilot/route-manager/alternate/airport", FMGCInternal.altAirport);
|
setprop("/autopilot/route-manager/alternate/airport", FMGCInternal.altAirport);
|
||||||
if (getprop("/autopilot/route-manager/active") != 1) {
|
if (getprop("/autopilot/route-manager/active") != 1) {
|
||||||
fgcommand("activate-flightplan", props.Node.new({"activate": 1}));
|
fgcommand("activate-flightplan", props.Node.new({"activate": 1}));
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,7 @@ var updateArptLatLon = func {
|
||||||
}
|
}
|
||||||
|
|
||||||
updateRouteManagerAlt = func() {
|
updateRouteManagerAlt = func() {
|
||||||
setprop("autopilot/route-manager/cruise/altitude-ft", FMGCInternal.crzFt);
|
setprop("/autopilot/route-manager/cruise/altitude-ft", FMGCInternal.crzFt);
|
||||||
# TODO - update FMGCInternal.phase when DES to re-enter in CLIMB/CRUIZE
|
# TODO - update FMGCInternal.phase when DES to re-enter in CLIMB/CRUIZE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -603,14 +603,92 @@ var radios = maketimer(1, func() {
|
||||||
adf1();
|
adf1();
|
||||||
});
|
});
|
||||||
|
|
||||||
var fuelUpdateFMGC = maketimer(0.5, func {
|
var masterFMGC = maketimer(0.2, func {
|
||||||
|
n1_left = pts.Engines.Engine.n1Actual[0].getValue();
|
||||||
|
n1_right = pts.Engines.Engine.n1Actual[1].getValue();
|
||||||
|
modelat = Modes.PFD.FMA.rollMode.getValue();
|
||||||
|
mode = Modes.PFD.FMA.pitchMode.getValue();
|
||||||
|
gs = pts.Velocities.groundspeed.getValue();
|
||||||
|
alt = pts.Instrumentation.Altimeter.indicatedFt.getValue();
|
||||||
|
# cruiseft = FMGCInternal.crzFt;
|
||||||
|
# cruiseft_b = FMGCInternal.crzFt - 200;
|
||||||
|
state1 = pts.Systems.Thrust.state[0].getValue();
|
||||||
|
state2 = pts.Systems.Thrust.state[1].getValue();
|
||||||
|
accel_agl_ft = Setting.reducAglFt.getValue();
|
||||||
|
gear0 = pts.Gear.wow[0].getBoolValue();
|
||||||
|
altSel = Input.alt.getValue();
|
||||||
|
|
||||||
|
if ((n1_left < 85 or n1_right < 85) and gs < 90 and mode == " " and gear0 and FMGCInternal.phase == 1) { # rejected takeoff
|
||||||
|
FMGCInternal.phase = 0;
|
||||||
|
systems.PNEU.pressMode.setValue("GN");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gear0 and FMGCInternal.phase == 0 and ((n1_left >= 85 and n1_right >= 85 and mode == "SRS") or gs >= 90)) {
|
||||||
|
FMGCInternal.phase = 1;
|
||||||
|
systems.PNEU.pressMode.setValue("TO");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FMGCInternal.phase == 1 and ((mode != "SRS" and mode != " ") or alt >= accel_agl_ft)) {
|
||||||
|
FMGCInternal.phase = 2;
|
||||||
|
systems.PNEU.pressMode.setValue("TO");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FMGCInternal.phase == 2 and (mode == "ALT CRZ" or mode == "ALT CRZ*")) {
|
||||||
|
FMGCInternal.phase = 3;
|
||||||
|
systems.PNEU.pressMode.setValue("CR");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FMGCInternal.crzFl >= 200) {
|
||||||
|
if (FMGCInternal.phase == 3 and (flightPlanController.arrivalDist <= 200 or altSel < 20000)) {
|
||||||
|
FMGCInternal.phase = 4;
|
||||||
|
systems.PNEU.pressMode.setValue("DE");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (FMGCInternal.phase == 3 and (flightPlanController.arrivalDist <= 200 or altSel < (FMGCInternal.crzFl * 100))) { # todo - not sure about crzFl condition, investigate what happens!
|
||||||
|
FMGCInternal.phase = 4;
|
||||||
|
systems.PNEU.pressMode.setValue("DE");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FMGCInternal.phase == 4) {
|
||||||
|
if (getprop("/FMGC/internal/decel")) {
|
||||||
|
FMGCInternal.phase = 5;
|
||||||
|
}
|
||||||
|
else if (altSel == (FMGCInternal.crzFl * 100)) { # back to CRZ state
|
||||||
|
FMGCInternal.phase = 3;
|
||||||
|
systems.PNEU.pressMode.setValue("CR");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flightPlanController.num[2].getValue() > 0 and getprop("/FMGC/flightplan[2]/active") == 1 and flightPlanController.arrivalDist <= 15 and (modelat == "NAV" or modelat == "LOC" or modelat == "LOC*") and pts.Position.gearAglFt.getValue() < 9500) { #todo decel pseudo waypoint
|
||||||
|
setprop("/FMGC/internal/decel", 1);
|
||||||
|
} else if (getprop("/FMGC/internal/decel") == 1 and (FMGCInternal.phase == 0 or FMGCInternal.phase == 6)) {
|
||||||
|
setprop("/FMGC/internal/decel", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((FMGCInternal.phase == 5) and state1 == "TOGA" and state2 == "TOGA") {
|
||||||
|
FMGCInternal.phase = 6;
|
||||||
|
systems.PNEU.pressMode.setValue("TO");
|
||||||
|
Input.toga.setValue(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FMGCInternal.phase == 6 and alt >= accel_agl_ft) { # todo when insert altn or new dest
|
||||||
|
FMGCInternal.phase = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
tempOverspeed = systems.ADIRS.overspeedVFE.getValue();
|
||||||
|
if (tempOverspeed != 1024) {
|
||||||
|
FMGCInternal.maxspeed = tempOverspeed - 4;
|
||||||
|
} elsif (pts.Gear.position[0].getValue() != 0 or pts.Gear.position[1].getValue() != 0 or pts.Gear.position[2].getValue() != 0) {
|
||||||
|
FMGCInternal.maxspeed = 284;
|
||||||
|
} else {
|
||||||
|
FMGCInternal.maxspeed = fmgc.FMGCInternal.vmo_mmo;
|
||||||
|
}
|
||||||
|
|
||||||
############################
|
############################
|
||||||
# fuel
|
# fuel
|
||||||
############################
|
############################
|
||||||
updateFuel();
|
updateFuel();
|
||||||
});
|
|
||||||
|
|
||||||
var windUpdateFMGC = maketimer(1, func {
|
|
||||||
|
|
||||||
############################
|
############################
|
||||||
# wind
|
# wind
|
||||||
|
@ -656,142 +734,6 @@ var windUpdateFMGC = maketimer(1, func {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
var prop_n1_left = pts.Engines.Engine.n1Actual[0];
|
|
||||||
var prop_n1_right = pts.Engines.Engine.n1Actual[1];
|
|
||||||
#var prop_nmodelat = Modes.PFD.FMA.rollMode;
|
|
||||||
#var prop_mode = Modes.PFD.FMA.pitchMode;
|
|
||||||
var prop_gs = pts.Velocities.groundspeed;
|
|
||||||
var prop_alt = pts.Instrumentation.Altimeter.indicatedFt;
|
|
||||||
var prop_state1 = pts.Systems.Thrust.state[0];
|
|
||||||
var prop_state2 = pts.Systems.Thrust.state[1];
|
|
||||||
#var prop_accel_agl_ft = Setting.reducAglFt;
|
|
||||||
var prop_gear0 = pts.Gear.wow[0];
|
|
||||||
#var prop_altSel = Input.alt;
|
|
||||||
|
|
||||||
var masterFMGC = maketimer(0.2, func {
|
|
||||||
|
|
||||||
n1_left = prop_n1_left.getValue();
|
|
||||||
n1_right = prop_n1_right.getValue();
|
|
||||||
modelat = Modes.PFD.FMA.rollMode.getValue();
|
|
||||||
mode = Modes.PFD.FMA.pitchMode.getValue();
|
|
||||||
gs = prop_gs.getValue();
|
|
||||||
alt = prop_alt.getValue();
|
|
||||||
# cruiseft = FMGCInternal.crzFt;
|
|
||||||
# cruiseft_b = FMGCInternal.crzFt - 200;
|
|
||||||
state1 = prop_state1.getValue();
|
|
||||||
state2 = prop_state2.getValue();
|
|
||||||
accel_agl_ft = Setting.reducAglFt.getValue();
|
|
||||||
gear0 = prop_gear0.getBoolValue();
|
|
||||||
altSel = Input.alt.getValue();
|
|
||||||
|
|
||||||
var phase = FMGCInternal.phase;
|
|
||||||
var newphase = phase;
|
|
||||||
|
|
||||||
if (phase == 0) {
|
|
||||||
|
|
||||||
if (gear0 and ((n1_left >= 85 and n1_right >= 85 and mode == "SRS") or gs >= 90)) {
|
|
||||||
newphase = 1;
|
|
||||||
systems.PNEU.pressMode.setValue("TO");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (phase == 1) {
|
|
||||||
|
|
||||||
if (gear0) {
|
|
||||||
|
|
||||||
if ((n1_left < 85 or n1_right < 85) and gs < 90 and mode == " ") { # rejected takeoff
|
|
||||||
newphase = 0;
|
|
||||||
systems.PNEU.pressMode.setValue("GN");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else if (((mode != "SRS" and mode != " ") or alt >= accel_agl_ft)) {
|
|
||||||
newphase = 2;
|
|
||||||
systems.PNEU.pressMode.setValue("TO");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (phase == 2) {
|
|
||||||
|
|
||||||
if ((mode == "ALT CRZ" or mode == "ALT CRZ*")) {
|
|
||||||
newphase = 3;
|
|
||||||
systems.PNEU.pressMode.setValue("CR");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (phase == 3) {
|
|
||||||
|
|
||||||
if (FMGCInternal.crzFl >= 200) {
|
|
||||||
if ((flightPlanController.arrivalDist <= 200 or altSel < 20000)) {
|
|
||||||
newphase = 4;
|
|
||||||
systems.PNEU.pressMode.setValue("DE");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ((flightPlanController.arrivalDist <= 200 or altSel < (FMGCInternal.crzFl * 100))) { # todo - not sure about crzFl condition, investigate what happens!
|
|
||||||
newphase = 4;
|
|
||||||
systems.PNEU.pressMode.setValue("DE");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (phase == 4) {
|
|
||||||
|
|
||||||
if (getprop("/FMGC/internal/decel")) {
|
|
||||||
newphase = 5;
|
|
||||||
}
|
|
||||||
else if (altSel == (FMGCInternal.crzFl * 100)) { # back to CRZ state
|
|
||||||
newphase = 3;
|
|
||||||
systems.PNEU.pressMode.setValue("CR");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (phase == 5) {
|
|
||||||
|
|
||||||
if (state1 == "TOGA" and state2 == "TOGA") {
|
|
||||||
newphase = 6;
|
|
||||||
systems.PNEU.pressMode.setValue("TO");
|
|
||||||
Input.toga.setValue(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (phase == 6) {
|
|
||||||
|
|
||||||
if (alt >= accel_agl_ft) { # todo when insert altn or new dest
|
|
||||||
newphase = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (flightPlanController.num[2].getValue() > 0 and getprop("/FMGC/flightplan[2]/active") == 1 and
|
|
||||||
flightPlanController.arrivalDist <= 15 and (modelat == "NAV" or modelat == "LOC" or modelat == "LOC*") and pts.Position.gearAglFt.getValue() < 9500) { #todo decel pseudo waypoint
|
|
||||||
setprop("/FMGC/internal/decel", 1);
|
|
||||||
} else if (getprop("/FMGC/internal/decel") == 1 and (phase == 0 or phase == 6)) {
|
|
||||||
setprop("/FMGC/internal/decel", 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (getprop("/systems/navigation/adr/computation/overspeed-vfe-spd") != 1024) {
|
|
||||||
FMGCInternal.maxspeed = getprop("/systems/navigation/adr/computation/overspeed-vfe-spd") - 4;
|
|
||||||
} elsif (pts.Gear.position[0].getValue() != 0 or pts.Gear.position[1].getValue() != 0 or pts.Gear.position[2].getValue() != 0) {
|
|
||||||
FMGCInternal.maxspeed = 284;
|
|
||||||
} else {
|
|
||||||
FMGCInternal.maxspeed = fmgc.FMGCInternal.vmo_mmo;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newphase != phase) { # phase changed
|
|
||||||
FMGCInternal.phase = newphase;
|
|
||||||
FMGCNodes.phase.setValue(newphase);
|
|
||||||
}
|
|
||||||
|
|
||||||
############################
|
############################
|
||||||
# calculate speeds
|
# calculate speeds
|
||||||
############################
|
############################
|
||||||
|
@ -832,7 +774,7 @@ var masterFMGC = maketimer(0.2, func {
|
||||||
}
|
}
|
||||||
|
|
||||||
# predicted takeoff speeds
|
# predicted takeoff speeds
|
||||||
if (phase == 1) {
|
if (FMGCInternal.phase == 1) {
|
||||||
FMGCInternal.clean_to = FMGCInternal.clean;
|
FMGCInternal.clean_to = FMGCInternal.clean;
|
||||||
FMGCInternal.vs1g_clean_to = FMGCInternal.vs1g_clean;
|
FMGCInternal.vs1g_clean_to = FMGCInternal.vs1g_clean;
|
||||||
FMGCInternal.vs1g_conf_2_to = FMGCInternal.vs1g_conf_2;
|
FMGCInternal.vs1g_conf_2_to = FMGCInternal.vs1g_conf_2;
|
||||||
|
@ -854,7 +796,7 @@ var masterFMGC = maketimer(0.2, func {
|
||||||
}
|
}
|
||||||
|
|
||||||
# predicted approach (temp go-around) speeds
|
# predicted approach (temp go-around) speeds
|
||||||
if (phase == 5 or phase == 6) {
|
if (FMGCInternal.phase == 5 or FMGCInternal.phase == 6) {
|
||||||
FMGCInternal.clean_appr = FMGCInternal.clean;
|
FMGCInternal.clean_appr = FMGCInternal.clean;
|
||||||
FMGCInternal.vs1g_clean_appr = FMGCInternal.vs1g_clean;
|
FMGCInternal.vs1g_clean_appr = FMGCInternal.vs1g_clean;
|
||||||
FMGCInternal.vs1g_conf_2_appr = FMGCInternal.vs1g_conf_2;
|
FMGCInternal.vs1g_conf_2_appr = FMGCInternal.vs1g_conf_2;
|
||||||
|
@ -975,8 +917,7 @@ var masterFMGC = maketimer(0.2, func {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (gear0 and pts.Controls.Flight.flapsPos.getValue() < 5 and (state1 == "MCT" or state1 == "MAN THR" or state1 == "TOGA") and (state2 == "MCT" or state2 == "MAN THR" or state2 == "TOGA")) {
|
if (gear0 and pts.Controls.Flight.flapsPos.getValue() < 5 and (state1 == "MCT" or state1 == "MAN THR" or state1 == "TOGA") and (state2 == "MCT" or state2 == "MAN THR" or state2 == "TOGA")) {
|
||||||
if (gear0 and flap < 5 and (state1 == "MCT" or state1 == "MAN THR" or state1 == "TOGA") and (state2 == "MCT" or state2 == "MAN THR" or state2 == "TOGA")) {
|
|
||||||
if (!FMGCInternal.takeoffState) {
|
if (!FMGCInternal.takeoffState) {
|
||||||
fmgc.FMGCNodes.toState.setValue(1);
|
fmgc.FMGCNodes.toState.setValue(1);
|
||||||
}
|
}
|
||||||
|
@ -992,15 +933,9 @@ var masterFMGC = maketimer(0.2, func {
|
||||||
#handle radios, runways, v1/vr/v2
|
#handle radios, runways, v1/vr/v2
|
||||||
############################
|
############################
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
var updateAirportRadios = func {
|
|
||||||
|
|
||||||
var phase = FMGCInternal.phase;
|
|
||||||
|
|
||||||
departure_rwy = fmgc.flightPlanController.flightplans[2].departure_runway;
|
departure_rwy = fmgc.flightPlanController.flightplans[2].departure_runway;
|
||||||
destination_rwy = fmgc.flightPlanController.flightplans[2].destination_runway;
|
destination_rwy = fmgc.flightPlanController.flightplans[2].destination_runway;
|
||||||
if (destination_rwy != nil and phase >= 2) {
|
if (destination_rwy != nil and FMGCInternal.phase >= 2) {
|
||||||
var airport = airportinfo(FMGCInternal.arrApt);
|
var airport = airportinfo(FMGCInternal.arrApt);
|
||||||
setprop("/FMGC/internal/ldg-elev", airport.elevation * M2FT); # eventually should be runway elevation
|
setprop("/FMGC/internal/ldg-elev", airport.elevation * M2FT); # eventually should be runway elevation
|
||||||
magnetic_hdg = geo.normdeg(destination_rwy.heading - getprop("/environment/magnetic-variation-deg"));
|
magnetic_hdg = geo.normdeg(destination_rwy.heading - getprop("/environment/magnetic-variation-deg"));
|
||||||
|
@ -1015,7 +950,7 @@ var updateAirportRadios = func {
|
||||||
} else if (!getprop("/FMGC/internal/ils1crs-set")) {
|
} else if (!getprop("/FMGC/internal/ils1crs-set")) {
|
||||||
setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
|
setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
|
||||||
}
|
}
|
||||||
} else if (departure_rwy != nil and phase <= 1) {
|
} else if (departure_rwy != nil and FMGCInternal.phase <= 1) {
|
||||||
magnetic_hdg = geo.normdeg(departure_rwy.heading - getprop("/environment/magnetic-variation-deg"));
|
magnetic_hdg = geo.normdeg(departure_rwy.heading - getprop("/environment/magnetic-variation-deg"));
|
||||||
runway_ils = departure_rwy.ils_frequency_mhz;
|
runway_ils = departure_rwy.ils_frequency_mhz;
|
||||||
if (runway_ils != nil and !getprop("/FMGC/internal/ils1freq-set") and !getprop("/FMGC/internal/ils1crs-set")) {
|
if (runway_ils != nil and !getprop("/FMGC/internal/ils1freq-set") and !getprop("/FMGC/internal/ils1crs-set")) {
|
||||||
|
@ -1029,15 +964,10 @@ var updateAirportRadios = func {
|
||||||
setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
|
setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
};
|
|
||||||
|
|
||||||
setlistener(FMGCNodes.phase, updateAirportRadios);
|
|
||||||
setlistener(flightPlanController.changed, updateAirportRadios);
|
|
||||||
|
|
||||||
var reset_FMGC = func {
|
var reset_FMGC = func {
|
||||||
FMGCInternal.phase = 0;
|
FMGCInternal.phase = 0;
|
||||||
FMGCNodes.phase.serValue(0);
|
|
||||||
fd1 = Input.fd1.getValue();
|
fd1 = Input.fd1.getValue();
|
||||||
fd2 = Input.fd2.getValue();
|
fd2 = Input.fd2.getValue();
|
||||||
spd = Input.kts.getValue();
|
spd = Input.kts.getValue();
|
||||||
|
|
|
@ -13,11 +13,11 @@ var SimbriefParser = {
|
||||||
fetch: func(username, i) {
|
fetch: func(username, i) {
|
||||||
me.inhibit = 1;
|
me.inhibit = 1;
|
||||||
var stamp = systime();
|
var stamp = systime();
|
||||||
http.save("https://www.simbrief.com/api/xml.fetcher.php?username=" ~ username, getprop('/sim/fg-home') ~ "/Export/A320-family-simbrief.xml")
|
http.save("https://www.simbrief.com/api/xml.fetcher.php?username=" ~ username, pts.Sim.fgHome.getValue() ~ "/Export/A320-family-simbrief.xml")
|
||||||
.fail(func { me.failure(i) })
|
.fail(func { me.failure(i) })
|
||||||
.done(func {
|
.done(func {
|
||||||
var errs = [];
|
var errs = [];
|
||||||
call(me.read, [(getprop('/sim/fg-home') ~ "/Export/A320-family-simbrief.xml"),i], SimbriefParser, {}, errs);
|
call(me.read, [(pts.Sim.fgHome.getValue() ~ "/Export/A320-family-simbrief.xml"),i], SimbriefParser, {}, errs);
|
||||||
if (size(errs) > 0) {
|
if (size(errs) > 0) {
|
||||||
debug.printerror(errs);
|
debug.printerror(errs);
|
||||||
me.failure(i);
|
me.failure(i);
|
||||||
|
|
|
@ -160,7 +160,7 @@ var WaypointDatabase = {
|
||||||
},
|
},
|
||||||
# write - write to file, as a hash structure
|
# write - write to file, as a hash structure
|
||||||
write: func() {
|
write: func() {
|
||||||
var path = getprop("/sim/fg-home") ~ "/Export/A320SavedWaypoints.xml";
|
var path = pts.Sim.fgHome.getValue() ~ "/Export/A320SavedWaypoints.xml";
|
||||||
var tree = {
|
var tree = {
|
||||||
waypoints: {
|
waypoints: {
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ var WaypointDatabase = {
|
||||||
},
|
},
|
||||||
# read - read from a file, extract using props interface
|
# read - read from a file, extract using props interface
|
||||||
read: func() {
|
read: func() {
|
||||||
var path = getprop("/sim/fg-home") ~ "/Export/A320SavedWaypoints.xml";
|
var path = pts.Sim.fgHome.getValue() ~ "/Export/A320SavedWaypoints.xml";
|
||||||
# create file if it doesn't exist
|
# create file if it doesn't exist
|
||||||
if (io.stat(path) == nil) {
|
if (io.stat(path) == nil) {
|
||||||
me.write();
|
me.write();
|
||||||
|
|
|
@ -226,7 +226,7 @@ var windController = {
|
||||||
},
|
},
|
||||||
# read - read from hist wind file, create one if it doesn't exist
|
# read - read from hist wind file, create one if it doesn't exist
|
||||||
read: func() {
|
read: func() {
|
||||||
var path = getprop("/sim/fg-home") ~ "/Export/A320SavedWinds.txt";
|
var path = pts.Sim.fgHome.getValue() ~ "/Export/A320SavedWinds.txt";
|
||||||
# create file if it doesn't exist
|
# create file if it doesn't exist
|
||||||
if (io.stat(path) == nil) {
|
if (io.stat(path) == nil) {
|
||||||
me.write();
|
me.write();
|
||||||
|
@ -267,7 +267,7 @@ var windController = {
|
||||||
# write - write to hist wind file, called whenever winds changed
|
# write - write to hist wind file, called whenever winds changed
|
||||||
write: func() {
|
write: func() {
|
||||||
if (me.des_winds[2] != 0) {
|
if (me.des_winds[2] != 0) {
|
||||||
var path = getprop("/sim/fg-home") ~ "/Export/A320SavedWinds.txt";
|
var path = pts.Sim.fgHome.getValue() ~ "/Export/A320SavedWinds.txt";
|
||||||
var file = io.open(path, "wb");
|
var file = io.open(path, "wb");
|
||||||
var winds_added = 0;
|
var winds_added = 0;
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,13 @@
|
||||||
# Anything that says Temp is set by another file to avoid multiple getValue calls
|
# Anything that says Temp is set by another file to avoid multiple getValue calls
|
||||||
# Usage Example: pts.Class.SubClass.node.getValue()
|
# Usage Example: pts.Class.SubClass.node.getValue()
|
||||||
|
|
||||||
|
var Autopilot = {
|
||||||
|
Settings: {
|
||||||
|
headingBugDeg: props.globals.getNode("/autopilot/settings/heading-bug-deg",1),
|
||||||
|
targetAltitudeFt: props.globals.getNode("/autopilot/settings/target-altitude-ft",1),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
var Accelerations = {
|
var Accelerations = {
|
||||||
pilotGDamped: props.globals.getNode("/accelerations/pilot-gdamped"),
|
pilotGDamped: props.globals.getNode("/accelerations/pilot-gdamped"),
|
||||||
};
|
};
|
||||||
|
@ -192,6 +199,7 @@ var Instrumentation = {
|
||||||
locDeflection: props.globals.getNode("/instrumentation/nav[0]/heading-needle-deflection-norm"),
|
locDeflection: props.globals.getNode("/instrumentation/nav[0]/heading-needle-deflection-norm"),
|
||||||
},
|
},
|
||||||
TCAS: {
|
TCAS: {
|
||||||
|
servicable: props.globals.getNode("/instrumentation/tcas/serviceable"),
|
||||||
Inputs: {
|
Inputs: {
|
||||||
mode: props.globals.getNode("/instrumentation/tcas/inputs/mode"),
|
mode: props.globals.getNode("/instrumentation/tcas/inputs/mode"),
|
||||||
},
|
},
|
||||||
|
@ -216,6 +224,7 @@ var Position = {
|
||||||
|
|
||||||
var Sim = {
|
var Sim = {
|
||||||
aero: props.globals.getNode("/sim/aero"),
|
aero: props.globals.getNode("/sim/aero"),
|
||||||
|
aircraft: props.globals.getNode("/sim/aircraft"),
|
||||||
CurrentView: {
|
CurrentView: {
|
||||||
fieldOfView: props.globals.getNode("/sim/current-view/field-of-view", 1),
|
fieldOfView: props.globals.getNode("/sim/current-view/field-of-view", 1),
|
||||||
headingOffsetDeg: props.globals.getNode("/sim/current-view/heading-offset-deg", 1),
|
headingOffsetDeg: props.globals.getNode("/sim/current-view/heading-offset-deg", 1),
|
||||||
|
@ -231,6 +240,7 @@ var Sim = {
|
||||||
zOffsetMaxM: props.globals.getNode("/sim/current-view/z-offset-max-m", 1),
|
zOffsetMaxM: props.globals.getNode("/sim/current-view/z-offset-max-m", 1),
|
||||||
zOffsetMinM: props.globals.getNode("/sim/current-view/z-offset-min-m", 1),
|
zOffsetMinM: props.globals.getNode("/sim/current-view/z-offset-min-m", 1),
|
||||||
},
|
},
|
||||||
|
fgHome: props.globals.getNode("/sim/fg-home"),
|
||||||
Input: {
|
Input: {
|
||||||
Selected: {
|
Selected: {
|
||||||
engine: [props.globals.getNode("/sim/input/selected/engine[0]", 1),props.globals.getNode("/sim/input/selected/engine[1]", 1)],
|
engine: [props.globals.getNode("/sim/input/selected/engine[0]", 1),props.globals.getNode("/sim/input/selected/engine[1]", 1)],
|
||||||
|
|
|
@ -32,7 +32,7 @@ var init = func() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var update_com1 = func() {
|
var update_com1 = func() {
|
||||||
if (getprop("/systems/acconfig/options/fo-view") == 1) {
|
if (acconfig.foViewNode.getValue() == 1) {
|
||||||
if (vhf1_fo_recive.getValue()) {
|
if (vhf1_fo_recive.getValue()) {
|
||||||
com1_volume.setValue(vhf1_fo_volume.getValue());
|
com1_volume.setValue(vhf1_fo_volume.getValue());
|
||||||
} else {
|
} else {
|
||||||
|
@ -48,7 +48,7 @@ var update_com1 = func() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var update_com2 = func() {
|
var update_com2 = func() {
|
||||||
if (getprop("/systems/acconfig/options/fo-view") == 1) {
|
if (acconfig.foViewNode.getValue() == 1) {
|
||||||
if (vhf2_fo_recive.getValue()) {
|
if (vhf2_fo_recive.getValue()) {
|
||||||
com2_volume.setValue(vhf2_fo_volume.getValue());
|
com2_volume.setValue(vhf2_fo_volume.getValue());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -141,10 +141,11 @@ var transponderPanel = {
|
||||||
code: "2000",
|
code: "2000",
|
||||||
codeDisp: "2000",
|
codeDisp: "2000",
|
||||||
codeProp: props.globals.initNode("/systems/atc/transponder-code", "2000", "STRING"),
|
codeProp: props.globals.initNode("/systems/atc/transponder-code", "2000", "STRING"),
|
||||||
|
failNode: props.globals.getNode("/systems/atc/failed"),
|
||||||
failLight: 0,
|
failLight: 0,
|
||||||
clearFlag: 0,
|
clearFlag: 0,
|
||||||
keypad: func(keyNum) {
|
keypad: func(keyNum) {
|
||||||
if (props.globals.getNode("/controls/switches/annun-test", 1).getBoolValue() or props.globals.getNode("/systems/electrical/bus/dc-ess", 1).getValue() < 25) {
|
if (pts.Controls.Switches.annunTest.getBoolValue() or systems.ELEC.Bus.dcEss.getValue() < 25) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (keyNum < 0 or keyNum > 7) {
|
if (keyNum < 0 or keyNum > 7) {
|
||||||
|
@ -162,7 +163,7 @@ var transponderPanel = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
clearKey: func() {
|
clearKey: func() {
|
||||||
if (props.globals.getNode("/controls/switches/annun-test", 1).getBoolValue() or props.globals.getNode("/systems/electrical/bus/dc-ess", 1).getValue() < 25) {
|
if (pts.Controls.Switches.annunTest.getBoolValue() or systems.ELEC.Bus.dcEss.getValue() < 25) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (me.codeDisp != "") {
|
if (me.codeDisp != "") {
|
||||||
|
@ -214,7 +215,7 @@ var transponderPanel = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
me.failLight = newFail;
|
me.failLight = newFail;
|
||||||
props.globals.getNode("/systems/atc/failed").setBoolValue(me.failLight);
|
me.failNode.setBoolValue(me.failLight);
|
||||||
},
|
},
|
||||||
identSwitch: func() {
|
identSwitch: func() {
|
||||||
Transponders.vector[me.atcSel - 1].ident();
|
Transponders.vector[me.atcSel - 1].ident();
|
||||||
|
@ -255,27 +256,27 @@ var transponderPanel = {
|
||||||
updateADR1: func(val) {
|
updateADR1: func(val) {
|
||||||
if (Transponders.vector[me.atcSel - 1].activeADIRS == 1) {
|
if (Transponders.vector[me.atcSel - 1].activeADIRS == 1) {
|
||||||
if (val) {
|
if (val) {
|
||||||
setprop("/instrumentation/tcas/serviceable", 1);
|
pts.Instrumentation.TCAS.servicable.setValue(1);
|
||||||
} else {
|
} else {
|
||||||
setprop("/instrumentation/tcas/serviceable", 0);
|
pts.Instrumentation.TCAS.servicable.setValue(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
updateADR2: func(val) {
|
updateADR2: func(val) {
|
||||||
if (Transponders.vector[me.atcSel - 1].activeADIRS == 2) {
|
if (Transponders.vector[me.atcSel - 1].activeADIRS == 2) {
|
||||||
if (val) {
|
if (val) {
|
||||||
setprop("/instrumentation/tcas/serviceable", 1);
|
pts.Instrumentation.TCAS.servicable.setValue(1);
|
||||||
} else {
|
} else {
|
||||||
setprop("/instrumentation/tcas/serviceable", 0);
|
pts.Instrumentation.TCAS.servicable.setValue(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
updateADR3: func(val) {
|
updateADR3: func(val) {
|
||||||
if (Transponders.vector[me.atcSel - 1].activeADIRS == 3) {
|
if (Transponders.vector[me.atcSel - 1].activeADIRS == 3) {
|
||||||
if (val) {
|
if (val) {
|
||||||
setprop("/instrumentation/tcas/serviceable", 1);
|
pts.Instrumentation.TCAS.servicable.setValue(1);
|
||||||
} else {
|
} else {
|
||||||
setprop("/instrumentation/tcas/serviceable", 0);
|
pts.Instrumentation.TCAS.servicable.setValue(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -295,7 +296,6 @@ setlistener("/instrumentation/transponder/id-code", func {
|
||||||
|
|
||||||
var Transponders = std.Vector.new([Transponder.new("/systems/electrical/bus/ac-ess-shed", 1), Transponder.new("/systems/electrical/bus/ac-2", 2)]);
|
var Transponders = std.Vector.new([Transponder.new("/systems/electrical/bus/ac-ess-shed", 1), Transponder.new("/systems/electrical/bus/ac-2", 2)]);
|
||||||
|
|
||||||
|
|
||||||
setlistener("/systems/navigation/adr/operating-1", func() {
|
setlistener("/systems/navigation/adr/operating-1", func() {
|
||||||
transponderPanel.updateADR1(systems.ADIRS.Operating.adr[0].getValue());
|
transponderPanel.updateADR1(systems.ADIRS.Operating.adr[0].getValue());
|
||||||
}, 1, 0);
|
}, 1, 0);
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
#
|
#
|
||||||
# Chrono - Clock - ET
|
# Chrono - Clock - ET
|
||||||
#
|
#
|
||||||
var chr = aircraft.timer.new("instrumentation/chrono[0]/elapsetime-sec",1);
|
var chr = aircraft.timer.new("/instrumentation/chrono[0]/elapsetime-sec",1);
|
||||||
var clk = aircraft.timer.new("instrumentation/clock/elapsetime-sec",1);
|
var clk = aircraft.timer.new("/instrumentation/clock/elapsetime-sec",1);
|
||||||
var chrono_cpt = aircraft.timer.new("instrumentation/ndchrono[0]/elapsetime-sec",1);
|
var chrono_cpt = aircraft.timer.new("/instrumentation/ndchrono[0]/elapsetime-sec",1);
|
||||||
var chrono_fo = aircraft.timer.new("instrumentation/ndchrono[1]/elapsetime-sec",1);
|
var chrono_fo = aircraft.timer.new("/instrumentation/ndchrono[1]/elapsetime-sec",1);
|
||||||
|
var chrono_cpt_node = props.globals.getNode("/instrumentation/ndchrono[0]/elapsetime-sec");
|
||||||
|
var chrono_fo_node = props.globals.getNode("/instrumentation/ndchrono[1]/elapsetime-sec");
|
||||||
|
|
||||||
var chr_min = nil;
|
var chr_min = nil;
|
||||||
var chr_sec = nil;
|
var chr_sec = nil;
|
||||||
|
@ -141,7 +143,7 @@ setlistener("/instrumentation/chrono[0]/chrono-reset", func(et){
|
||||||
}, 0, 0);
|
}, 0, 0);
|
||||||
|
|
||||||
#Chrono
|
#Chrono
|
||||||
setlistener("instrumentation/efis[0]/inputs/CHRONO", func(et){
|
setlistener("/instrumentation/efis[0]/inputs/CHRONO", func(et){
|
||||||
chrono0 = et.getValue();
|
chrono0 = et.getValue();
|
||||||
if (chrono0 == 1){
|
if (chrono0 == 1){
|
||||||
chrono_cpt.start();
|
chrono_cpt.start();
|
||||||
|
@ -149,11 +151,11 @@ setlistener("instrumentation/efis[0]/inputs/CHRONO", func(et){
|
||||||
chrono_cpt.stop();
|
chrono_cpt.stop();
|
||||||
} elsif (chrono0 == 0) {
|
} elsif (chrono0 == 0) {
|
||||||
chrono_cpt.reset();
|
chrono_cpt.reset();
|
||||||
setprop("instrumentation/ndchrono[0]/elapsetime-sec", 0);
|
chrono_cpt_node.setValue(0);
|
||||||
}
|
}
|
||||||
}, 0, 0);
|
}, 0, 0);
|
||||||
|
|
||||||
setlistener("instrumentation/efis[1]/inputs/CHRONO", func(et){
|
setlistener("/instrumentation/efis[1]/inputs/CHRONO", func(et){
|
||||||
chrono1 = et.getValue();
|
chrono1 = et.getValue();
|
||||||
if (chrono1 == 1){
|
if (chrono1 == 1){
|
||||||
chrono_fo.start();
|
chrono_fo.start();
|
||||||
|
@ -161,11 +163,11 @@ setlistener("instrumentation/efis[1]/inputs/CHRONO", func(et){
|
||||||
chrono_fo.stop();
|
chrono_fo.stop();
|
||||||
} elsif (chrono1 == 0) {
|
} elsif (chrono1 == 0) {
|
||||||
chrono_fo.reset();
|
chrono_fo.reset();
|
||||||
setprop("instrumentation/ndchrono[1]/elapsetime-sec", 0);
|
chrono_fo_node.setValue(0);
|
||||||
}
|
}
|
||||||
}, 0, 0);
|
}, 0, 0);
|
||||||
|
|
||||||
setlistener("instrumentation/clock/et-selector", func(et){
|
setlistener("/instrumentation/clock/et-selector", func(et){
|
||||||
tmp1 = et.getValue();
|
tmp1 = et.getValue();
|
||||||
if (tmp1 == 2){
|
if (tmp1 == 2){
|
||||||
clk.reset();
|
clk.reset();
|
||||||
|
@ -272,37 +274,39 @@ var start_loop = maketimer(0.1, func {
|
||||||
}
|
}
|
||||||
|
|
||||||
#Cpt Chrono
|
#Cpt Chrono
|
||||||
chr0_tmp = getprop("instrumentation/ndchrono[0]/elapsetime-sec");
|
chr0_tmp = chrono_cpt_node.getValue();
|
||||||
if (chr0_tmp >= 360000) {
|
if (chr0_tmp >= 360000) {
|
||||||
setprop("instrumentation/ndchrono[0]/elapsetime-sec", getprop("instrumentation/ndchrono[0]/elapsetime-sec") - 360000);
|
chrono_cpt_node.setValue(chrono_cpt_node.getValue() - 360000);
|
||||||
};
|
}
|
||||||
|
|
||||||
chr0_hh = int(chr0_tmp * 0.000277777777778);
|
chr0_hh = int(chr0_tmp * 0.000277777777778);
|
||||||
chr0_min = int((chr0_tmp * 0.0166666666667) - (chr0_hh * 60));
|
chr0_min = int((chr0_tmp * 0.0166666666667) - (chr0_hh * 60));
|
||||||
chr0_sec = int(chr0_tmp - (chr0_min * 60) - (chr0_hh * 3600));
|
chr0_sec = int(chr0_tmp - (chr0_min * 60) - (chr0_hh * 3600));
|
||||||
setprop("instrumentation/ndchrono[0]/etHh_cpt", chr0_hh);
|
cpt_chrono.etHh_cpt.setValue(chr0_hh);
|
||||||
setprop("instrumentation/ndchrono[0]/etMin_cpt", chr0_min);
|
cpt_chrono.etMin_cpt.setValue(chr0_min);
|
||||||
setprop("instrumentation/ndchrono[0]/etSec_cpt", chr0_sec);
|
cpt_chrono.etSec_cpt.setValue(chr0_sec);
|
||||||
if (chr0_tmp >= 3600) {
|
if (chr0_tmp >= 3600) {
|
||||||
setprop("instrumentation/ndchrono[0]/text", sprintf("%02d H %02d'", chr0_hh, chr0_min));
|
cpt_chrono.text.setValue(sprintf("%02d H %02d'", chr0_hh, chr0_min));
|
||||||
} else {
|
} else {
|
||||||
setprop("instrumentation/ndchrono[0]/text", sprintf("%02d' %02d''", chr0_min, chr0_sec));
|
cpt_chrono.text.setValue(sprintf("%02d' %02d''", chr0_min, chr0_sec));
|
||||||
}
|
}
|
||||||
|
|
||||||
#Fo Chrono
|
#Fo Chrono
|
||||||
chr1_tmp = getprop("instrumentation/ndchrono[1]/elapsetime-sec");
|
chr1_tmp = chrono_fo_node.getValue();
|
||||||
if (chr1_tmp >= 360000) {
|
if (chr1_tmp >= 360000) {
|
||||||
setprop("instrumentation/ndchrono[1]/elapsetime-sec", getprop("instrumentation/ndchrono[1]/elapsetime-sec") - 360000);
|
chrono_fo_node.setValue(chrono_fo_node.getValue() - 360000);
|
||||||
};
|
}
|
||||||
|
|
||||||
chr1_hh = int(chr1_tmp * 0.000277777777778);
|
chr1_hh = int(chr1_tmp * 0.000277777777778);
|
||||||
chr1_min = int(chr1_tmp * 0.0166666666667);
|
chr1_min = int(chr1_tmp * 0.0166666666667);
|
||||||
chr1_sec = int(chr1_tmp - (chr1_min * 60) - (chr1_hh * 3600));
|
chr1_sec = int(chr1_tmp - (chr1_min * 60) - (chr1_hh * 3600));
|
||||||
setprop("instrumentation/ndchrono[1]/etHh_fo", chr1_hh);
|
fo_chrono.etHh_fo.setValue(chr1_hh);
|
||||||
setprop("instrumentation/ndchrono[1]/etMin_fo", chr1_min);
|
fo_chrono.etMin_fo.setValue(chr1_min);
|
||||||
setprop("instrumentation/ndchrono[1]/etSec_fo", chr1_sec);
|
fo_chrono.etSec_fo.setValue(chr1_sec);
|
||||||
if (chr1_tmp >= 3600) {
|
if (chr1_tmp >= 3600) {
|
||||||
setprop("instrumentation/ndchrono[1]/text", sprintf("%02d H %02d'", chr1_hh, chr1_min));
|
fo_chrono.text.setValue(sprintf("%02d H %02d'", chr1_hh, chr1_min));
|
||||||
} else {
|
} else {
|
||||||
setprop("instrumentation/ndchrono[1]/text", sprintf("%02d' %02d''", chr1_min, chr1_sec));
|
fo_chrono.text.setValue(sprintf("%02d' %02d''", chr1_min, chr1_sec));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -27,23 +27,23 @@ var chan_rmp1_v = "vhr1";
|
||||||
var chan_rmp2_v = "vhr2";
|
var chan_rmp2_v = "vhr2";
|
||||||
var chan_rmp3_v = "vhr3";
|
var chan_rmp3_v = "vhr3";
|
||||||
|
|
||||||
var act_vhf1 = props.globals.getNode("instrumentation/comm[0]/frequencies/selected-mhz");
|
var act_vhf1 = props.globals.getNode("/instrumentation/comm[0]/frequencies/selected-mhz");
|
||||||
var act_vhf2 = props.globals.getNode("instrumentation/comm[1]/frequencies/selected-mhz");
|
var act_vhf2 = props.globals.getNode("/instrumentation/comm[1]/frequencies/selected-mhz");
|
||||||
var act_vhf3 = props.globals.getNode("instrumentation/comm[2]/frequencies/selected-mhz");
|
var act_vhf3 = props.globals.getNode("/instrumentation/comm[2]/frequencies/selected-mhz");
|
||||||
|
|
||||||
var act_ls1 = props.globals.getNode("instrumentation/nav[0]/frequencies/selected-mhz");
|
var act_ls1 = props.globals.getNode("/instrumentation/nav[0]/frequencies/selected-mhz");
|
||||||
var act_vor1 = props.globals.getNode("instrumentation/nav[2]/frequencies/selected-mhz");
|
var act_vor1 = props.globals.getNode("/instrumentation/nav[2]/frequencies/selected-mhz");
|
||||||
var act_vor2 = props.globals.getNode("instrumentation/nav[3]/frequencies/selected-mhz");
|
var act_vor2 = props.globals.getNode("/instrumentation/nav[3]/frequencies/selected-mhz");
|
||||||
var act_adf1 = props.globals.getNode("instrumentation/adf[0]/frequencies/selected-khz");
|
var act_adf1 = props.globals.getNode("/instrumentation/adf[0]/frequencies/selected-khz");
|
||||||
var act_adf2 = props.globals.getNode("instrumentation/adf[1]/frequencies/selected-khz");
|
var act_adf2 = props.globals.getNode("/instrumentation/adf[1]/frequencies/selected-khz");
|
||||||
var stby_ls1 = props.globals.getNode("instrumentation/nav[0]/frequencies/standby-mhz");
|
var stby_ls1 = props.globals.getNode("/instrumentation/nav[0]/frequencies/standby-mhz");
|
||||||
var stby_vor1 = props.globals.getNode("instrumentation/nav[2]/frequencies/standby-mhz");
|
var stby_vor1 = props.globals.getNode("/instrumentation/nav[2]/frequencies/standby-mhz");
|
||||||
var stby_vor2 = props.globals.getNode("instrumentation/nav[3]/frequencies/standby-mhz");
|
var stby_vor2 = props.globals.getNode("/instrumentation/nav[3]/frequencies/standby-mhz");
|
||||||
var stby_adf1 = props.globals.getNode("instrumentation/adf[0]/frequencies/standby-khz");
|
var stby_adf1 = props.globals.getNode("/instrumentation/adf[0]/frequencies/standby-khz");
|
||||||
var stby_adf2 = props.globals.getNode("instrumentation/adf[1]/frequencies/standby-khz");
|
var stby_adf2 = props.globals.getNode("/instrumentation/adf[1]/frequencies/standby-khz");
|
||||||
var act_ls1_crs = props.globals.getNode("instrumentation/nav[0]/radials/selected-deg");
|
var act_ls1_crs = props.globals.getNode("/instrumentation/nav[0]/radials/selected-deg");
|
||||||
var act_vor1_crs = props.globals.getNode("instrumentation/nav[2]/radials/selected-deg");
|
var act_vor1_crs = props.globals.getNode("/instrumentation/nav[2]/radials/selected-deg");
|
||||||
var act_vor2_crs = props.globals.getNode("instrumentation/nav[3]/radials/selected-deg");
|
var act_vor2_crs = props.globals.getNode("/instrumentation/nav[3]/radials/selected-deg");
|
||||||
|
|
||||||
if (rand() > 0.5) {
|
if (rand() > 0.5) {
|
||||||
var hf1 = genFourRand();
|
var hf1 = genFourRand();
|
||||||
|
@ -149,13 +149,19 @@ var rmpUpdate = func() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var act = nil;
|
||||||
|
var data_mode = nil;
|
||||||
|
var sel1 = nil;
|
||||||
|
var sel2 = nil;
|
||||||
|
var sel3 = nil;
|
||||||
|
|
||||||
var update_active_vhf = func(vhf) {
|
var update_active_vhf = func(vhf) {
|
||||||
var sel1 = chan_rmp1.getValue();
|
sel1 = chan_rmp1.getValue();
|
||||||
var sel2 = chan_rmp2.getValue();
|
sel2 = chan_rmp2.getValue();
|
||||||
var sel3 = chan_rmp3.getValue();
|
sel3 = chan_rmp3.getValue();
|
||||||
|
|
||||||
if (vhf == 1) {
|
if (vhf == 1) {
|
||||||
var act = sprintf("%3.3f", act_vhf1.getValue());
|
act = sprintf("%3.3f", act_vhf1.getValue());
|
||||||
|
|
||||||
if (sel1 == "vhf1") {
|
if (sel1 == "vhf1") {
|
||||||
act_display_rmp1.setValue(act);
|
act_display_rmp1.setValue(act);
|
||||||
|
@ -167,7 +173,7 @@ var update_active_vhf = func(vhf) {
|
||||||
act_display_rmp3.setValue(act);
|
act_display_rmp3.setValue(act);
|
||||||
}
|
}
|
||||||
} else if (vhf == 2) {
|
} else if (vhf == 2) {
|
||||||
var act = sprintf("%3.3f", act_vhf2.getValue());
|
act = sprintf("%3.3f", act_vhf2.getValue());
|
||||||
|
|
||||||
if (sel1 == "vhf2") {
|
if (sel1 == "vhf2") {
|
||||||
act_display_rmp1.setValue(act);
|
act_display_rmp1.setValue(act);
|
||||||
|
@ -179,8 +185,8 @@ var update_active_vhf = func(vhf) {
|
||||||
act_display_rmp3.setValue(act);
|
act_display_rmp3.setValue(act);
|
||||||
}
|
}
|
||||||
} else if (vhf == 3) {
|
} else if (vhf == 3) {
|
||||||
var act = sprintf("%3.3f", act_vhf3.getValue());
|
act = sprintf("%3.3f", act_vhf3.getValue());
|
||||||
var data_mode = vhf3_data_mode.getValue();
|
data_mode = vhf3_data_mode.getValue();
|
||||||
|
|
||||||
if (sel1 == "vhf3") {
|
if (sel1 == "vhf3") {
|
||||||
if (data_mode == 1) {
|
if (data_mode == 1) {
|
||||||
|
@ -205,7 +211,7 @@ var update_active_vhf = func(vhf) {
|
||||||
}
|
}
|
||||||
} else if (vhf == 4) {
|
} else if (vhf == 4) {
|
||||||
if (sel1 == "hf1" or sel2 == "hf1") {
|
if (sel1 == "hf1" or sel2 == "hf1") {
|
||||||
var act = sprintf("%5.0f", systems.HFS[0].selectedChannelKhz);
|
act = sprintf("%5.0f", systems.HFS[0].selectedChannelKhz);
|
||||||
|
|
||||||
if (sel1 == "hf1") {
|
if (sel1 == "hf1") {
|
||||||
act_display_rmp1.setValue(act);
|
act_display_rmp1.setValue(act);
|
||||||
|
@ -219,7 +225,7 @@ var update_active_vhf = func(vhf) {
|
||||||
}
|
}
|
||||||
} else if (vhf == 5) {
|
} else if (vhf == 5) {
|
||||||
if (sel1 == "hf2" or sel2 == "hf2") {
|
if (sel1 == "hf2" or sel2 == "hf2") {
|
||||||
var act = sprintf("%5.0f", systems.HFS[1].selectedChannelKhz);
|
act = sprintf("%5.0f", systems.HFS[1].selectedChannelKhz);
|
||||||
|
|
||||||
if (sel1 == "hf2") {
|
if (sel1 == "hf2") {
|
||||||
act_display_rmp1.setValue(act);
|
act_display_rmp1.setValue(act);
|
||||||
|
@ -279,65 +285,67 @@ var update_displays_nav = func(nav) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var stby = nil;
|
||||||
var update_stby_freq = func(rmp_no, freq) {
|
var update_stby_freq = func(rmp_no, freq) {
|
||||||
var data_mode = vhf3_data_mode.getValue();
|
data_mode = vhf3_data_mode.getValue();
|
||||||
if (rmp_no == 0) {
|
if (rmp_no == 0) {
|
||||||
if (freq == 1) {
|
if (freq == 1) {
|
||||||
var stby = sprintf("%3.3f", stby_rmp1_vhf1.getValue());
|
stby = sprintf("%3.3f", stby_rmp1_vhf1.getValue());
|
||||||
} else if (freq == 2) {
|
} else if (freq == 2) {
|
||||||
var stby = sprintf("%3.3f", stby_rmp1_vhf2.getValue());
|
stby = sprintf("%3.3f", stby_rmp1_vhf2.getValue());
|
||||||
} else if (freq == 3) {
|
} else if (freq == 3) {
|
||||||
if (data_mode == 0) {
|
if (data_mode == 0) {
|
||||||
var stby = "data";
|
stby = "data";
|
||||||
} else {
|
} else {
|
||||||
var stby = sprintf("%3.3f", stby_rmp1_vhf3.getValue());
|
stby = sprintf("%3.3f", stby_rmp1_vhf3.getValue());
|
||||||
}
|
}
|
||||||
} else if (freq == 4) {
|
} else if (freq == 4) {
|
||||||
var stby = sprintf("%5.0f", stby_rmp1_hf1.getValue());
|
stby = sprintf("%5.0f", stby_rmp1_hf1.getValue());
|
||||||
} else if (freq == 5) {
|
} else if (freq == 5) {
|
||||||
var stby = sprintf("%5.0f", stby_rmp1_hf2.getValue());
|
stby = sprintf("%5.0f", stby_rmp1_hf2.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
stby_display_rmp1.setValue(stby);
|
stby_display_rmp1.setValue(stby);
|
||||||
} else if (rmp_no == 1) {
|
} else if (rmp_no == 1) {
|
||||||
if (freq == 1) {
|
if (freq == 1) {
|
||||||
var stby = sprintf("%3.3f", stby_rmp2_vhf1.getValue());
|
stby = sprintf("%3.3f", stby_rmp2_vhf1.getValue());
|
||||||
} else if (freq == 2) {
|
} else if (freq == 2) {
|
||||||
var stby = sprintf("%3.3f", stby_rmp2_vhf2.getValue());
|
stby = sprintf("%3.3f", stby_rmp2_vhf2.getValue());
|
||||||
} else if (freq == 3) {
|
} else if (freq == 3) {
|
||||||
if (data_mode == 0) {
|
if (data_mode == 0) {
|
||||||
var stby = "data";
|
stby = "data";
|
||||||
} else {
|
} else {
|
||||||
var stby = sprintf("%3.3f", stby_rmp2_vhf3.getValue());
|
stby = sprintf("%3.3f", stby_rmp2_vhf3.getValue());
|
||||||
}
|
}
|
||||||
} else if (freq == 4) {
|
} else if (freq == 4) {
|
||||||
var stby = sprintf("%5.0f", stby_rmp2_hf1.getValue());
|
stby = sprintf("%5.0f", stby_rmp2_hf1.getValue());
|
||||||
} else if (freq == 5) {
|
} else if (freq == 5) {
|
||||||
var stby = sprintf("%5.0f", stby_rmp2_hf2.getValue());
|
stby = sprintf("%5.0f", stby_rmp2_hf2.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
stby_display_rmp2.setValue(stby);
|
stby_display_rmp2.setValue(stby);
|
||||||
} else {
|
} else {
|
||||||
if (freq == 1) {
|
if (freq == 1) {
|
||||||
var stby = sprintf("%3.3f", stby_rmp3_vhf1.getValue());
|
stby = sprintf("%3.3f", stby_rmp3_vhf1.getValue());
|
||||||
} else if (freq == 2) {
|
} else if (freq == 2) {
|
||||||
var stby = sprintf("%3.3f", stby_rmp3_vhf2.getValue());
|
stby = sprintf("%3.3f", stby_rmp3_vhf2.getValue());
|
||||||
} else if (freq == 3) {
|
} else if (freq == 3) {
|
||||||
if (data_mode == 0) {
|
if (data_mode == 0) {
|
||||||
var stby = "data";
|
stby = "data";
|
||||||
} else {
|
} else {
|
||||||
var stby = sprintf("%3.3f", stby_rmp3_vhf3.getValue());
|
stby = sprintf("%3.3f", stby_rmp3_vhf3.getValue());
|
||||||
}
|
}
|
||||||
} else if (freq == 4) {
|
} else if (freq == 4) {
|
||||||
var stby = sprintf("%5.0f", stby_rmp3_hf1.getValue());
|
stby = sprintf("%5.0f", stby_rmp3_hf1.getValue());
|
||||||
} else if (freq == 5) {
|
} else if (freq == 5) {
|
||||||
var stby = sprintf("%5.0f", stby_rmp3_hf2.getValue());
|
stby = sprintf("%5.0f", stby_rmp3_hf2.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
stby_display_rmp3.setValue(stby);
|
stby_display_rmp3.setValue(stby);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var chan = nil;
|
||||||
var update_chan_sel = func(rmp_no) {
|
var update_chan_sel = func(rmp_no) {
|
||||||
update_active_vhf(1);
|
update_active_vhf(1);
|
||||||
update_active_vhf(2);
|
update_active_vhf(2);
|
||||||
|
@ -350,7 +358,7 @@ var update_chan_sel = func(rmp_no) {
|
||||||
update_displays_nav(rmp_no + 5);
|
update_displays_nav(rmp_no + 5);
|
||||||
|
|
||||||
if (rmp_no == 0) {
|
if (rmp_no == 0) {
|
||||||
var chan = chan_rmp1.getValue();
|
chan = chan_rmp1.getValue();
|
||||||
if (chan == "vhf1") {
|
if (chan == "vhf1") {
|
||||||
update_stby_freq(rmp_no, 1);
|
update_stby_freq(rmp_no, 1);
|
||||||
} else if (chan == "vhf2") {
|
} else if (chan == "vhf2") {
|
||||||
|
@ -363,7 +371,7 @@ var update_chan_sel = func(rmp_no) {
|
||||||
update_stby_freq(rmp_no, 5);
|
update_stby_freq(rmp_no, 5);
|
||||||
}
|
}
|
||||||
} else if (rmp_no == 1) {
|
} else if (rmp_no == 1) {
|
||||||
var chan = chan_rmp2.getValue();
|
chan = chan_rmp2.getValue();
|
||||||
if (chan == "vhf1") {
|
if (chan == "vhf1") {
|
||||||
update_stby_freq(rmp_no, 1);
|
update_stby_freq(rmp_no, 1);
|
||||||
} else if (chan == "vhf2") {
|
} else if (chan == "vhf2") {
|
||||||
|
@ -376,7 +384,7 @@ var update_chan_sel = func(rmp_no) {
|
||||||
update_stby_freq(rmp_no, 5);
|
update_stby_freq(rmp_no, 5);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var chan = chan_rmp3.getValue();
|
chan = chan_rmp3.getValue();
|
||||||
if (chan == "vhf1") {
|
if (chan == "vhf1") {
|
||||||
update_stby_freq(rmp_no, 1);
|
update_stby_freq(rmp_no, 1);
|
||||||
} else if (chan == "vhf2") {
|
} else if (chan == "vhf2") {
|
||||||
|
@ -391,13 +399,19 @@ var update_chan_sel = func(rmp_no) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var sel_chan = nil;
|
||||||
|
var sel_crs = nil;
|
||||||
|
var mod1 = nil;
|
||||||
|
var mod = nil;
|
||||||
|
var mem = nil;
|
||||||
|
|
||||||
var transfer = func(rmp_no) {
|
var transfer = func(rmp_no) {
|
||||||
rmp_no = rmp_no - 1;
|
rmp_no = rmp_no - 1;
|
||||||
var sel_chan = getprop("/systems/radio/rmp[" ~ rmp_no ~ "]/sel_chan");
|
sel_chan = getprop("/systems/radio/rmp[" ~ rmp_no ~ "]/sel_chan");
|
||||||
var sel_crs = getprop("/systems/radio/rmp[" ~ rmp_no ~ "]/select-crs");
|
sel_crs = getprop("/systems/radio/rmp[" ~ rmp_no ~ "]/select-crs");
|
||||||
|
|
||||||
if (string.match(sel_chan, "vhf[1-3]")) {
|
if (string.match(sel_chan, "vhf[1-3]")) {
|
||||||
var data_mode = vhf3_data_mode.getValue();
|
data_mode = vhf3_data_mode.getValue();
|
||||||
if (string.match(sel_chan, "vhf3")) {
|
if (string.match(sel_chan, "vhf3")) {
|
||||||
if (data_mode == 0) {
|
if (data_mode == 0) {
|
||||||
vhf3_data_mode.setValue(1);
|
vhf3_data_mode.setValue(1);
|
||||||
|
@ -415,41 +429,41 @@ var transfer = func(rmp_no) {
|
||||||
update_stby_freq(2, 3);
|
update_stby_freq(2, 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var mod1 = int(string.replace(sel_chan, "vhf", ""));
|
mod1 = int(string.replace(sel_chan, "vhf", ""));
|
||||||
var mod = mod1 - 1;
|
mod = mod1 - 1;
|
||||||
|
|
||||||
var mem = getprop("instrumentation/comm[" ~ mod ~ "]/frequencies/selected-mhz");
|
mem = getprop("/instrumentation/comm[" ~ mod ~ "]/frequencies/selected-mhz");
|
||||||
setprop("instrumentation/comm[" ~ mod ~ "]/frequencies/selected-mhz", getprop("/systems/radio/rmp[" ~ rmp_no ~ "]/vhf" ~ mod1 ~ "-standby"));
|
setprop("/instrumentation/comm[" ~ mod ~ "]/frequencies/selected-mhz", getprop("/systems/radio/rmp[" ~ rmp_no ~ "]/vhf" ~ mod1 ~ "-standby"));
|
||||||
setprop("/systems/radio/rmp[" ~ rmp_no ~ "]/vhf" ~ mod1 ~ "-standby", mem);
|
setprop("/systems/radio/rmp[" ~ rmp_no ~ "]/vhf" ~ mod1 ~ "-standby", mem);
|
||||||
} elsif (string.match(sel_chan, "hf[1-2]")) {
|
} elsif (string.match(sel_chan, "hf[1-2]")) {
|
||||||
var mod1 = int(string.replace(sel_chan, "hf", ""));
|
mod1 = int(string.replace(sel_chan, "hf", ""));
|
||||||
var mod = mod1 - 1;
|
mod = mod1 - 1;
|
||||||
|
|
||||||
var mem = systems.HFS[mod].selectedChannelKhz;
|
mem = systems.HFS[mod].selectedChannelKhz;
|
||||||
systems.HFS[mod].selectChannel(getprop("/systems/radio/rmp[" ~ rmp_no ~ "]/hf" ~ mod1 ~ "-standby"));
|
systems.HFS[mod].selectChannel(getprop("/systems/radio/rmp[" ~ rmp_no ~ "]/hf" ~ mod1 ~ "-standby"));
|
||||||
setprop("/systems/radio/rmp[" ~ rmp_no ~ "]/hf" ~ mod1 ~ "-standby", mem);
|
setprop("/systems/radio/rmp[" ~ rmp_no ~ "]/hf" ~ mod1 ~ "-standby", mem);
|
||||||
} elsif (sel_chan == "adf") {
|
} elsif (sel_chan == "adf") {
|
||||||
var mem = getprop("instrumentation/adf[" ~ rmp_no ~ "]/frequencies/selected-khz");
|
mem = getprop("/instrumentation/adf[" ~ rmp_no ~ "]/frequencies/selected-khz");
|
||||||
setprop("instrumentation/adf[" ~ rmp_no ~ "]/frequencies/selected-khz", getprop("instrumentation/adf[" ~ rmp_no ~ "]/frequencies/standby-khz"));
|
setprop("/instrumentation/adf[" ~ rmp_no ~ "]/frequencies/selected-khz", getprop("/instrumentation/adf[" ~ rmp_no ~ "]/frequencies/standby-khz"));
|
||||||
setprop("instrumentation/adf[" ~ rmp_no ~ "]/frequencies/standby-khz", mem);
|
setprop("/instrumentation/adf[" ~ rmp_no ~ "]/frequencies/standby-khz", mem);
|
||||||
update_displays_nav(rmp_no + 5);
|
update_displays_nav(rmp_no + 5);
|
||||||
} elsif (sel_chan == "vor") {
|
} elsif (sel_chan == "vor") {
|
||||||
if (sel_crs) {
|
if (sel_crs) {
|
||||||
setprop("instrumentation/nav[" ~ (rmp_no + 2) ~ "]/frequencies/standby-mhz", getprop("instrumentation/nav[" ~ (rmp_no + 2) ~ "]/frequencies/selected-mhz"));
|
setprop("/instrumentation/nav[" ~ (rmp_no + 2) ~ "]/frequencies/standby-mhz", getprop("/instrumentation/nav[" ~ (rmp_no + 2) ~ "]/frequencies/selected-mhz"));
|
||||||
setprop("/systems/radio/rmp[" ~ rmp_no ~ "]/select-crs", 0);
|
setprop("/systems/radio/rmp[" ~ rmp_no ~ "]/select-crs", 0);
|
||||||
update_displays_nav(rmp_no + 3);
|
update_displays_nav(rmp_no + 3);
|
||||||
} else {
|
} else {
|
||||||
setprop("instrumentation/nav[" ~ (rmp_no + 2) ~ "]/frequencies/selected-mhz", getprop("instrumentation/nav[" ~ (rmp_no + 2) ~ "]/frequencies/standby-mhz"));
|
setprop("/instrumentation/nav[" ~ (rmp_no + 2) ~ "]/frequencies/selected-mhz", getprop("/instrumentation/nav[" ~ (rmp_no + 2) ~ "]/frequencies/standby-mhz"));
|
||||||
setprop("/systems/radio/rmp[" ~ rmp_no ~ "]/select-crs", 1);
|
setprop("/systems/radio/rmp[" ~ rmp_no ~ "]/select-crs", 1);
|
||||||
update_displays_nav(rmp_no + 3);
|
update_displays_nav(rmp_no + 3);
|
||||||
}
|
}
|
||||||
} elsif (sel_chan == "ls") {
|
} elsif (sel_chan == "ls") {
|
||||||
if (sel_crs) {
|
if (sel_crs) {
|
||||||
setprop("instrumentation/nav[0]/frequencies/standby-mhz", getprop("instrumentation/nav[0]/frequencies/selected-mhz"));
|
setprop("/instrumentation/nav[0]/frequencies/standby-mhz", getprop("/instrumentation/nav[0]/frequencies/selected-mhz"));
|
||||||
setprop("/systems/radio/rmp[" ~ rmp_no ~ "]/select-crs", 0);
|
setprop("/systems/radio/rmp[" ~ rmp_no ~ "]/select-crs", 0);
|
||||||
update_displays_nav(1);
|
update_displays_nav(1);
|
||||||
} else {
|
} else {
|
||||||
setprop("instrumentation/nav[0]/frequencies/selected-mhz", getprop("instrumentation/nav[0]/frequencies/standby-mhz"));
|
setprop("/instrumentation/nav[0]/frequencies/selected-mhz", getprop("/instrumentation/nav[0]/frequencies/standby-mhz"));
|
||||||
setprop("/systems/radio/rmp[" ~ rmp_no ~ "]/select-crs", 1);
|
setprop("/systems/radio/rmp[" ~ rmp_no ~ "]/select-crs", 1);
|
||||||
update_displays_nav(1);
|
update_displays_nav(1);
|
||||||
}
|
}
|
||||||
|
@ -475,6 +489,21 @@ var change_nav_mode = func(rmp_nr, nav_mode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ADF Radio: Implement BFO such that you will hear audio
|
||||||
|
var BFOActive = [props.globals.getNode("/systems/radio/rmp[0]/bfo-active"),props.globals.getNode("/systems/radio/rmp[1]/bfo-active")];
|
||||||
|
var ADFIdent = [props.globals.getNode("/instrumentation/adf[0]/ident-audible"),props.globals.getNode("/instrumentation/adf[1]/ident-audible")];
|
||||||
|
var ADFMode = [props.globals.getNode("/instrumentation/adf[0]/mode"),props.globals.getNode("/instrumentation/adf[1]/mode")];
|
||||||
|
|
||||||
|
setlistener("/systems/radio/rmp[0]/bfo-active", func (val) {
|
||||||
|
ADFIdent[0].setValue(val.getValue());
|
||||||
|
ADFMode[0].setValue(val.getValue() == 1 ? "bfo" : "adf");
|
||||||
|
},0,0);
|
||||||
|
|
||||||
|
setlistener("/systems/radio/rmp[1]/bfo-active", func (val) {
|
||||||
|
ADFIdent[1].setValue(val.getValue());
|
||||||
|
ADFMode[1].setValue(val.getValue() == 1 ? "bfo" : "adf");
|
||||||
|
},0,0);
|
||||||
|
|
||||||
setlistener("/systems/radio/rmp[0]/vhf1-standby", func {
|
setlistener("/systems/radio/rmp[0]/vhf1-standby", func {
|
||||||
update_stby_freq(0, 1);
|
update_stby_freq(0, 1);
|
||||||
});
|
});
|
||||||
|
@ -613,9 +642,11 @@ setlistener("/instrumentation/nav[3]/radials/selected-deg", func {
|
||||||
|
|
||||||
setlistener("/systems/radio/rmp[0]/nav", func(nav_mode) {
|
setlistener("/systems/radio/rmp[0]/nav", func(nav_mode) {
|
||||||
change_nav_mode(1, nav_mode);
|
change_nav_mode(1, nav_mode);
|
||||||
|
if (nav_mode.getValue() == 0) { BFOActive[0].setValue(0); }
|
||||||
});
|
});
|
||||||
|
|
||||||
setlistener("/systems/radio/rmp[1]/nav", func(nav_mode) {
|
setlistener("/systems/radio/rmp[1]/nav", func(nav_mode) {
|
||||||
change_nav_mode(2, nav_mode);
|
change_nav_mode(2, nav_mode);
|
||||||
|
if (nav_mode.getValue() == 0) { BFOActive[1].setValue(0); }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
# Jonathan Redpath
|
# Jonathan Redpath
|
||||||
|
|
||||||
# Copyright (c) 2019 Jonathan Redpath
|
# Copyright (c) 2019 Jonathan Redpath
|
||||||
var lcont = 0;
|
|
||||||
var rcont = 0;
|
|
||||||
|
|
||||||
var HYD = {
|
var HYD = {
|
||||||
|
lcont: 0,
|
||||||
|
rcont: 0,
|
||||||
Brakes: {
|
Brakes: {
|
||||||
accumPressPsi: props.globals.initNode("/systems/hydraulic/yellow-accumulator-psi-cmd", 0, "INT"),
|
accumPressPsi: props.globals.initNode("/systems/hydraulic/yellow-accumulator-psi-cmd", 0, "INT"),
|
||||||
leftPressPsi: props.globals.initNode("/systems/hydraulic/brakes/pressure-left-psi", 0, "INT"),
|
leftPressPsi: props.globals.initNode("/systems/hydraulic/brakes/pressure-left-psi", 0, "INT"),
|
||||||
|
@ -86,22 +86,23 @@ var HYD = {
|
||||||
me.Fail.yellowLeak.setBoolValue(0);
|
me.Fail.yellowLeak.setBoolValue(0);
|
||||||
},
|
},
|
||||||
loop: func(notification) {
|
loop: func(notification) {
|
||||||
# Decrease accumPressPsi when green and yellow hydraulic's aren't pressurized
|
# Decrease accumPressPsi when green and yellow hydraulics aren't pressurized
|
||||||
if (me.Brakes.leftbrake.getValue() > 0 or notification.brakesMode == 0) {
|
if (me.Brakes.leftbrake.getValue() > 0 or notification.brakesMode == 0) {
|
||||||
lcont = lcont + 1;
|
me.lcont = me.lcont + 1;
|
||||||
} else {
|
} else {
|
||||||
lcont = 0;
|
me.lcont = 0;
|
||||||
}
|
}
|
||||||
if (me.Brakes.rightbrake.getValue() > 0 or notification.brakesMode == 0) {
|
if (me.Brakes.rightbrake.getValue() > 0 or notification.brakesMode == 0) {
|
||||||
rcont = rcont + 1;
|
me.rcont = me.rcont + 1;
|
||||||
} else {
|
} else {
|
||||||
rcont = 0;
|
me.rcont = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notification.yellow < notification.accumPressPsi and notification.accumPressPsi > 0) {
|
if (notification.yellow < notification.accumPressPsi and notification.accumPressPsi > 0) {
|
||||||
if (lcont == 1) {
|
if (me.lcont == 1) {
|
||||||
me.Brakes.accumPressPsi.setValue(notification.accumPressPsi - 200);
|
me.Brakes.accumPressPsi.setValue(notification.accumPressPsi - 200);
|
||||||
}
|
}
|
||||||
if (rcont == 1) {
|
if (me.rcont == 1) {
|
||||||
me.Brakes.accumPressPsi.setValue(notification.accumPressPsi - 200);
|
me.Brakes.accumPressPsi.setValue(notification.accumPressPsi - 200);
|
||||||
}
|
}
|
||||||
if (notification.accumPressPsi < 0) {
|
if (notification.accumPressPsi < 0) {
|
||||||
|
@ -181,6 +182,7 @@ var HYD = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Restrict gear raising on the ground
|
||||||
setlistener("/controls/gear/gear-down", func {
|
setlistener("/controls/gear/gear-down", func {
|
||||||
if (!pts.Controls.Gear.gearDown.getValue() and (pts.Gear.wow[0].getValue() or pts.Gear.wow[1].getValue() or pts.Gear.wow[2].getValue())) {
|
if (!pts.Controls.Gear.gearDown.getValue() and (pts.Gear.wow[0].getValue() or pts.Gear.wow[1].getValue() or pts.Gear.wow[2].getValue())) {
|
||||||
pts.Controls.Gear.gearDown.setValue(1);
|
pts.Controls.Gear.gearDown.setValue(1);
|
||||||
|
|
|
@ -233,14 +233,12 @@ setlistener("/controls/oxygen/masksDeployMan", func {
|
||||||
|
|
||||||
setlistener("/controls/oxygen/masksDeployMan", func {
|
setlistener("/controls/oxygen/masksDeployMan", func {
|
||||||
masks = getprop("/controls/oxygen/masksDeployMan");
|
masks = getprop("/controls/oxygen/masksDeployMan");
|
||||||
autoMasks = getprop("/controls/oxygen/masksDeploy");
|
|
||||||
if (!masks) {
|
if (!masks) {
|
||||||
setprop("/controls/oxygen/masksDeployMan", 1);
|
setprop("/controls/oxygen/masksDeployMan", 1);
|
||||||
}
|
}
|
||||||
}, 0, 0);
|
}, 0, 0);
|
||||||
|
|
||||||
setlistener("/controls/oxygen/masksDeploy", func {
|
setlistener("/controls/oxygen/masksDeploy", func {
|
||||||
masks = getprop("/controls/oxygen/masksDeployMan");
|
|
||||||
autoMasks = getprop("/controls/oxygen/masksDeploy");
|
autoMasks = getprop("/controls/oxygen/masksDeploy");
|
||||||
if (!autoMasks) {
|
if (!autoMasks) {
|
||||||
setprop("/controls/oxygen/masksDeploy", 1);
|
setprop("/controls/oxygen/masksDeploy", 1);
|
||||||
|
|
|
@ -541,6 +541,36 @@
|
||||||
/systems/hydraulic/yellow-accumulator-psi-cmd ge 0
|
/systems/hydraulic/yellow-accumulator-psi-cmd ge 0
|
||||||
</test>
|
</test>
|
||||||
</switch>
|
</switch>
|
||||||
|
|
||||||
|
<lag_filter name="/systems/hydraulic/yellow-accumulator-psi-output">
|
||||||
|
<input>/systems/hydraulic/yellow-accumulator-psi</input>
|
||||||
|
<c1>9</c1>
|
||||||
|
</lag_filter>
|
||||||
|
|
||||||
|
<switch name="/systems/hydraulic/brakes/pressure-left-psi-input">
|
||||||
|
<default value="0"/>
|
||||||
|
<test logic="AND" value="/systems/hydraulic/brakes/pressure-left-psi">
|
||||||
|
/systems/hydraulic/brakes/mode ne 1
|
||||||
|
</test>
|
||||||
|
</switch>
|
||||||
|
|
||||||
|
<switch name="/systems/hydraulic/brakes/pressure-right-psi-input">
|
||||||
|
<default value="0"/>
|
||||||
|
<test logic="AND" value="/systems/hydraulic/brakes/pressure-right-psi">
|
||||||
|
/systems/hydraulic/brakes/mode ne 1
|
||||||
|
</test>
|
||||||
|
</switch>
|
||||||
|
|
||||||
|
<lag_filter name="/systems/hydraulic/brakes/pressure-left-psi-output">
|
||||||
|
<input>/systems/hydraulic/brakes/pressure-left-psi-input</input>
|
||||||
|
<c1>9</c1>
|
||||||
|
</lag_filter>
|
||||||
|
|
||||||
|
<lag_filter name="/systems/hydraulic/brakes/pressure-right-psi-output">
|
||||||
|
<input>/systems/hydraulic/brakes/pressure-right-psi-input</input>
|
||||||
|
<c1>9</c1>
|
||||||
|
</lag_filter>
|
||||||
|
|
||||||
</channel>
|
</channel>
|
||||||
|
|
||||||
<channel name="Lights" execrate="8">
|
<channel name="Lights" execrate="8">
|
||||||
|
|
|
@ -1325,5 +1325,4 @@
|
||||||
</input>
|
</input>
|
||||||
<output>/instrumentation/mk-viii/inputs/discretes/landing-flaps</output>
|
<output>/instrumentation/mk-viii/inputs/discretes/landing-flaps</output>
|
||||||
</logic>
|
</logic>
|
||||||
|
|
||||||
</PropertyList>
|
</PropertyList>
|
||||||
|
|
Loading…
Reference in a new issue