1
0
Fork 0

Merge branch 'dev' into 3D

This commit is contained in:
legoboyvdlp R 2021-06-16 15:04:46 +01:00
commit e3502622ce
21 changed files with 587 additions and 239 deletions

View file

@ -471,6 +471,16 @@
]]></script> ]]></script>
</binding> </binding>
</item> </item>
<item>
<label>Remote MCDU</label>
<binding>
<command>nasal</command>
<script>
var mcduweb_dlg = gui.Dialog.new("sim/gui/dialogs/mcduweb/dialog", "Aircraft/A320-family/gui/dialogs/mcduweb.xml");
mcduweb_dlg.open();
</script>
</binding>
</item>
</menu> </menu>
<menu n="105"> <menu n="105">
<label>Utilities</label> <label>Utilities</label>

View file

@ -262,7 +262,7 @@ var colddark = func {
setprop("/controls/engines/engine[0]/cutoff-switch", 1); setprop("/controls/engines/engine[0]/cutoff-switch", 1);
setprop("/controls/engines/engine[1]/cutoff-switch", 1); setprop("/controls/engines/engine[1]/cutoff-switch", 1);
setprop("/controls/flight/flaps", 0); setprop("/controls/flight/flaps", 0);
setprop("/controls/flight/speedbrake-arm", 0); pts.Controls.Flight.speedbrakeArm.setValue(0);
setprop("/controls/flight/speedbrake", 0); setprop("/controls/flight/speedbrake", 0);
setprop("/controls/gear/gear-down", 1); setprop("/controls/gear/gear-down", 1);
setprop("/controls/flight/elevator-trim", 0); setprop("/controls/flight/elevator-trim", 0);
@ -321,7 +321,7 @@ var beforestart = func {
setprop("/controls/engines/engine[0]/cutoff-switch", 1); setprop("/controls/engines/engine[0]/cutoff-switch", 1);
setprop("/controls/engines/engine[1]/cutoff-switch", 1); setprop("/controls/engines/engine[1]/cutoff-switch", 1);
setprop("/controls/flight/flaps", 0); setprop("/controls/flight/flaps", 0);
setprop("/controls/flight/speedbrake-arm", 0); pts.Controls.Flight.speedbrakeArm.setValue(0);
setprop("/controls/flight/speedbrake", 0); setprop("/controls/flight/speedbrake", 0);
setprop("/controls/gear/gear-down", 1); setprop("/controls/gear/gear-down", 1);
setprop("/controls/flight/elevator-trim", 0); setprop("/controls/flight/elevator-trim", 0);
@ -384,9 +384,9 @@ var beforestart_b = func {
setprop("/controls/adirs/mcducbtn", 1); setprop("/controls/adirs/mcducbtn", 1);
setprop("/controls/switches/beacon", 1); setprop("/controls/switches/beacon", 1);
setprop("/controls/lighting/nav-lights-switch", 1); setprop("/controls/lighting/nav-lights-switch", 1);
setprop("/controls/switches/no-smoking-sign", 0.5); libraries.noSmokingSwitch.setValue(0.5);
setprop("/controls/switches/seatbelt-sign", 1); libraries.seatbeltSwitch.setValue(1.0);
setprop("/controls/switches/emer-lights", 0.5); libraries.emerLtsSwitch.setValue(0.5);
setprop("/controls/radio/rmp[0]/on", 1); setprop("/controls/radio/rmp[0]/on", 1);
setprop("/controls/radio/rmp[1]/on", 1); setprop("/controls/radio/rmp[1]/on", 1);
setprop("/controls/radio/rmp[2]/on", 1); setprop("/controls/radio/rmp[2]/on", 1);
@ -416,7 +416,7 @@ var taxi = func {
setprop("/controls/engines/engine[0]/cutoff-switch", 1); setprop("/controls/engines/engine[0]/cutoff-switch", 1);
setprop("/controls/engines/engine[1]/cutoff-switch", 1); setprop("/controls/engines/engine[1]/cutoff-switch", 1);
setprop("/controls/flight/flaps", 0); setprop("/controls/flight/flaps", 0);
setprop("/controls/flight/speedbrake-arm", 0); pts.Controls.Flight.speedbrakeArm.setValue(0);
setprop("/controls/flight/speedbrake", 0); setprop("/controls/flight/speedbrake", 0);
setprop("/controls/gear/gear-down", 1); setprop("/controls/gear/gear-down", 1);
setprop("/controls/flight/elevator-trim", 0); setprop("/controls/flight/elevator-trim", 0);
@ -480,9 +480,9 @@ var taxi_b = func {
setprop("/controls/switches/beacon", 1); setprop("/controls/switches/beacon", 1);
setprop("/controls/switches/wing-lights", 1); setprop("/controls/switches/wing-lights", 1);
setprop("/controls/lighting/nav-lights-switch", 1); setprop("/controls/lighting/nav-lights-switch", 1);
setprop("/controls/switches/no-smoking-sign", 0.5); libraries.noSmokingSwitch.setValue(0.5);
setprop("/controls/switches/seatbelt-sign", 1); libraries.seatbeltSwitch.setValue(1.0);
setprop("/controls/switches/emer-lights", 0.5); libraries.emerLtsSwitch.setValue(0.5);
setprop("/controls/radio/rmp[0]/on", 1); setprop("/controls/radio/rmp[0]/on", 1);
setprop("/controls/radio/rmp[1]/on", 1); setprop("/controls/radio/rmp[1]/on", 1);
setprop("/controls/radio/rmp[2]/on", 1); setprop("/controls/radio/rmp[2]/on", 1);
@ -542,7 +542,7 @@ var takeoff = func {
setprop("/controls/lighting/taxi-light-switch", 1); setprop("/controls/lighting/taxi-light-switch", 1);
setprop("/controls/switches/landing-lights-l", 1); setprop("/controls/switches/landing-lights-l", 1);
setprop("/controls/switches/landing-lights-r", 1); setprop("/controls/switches/landing-lights-r", 1);
setprop("/controls/flight/speedbrake-arm", 1); pts.Controls.Flight.speedbrakeArm.setValue(1);
setprop("/controls/flight/flaps", 0.2); setprop("/controls/flight/flaps", 0.2);
setprop("/controls/atc/mode-knob", 4); setprop("/controls/atc/mode-knob", 4);
atc.transponderPanel.modeSwitch(5); atc.transponderPanel.modeSwitch(5);

View file

@ -1164,6 +1164,7 @@
<object-name>vord_led</object-name> <object-name>vord_led</object-name>
<object-name>vord_led.001</object-name> <object-name>vord_led.001</object-name>
<object-name>vs-text</object-name> <object-name>vs-text</object-name>
<object-name>vs-text-last-2-digits</object-name>
<object-name>vs-text-test</object-name> <object-name>vs-text-test</object-name>
<object-name>wpt_led</object-name> <object-name>wpt_led</object-name>
<object-name>wpt_led.001</object-name> <object-name>wpt_led.001</object-name>
@ -1216,7 +1217,6 @@
<object-name>audio_call_vhf2_led</object-name> <object-name>audio_call_vhf2_led</object-name>
<object-name>audio_call_vhf3_led</object-name> <object-name>audio_call_vhf3_led</object-name>
<object-name>audio_mech_sgn</object-name> <object-name>audio_mech_sgn</object-name>
<object-name>autoland_light_on</object-name>
<object-name>ecam_c_b_led</object-name> <object-name>ecam_c_b_led</object-name>
<object-name>ecam_el_dc_led</object-name> <object-name>ecam_el_dc_led</object-name>
<object-name>ecam_sts_led</object-name> <object-name>ecam_sts_led</object-name>
@ -4320,23 +4320,6 @@
</condition> </condition>
</animation> </animation>
<animation>
<type>select</type>
<object-name>lvlch.ind</object-name>
<condition>
<or>
<equals>
<property>controls/switches/annun-test</property>
<value>1</value>
</equals>
<equals>
<property>it-autoflight/output/vert</property>
<value>4</value>
</equals>
</or>
</condition>
</animation>
<animation> <animation>
<type>select</type> <type>select</type>
<object-name>alt-text</object-name> <object-name>alt-text</object-name>
@ -4404,6 +4387,7 @@
<animation> <animation>
<type>select</type> <type>select</type>
<object-name>vs-text</object-name> <object-name>vs-text</object-name>
<object-name>vs-text-last-2-digits</object-name>
<condition> <condition>
<and> <and>
<not-equals> <not-equals>
@ -4642,16 +4626,42 @@
<name>vs-text</name> <name>vs-text</name>
<offsets> <offsets>
<x-m>-0.377</x-m> <x-m>-0.377</x-m>
<y-m>0.09043</y-m> <y-m>0.0850</y-m>
<z-m>0.50254</z-m> <z-m>0.50254</z-m>
<heading-deg>90</heading-deg> <heading-deg>90</heading-deg>
<roll-deg>72.81</roll-deg> <roll-deg>72.81</roll-deg>
</offsets> </offsets>
<alignment>center-center</alignment> <alignment>center-center</alignment>
<axis-alignment>xy-plane</axis-alignment> <axis-alignment>xy-plane</axis-alignment>
<type type="string">number-value</type> <type type="string">text-value</type>
<format type="string">%4.0f</format> <format type="string">%s</format>
<property>it-autoflight/input/vs</property> <property>it-autoflight/output/vs-fcu-display</property>
<truncate>false</truncate>
<font type="string">led.txf</font>
<draw-text>true</draw-text>
<draw-alignment>false</draw-alignment>
<draw-boundingbox>false</draw-boundingbox>
<character-size>0.008</character-size>
<font-resolution>
<width type="int">32</width>
<height type="int">32</height>
</font-resolution>
</text>
<text>
<name>vs-text-last-2-digits</name>
<offsets>
<x-m>-0.377</x-m>
<y-m>0.0977</y-m>
<z-m>0.5028</z-m>
<heading-deg>90</heading-deg>
<roll-deg>72.81</roll-deg>
</offsets>
<alignment>center-center</alignment>
<axis-alignment>xy-plane</axis-alignment>
<type type="string">text-value</type>
<format type="string">oo</format>
<property>autopilot/serviceable</property>
<truncate>false</truncate> <truncate>false</truncate>
<font type="string">led.txf</font> <font type="string">led.txf</font>
<draw-text>true</draw-text> <draw-text>true</draw-text>
@ -4668,7 +4678,7 @@
<name>fpa-text</name> <name>fpa-text</name>
<offsets> <offsets>
<x-m>-0.377</x-m> <x-m>-0.377</x-m>
<y-m>0.09043</y-m> <y-m>0.0860</y-m>
<z-m>0.50254</z-m> <z-m>0.50254</z-m>
<heading-deg>90</heading-deg> <heading-deg>90</heading-deg>
<roll-deg>72.81</roll-deg> <roll-deg>72.81</roll-deg>
@ -4676,7 +4686,7 @@
<alignment>center-center</alignment> <alignment>center-center</alignment>
<axis-alignment>xy-plane</axis-alignment> <axis-alignment>xy-plane</axis-alignment>
<type type="string">number-value</type> <type type="string">number-value</type>
<format type="string">%2.1f</format> <format type="string">%+2.1f</format>
<property>it-autoflight/input/fpa</property> <property>it-autoflight/input/fpa</property>
<truncate>false</truncate> <truncate>false</truncate>
<font type="string">led.txf</font> <font type="string">led.txf</font>
@ -6372,6 +6382,29 @@
</emission> </emission>
</animation> </animation>
<animation>
<type>select</type>
<object-name>autoland_light_on</object-name>
<condition>
<or>
<equals>
<property>controls/switches/annun-test</property>
<value>1</value>
</equals>
<and>
<equals>
<property>instrumentation/pfd/lights/autoland-armed</property>
<value>1</value>
</equals>
<equals>
<property>instrumentation/pfd/lights/autoland-on</property>
<value>1</value>
</equals>
</and>
</or>
</condition>
</animation>
<!-- Master Warning and Caution --> <!-- Master Warning and Caution -->
<animation> <animation>
<type>select</type> <type>select</type>
@ -7379,6 +7412,7 @@
<object-name>hdg-text</object-name> <object-name>hdg-text</object-name>
<object-name>alt-text</object-name> <object-name>alt-text</object-name>
<object-name>vs-text</object-name> <object-name>vs-text</object-name>
<object-name>vs-text-last-2-digits</object-name>
<object-name>spd-text-test</object-name> <object-name>spd-text-test</object-name>
<object-name>hdg-text-test</object-name> <object-name>hdg-text-test</object-name>
<object-name>alt-text-test</object-name> <object-name>alt-text-test</object-name>
@ -7393,9 +7427,9 @@
<object-name>rudder-trim</object-name> <object-name>rudder-trim</object-name>
<object-name>rudder-trim-letter</object-name> <object-name>rudder-trim-letter</object-name>
<diffuse> <diffuse>
<red>0.89</red> <red>0.75</red>
<green>0.37</green> <green>0.30</green>
<blue>0.08</blue> <blue>0.0</blue>
</diffuse> </diffuse>
<ambient> <ambient>
<red>0</red> <red>0</red>
@ -7408,9 +7442,9 @@
<blue>0</blue> <blue>0</blue>
</specular> </specular>
<emission> <emission>
<red>0.89</red> <red>0.75</red>
<green>0.37</green> <green>0.30</green>
<blue>0.08</blue> <blue>0.0</blue>
</emission> </emission>
</animation> </animation>

Binary file not shown.

Before

(image error) Size: 72 KiB

After

(image error) Size: 98 KiB

View file

@ -161,6 +161,9 @@ var amberFlash1 = props.globals.initNode("/instrumentation/pfd/flash-indicators/
var amberFlash2 = props.globals.initNode("/instrumentation/pfd/flash-indicators/amber-flash-2", 0, "BOOL"); var amberFlash2 = props.globals.initNode("/instrumentation/pfd/flash-indicators/amber-flash-2", 0, "BOOL");
var dhFlash = props.globals.initNode("/instrumentation/pfd/flash-indicators/dh-flash", 0, "BOOL"); var dhFlash = props.globals.initNode("/instrumentation/pfd/flash-indicators/dh-flash", 0, "BOOL");
var light_autoland_armed = props.globals.initNode("/instrumentation/pfd/lights/autoland-armed", 0, "BOOL");
var light_autoland_on = props.globals.initNode("/instrumentation/pfd/lights/autoland-on", 0, "BOOL");
var canvas_PFD_base = { var canvas_PFD_base = {
init: func(canvas_group, file) { init: func(canvas_group, file) {
var font_mapper = func(family, weight) { var font_mapper = func(family, weight) {

View file

@ -3158,7 +3158,7 @@ var messages_config_memo = func {
toMemoLine1.colour = "c"; toMemoLine1.colour = "c";
} }
if (getprop("/controls/switches/seatbelt-sign") and getprop("/controls/switches/no-smoking-sign")) { if (libraries.seatbeltSwitch.getValue() and libraries.noSmokingSwitch.getValue() ) {
toMemoLine2.msg = " SIGNS ON"; toMemoLine2.msg = " SIGNS ON";
toMemoLine2.colour = "g"; toMemoLine2.colour = "g";
} else { } else {
@ -3166,7 +3166,7 @@ var messages_config_memo = func {
toMemoLine2.colour = "c"; toMemoLine2.colour = "c";
} }
if (getprop("/controls/flight/speedbrake-arm")) { if (pts.Controls.Flight.speedbrakeArm.getValue()) {
toMemoLine3.msg = " SPLRS ARM"; toMemoLine3.msg = " SPLRS ARM";
toMemoLine3.colour = "g"; toMemoLine3.colour = "g";
} else { } else {
@ -3202,7 +3202,7 @@ var messages_config_memo = func {
setprop("/ECAM/to-memo-reset", 0); setprop("/ECAM/to-memo-reset", 0);
} }
if ((phaseVarMemo == 2 and getprop("/ECAM/engine-start-time") != 0 and getprop("/ECAM/engine-start-time") + 120 < pts.Sim.Time.elapsedSec.getValue()) or getprop("/ECAM/to-memo-flipflop")) { if ((phaseVarMemo == 2 and engStrtTime.getValue() != 0 and engStrtTime.getValue() + 120 < pts.Sim.Time.elapsedSec.getValue()) or getprop("/ECAM/to-memo-flipflop")) {
toMemoLine1.active = 1; toMemoLine1.active = 1;
toMemoLine2.active = 1; toMemoLine2.active = 1;
toMemoLine3.active = 1; toMemoLine3.active = 1;
@ -3224,7 +3224,7 @@ var messages_config_memo = func {
ldgMemoLine1.colour = "c"; ldgMemoLine1.colour = "c";
} }
if (getprop("/controls/switches/seatbelt-sign") and getprop("/controls/switches/no-smoking-sign")) { if (libraries.seatbeltSwitch.getValue() and libraries.noSmokingSwitch.getValue()) {
ldgMemoLine2.msg = " SIGNS ON"; ldgMemoLine2.msg = " SIGNS ON";
ldgMemoLine2.colour = "g"; ldgMemoLine2.colour = "g";
} else { } else {
@ -3232,7 +3232,7 @@ var messages_config_memo = func {
ldgMemoLine2.colour = "c"; ldgMemoLine2.colour = "c";
} }
if (getprop("/controls/flight/speedbrake-arm")) { if (pts.Controls.Flight.speedbrakeArm.getValue()) {
ldgMemoLine3.msg = " SPLRS ARM"; ldgMemoLine3.msg = " SPLRS ARM";
ldgMemoLine3.colour = "g"; ldgMemoLine3.colour = "g";
} else { } else {
@ -3343,19 +3343,19 @@ var messages_memo = func {
} }
} }
if (getprop("/controls/flight/speedbrake-arm") == 1 and toMemoLine1.active != 1 and ldgMemoLine1.active != 1) { if (pts.Controls.Flight.speedbrakeArm.getValue() == 1 and toMemoLine1.active != 1 and ldgMemoLine1.active != 1) {
gnd_splrs.active = 1; gnd_splrs.active = 1;
} else { } else {
gnd_splrs.active = 0; gnd_splrs.active = 0;
} }
if (getprop("/controls/lighting/seatbelt-sign") == 1 and toMemoLine1.active != 1 and ldgMemoLine1.active != 1) { if (libraries.seatbeltLight.getValue() == 1 and toMemoLine1.active != 1 and ldgMemoLine1.active != 1) {
seatbelts.active = 1; seatbelts.active = 1;
} else { } else {
seatbelts.active = 0; seatbelts.active = 0;
} }
if (getprop("/controls/lighting/no-smoking-sign") == 1 and toMemoLine1.active != 1 and ldgMemoLine1.active != 1) { # should go off after takeoff assuming switch is in auto due to old logic from the days when smoking was allowed! if (libraries.noSmokingLight.getValue() == 1 and toMemoLine1.active != 1 and ldgMemoLine1.active != 1) { # should go off after takeoff assuming switch is in auto due to old logic from the days when smoking was allowed!
nosmoke.active = 1; nosmoke.active = 1;
} else { } else {
nosmoke.active = 0; nosmoke.active = 0;

View file

@ -5,33 +5,29 @@
var ap_active = 0; var ap_active = 0;
var athr_active = 0; var athr_active = 0;
var aileron = 0;
var elevator = 0;
var engModeSel = 0; var engModeSel = 0;
var APUMaster = 0; var APUMaster = 0;
var APURPM = 0; var APURPM = 0;
var gearDown = 0; var apOffTime = props.globals.initNode("/ECAM/warnings/ap-off-time", 0, "INT");
var apOffTime = 0; var athrOffTime = props.globals.initNode("/ECAM/warnings/athr-off-time", 0, "INT");
var athrOffTime = 0; var engStrtTimeSw = props.globals.initNode("/ECAM/engine-start-time-switch", 0, "BOOL");
var apWarnNode = 0; var engStrtTime = props.globals.initNode("/ECAM/engine-start-time", 0.0, "DOUBLE");
var athrWarnNode = 0; var apWarnNode = props.globals.initNode("/it-autoflight/output/ap-warning", 0, "INT");
var engStrtTimeSw = 0; var athrWarnNode = props.globals.initNode("/it-autoflight/output/athr-warning", 0, "INT");
var engStrtTime = 0; var page = props.globals.initNode("/ECAM/Lower/page", "door", "STRING");
var page = 0;
var gearWarnLight = props.globals.initNode("/ECAM/warnings/landing-gear-warning-light", 0, "BOOL"); var gearWarnLight = props.globals.initNode("/ECAM/warnings/landing-gear-warning-light", 0, "BOOL");
var ECAM = { var ECAM = {
_cachePage: "", _cachePage: "",
init: func() { init: func() {
page = props.globals.initNode("/ECAM/Lower/page", "door", "STRING"); page.setValue("door");
apOffTime.setValue(0);
apOffTime = props.globals.initNode("/ECAM/warnings/ap-off-time", 0, "INT"); athrOffTime.setValue(0);
athrOffTime = props.globals.initNode("/ECAM/warnings/athr-off-time", 0, "INT"); engStrtTimeSw.setValue(0);
engStrtTimeSw = props.globals.initNode("/ECAM/engine-start-time-switch", 0, "BOOL"); engStrtTime.setValue(0);
engStrtTime = props.globals.initNode("/ECAM/engine-start-time", 0.0, "DOUBLE"); apWarnNode.setValue(0);
apWarnNode = props.globals.initNode("/it-autoflight/output/ap-warning", 0, "INT"); athrWarnNode.setValue(0);
athrWarnNode = props.globals.initNode("/it-autoflight/output/athr-warning", 0, "INT");
me.reset(); me.reset();
}, },
update_items: [ update_items: [

View file

@ -218,20 +218,20 @@ var FCUController = {
me.ias = fmgc.Velocities.indicatedAirspeedKt.getValue(); me.ias = fmgc.Velocities.indicatedAirspeedKt.getValue();
me.mach = fmgc.Velocities.indicatedMach.getValue(); me.mach = fmgc.Velocities.indicatedMach.getValue();
if (!fmgc.Input.ktsMach.getBoolValue()) { if (!fmgc.Input.ktsMach.getBoolValue()) {
if (me.ias >= 100 and me.ias <= 350) { if (me.ias >= 100 and me.ias <= 399) {
fmgc.Input.kts.setValue(math.round(me.ias)); fmgc.Input.kts.setValue(math.round(me.ias));
} else if (me.ias < 100) { } else if (me.ias < 100) {
fmgc.Input.kts.setValue(100); fmgc.Input.kts.setValue(100);
} else if (me.ias > 350) { } else if (me.ias > 399) {
fmgc.Input.kts.setValue(350); fmgc.Input.kts.setValue(399);
} }
} else if (fmgc.Input.ktsMach.getBoolValue()) { } else if (fmgc.Input.ktsMach.getBoolValue()) {
if (me.mach >= 0.50 and me.mach <= 0.82) { if (me.mach >= 0.10 and me.mach <= 0.99) {
fmgc.Input.mach.setValue(math.round(me.mach, 0.001)); fmgc.Input.mach.setValue(math.round(me.mach, 0.001));
} else if (me.mach < 0.50) { } else if (me.mach < 0.10) {
fmgc.Input.mach.setValue(0.50); fmgc.Input.mach.setValue(0.10);
} else if (me.mach > 0.82) { } else if (me.mach > 0.99) {
fmgc.Input.mach.setValue(0.82); fmgc.Input.mach.setValue(0.99);
} }
} }
} }
@ -252,10 +252,10 @@ var FCUController = {
} else if (d == -10) { } else if (d == -10) {
me.machTemp = math.round(me.machTemp - 0.01, 0.01); # Kill floating point error me.machTemp = math.round(me.machTemp - 0.01, 0.01); # Kill floating point error
} }
if (me.machTemp < 0.50) { if (me.machTemp < 0.10) {
fmgc.Input.mach.setValue(0.50); fmgc.Input.mach.setValue(0.10);
} else if (me.machTemp > 0.82) { } else if (me.machTemp > 0.99) {
fmgc.Input.mach.setValue(0.82); fmgc.Input.mach.setValue(0.99);
} else { } else {
fmgc.Input.mach.setValue(me.machTemp); fmgc.Input.mach.setValue(me.machTemp);
} }
@ -272,8 +272,8 @@ var FCUController = {
} }
if (me.iasTemp < 100) { if (me.iasTemp < 100) {
fmgc.Input.kts.setValue(100); fmgc.Input.kts.setValue(100);
} else if (me.iasTemp > 350) { } else if (me.iasTemp > 399) {
fmgc.Input.kts.setValue(350); fmgc.Input.kts.setValue(399);
} else { } else {
fmgc.Input.kts.setValue(me.iasTemp); fmgc.Input.kts.setValue(me.iasTemp);
} }
@ -410,6 +410,7 @@ var FCUController = {
} else { } else {
fmgc.Input.vert.setValue(1); fmgc.Input.vert.setValue(1);
fmgc.Input.vs.setValue(0); fmgc.Input.vs.setValue(0);
fmgc.Custom.Output.vsFCU.setValue(left(sprintf("%+05.0f",0),3));
} }
} }
}, },
@ -444,6 +445,7 @@ var FCUController = {
} else { } else {
fmgc.Input.vs.setValue(me.vsTemp); fmgc.Input.vs.setValue(me.vsTemp);
} }
fmgc.Custom.Output.vsFCU.setValue(left(sprintf("%+05.0f",fmgc.Input.vs.getValue()),3));
} else if (fmgc.Output.vert.getValue() == 5) { } else if (fmgc.Output.vert.getValue() == 5) {
me.fpaTemp = fmgc.Input.fpa.getValue(); me.fpaTemp = fmgc.Input.fpa.getValue();
if (d == 1) { if (d == 1) {

View file

@ -182,6 +182,7 @@ var Custom = {
}, },
Output: { Output: {
fmaPower: props.globals.initNode("/it-autoflight/output/fma-pwr", 0, "BOOL"), fmaPower: props.globals.initNode("/it-autoflight/output/fma-pwr", 0, "BOOL"),
vsFCU: props.globals.initNode("/it-autoflight/output/vs-fcu-display", "", "STRING"),
}, },
Sound: { Sound: {
athrOff: props.globals.initNode("/it-autoflight/sound/athrsound", 0, "BOOL"), athrOff: props.globals.initNode("/it-autoflight/sound/athrsound", 0, "BOOL"),
@ -204,6 +205,7 @@ var ITAF = {
Input.hdg.setValue(360); Input.hdg.setValue(360);
Input.alt.setValue(10000); Input.alt.setValue(10000);
Input.vs.setValue(0); Input.vs.setValue(0);
Custom.Output.vsFCU.setValue(left(sprintf("%+05.0f",0),3));
Input.fpa.setValue(0); Input.fpa.setValue(0);
Input.lat.setValue(9); Input.lat.setValue(9);
Input.vert.setValue(9); Input.vert.setValue(9);
@ -260,6 +262,10 @@ var ITAF = {
Internal.vsTemp = Internal.vs.getValue(); Internal.vsTemp = Internal.vs.getValue();
Position.indicatedAltitudeFtTemp = Position.indicatedAltitudeFt.getValue(); Position.indicatedAltitudeFtTemp = Position.indicatedAltitudeFt.getValue();
# Update VLS / VMAX for autothrust
FMGCNodes.vmax.setValue(FMGCInternal.maxspeed);
FMGCNodes.vlsMin.setValue(FMGCInternal.vls_min);
# LNAV Engagement # LNAV Engagement
if (Output.lnavArm.getBoolValue()) { if (Output.lnavArm.getBoolValue()) {
me.checkLnav(1); me.checkLnav(1);
@ -833,13 +839,13 @@ var ITAF = {
} }
}, },
syncKts: func() { syncKts: func() {
Input.kts.setValue(math.clamp(math.round(Velocities.indicatedAirspeedKt.getValue()), 100, 350)); Input.kts.setValue(math.clamp(math.round(Velocities.indicatedAirspeedKt.getValue()), 100, 399));
}, },
syncKtsGa: func() { # Same as syncKts, except doesn't go below V2 syncKtsGa: func() { # Same as syncKts, except doesn't go below V2
Input.kts.setValue(math.clamp(math.round(Velocities.indicatedAirspeedKt.getValue()), FMGCInternal.v2, 350)); Input.kts.setValue(math.clamp(math.round(Velocities.indicatedAirspeedKt.getValue()), FMGCInternal.v2, 399));
}, },
syncMach: func() { syncMach: func() {
Input.mach.setValue(math.clamp(math.round(Velocities.indicatedMach.getValue(), 0.001), 0.5, 0.82)); Input.mach.setValue(math.clamp(math.round(Velocities.indicatedMach.getValue(), 0.001), 0.1, 0.99));
}, },
syncHdg: func() { syncHdg: func() {
Input.hdg.setValue(math.round(Internal.hdgPredicted.getValue())); # Switches to track automatically Input.hdg.setValue(math.round(Internal.hdgPredicted.getValue())); # Switches to track automatically
@ -848,8 +854,11 @@ var ITAF = {
Input.alt.setValue(math.clamp(math.round(Internal.altPredicted.getValue(), 100), 0, 50000)); Input.alt.setValue(math.clamp(math.round(Internal.altPredicted.getValue(), 100), 0, 50000));
Internal.alt.setValue(math.clamp(math.round(Internal.altPredicted.getValue(), 100), 0, 50000)); Internal.alt.setValue(math.clamp(math.round(Internal.altPredicted.getValue(), 100), 0, 50000));
}, },
tempVS: 0,
syncVs: func() { syncVs: func() {
Input.vs.setValue(math.clamp(math.round(Internal.vs.getValue(), 100), -6000, 6000)); me.tempVS = math.clamp(math.round(Internal.vs.getValue(), 100), -6000, 6000);
Input.vs.setValue(me.tempVS);
fmgc.Custom.Output.vsFCU.setValue(left(sprintf("%+05.0f",me.tempVS),3));
}, },
syncFpa: func() { syncFpa: func() {
Input.fpa.setValue(math.clamp(math.round(Internal.fpa.getValue(), 0.1), -9.9, 9.9)); Input.fpa.setValue(math.clamp(math.round(Internal.fpa.getValue(), 0.1), -9.9, 9.9));

View file

@ -16,7 +16,7 @@ var dep = "";
var arr = ""; var arr = "";
var n1_left = 0; var n1_left = 0;
var n1_right = 0; var n1_right = 0;
var modelat = 0; var modelat = "";
var mode = 0; var mode = 0;
var gs = 0; var gs = 0;
var cruiseft = 0; var cruiseft = 0;
@ -31,6 +31,7 @@ var hdg = 0;
var alt = 0; var alt = 0;
var altitude = 0; var altitude = 0;
var flap = 0; var flap = 0;
var flaps = 0;
var freqnav0uf = 0; var freqnav0uf = 0;
var freqnav0 = 0; var freqnav0 = 0;
var namenav0 = "XX"; var namenav0 = "XX";
@ -69,8 +70,8 @@ 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);
setprop("/it-autoflight/output/fma-pwr", 0); setprop("/it-autoflight/output/fma-pwr", 0);
setprop("instrumentation/nav[0]/nav-id", "XXX"); setprop("/instrumentation/nav[0]/nav-id", "XXX");
setprop("instrumentation/nav[1]/nav-id", "XXX"); setprop("/instrumentation/nav[1]/nav-id", "XXX");
setprop("/FMGC/internal/ils1-mcdu", "XXX/999.99"); setprop("/FMGC/internal/ils1-mcdu", "XXX/999.99");
setprop("/FMGC/internal/ils2-mcdu", "XXX/999.99"); setprop("/FMGC/internal/ils2-mcdu", "XXX/999.99");
setprop("/FMGC/internal/vor1-mcdu", "XXX/999.99"); setprop("/FMGC/internal/vor1-mcdu", "XXX/999.99");
@ -78,6 +79,9 @@ setprop("/FMGC/internal/vor2-mcdu", "999.99/XXX");
setprop("/FMGC/internal/adf1-mcdu", "XXX/999.99"); setprop("/FMGC/internal/adf1-mcdu", "XXX/999.99");
setprop("/FMGC/internal/adf2-mcdu", "999.99/XXX"); setprop("/FMGC/internal/adf2-mcdu", "999.99/XXX");
var FMGCAlignDone = [props.globals.initNode("/FMGC/internal/align1-done", 0, "BOOL"), props.globals.initNode("/FMGC/internal/align2-done", 0, "BOOL"), props.globals.initNode("/FMGC/internal/align3-done", 0, "BOOL")];
var FMGCAlignTime = [props.globals.initNode("/FMGC/internal/align1-time", 0, "DOUBLE"), props.globals.initNode("/FMGC/internal/align2-time", 0, "DOUBLE"), props.globals.initNode("/FMGC/internal/align3-time", 0, "DOUBLE")];
var adirsSkip = props.globals.getNode("/systems/acconfig/options/adirs-skip");
var blockCalculating = props.globals.initNode("/FMGC/internal/block-calculating", 0, "BOOL"); var blockCalculating = props.globals.initNode("/FMGC/internal/block-calculating", 0, "BOOL");
var fuelCalculating = props.globals.initNode("/FMGC/internal/fuel-calculating", 0, "BOOL"); var fuelCalculating = props.globals.initNode("/FMGC/internal/fuel-calculating", 0, "BOOL");
@ -86,6 +90,7 @@ 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;
@ -93,9 +98,9 @@ var FMGCinit = func {
setprop("/FMGC/internal/loc-source", "NAV0"); setprop("/FMGC/internal/loc-source", "NAV0");
setprop("/FMGC/internal/optalt", 0); setprop("/FMGC/internal/optalt", 0);
setprop("/FMGC/internal/landing-time", -99); setprop("/FMGC/internal/landing-time", -99);
setprop("/FMGC/internal/align1-time", -99); FMGCAlignTime[0].setValue(-99);
setprop("/FMGC/internal/align2-time", -99); FMGCAlignTime[1].setValue(-99);
setprop("/FMGC/internal/align3-time", -99); FMGCAlignTime[2].setValue(-99);
setprop("/FMGC/internal/block-fuel-time", -99); setprop("/FMGC/internal/block-fuel-time", -99);
setprop("/FMGC/internal/fuel-pred-time", -99); setprop("/FMGC/internal/fuel-pred-time", -99);
masterFMGC.start(); masterFMGC.start();
@ -255,6 +260,9 @@ 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"),
vlsMin: props.globals.initNode("/FMGC/internal/vls-min", 0, "DOUBLE"),
vmax: props.globals.initNode("/FMGC/internal/vmax", 0, "DOUBLE"),
}; };
############ ############
@ -327,7 +335,7 @@ var updateFuel = func {
final_time = final_fuel / (2.0 * ((zfw*zfw*-2e-10) + (zfw*0.0003) + 2.8903)); # x2 for 2 engines final_time = final_fuel / (2.0 * ((zfw*zfw*-2e-10) + (zfw*0.0003) + 2.8903)); # x2 for 2 engines
if (final_time < 0) { if (final_time < 0) {
final_time = 0; final_time = 0;
} else if (final_time > 480) { } elsif (final_time > 480) {
final_time = 480; final_time = 480;
} }
if (num(final_time) >= 60) { if (num(final_time) >= 60) {
@ -349,7 +357,7 @@ var updateFuel = func {
final_fuel = final_time * 2.0 * ((zfw*zfw*-2e-10) + (zfw*0.0003) + 2.8903); # x2 for 2 engines final_fuel = final_time * 2.0 * ((zfw*zfw*-2e-10) + (zfw*0.0003) + 2.8903); # x2 for 2 engines
if (final_fuel < 0) { if (final_fuel < 0) {
final_fuel = 0; final_fuel = 0;
} else if (final_fuel > 80000) { } elsif (final_fuel > 80000) {
final_fuel = 80000; final_fuel = 80000;
} }
FMGCInternal.finalFuel = final_fuel / 1000; FMGCInternal.finalFuel = final_fuel / 1000;
@ -358,14 +366,14 @@ var updateFuel = func {
# Calculate alternate fuel # Calculate alternate fuel
if (!FMGCInternal.altFuelSet and FMGCInternal.altAirportSet) { if (!FMGCInternal.altFuelSet and FMGCInternal.altAirportSet) {
#calc #calc
} else if (FMGCInternal.altFuelSet and FMGCInternal.altAirportSet) { } elsif (FMGCInternal.altFuelSet and FMGCInternal.altAirportSet) {
#dummy calc for now #dummy calc for now
alt_fuel = 1000 * num(FMGCInternal.altFuel); alt_fuel = 1000 * num(FMGCInternal.altFuel);
zfw = 1000 * FMGCInternal.zfw; zfw = 1000 * FMGCInternal.zfw;
alt_time = alt_fuel / (2.0 * ((zfw*zfw*-2e-10) + (zfw*0.0003) + 2.8903)); # x2 for 2 engines alt_time = alt_fuel / (2.0 * ((zfw*zfw*-2e-10) + (zfw*0.0003) + 2.8903)); # x2 for 2 engines
if (alt_time < 0) { if (alt_time < 0) {
alt_time = 0; alt_time = 0;
} else if (alt_time > 480) { } elsif (alt_time > 480) {
alt_time = 480; alt_time = 480;
} }
if (num(alt_time) >= 60) { if (num(alt_time) >= 60) {
@ -375,7 +383,7 @@ var updateFuel = func {
} else { } else {
FMGCInternal.altTime = sprintf("%04d", alt_time); FMGCInternal.altTime = sprintf("%04d", alt_time);
} }
} else if (!FMGCInternal.altFuelSet) { } elsif (!FMGCInternal.altFuelSet) {
FMGCInternal.altFuel = 0.0; FMGCInternal.altFuel = 0.0;
FMGCInternal.altTime = "0000"; FMGCInternal.altTime = "0000";
} }
@ -406,7 +414,7 @@ var updateFuel = func {
trip_fuel = 4.018e+02 + (dist*3.575e+01) + (dist*dist*-4.260e-02) + (dist*dist*dist*-1.446e-05) + (dist*dist*dist*dist*4.101e-09) + (dist*dist*dist*dist*dist*-6.753e-13) + (dist*dist*dist*dist*dist*dist*5.074e-17) + (crz*-2.573e+01) + (dist*crz*-1.583e-01) + (dist*dist*crz*8.147e-04) + (dist*dist*dist*crz*4.485e-08) + (dist*dist*dist*dist*crz*-7.656e-12) + (dist*dist*dist*dist*dist*crz*4.503e-16) + (crz*crz*4.427e-01) + (dist*crz*crz*-1.137e-03) + (dist*dist*crz*crz*-4.409e-06) + (dist*dist*dist*crz*crz*-3.345e-11) + (dist*dist*dist*dist*crz*crz*4.985e-15) + (crz*crz*crz*-2.471e-03) + (dist*crz*crz*crz*1.223e-05) + (dist*dist*crz*crz*crz*9.660e-09) + (dist*dist*dist*crz*crz*crz*-2.127e-14) + (crz*crz*crz*crz*5.714e-06) + (dist*crz*crz*crz*crz*-3.546e-08) + (dist*dist*crz*crz*crz*crz*-7.536e-12) + (crz*crz*crz*crz*crz*-4.061e-09) + (dist*crz*crz*crz*crz*crz*3.355e-11) + (crz*crz*crz*crz*crz*crz*-1.451e-12); trip_fuel = 4.018e+02 + (dist*3.575e+01) + (dist*dist*-4.260e-02) + (dist*dist*dist*-1.446e-05) + (dist*dist*dist*dist*4.101e-09) + (dist*dist*dist*dist*dist*-6.753e-13) + (dist*dist*dist*dist*dist*dist*5.074e-17) + (crz*-2.573e+01) + (dist*crz*-1.583e-01) + (dist*dist*crz*8.147e-04) + (dist*dist*dist*crz*4.485e-08) + (dist*dist*dist*dist*crz*-7.656e-12) + (dist*dist*dist*dist*dist*crz*4.503e-16) + (crz*crz*4.427e-01) + (dist*crz*crz*-1.137e-03) + (dist*dist*crz*crz*-4.409e-06) + (dist*dist*dist*crz*crz*-3.345e-11) + (dist*dist*dist*dist*crz*crz*4.985e-15) + (crz*crz*crz*-2.471e-03) + (dist*crz*crz*crz*1.223e-05) + (dist*dist*crz*crz*crz*9.660e-09) + (dist*dist*dist*crz*crz*crz*-2.127e-14) + (crz*crz*crz*crz*5.714e-06) + (dist*crz*crz*crz*crz*-3.546e-08) + (dist*dist*crz*crz*crz*crz*-7.536e-12) + (crz*crz*crz*crz*crz*-4.061e-09) + (dist*crz*crz*crz*crz*crz*3.355e-11) + (crz*crz*crz*crz*crz*crz*-1.451e-12);
if (trip_fuel < 400) { if (trip_fuel < 400) {
trip_fuel = 400; trip_fuel = 400;
} else if (trip_fuel > 80000) { } elsif (trip_fuel > 80000) {
trip_fuel = 80000; trip_fuel = 80000;
} }
@ -416,7 +424,7 @@ var updateFuel = func {
trip_time = 9.095e-02 + (dist*-3.968e-02) + (dist*dist*4.302e-04) + (dist*dist*dist*2.005e-07) + (dist*dist*dist*dist*-6.876e-11) + (dist*dist*dist*dist*dist*1.432e-14) + (dist*dist*dist*dist*dist*dist*-1.177e-18) + (crz*7.348e-01) + (dist*crz*3.310e-03) + (dist*dist*crz*-8.700e-06) + (dist*dist*dist*crz*-4.214e-10) + (dist*dist*dist*dist*crz*5.652e-14) + (dist*dist*dist*dist*dist*crz*-6.379e-18) + (crz*crz*-1.449e-02) + (dist*crz*crz*-7.508e-06) + (dist*dist*crz*crz*4.529e-08) + (dist*dist*dist*crz*crz*3.699e-13) + (dist*dist*dist*dist*crz*crz*8.466e-18) + (crz*crz*crz*1.108e-04) + (dist*crz*crz*crz*-4.126e-08) + (dist*dist*crz*crz*crz*-9.645e-11) + (dist*dist*dist*crz*crz*crz*-1.544e-16) + (crz*crz*crz*crz*-4.123e-07) + (dist*crz*crz*crz*crz*1.831e-10) + (dist*dist*crz*crz*crz*crz*7.438e-14) + (crz*crz*crz*crz*crz*7.546e-10) + (dist*crz*crz*crz*crz*crz*-1.921e-13) + (crz*crz*crz*crz*crz*crz*-5.453e-13); trip_time = 9.095e-02 + (dist*-3.968e-02) + (dist*dist*4.302e-04) + (dist*dist*dist*2.005e-07) + (dist*dist*dist*dist*-6.876e-11) + (dist*dist*dist*dist*dist*1.432e-14) + (dist*dist*dist*dist*dist*dist*-1.177e-18) + (crz*7.348e-01) + (dist*crz*3.310e-03) + (dist*dist*crz*-8.700e-06) + (dist*dist*dist*crz*-4.214e-10) + (dist*dist*dist*dist*crz*5.652e-14) + (dist*dist*dist*dist*dist*crz*-6.379e-18) + (crz*crz*-1.449e-02) + (dist*crz*crz*-7.508e-06) + (dist*dist*crz*crz*4.529e-08) + (dist*dist*dist*crz*crz*3.699e-13) + (dist*dist*dist*dist*crz*crz*8.466e-18) + (crz*crz*crz*1.108e-04) + (dist*crz*crz*crz*-4.126e-08) + (dist*dist*crz*crz*crz*-9.645e-11) + (dist*dist*dist*crz*crz*crz*-1.544e-16) + (crz*crz*crz*crz*-4.123e-07) + (dist*crz*crz*crz*crz*1.831e-10) + (dist*dist*crz*crz*crz*crz*7.438e-14) + (crz*crz*crz*crz*crz*7.546e-10) + (dist*crz*crz*crz*crz*crz*-1.921e-13) + (crz*crz*crz*crz*crz*crz*-5.453e-13);
if (trip_time < 10) { if (trip_time < 10) {
trip_time = 10; trip_time = 10;
} else if (trip_time > 480) { } elsif (trip_time > 480) {
trip_time = 480; trip_time = 480;
} }
# if (low air conditioning) { # if (low air conditioning) {
@ -424,7 +432,7 @@ var updateFuel = func {
#} #}
# if (total anti-ice) { # if (total anti-ice) {
# trip_fuel = trip_fuel * 1.045; # trip_fuel = trip_fuel * 1.045;
#} else if (engine anti-ice) { #} elsif (engine anti-ice) {
# trip_fuel = trip_fuel * 1.02; # trip_fuel = trip_fuel * 1.02;
#} #}
@ -433,7 +441,7 @@ var updateFuel = func {
trip_fuel = trip_fuel + (landing_weight_correction * (FMGCInternal.lw * 1000 - 121254.24421) / 2204.622622); trip_fuel = trip_fuel + (landing_weight_correction * (FMGCInternal.lw * 1000 - 121254.24421) / 2204.622622);
if (trip_fuel < 400) { if (trip_fuel < 400) {
trip_fuel = 400; trip_fuel = 400;
} else if (trip_fuel > 80000) { } elsif (trip_fuel > 80000) {
trip_fuel = 80000; trip_fuel = 80000;
} }
@ -461,7 +469,7 @@ var updateFuel = func {
FMGCInternal.rtePercent = 15.0; # need reasearch on this value FMGCInternal.rtePercent = 15.0; # need reasearch on this value
} }
} }
} else if (FMGCInternal.rtePercentSet) { } elsif (FMGCInternal.rtePercentSet) {
FMGCInternal.rteRsv = num(FMGCInternal.tripFuel * FMGCInternal.rtePercent / 100.0); FMGCInternal.rteRsv = num(FMGCInternal.tripFuel * FMGCInternal.rtePercent / 100.0);
} else { } else {
if (num(FMGCInternal.tripFuel) <= 0.0) { if (num(FMGCInternal.tripFuel) <= 0.0) {
@ -491,7 +499,7 @@ var updateFuel = func {
extra_time = extra_fuel / (2.0 * ((lw*lw*-2e-10) + (lw*0.0003) + 2.8903)); # x2 for 2 engines extra_time = extra_fuel / (2.0 * ((lw*lw*-2e-10) + (lw*0.0003) + 2.8903)); # x2 for 2 engines
if (extra_time < 0) { if (extra_time < 0) {
extra_time = 0; extra_time = 0;
} else if (extra_time > 480) { } elsif (extra_time > 480) {
extra_time = 480; extra_time = 480;
} }
if (num(extra_time) >= 60) { if (num(extra_time) >= 60) {
@ -599,7 +607,10 @@ var radios = maketimer(1, func() {
adf1(); adf1();
}); });
var newphase = nil;
var masterFMGC = maketimer(0.2, func { var masterFMGC = maketimer(0.2, func {
n1_left = pts.Engines.Engine.n1Actual[0].getValue(); n1_left = pts.Engines.Engine.n1Actual[0].getValue();
n1_right = pts.Engines.Engine.n1Actual[1].getValue(); n1_right = pts.Engines.Engine.n1Actual[1].getValue();
modelat = Modes.PFD.FMA.rollMode.getValue(); modelat = Modes.PFD.FMA.rollMode.getValue();
@ -614,64 +625,67 @@ var masterFMGC = maketimer(0.2, func {
gear0 = pts.Gear.wow[0].getBoolValue(); gear0 = pts.Gear.wow[0].getBoolValue();
altSel = Input.alt.getValue(); 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 newphase = FMGCInternal.phase;
FMGCInternal.phase = 0;
systems.PNEU.pressMode.setValue("GN"); if (FMGCInternal.phase == 0) {
} if (gear0 and ((n1_left >= 85 and n1_right >= 85 and mode == "SRS") or gs >= 90)) {
newphase = 1;
if (gear0 and FMGCInternal.phase == 0 and ((n1_left >= 85 and n1_right >= 85 and mode == "SRS") or gs >= 90)) { systems.PNEU.pressMode.setValue("TO");
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 { } elsif (FMGCInternal.phase == 1) {
if (FMGCInternal.phase == 3 and (flightPlanController.arrivalDist <= 200 or altSel < (FMGCInternal.crzFl * 100))) { # todo - not sure about crzFl condition, investigate what happens! if (gear0) {
FMGCInternal.phase = 4; if ((n1_left < 85 or n1_right < 85) and gs < 90 and mode == " ") { # rejected takeoff
systems.PNEU.pressMode.setValue("DE"); newphase = 0;
systems.PNEU.pressMode.setValue("GN");
}
} elsif (((mode != "SRS" and mode != " ") or alt >= accel_agl_ft)) {
newphase = 2;
systems.PNEU.pressMode.setValue("TO");
} }
} } elsif (FMGCInternal.phase == 2) {
if ((mode == "ALT CRZ" or mode == "ALT CRZ*")) {
if (FMGCInternal.phase == 4) { newphase = 3;
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"); systems.PNEU.pressMode.setValue("CR");
} }
} } elsif (FMGCInternal.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 and altSel < (FMGCInternal.crzFl * 100))) { # todo - not sure about crzFl condition, investigate what happens!
newphase = 4;
systems.PNEU.pressMode.setValue("DE");
}
}
} elsif (FMGCInternal.phase == 4) {
if (getprop("/FMGC/internal/decel")) {
newphase = 5;
}
elsif (altSel == (FMGCInternal.crzFl * 100)) { # back to CRZ state
newphase = 3;
systems.PNEU.pressMode.setValue("CR");
}
} elsif (FMGCInternal.phase == 5) {
if (state1 == "TOGA" and state2 == "TOGA") {
newphase = 6;
systems.PNEU.pressMode.setValue("TO");
Input.toga.setValue(1);
}
} elsif (FMGCInternal.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 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); setprop("/FMGC/internal/decel", 1);
} else if (getprop("/FMGC/internal/decel") == 1 and (FMGCInternal.phase == 0 or FMGCInternal.phase == 6)) { } elsif (getprop("/FMGC/internal/decel") == 1 and (FMGCInternal.phase == 0 or FMGCInternal.phase == 6)) {
setprop("/FMGC/internal/decel", 0); 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(); tempOverspeed = systems.ADIRS.overspeedVFE.getValue();
if (tempOverspeed != 1024) { if (tempOverspeed != 1024) {
FMGCInternal.maxspeed = tempOverspeed - 4; FMGCInternal.maxspeed = tempOverspeed - 4;
@ -681,6 +695,11 @@ var masterFMGC = maketimer(0.2, func {
FMGCInternal.maxspeed = fmgc.FMGCInternal.vmo_mmo; FMGCInternal.maxspeed = fmgc.FMGCInternal.vmo_mmo;
} }
if (newphase != FMGCInternal.phase) { # phase changed
FMGCInternal.phase = newphase;
FMGCNodes.phase.setValue(newphase);
}
############################ ############################
# fuel # fuel
############################ ############################
@ -762,7 +781,7 @@ var masterFMGC = maketimer(0.2, func {
if (!fmgc.FMGCInternal.vappSpeedSet) { if (!fmgc.FMGCInternal.vappSpeedSet) {
if (FMGCInternal.destWind < 5) { if (FMGCInternal.destWind < 5) {
FMGCInternal.vapp = FMGCInternal.vls + 5; FMGCInternal.vapp = FMGCInternal.vls + 5;
} else if (FMGCInternal.destWind > 15) { } elsif (FMGCInternal.destWind > 15) {
FMGCInternal.vapp = FMGCInternal.vls + 15; FMGCInternal.vapp = FMGCInternal.vls + 15;
} else { } else {
FMGCInternal.vapp = FMGCInternal.vls + FMGCInternal.destWind; FMGCInternal.vapp = FMGCInternal.vls + FMGCInternal.destWind;
@ -826,7 +845,7 @@ var masterFMGC = maketimer(0.2, func {
if (!fmgc.FMGCInternal.vappSpeedSet) { if (!fmgc.FMGCInternal.vappSpeedSet) {
if (FMGCInternal.destWind < 5) { if (FMGCInternal.destWind < 5) {
FMGCInternal.vapp_appr = FMGCInternal.vls_appr + 5; FMGCInternal.vapp_appr = FMGCInternal.vls_appr + 5;
} else if (FMGCInternal.destWind > 15) { } elsif (FMGCInternal.destWind > 15) {
FMGCInternal.vapp_appr = FMGCInternal.vls_appr + 15; FMGCInternal.vapp_appr = FMGCInternal.vls_appr + 15;
} else { } else {
FMGCInternal.vapp_appr = FMGCInternal.vls_appr + FMGCInternal.destWind; FMGCInternal.vapp_appr = FMGCInternal.vls_appr + FMGCInternal.destWind;
@ -862,7 +881,7 @@ var masterFMGC = maketimer(0.2, func {
} else { } else {
FMGCInternal.vls_min = FMGCInternal.vs1g_clean * 1.23; FMGCInternal.vls_min = FMGCInternal.vs1g_clean * 1.23;
} }
} else if (flap == 1) { # 1 } elsif (flap == 1) { # 1
FMGCInternal.vsw = FMGCInternal.vs1g_conf_2; FMGCInternal.vsw = FMGCInternal.vs1g_conf_2;
FMGCInternal.minspeed = FMGCInternal.slat; FMGCInternal.minspeed = FMGCInternal.slat;
@ -871,7 +890,7 @@ var masterFMGC = maketimer(0.2, func {
} else { } else {
FMGCInternal.vls_min = FMGCInternal.vs1g_conf_1 * 1.23; FMGCInternal.vls_min = FMGCInternal.vs1g_conf_1 * 1.23;
} }
} else if (flap == 2) { # 1+F } elsif (flap == 2) { # 1+F
FMGCInternal.vsw = FMGCInternal.vs1g_conf_1f; FMGCInternal.vsw = FMGCInternal.vs1g_conf_1f;
FMGCInternal.minspeed = FMGCInternal.slat; FMGCInternal.minspeed = FMGCInternal.slat;
@ -880,7 +899,7 @@ var masterFMGC = maketimer(0.2, func {
} else { } else {
FMGCInternal.vls_min = FMGCInternal.vs1g_conf_1f * 1.23; FMGCInternal.vls_min = FMGCInternal.vs1g_conf_1f * 1.23;
} }
} else if (flap == 3) { # 2 } elsif (flap == 3) { # 2
FMGCInternal.vsw = FMGCInternal.vs1g_conf_2; FMGCInternal.vsw = FMGCInternal.vs1g_conf_2;
FMGCInternal.minspeed = FMGCInternal.flap2; FMGCInternal.minspeed = FMGCInternal.flap2;
@ -889,7 +908,7 @@ var masterFMGC = maketimer(0.2, func {
} else { } else {
FMGCInternal.vls_min = FMGCInternal.vs1g_conf_2 * 1.23; FMGCInternal.vls_min = FMGCInternal.vs1g_conf_2 * 1.23;
} }
} else if (flap == 4) { # 3 } elsif (flap == 4) { # 3
FMGCInternal.vsw = FMGCInternal.vs1g_conf_3; FMGCInternal.vsw = FMGCInternal.vs1g_conf_3;
FMGCInternal.minspeed = FMGCInternal.flap3; FMGCInternal.minspeed = FMGCInternal.flap3;
@ -898,7 +917,7 @@ var masterFMGC = maketimer(0.2, func {
} else { } else {
FMGCInternal.vls_min = FMGCInternal.vs1g_conf_3 * 1.23; FMGCInternal.vls_min = FMGCInternal.vs1g_conf_3 * 1.23;
} }
} else if (flap == 5) { # FULL } elsif (flap == 5) { # FULL
FMGCInternal.vsw = FMGCInternal.vs1g_conf_full; FMGCInternal.vsw = FMGCInternal.vs1g_conf_full;
if (FMGCInternal.vappSpeedSet) { if (FMGCInternal.vappSpeedSet) {
FMGCInternal.minspeed = FMGCInternal.vapp_appr; FMGCInternal.minspeed = FMGCInternal.vapp_appr;
@ -913,7 +932,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 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);
} }
@ -925,45 +944,56 @@ var masterFMGC = maketimer(0.2, func {
FMGCInternal.takeoffState = 0; FMGCInternal.takeoffState = 0;
} }
############################ });
#handle radios, runways, v1/vr/v2
############################ ############################
#handle radios, runways, v1/vr/v2
############################
var airportRadiosPhase = nil;
var updateAirportRadios = func {
airportRadiosPhase = 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 FMGCInternal.phase >= 2) { if (airportRadiosPhase >= 2 and destination_rwy != nil) {
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"));
runway_ils = destination_rwy.ils_frequency_mhz; runway_ils = destination_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")) {
setprop("/FMGC/internal/ils1freq-calculated", runway_ils); setprop("/FMGC/internal/ils1freq-calculated", runway_ils);
setprop("instrumentation/nav[0]/frequencies/selected-mhz", runway_ils); setprop("/instrumentation/nav[0]/frequencies/selected-mhz", runway_ils);
setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg); setprop("/instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
} else if (runway_ils != nil and !getprop("/FMGC/internal/ils1freq-set")) { } elsif (runway_ils != nil and !getprop("/FMGC/internal/ils1freq-set")) {
setprop("/FMGC/internal/ils1freq-calculated", runway_ils); setprop("/FMGC/internal/ils1freq-calculated", runway_ils);
setprop("instrumentation/nav[0]/frequencies/selected-mhz", runway_ils); setprop("/instrumentation/nav[0]/frequencies/selected-mhz", runway_ils);
} else if (!getprop("/FMGC/internal/ils1crs-set")) { } elsif (!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 FMGCInternal.phase <= 1) { } elsif (airportRadiosPhase <= 1 and departure_rwy != nil) {
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")) {
setprop("/FMGC/internal/ils1freq-calculated", runway_ils); setprop("/FMGC/internal/ils1freq-calculated", runway_ils);
setprop("instrumentation/nav[0]/frequencies/selected-mhz", runway_ils); setprop("/instrumentation/nav[0]/frequencies/selected-mhz", runway_ils);
setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg); setprop("/instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
} else if (runway_ils != nil and !getprop("/FMGC/internal/ils1freq-set")) { } elsif (runway_ils != nil and !getprop("/FMGC/internal/ils1freq-set")) {
setprop("/FMGC/internal/ils1freq-calculated", runway_ils); setprop("/FMGC/internal/ils1freq-calculated", runway_ils);
setprop("instrumentation/nav[0]/frequencies/selected-mhz", runway_ils); setprop("/instrumentation/nav[0]/frequencies/selected-mhz", runway_ils);
} else if (!getprop("/FMGC/internal/ils1crs-set")) { } elsif (!getprop("/FMGC/internal/ils1crs-set")) {
setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg); setprop("/instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
} }
} }
});
};
setlistener(FMGCNodes.phase, updateAirportRadios,0,0);
setlistener(flightPlanController.changed, updateAirportRadios,0,0);
var reset_FMGC = func { var reset_FMGC = func {
FMGCInternal.phase = 0; FMGCInternal.phase = 0;
FMGCNodes.phase.setValue(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();
@ -977,6 +1007,7 @@ var reset_FMGC = func {
windController.init(); windController.init();
mcdu.MCDU_reset(0); mcdu.MCDU_reset(0);
mcdu.MCDU_reset(1); mcdu.MCDU_reset(1);
Simbrief.SimbriefParser.inhibit = 0;
mcdu.ReceivedMessagesDatabase.clearDatabase(); mcdu.ReceivedMessagesDatabase.clearDatabase();
mcdu.FlightLogDatabase.reset(); # track reset events without loosing recorded data mcdu.FlightLogDatabase.reset(); # track reset events without loosing recorded data
@ -1041,59 +1072,59 @@ var ManagedSPD = maketimer(0.25, func {
if (FMGCInternal.mngSpdCmd != srsSPD) { if (FMGCInternal.mngSpdCmd != srsSPD) {
FMGCInternal.mngSpdCmd = srsSPD; FMGCInternal.mngSpdCmd = srsSPD;
} }
} else if ((FMGCInternal.phase == 2 or FMGCInternal.phase == 3) and altitude <= 10050) { } elsif ((FMGCInternal.phase == 2 or FMGCInternal.phase == 3) and altitude <= 10050) {
if (FMGCInternal.mngKtsMach) { if (FMGCInternal.mngKtsMach) {
FMGCInternal.mngKtsMach = 0; FMGCInternal.mngKtsMach = 0;
} }
if (FMGCInternal.mngSpdCmd != 250 and !decel) { if (FMGCInternal.mngSpdCmd != 250 and !decel) {
FMGCInternal.mngSpdCmd = 250; FMGCInternal.mngSpdCmd = 250;
} else if (FMGCInternal.mngSpdCmd != FMGCInternal.minspeed and decel) { } elsif (FMGCInternal.mngSpdCmd != FMGCInternal.minspeed and decel) {
FMGCInternal.mngSpdCmd = FMGCInternal.minspeed; FMGCInternal.mngSpdCmd = FMGCInternal.minspeed;
} }
} else if ((FMGCInternal.phase == 2 or FMGCInternal.phase == 3) and altitude > 10070 and !FMGCInternal.machSwitchover) { } elsif ((FMGCInternal.phase == 2 or FMGCInternal.phase == 3) and altitude > 10070 and !FMGCInternal.machSwitchover) {
if (FMGCInternal.mngKtsMach) { if (FMGCInternal.mngKtsMach) {
FMGCInternal.mngKtsMach = 0; FMGCInternal.mngKtsMach = 0;
} }
if (FMGCInternal.mngSpdCmd != mng_alt_spd) { if (FMGCInternal.mngSpdCmd != mng_alt_spd) {
FMGCInternal.mngSpdCmd = mng_alt_spd; FMGCInternal.mngSpdCmd = mng_alt_spd;
} }
} else if ((FMGCInternal.phase == 2 or FMGCInternal.phase == 3) and altitude > 10070 and FMGCInternal.machSwitchover) { } elsif ((FMGCInternal.phase == 2 or FMGCInternal.phase == 3) and altitude > 10070 and FMGCInternal.machSwitchover) {
if (!FMGCInternal.mngKtsMach) { if (!FMGCInternal.mngKtsMach) {
FMGCInternal.mngKtsMach = 1; FMGCInternal.mngKtsMach = 1;
} }
if (FMGCInternal.mngSpdCmd != mng_alt_mach) { if (FMGCInternal.mngSpdCmd != mng_alt_mach) {
FMGCInternal.mngSpdCmd = mng_alt_mach; FMGCInternal.mngSpdCmd = mng_alt_mach;
} }
} else if (FMGCInternal.phase == 4 and altitude > 11000 and !FMGCInternal.machSwitchover) { } elsif (FMGCInternal.phase == 4 and altitude > 11000 and !FMGCInternal.machSwitchover) {
if (FMGCInternal.mngKtsMach) { if (FMGCInternal.mngKtsMach) {
FMGCInternal.mngKtsMach = 0; FMGCInternal.mngKtsMach = 0;
} }
if (FMGCInternal.mngSpdCmd != mng_alt_spd) { if (FMGCInternal.mngSpdCmd != mng_alt_spd) {
FMGCInternal.mngSpdCmd = mng_alt_spd; FMGCInternal.mngSpdCmd = mng_alt_spd;
} }
} else if (FMGCInternal.phase == 4 and altitude > 11000 and FMGCInternal.machSwitchover) { } elsif (FMGCInternal.phase == 4 and altitude > 11000 and FMGCInternal.machSwitchover) {
if (!FMGCInternal.mngKtsMach) { if (!FMGCInternal.mngKtsMach) {
FMGCInternal.mngKtsMach = 1; FMGCInternal.mngKtsMach = 1;
} }
if (FMGCInternal.mngSpdCmd != mng_alt_mach) { if (FMGCInternal.mngSpdCmd != mng_alt_mach) {
FMGCInternal.mngSpdCmd = mng_alt_mach; FMGCInternal.mngSpdCmd = mng_alt_mach;
} }
} else if ((FMGCInternal.phase == 4 or FMGCInternal.phase == 5 or FMGCInternal.phase == 6) and altitude > 11000 and !FMGCInternal.machSwitchover) { } elsif ((FMGCInternal.phase == 4 or FMGCInternal.phase == 5 or FMGCInternal.phase == 6) and altitude > 11000 and !FMGCInternal.machSwitchover) {
if (FMGCInternal.mngKtsMach) { if (FMGCInternal.mngKtsMach) {
FMGCInternal.mngKtsMach = 0; FMGCInternal.mngKtsMach = 0;
} }
if (FMGCInternal.mngSpdCmd != mng_alt_spd and !decel) { if (FMGCInternal.mngSpdCmd != mng_alt_spd and !decel) {
FMGCInternal.mngSpdCmd = mng_alt_spd; FMGCInternal.mngSpdCmd = mng_alt_spd;
} else if (FMGCInternal.mngSpdCmd != FMGCInternal.minspeed and decel) { } elsif (FMGCInternal.mngSpdCmd != FMGCInternal.minspeed and decel) {
FMGCInternal.mngSpdCmd = FMGCInternal.minspeed; FMGCInternal.mngSpdCmd = FMGCInternal.minspeed;
} }
} else if ((FMGCInternal.phase == 4 or FMGCInternal.phase == 5 or FMGCInternal.phase == 6) and altitude <= 10980) { } elsif ((FMGCInternal.phase == 4 or FMGCInternal.phase == 5 or FMGCInternal.phase == 6) and altitude <= 10980) {
if (FMGCInternal.mngKtsMach) { if (FMGCInternal.mngKtsMach) {
FMGCInternal.mngKtsMach = 0; FMGCInternal.mngKtsMach = 0;
} }
if (FMGCInternal.mngSpdCmd != 250 and !decel) { if (FMGCInternal.mngSpdCmd != 250 and !decel) {
FMGCInternal.mngSpdCmd = 250; FMGCInternal.mngSpdCmd = 250;
} else if (FMGCInternal.mngSpdCmd != FMGCInternal.minspeed and decel) { } elsif (FMGCInternal.mngSpdCmd != FMGCInternal.minspeed and decel) {
FMGCInternal.mngSpdCmd = FMGCInternal.minspeed; FMGCInternal.mngSpdCmd = FMGCInternal.minspeed;
} }
} }
@ -1106,13 +1137,13 @@ var ManagedSPD = maketimer(0.25, func {
if (ktsmach and !FMGCInternal.mngKtsMach) { if (ktsmach and !FMGCInternal.mngKtsMach) {
Input.ktsMach.setValue(0); Input.ktsMach.setValue(0);
} else if (!ktsmach and FMGCInternal.mngKtsMach) { } elsif (!ktsmach and FMGCInternal.mngKtsMach) {
Input.ktsMach.setValue(1); Input.ktsMach.setValue(1);
} }
if (kts_sel != FMGCInternal.mngSpd and !ktsmach) { if (kts_sel != FMGCInternal.mngSpd and !ktsmach) {
Input.kts.setValue(FMGCInternal.mngSpd); Input.kts.setValue(FMGCInternal.mngSpd);
} else if (mach_sel != FMGCInternal.mngSpd and ktsmach) { } elsif (mach_sel != FMGCInternal.mngSpd and ktsmach) {
Input.mach.setValue(FMGCInternal.mngSpd); Input.mach.setValue(FMGCInternal.mngSpd);
} }
} else { } else {
@ -1154,9 +1185,9 @@ setlistener("/systems/navigation/adr/operating-1", func() {
timer48gpsAlign1.stop(); timer48gpsAlign1.stop();
} }
if (getprop("/FMGC/internal/align1-time") == -99) { if (FMGCAlignTime[0].getValue() == -99) {
timer48gpsAlign1.start(); timer48gpsAlign1.start();
setprop("/FMGC/internal/align1-time", pts.Sim.Time.elapsedSec.getValue()); FMGCAlignTime[0].setValue(pts.Sim.Time.elapsedSec.getValue());
} }
}, 0, 0); }, 0, 0);
@ -1166,9 +1197,9 @@ setlistener("/systems/navigation/adr/operating-2", func() {
timer48gpsAlign2.stop(); timer48gpsAlign2.stop();
} }
if (getprop("/FMGC/internal/align2-time") == -99) { if (FMGCAlignTime[1].getValue() == -99) {
timer48gpsAlign2.start(); timer48gpsAlign2.start();
setprop("/FMGC/internal/align2-time", pts.Sim.Time.elapsedSec.getValue()); FMGCAlignTime[1].setValue(pts.Sim.Time.elapsedSec.getValue());
} }
}, 0, 0); }, 0, 0);
@ -1178,9 +1209,9 @@ setlistener("/systems/navigation/adr/operating-3", func() {
timer48gpsAlign3.stop(); timer48gpsAlign3.stop();
} }
if (getprop("/FMGC/internal/align3-time") == -99) { if (FMGCAlignTime[2].getValue() == -99) {
timer48gpsAlign3.start(); timer48gpsAlign3.start();
setprop("/FMGC/internal/align3-time", pts.Sim.Time.elapsedSec.getValue()); FMGCAlignTime[2].setValue(pts.Sim.Time.elapsedSec.getValue());
} }
}, 0, 0); }, 0, 0);
@ -1227,25 +1258,25 @@ var timer30secLanding = maketimer(1, func() {
}); });
var timer48gpsAlign1 = maketimer(1, func() { var timer48gpsAlign1 = maketimer(1, func() {
if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/align1-time") + 48 or getprop("/systems/acconfig/options/adirs-skip")) { if (pts.Sim.Time.elapsedSec.getValue() > (FMGCAlignTime[0].getValue() + 48) or adirsSkip.getValue()) {
setprop("/FMGC/internal/align1-done", 1); FMGCAlignDone[0].setValue(1);
setprop("/FMGC/internal/align1-time", -99); FMGCAlignTime[0].setValue(-99);
timer48gpsAlign1.stop(); timer48gpsAlign1.stop();
} }
}); });
var timer48gpsAlign2 = maketimer(1, func() { var timer48gpsAlign2 = maketimer(1, func() {
if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/align2-time") + 48 or getprop("/systems/acconfig/options/adirs-skip")) { if (pts.Sim.Time.elapsedSec.getValue() > (FMGCAlignTime[1].getValue() + 48) or adirsSkip.getValue()) {
setprop("/FMGC/internal/align2-done", 1); FMGCAlignDone[1].setValue(1);
setprop("/FMGC/internal/align2-time", -99); FMGCAlignTime[1].setValue(-99);
timer48gpsAlign2.stop(); timer48gpsAlign2.stop();
} }
}); });
var timer48gpsAlign3 = maketimer(1, func() { var timer48gpsAlign3 = maketimer(1, func() {
if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/align3-time") + 48 or getprop("/systems/acconfig/options/adirs-skip")) { if (pts.Sim.Time.elapsedSec.getValue() > (FMGCAlignTime[2].getValue() + 48) or adirsSkip.getValue()) {
setprop("/FMGC/internal/align3-done", 1); FMGCAlignDone[2].setValue(1);
setprop("/FMGC/internal/align3-time", -99); FMGCAlignTime[2].setValue(-99);
timer48gpsAlign3.stop(); timer48gpsAlign3.stop();
} }
}); });

View file

@ -32,6 +32,8 @@ var flightPlanController = {
# These flags are only for the main flgiht-plan # These flags are only for the main flgiht-plan
active: props.globals.initNode("/FMGC/flightplan[2]/active", 0, "BOOL"), active: props.globals.initNode("/FMGC/flightplan[2]/active", 0, "BOOL"),
changed: props.globals.initNode("/FMGC/flightplan[2]/changed", 0, "BOOL"),
currentToWpt: nil, # container for the current TO waypoint ghost currentToWpt: nil, # container for the current TO waypoint ghost
currentToWptIndex: props.globals.initNode("/FMGC/flightplan[2]/current-wp", 0, "INT"), currentToWptIndex: props.globals.initNode("/FMGC/flightplan[2]/current-wp", 0, "INT"),
@ -765,6 +767,9 @@ var flightPlanController = {
fmgc.FMGCInternal.fuelCalculating = 1; fmgc.FMGCInternal.fuelCalculating = 1;
fmgc.fuelCalculating.setValue(1); fmgc.fuelCalculating.setValue(1);
} }
if (n == 2) flightPlanController.changed.setBoolValue(1);
canvas_nd.A3XXRouteDriver.triggerSignal("fp-added"); canvas_nd.A3XXRouteDriver.triggerSignal("fp-added");
}, },

View file

@ -22,7 +22,7 @@ var variousReset = func() {
setprop("/instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override", 0); setprop("/instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override", 0);
setprop("/controls/switches/cabinCall", 0); setprop("/controls/switches/cabinCall", 0);
setprop("/controls/switches/mechCall", 0); setprop("/controls/switches/mechCall", 0);
setprop("/controls/switches/emer-lights", 0.5); libraries.emerLtsSwitch.setValue(0.5);
# cockpit voice recorder stuff # cockpit voice recorder stuff
setprop("/controls/CVR/power", 0); setprop("/controls/CVR/power", 0);
setprop("/controls/CVR/test", 0); setprop("/controls/CVR/test", 0);
@ -60,9 +60,9 @@ var variousReset = func() {
setprop("/modes/fcu/hdg-time", -45); setprop("/modes/fcu/hdg-time", -45);
setprop("/controls/navigation/switching/att-hdg", 0); setprop("/controls/navigation/switching/att-hdg", 0);
setprop("/controls/navigation/switching/air-data", 0); setprop("/controls/navigation/switching/air-data", 0);
setprop("/controls/switches/no-smoking-sign", 0.0); libraries.noSmokingSwitch.setValue(0.0);
setprop("/controls/switches/seatbelt-sign", 0); libraries.seatbeltSwitch.setValue(0.0);
setprop("/controls/switches/emer-lights", 0); libraries.emerLtsSwitch.setValue(0.0);
} }
var BUTTONS = { var BUTTONS = {

View file

@ -139,6 +139,9 @@ var groundspeed = 0;
var stateL = 0; var stateL = 0;
var stateR = 0; var stateR = 0;
var seatbeltSwitch = props.globals.getNode("/controls/switches/seatbelt-sign");
var noSmokingSwitch = props.globals.getNode("/controls/switches/no-smoking-sign");
var emerLtsSwitch = props.globals.getNode("/controls/switches/emer-lights");
var seatbeltLight = props.globals.getNode("/controls/lighting/seatbelt-sign"); var seatbeltLight = props.globals.getNode("/controls/lighting/seatbelt-sign");
var noSmokingLight = props.globals.getNode("/controls/lighting/no-smoking-sign"); var noSmokingLight = props.globals.getNode("/controls/lighting/no-smoking-sign");
@ -247,8 +250,8 @@ setlistener("/instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit", func{
# Replay # Replay
var replayState = props.globals.getNode("/sim/replay/replay-state"); var replayState = props.globals.getNode("/sim/replay/replay-state");
setlistener("/sim/replay/replay-state", func() { setlistener(replayState, func(v) {
if (replayState.getBoolValue()) { if (v.getBoolValue()) {
} else { } else {
acconfig.colddark(); acconfig.colddark();
gui.popupTip("Replay Ended: Setting Cold and Dark state..."); gui.popupTip("Replay Ended: Setting Cold and Dark state...");

View file

@ -128,15 +128,16 @@ var doorR4_pos = props.globals.getNode("/sim/model/door-positions/doorr4/positio
# Detect OFF without IN # Detect OFF without IN
var lastgs0 = 0; var lastgs0 = 0;
#var lastgear0 = 0; var phase = 0;
var gs = 0;
var gear0 = 0;
var lastgsrestart = 0; var lastgsrestart = 0;
# Check for A/C state change - advice me for a better method, please :/ # Check for A/C state change - advice me for a better method, please :/
var waitingOOOIChange = maketimer(1, func(){ # 1sec precision var waitingOOOIChange = maketimer(1, func(){ # 1sec precision
phase = fmgc.FMGCInternal.phase;
var phase = fmgc.FMGCInternal.phase; gs = pts.Velocities.groundspeed.getValue();
var gs = pts.Velocities.groundspeedKt.getValue(); gear0 = pts.Gear.wow[0].getBoolValue();
var gear0 = pts.Gear.wow[0].getBoolValue();
#print(sprintf("OOOI check: %d %d %.2f %s",expectedOOOIState,phase,gs,gear0)); #print(sprintf("OOOI check: %d %d %.2f %s",expectedOOOIState,phase,gs,gear0));
@ -183,14 +184,14 @@ var waitingOOOIChange = maketimer(1, func(){ # 1sec precision
expectedOOOIState = 1; # go on to OFF state expectedOOOIState = 1; # go on to OFF state
} }
else if (gs > 9 and lastgsrestart == 0) { # try to detect OFF without IN else if (gs > 9 and lastgsrestart == 0) { # try to detect OFF without IN
lastgsrestart = int(getprop("/sim/time/elapsed-sec")); lastgsrestart = int(pts.Sim.Time.elapsedSec.getValue());
} }
} }
}); });
var engine_one_chk_OOOI = setlistener("/engines/engine[0]/state", func { var engine_one_chk_OOOI = setlistener("/engines/engine[0]/state", func {
if (getprop("/engines/engine[0]/state") == 3) { if (pts.Engines.Engine.state[0].getValue() == 3) {
removelistener(engine_one_chk_OOOI); removelistener(engine_one_chk_OOOI);
waitingOOOIChange.start(); waitingOOOIChange.start();
} }

View file

@ -279,7 +279,7 @@ var initInputA = func(key, i) {
} }
} }
} else if (key == "R2") { } else if (key == "R2") {
if (pts.Engines.Engine.state[0].getValue() != 3 and pts.Engines.Engine.state[1].getValue() != 3) { if (pts.Engines.Engine.state[0].getValue() != 3 and pts.Engines.Engine.state[1].getValue() != 3 and fmgc.FMGCInternal.toFromSet == 0) {
if (!ecam.vhf3_voice.active) { if (!ecam.vhf3_voice.active) {
if (atsu.ATSU.working) { if (atsu.ATSU.working) {
if (getprop("/FMGC/simbrief-username") == "") { if (getprop("/FMGC/simbrief-username") == "") {

View file

@ -91,9 +91,9 @@ var MCDU_reset = func(i) {
setprop("/FMGC/internal/align-ref-long-sign", ""); setprop("/FMGC/internal/align-ref-long-sign", "");
setprop("/FMGC/internal/align-ref-lat-edit", 0); setprop("/FMGC/internal/align-ref-lat-edit", 0);
setprop("/FMGC/internal/align-ref-long-edit", 0); setprop("/FMGC/internal/align-ref-long-edit", 0);
setprop("/FMGC/internal/align1-done", 0); fmgc.FMGCAlignDone[0].setValue(0);
setprop("/FMGC/internal/align2-done", 0); fmgc.FMGCAlignDone[1].setValue(0);
setprop("/FMGC/internal/align3-done", 0); fmgc.FMGCAlignDone[2].setValue(0);
# ROUTE SELECTION # ROUTE SELECTION
fmgc.FMGCInternal.altSelected = 0; fmgc.FMGCInternal.altSelected = 0;

View file

@ -22,7 +22,8 @@ It is highly reccomended to purchase a NAVIGRAPH subscription and download their
To install navdata, create a folder FMSDATA, and add it to your additional scenery folders, at the top of the list. Inside that folder, place all the XXXX.procedures.xml files, in the format FMSDATA/X/X/X/XXXX.procedures.xml. For instance, FMSDATA/Airports/E/G/K/EGKK.procedures.xml. To install navdata, create a folder FMSDATA, and add it to your additional scenery folders, at the top of the list. Inside that folder, place all the XXXX.procedures.xml files, in the format FMSDATA/X/X/X/XXXX.procedures.xml. For instance, FMSDATA/Airports/E/G/K/EGKK.procedures.xml.
## Remote MCDU ## Remote MCDU
If you want to run the MCDU on a phone or tablet for better realism and easier input, put mcdu.html into the FGDATA/Phi folder, run FlightGear with enabled HTTP server (i.e. command line --httpd=<Port; e.g. 8080>) and open http://<FlightGear Computer IP/Hostname; e.g. 127.0.0.1/localhost>:<Port; e.g. 8080>/mcdu.html in the browser on your phone or tablet. If you want to run the MCDU on a your smarthphone or tablet for better realism and easier input, run FlightGear with enabled HTTP server (i.e. command line --httpd=<Port; e.g. 8080>) then go to main menu -> Instruments -> Remote MCDU.
You can generate a QR-code to lauch directly on your smartphone/tablet, first insert your local ip. Your device must run on the same local network of your computer.
## Installation ## Installation
If you have issues installing, please check INSTALL.MD! If you have issues installing, please check INSTALL.MD!

View file

@ -922,6 +922,17 @@
<max>5000</max> <max>5000</max>
</clipto> </clipto>
</pure_gain> </pure_gain>
<fcs_function name="/instrumentation/radar-altimeter-difference-ft">
<function>
<abs>
<difference>
<property>/instrumentation/radar-altimeter[0]/radar-altitude-ft-corrected</property>
<property>/instrumentation/radar-altimeter[1]/radar-altitude-ft-corrected</property>
</difference>
</abs>
</function>
</fcs_function>
<switch name="/instrumentation/transponder/altimeter-input/mode-c-alt-ft"> <switch name="/instrumentation/transponder/altimeter-input/mode-c-alt-ft">
<test logic="AND" value="/instrumentation/altimeter[0]/mode-c-alt-ft"> <test logic="AND" value="/instrumentation/altimeter[0]/mode-c-alt-ft">

View file

@ -2212,7 +2212,7 @@
/ECAM/warnings/logic/stall/phase-flipflop eq 1 /ECAM/warnings/logic/stall/phase-flipflop eq 1
</test> </test>
</switch> </switch>
<switch name="/ECAM/warnings/logic/stall/stall-warn"> <switch name="/ECAM/warnings/logic/stall/stall-warn">
<default value="0"/> <default value="0"/>
<test logic="AND" value="1"> <test logic="AND" value="1">
@ -2301,7 +2301,41 @@
/ECAM/warnings/logic/stall/stall-warn-inhibit eq 0 /ECAM/warnings/logic/stall/stall-warn-inhibit eq 0
</test> </test>
</switch> </switch>
<switch name="/instrumentation/pfd/lights/autoland-armed">
<default value="0"/>
<test logic="OR" value="1">
<!-- /gear/gear[0]/wow eq 0 -->
<test logic="AND">
/modes/pfd/ILS1 eq 1
/instrumentation/radar-altimeter[0]/radar-altitude-ft-corrected le 200
</test>
<test logic="AND">
/modes/pfd/ILS2 eq 1
/instrumentation/radar-altimeter[1]/radar-altitude-ft-corrected le 200
</test>
<!-- /instrumentation/radar-altimeter[1]/radar-altitude-ft-corrected le 200 -->
</test>
</switch>
<switch name="/instrumentation/pfd/lights/autoland-on">
<default value="0"/>
<test logic="AND" value="1">
/instrumentation/pfd/lights/autoland-armed eq 1
<test logic="OR">
<test logic="AND">
/it-autoflight/output/ap1 eq 0
/it-autoflight/output/ap2 eq 0
</test>
/instrumentation/radar-altimeter-difference-ft gt 15
<!-- TODO
- Localizer deviation excessive
- Loss of localizer signal
-->
</test>
</test>
</switch>
</channel> </channel>
<channel name="ENG" execrate="16"> <channel name="ENG" execrate="16">

View file

@ -1,12 +1,17 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="en" translate="no">
<head> <head>
<title>MCDU</title> <title>A320 MCDU</title>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link rel="manifest" href="mcdu_manifest.json" />
<meta name="apple-mobile-web-app-status-bar" content="#db4938" />
<meta name="theme-color" content="#db4938" />
<script> <script>
let screen; let screen;
let screen_src; let screen_src;
let blank_src;
let loading = 0; let loading = 0;
let scheduled_load = 0; let scheduled_load = 0;
function refresh_screen() { function refresh_screen() {
@ -40,30 +45,50 @@
refresh_screen(); refresh_screen();
}, true); }, true);
} }
var preventzoomaction = function(e) { //https://exceptionshub.com/disable-double-tap-zoom-option-in-browser-on-touch-devices.html
var t2 = e.timeStamp;
var t1 = e.currentTarget.dataset.lastTouch || t2;
var dt = t2 - t1;
var fingers = e.touches.length;
e.currentTarget.dataset.lastTouch = t2;
if (!dt || dt > 500 || fingers > 1) return; // not double-tap
e.preventDefault();
e.target.click();
};
window.addEventListener('load', function () { window.addEventListener('load', function () {
let tds = document.querySelectorAll('.input td'); let tds = document.querySelectorAll('.input td');
for (const td of tds) { for (const td of tds) {
td.addEventListener('click', function () { td.addEventListener('click', function () {
if (td.className == "disabled") return;
press_button("button", td.textContent); press_button("button", td.textContent);
}, true); }, true);
td.addEventListener('touchstart', preventzoomaction, true);
} }
tds = document.querySelectorAll('.enter td'); tds = document.querySelectorAll('.enter td');
for (const td of tds) { for (const td of tds) {
td.addEventListener('click', function () { td.addEventListener('click', function () {
press_button(td.getAttribute("button-side") == "l" ? "lskbutton" : "rskbutton", td.getAttribute("button-id")); press_button(td.getAttribute("button-side") == "l" ? "lskbutton" : "rskbutton", td.getAttribute("button-id"));
}, true); }, true);
td.addEventListener('touchstart', preventzoomaction, true);
} }
tds = document.querySelectorAll('.menu td'); tds = document.querySelectorAll('.menu td');
for (const td of tds) { for (const td of tds) {
td.addEventListener('click', function () { td.addEventListener('click', function () {
press_button("pagebutton", td.className); press_button("pagebutton", td.className);
}, true); }, true);
td.addEventListener('touchstart', preventzoomaction, true);
} }
tds = document.querySelectorAll('.arrows td'); tds = document.querySelectorAll('.arrows td');
for (const td of tds) { for (const td of tds) {
td.addEventListener('click', function () { td.addEventListener('click', function () {
press_button(td.className == 'airport' ? "pagebutton" : "arrowbutton", td.className); press_button(td.className == 'airport' ? "pagebutton" : "arrowbutton", td.className);
}, true); }, true);
td.addEventListener('touchstart', preventzoomaction, true);
} }
screen = document.querySelector('img'); screen = document.querySelector('img');
screen.addEventListener('load', function () { screen.addEventListener('load', function () {
@ -73,8 +98,9 @@
refresh_screen(); refresh_screen();
} }
}); });
screen_src = screen.src; blank_src = screen_src;
window.setInterval(refresh_screen, 1000); screen_src = "/screenshot?canvasindex=10&type=png";
setInterval(refresh_screen, 1000);
}, true); }, true);
</script> </script>
<style> <style>
@ -89,12 +115,14 @@
table { table {
margin: 0; margin: 0;
padding: 0 padding: 0;
word-wrap: normal;
overflow-wrap: normal;
} }
tr { tr {
margin: 0; margin: 0;
padding: 0 padding: 0;
} }
td { td {
@ -102,23 +130,32 @@
padding: 0; padding: 0;
text-align: center; text-align: center;
outline: 1px solid gray; outline: 1px solid gray;
-ms-user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
-webkit-touch-callout: none;
-khtml-user-select: none;
user-select: none;
overflow: hidden;
text-overflow: clip;
} }
td:active { td:active {
background-color: white; background-color: white;
color: black color: black;
} }
.enter { .enter {
font-size: 60% font-size: 60%;
} }
.enter tr:first-child { .enter tr:first-child {
font-size: 70% font-size: 70%;
} }
.enter tr:last-child { .enter tr:last-child {
font-size: 50% font-size: 50%;
} }
.enter td:first-child, .enter td:first-child,
@ -148,11 +185,11 @@
</style> </style>
</head> </head>
<body style="width: 100%"> <body style="width: 100%" oncontextmenu="return false;">
<table class="enter" style="width: 100%"> <table class="enter" style="width: 100%">
<tr> <tr>
<td><br></td> <td><br></td>
<td rowspan="8" style="vertical-align: top"><img src="/screenshot?canvasindex=10&type=png" <td rowspan="8" style="vertical-align: top"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABAAAAANgAQMAAACIgIgUAAAAA1BMVEUAAACnej3aAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAgklEQVR42u3BAQEAAACCIP+vbkhAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7wazbwABRxu5owAAAABJRU5ErkJggg=="
style="width: 100%" /></td> style="width: 100%" /></td>
<td><br></td> <td><br></td>
</tr> </tr>
@ -245,7 +282,7 @@
<td>Z</td> <td>Z</td>
<td>/</td> <td>/</td>
<td style="font-size: 50%">SP</td> <td style="font-size: 50%">SP</td>
<td style="font-size: 33%">OVFY<br></td> <td style="font-size: 33%" class="disabled">OVFY<br></td>
<td style="font-size: 33%">CLR</td> <td style="font-size: 33%">CLR</td>
</tr> </tr>
</table> </table>
@ -283,11 +320,11 @@
<td>.</td> <td>.</td>
<td>0</td> <td>0</td>
<td <td
style="font-size: 3vw; width: 33.333333333333333333333333333333333333333333333333333333333333333333333%; /* :) */"> style="font-size: 3vw; width: 33.333333333333333333333333333333333333333333333333333333333333333333333%; /* :) */" class="disabled">
+/- +/-
</td> </td>
</tr> </tr>
</table> </table>
</body> </body>
</html> </html>

171
gui/dialogs/mcduweb.xml Normal file
View file

@ -0,0 +1,171 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Copyright (c) 2020 Josh Davidson (Octal450) -->
<!-- A3XX MCDU web launcher Dialog -->
<PropertyList>
<name>mcdu-web</name>
<layout>vbox</layout>
<pref-width>480</pref-width>
<nasal>
<open>
props.globals.initNode("/sim/http/mcduweb/local-ip", "", "STRING");
</open>
</nasal>
<group>
<layout>hbox</layout>
<text>
<halign>left</halign>
<label>Remote MCDU for browser/tablet/smartphone</label>
</text>
<button>
<halign>right</halign>
<pref-width>20</pref-width>
<pref-height>20</pref-height>
<legend>X</legend>
<key>Esc</key>
<binding>
<command>dialog-close</command>
</binding>
</button>
</group>
<hrule/>
<group>
<layout>vbox</layout>
<text>
<halign>left</halign>
<label>Please check: HTTP service running is required.</label>
<visible>
<equals>
<property>/sim/http/running</property>
<value>0</value>
</equals>
</visible>
</text>
<text>
<halign>left</halign>
<label>Start FlightGear with -httpd=8080</label>
<visible>
<equals>
<property>/sim/http/running</property>
<value>0</value>
</equals>
</visible>
</text>
</group>
<group>
<layout>vbox</layout>
<text>
<halign>center</halign>
<label>Open MCDU on browser</label>
</text>
<button>
<halign>center</halign>
<legend>launch browser</legend>
<binding>
<command>nasal</command>
<script>
var n = getprop("/sim/http/running",0);
if( n != 1 ) {
gui.popupTip("Internal webserver not running. Restart FlightGear with -httpd=8080", 5.0);
} else {
var _url = "http://localhost:" ~ getprop("/sim/http/options/listening-port") ~ "/aircraft-dir/WebPanel/mcdu.html";
fgcommand("open-browser", props.Node.new({ "url": _url }));
}
</script>
</binding>
</button>
</group>
<group>
<layout>vbox</layout>
<text>
<halign>center</halign>
<label></label>
</text>
<text>
<halign>center</halign>
<label>Scan QR code with your smartphone or tablet</label>
</text>
</group>
<group>
<layout>hbox</layout>
<input>
<width>220</width>
<height>25</height>
<padding>5</padding>
<label>Local IP</label>
<property>/sim/http/mcduweb/local-ip</property>
<binding>
<command>dialog-apply</command>
</binding>
<live type="bool">true</live>
</input>
<button>
<legend>get qrcode</legend>
<pref-height>25</pref-height>
<pref-width>180</pref-width>
<padding>5</padding>
<binding>
<command>nasal</command>
<script>
var _url = "";
if (size(getprop("/sim/http/mcduweb/local-ip"))>6) {
if ( getprop("sim/http/running",0) == 1 ) _url = "http://" ~ getprop("/sim/http/mcduweb/local-ip") ~ ":" ~ getprop("/sim/http/options/listening-port") ~ "/aircraft-dir/WebPanel/mcdu.html";
root.createChild("image").set("src", "https://qr.eletto.dev/" ~ _url).setSize(300,300).setTranslation(10,10);
}
</script>
</binding>
</button>
</group>
<canvas>
<name>mcduwebqr</name>
<valign>center</valign>
<halign>center</halign>
<stretch>false</stretch>
<pref-width>320</pref-width>
<pref-height>320</pref-height>
<nasal>
<load>
<![CDATA[
var n = props.globals.getNode("/sim/http/running");
var mcdu_canvas_dlg = canvas.get(cmdarg());
var root = mcdu_canvas_dlg.createGroup();
mcdu_canvas_dlg.setColorBackground(1, 1, 1, 1);
]]>
</load>
<unload>
<![CDATA[
mcdu_canvas_dlg.del();
mcdu_canvas_dlg = nil;
root = nil;
]]>
</unload>
</nasal>
</canvas>
<group>
<layout>vbox</layout>
<text>
<halign>center</halign>
<label>* QRCode provided by https://qr.eletto.dev/</label>
</text>
</group>
</PropertyList>