1
0
Fork 0

Merge branch 'rework' of https://github.com/inuyaksa/A320-family into inuyaksa-rework

This commit is contained in:
legoboyvdlp R 2021-06-13 18:48:13 +01:00
commit a702a2b4db
12 changed files with 479 additions and 111 deletions

View file

@ -457,6 +457,16 @@
]]></script>
</binding>
</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 n="105">
<label>Utilities</label>

View file

@ -1206,7 +1206,7 @@
<object-name>audio_call_vhf2_led</object-name>
<object-name>audio_call_vhf3_led</object-name>
<object-name>audio_mech_sgn</object-name>
<object-name>autoland_light_on</object-name>
<!-- <object-name>autoland_light_on</object-name> -->
<object-name>ecam_c_b_led</object-name>
<object-name>ecam_el_dc_led</object-name>
<object-name>ecam_sts_led</object-name>
@ -6158,6 +6158,29 @@
</emission>
</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 -->
<animation>
<type>select</type>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 98 KiB

View file

@ -164,6 +164,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 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 = {
init: func(canvas_group, file) {
var font_mapper = func(family, weight) {

View file

@ -16,7 +16,7 @@ var dep = "";
var arr = "";
var n1_left = 0;
var n1_right = 0;
var modelat = 0;
var modelat = "";
var mode = 0;
var gs = 0;
var cruiseft = 0;
@ -69,8 +69,8 @@ setprop("position/gear-agl-ft", 0);
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/output/fma-pwr", 0);
setprop("/instrumentation/nav[0]/nav-id", "XXX");
setprop("/instrumentation/nav[1]/nav-id", "XXX");
setprop("instrumentation/nav[0]/nav-id", "XXX");
setprop("instrumentation/nav[1]/nav-id", "XXX");
setprop("/FMGC/internal/ils1-mcdu", "XXX/999.99");
setprop("/FMGC/internal/ils2-mcdu", "XXX/999.99");
setprop("/FMGC/internal/vor1-mcdu", "XXX/999.99");
@ -89,6 +89,7 @@ var FMGCinit = func {
FMGCInternal.minspeed = 0;
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
FMGCNodes.phase.setValue(0);
FMGCInternal.mngSpd = 157;
FMGCInternal.mngSpdCmd = 157;
FMGCInternal.mngKtsMach = 0;
@ -96,9 +97,9 @@ var FMGCinit = func {
setprop("/FMGC/internal/loc-source", "NAV0");
setprop("/FMGC/internal/optalt", 0);
setprop("/FMGC/internal/landing-time", -99);
FMGCAlignTime[0].setValue(-99);
FMGCAlignTime[1].setValue(-99);
FMGCAlignTime[2].setValue(-99);
setprop("/FMGC/internal/align1-time", -99);
setprop("/FMGC/internal/align2-time", -99);
setprop("/FMGC/internal/align3-time", -99);
setprop("/FMGC/internal/block-fuel-time", -99);
setprop("/FMGC/internal/fuel-pred-time", -99);
masterFMGC.start();
@ -262,6 +263,7 @@ var FMGCNodes = {
toState: props.globals.initNode("/FMGC/internal/to-state", 0, "BOOL"),
v1: props.globals.initNode("/FMGC/internal/v1", 0, "DOUBLE"),
v1set: props.globals.initNode("/FMGC/internal/v1-set", 0, "BOOL"),
phase: props.globals.initNode("/FMGC/internal/phase", 0, "INT"),
};
############
@ -606,79 +608,129 @@ var radios = maketimer(1, func() {
adf1();
});
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 = pts.Engines.Engine.n1Actual[0].getValue();
n1_right = pts.Engines.Engine.n1Actual[1].getValue();
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 = pts.Velocities.groundspeed.getValue();
alt = pts.Instrumentation.Altimeter.indicatedFt.getValue();
gs = prop_gs.getValue();
alt = prop_alt.getValue();
# cruiseft = FMGCInternal.crzFt;
# cruiseft_b = FMGCInternal.crzFt - 200;
state1 = pts.Systems.Thrust.state[0].getValue();
state2 = pts.Systems.Thrust.state[1].getValue();
state1 = prop_state1.getValue();
state2 = prop_state2.getValue();
accel_agl_ft = Setting.reducAglFt.getValue();
gear0 = pts.Gear.wow[0].getBoolValue();
gear0 = prop_gear0.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;
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");
}
if (gear0 and FMGCInternal.phase == 0 and ((n1_left >= 85 and n1_right >= 85 and mode == "SRS") or gs >= 90)) {
FMGCInternal.phase = 1;
}
else if (((mode != "SRS" and mode != " ") or alt >= accel_agl_ft)) {
newphase = 2;
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;
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 (FMGCInternal.phase == 3 and (flightPlanController.arrivalDist <= 200 or altSel < 20000)) {
FMGCInternal.phase = 4;
if ((flightPlanController.arrivalDist <= 200 or altSel < 20000)) {
newphase = 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;
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");
}
}
if (FMGCInternal.phase == 4) {
}
else if (phase == 4) {
if (getprop("/FMGC/internal/decel")) {
FMGCInternal.phase = 5;
newphase = 5;
}
else if (altSel == (FMGCInternal.crzFl * 100)) { # back to CRZ state
FMGCInternal.phase = 3;
newphase = 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);
}
else if (phase == 5) {
if ((FMGCInternal.phase == 5) and state1 == "TOGA" and state2 == "TOGA") {
FMGCInternal.phase = 6;
if (state1 == "TOGA" and state2 == "TOGA") {
newphase = 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;
}
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);
}
tempOverspeed = systems.ADIRS.overspeedVFE.getValue();
if (tempOverspeed != 1024) {
FMGCInternal.maxspeed = tempOverspeed - 4;
@ -688,6 +740,13 @@ var masterFMGC = maketimer(0.2, func {
FMGCInternal.maxspeed = fmgc.FMGCInternal.vmo_mmo;
}
if (newphase != phase) { # phase changed
FMGCInternal.phase = newphase;
FMGCNodes.phase.setValue(newphase);
}
############################
# fuel
############################
@ -777,7 +836,7 @@ var masterFMGC = maketimer(0.2, func {
}
# predicted takeoff speeds
if (FMGCInternal.phase == 1) {
if (phase == 1) {
FMGCInternal.clean_to = FMGCInternal.clean;
FMGCInternal.vs1g_clean_to = FMGCInternal.vs1g_clean;
FMGCInternal.vs1g_conf_2_to = FMGCInternal.vs1g_conf_2;
@ -799,7 +858,7 @@ var masterFMGC = maketimer(0.2, func {
}
# predicted approach (temp go-around) speeds
if (FMGCInternal.phase == 5 or FMGCInternal.phase == 6) {
if (phase == 5 or phase == 6) {
FMGCInternal.clean_appr = FMGCInternal.clean;
FMGCInternal.vs1g_clean_appr = FMGCInternal.vs1g_clean;
FMGCInternal.vs1g_conf_2_appr = FMGCInternal.vs1g_conf_2;
@ -920,7 +979,8 @@ 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) {
fmgc.FMGCNodes.toState.setValue(1);
}
@ -932,45 +992,58 @@ var masterFMGC = maketimer(0.2, func {
FMGCInternal.takeoffState = 0;
}
});
############################
#handle radios, runways, v1/vr/v2
############################
var updateAirportRadios = func {
var phase = FMGCInternal.phase;
print("# Update airport radios");
departure_rwy = fmgc.flightPlanController.flightplans[2].departure_runway;
destination_rwy = fmgc.flightPlanController.flightplans[2].destination_runway;
if (destination_rwy != nil and FMGCInternal.phase >= 2) {
if (phase >= 2 and destination_rwy != nil) {
var airport = airportinfo(FMGCInternal.arrApt);
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"));
runway_ils = destination_rwy.ils_frequency_mhz;
if (runway_ils != nil and !getprop("/FMGC/internal/ils1freq-set") and !getprop("/FMGC/internal/ils1crs-set")) {
setprop("/FMGC/internal/ils1freq-calculated", runway_ils);
setprop("/instrumentation/nav[0]/frequencies/selected-mhz", runway_ils);
setprop("/instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
setprop("instrumentation/nav[0]/frequencies/selected-mhz", runway_ils);
setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
} else if (runway_ils != nil and !getprop("/FMGC/internal/ils1freq-set")) {
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")) {
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) {
} else if (phase <= 1 and departure_rwy != nil) {
magnetic_hdg = geo.normdeg(departure_rwy.heading - getprop("/environment/magnetic-variation-deg"));
runway_ils = departure_rwy.ils_frequency_mhz;
if (runway_ils != nil and !getprop("/FMGC/internal/ils1freq-set") and !getprop("/FMGC/internal/ils1crs-set")) {
setprop("/FMGC/internal/ils1freq-calculated", runway_ils);
setprop("/instrumentation/nav[0]/frequencies/selected-mhz", runway_ils);
setprop("/instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
setprop("instrumentation/nav[0]/frequencies/selected-mhz", runway_ils);
setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
} else if (runway_ils != nil and !getprop("/FMGC/internal/ils1freq-set")) {
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")) {
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);
var reset_FMGC = func {
FMGCInternal.phase = 0;
FMGCNodes.phase.setValue(0);
fd1 = Input.fd1.getValue();
fd2 = Input.fd2.getValue();
spd = Input.kts.getValue();
@ -1162,9 +1235,9 @@ setlistener("/systems/navigation/adr/operating-1", func() {
timer48gpsAlign1.stop();
}
if (FMGCAlignTime[0].getValue() == -99) {
if (getprop("/FMGC/internal/align1-time") == -99) {
timer48gpsAlign1.start();
FMGCAlignTime[0].setValue(pts.Sim.Time.elapsedSec.getValue());
setprop("/FMGC/internal/align1-time", pts.Sim.Time.elapsedSec.getValue());
}
}, 0, 0);
@ -1174,9 +1247,9 @@ setlistener("/systems/navigation/adr/operating-2", func() {
timer48gpsAlign2.stop();
}
if (FMGCAlignTime[1].getValue() == -99) {
if (getprop("/FMGC/internal/align2-time") == -99) {
timer48gpsAlign2.start();
FMGCAlignTime[1].setValue(pts.Sim.Time.elapsedSec.getValue());
setprop("/FMGC/internal/align2-time", pts.Sim.Time.elapsedSec.getValue());
}
}, 0, 0);
@ -1186,9 +1259,9 @@ setlistener("/systems/navigation/adr/operating-3", func() {
timer48gpsAlign3.stop();
}
if (FMGCAlignTime[2].getValue() == -99) {
if (getprop("/FMGC/internal/align3-time") == -99) {
timer48gpsAlign3.start();
FMGCAlignTime[2].setValue(pts.Sim.Time.elapsedSec.getValue());
setprop("/FMGC/internal/align3-time", pts.Sim.Time.elapsedSec.getValue());
}
}, 0, 0);
@ -1235,25 +1308,25 @@ var timer30secLanding = maketimer(1, func() {
});
var timer48gpsAlign1 = maketimer(1, func() {
if (pts.Sim.Time.elapsedSec.getValue() > (FMGCAlignTime[0].getValue() + 48) or adirsSkip.getValue()) {
FMGCAlignDone[0].setValue(1);
FMGCAlignTime[0].setValue(-99);
if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/align1-time") + 48 or getprop("/systems/acconfig/options/adirs-skip")) {
setprop("/FMGC/internal/align1-done", 1);
setprop("/FMGC/internal/align1-time", -99);
timer48gpsAlign1.stop();
}
});
var timer48gpsAlign2 = maketimer(1, func() {
if (pts.Sim.Time.elapsedSec.getValue() > (FMGCAlignTime[1].getValue() + 48) or adirsSkip.getValue()) {
FMGCAlignDone[1].setValue(1);
FMGCAlignTime[1].setValue(-99);
if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/align2-time") + 48 or getprop("/systems/acconfig/options/adirs-skip")) {
setprop("/FMGC/internal/align2-done", 1);
setprop("/FMGC/internal/align2-time", -99);
timer48gpsAlign2.stop();
}
});
var timer48gpsAlign3 = maketimer(1, func() {
if (pts.Sim.Time.elapsedSec.getValue() > (FMGCAlignTime[2].getValue() + 48) or adirsSkip.getValue()) {
FMGCAlignDone[2].setValue(1);
FMGCAlignTime[2].setValue(-99);
if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/align3-time") + 48 or getprop("/systems/acconfig/options/adirs-skip")) {
setprop("/FMGC/internal/align3-done", 1);
setprop("/FMGC/internal/align3-time", -99);
timer48gpsAlign3.stop();
}
});

View file

@ -33,6 +33,8 @@ var flightPlanController = {
# These flags are only for the main flgiht-plan
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
currentToWptIndex: props.globals.initNode("/FMGC/flightplan[2]/current-wp", 0, "INT"),
currentToWptIndexTemp: 0,
@ -765,6 +767,9 @@ var flightPlanController = {
fmgc.FMGCInternal.fuelCalculating = 1;
fmgc.fuelCalculating.setValue(1);
}
if (n == 2) flightPlanController.changed.setBoolValue(1);
canvas_nd.A3XXRouteDriver.triggerSignal("fp-added");
},

View file

@ -253,8 +253,8 @@ setlistener("/instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit", func{
# Replay
var replayState = props.globals.getNode("/sim/replay/replay-state");
setlistener("/sim/replay/replay-state", func() {
if (replayState.getBoolValue()) {
setlistener(replayState, func(v) {
if (v.getBoolValue()) {
} else {
acconfig.colddark();
gui.popupTip("Replay Ended: Setting Cold and Dark state...");

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.
## 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
If you have issues installing, please check INSTALL.MD!

View file

@ -923,6 +923,17 @@
</clipto>
</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">
<test logic="AND" value="/instrumentation/altimeter[0]/mode-c-alt-ft">
/instrumentation/transponder/altimeter-input-src eq 1

View file

@ -2301,6 +2301,40 @@
</test>
</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 name="ENG" execrate="16">

View file

@ -1,12 +1,17 @@
<!DOCTYPE html>
<html>
<html lang="en" translate="no">
<head>
<title>MCDU</title>
<title>A320 MCDU</title>
<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>
let screen;
let screen_src;
let blank_src;
let loading = 0;
let scheduled_load = 0;
function refresh_screen() {
@ -40,30 +45,50 @@
refresh_screen();
}, 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 () {
let tds = document.querySelectorAll('.input td');
for (const td of tds) {
td.addEventListener('click', function () {
if (td.className == "disabled") return;
press_button("button", td.textContent);
}, true);
td.addEventListener('touchstart', preventzoomaction, true);
}
tds = document.querySelectorAll('.enter td');
for (const td of tds) {
td.addEventListener('click', function () {
press_button(td.getAttribute("button-side") == "l" ? "lskbutton" : "rskbutton", td.getAttribute("button-id"));
}, true);
td.addEventListener('touchstart', preventzoomaction, true);
}
tds = document.querySelectorAll('.menu td');
for (const td of tds) {
td.addEventListener('click', function () {
press_button("pagebutton", td.className);
}, true);
td.addEventListener('touchstart', preventzoomaction, true);
}
tds = document.querySelectorAll('.arrows td');
for (const td of tds) {
td.addEventListener('click', function () {
press_button(td.className == 'airport' ? "pagebutton" : "arrowbutton", td.className);
}, true);
td.addEventListener('touchstart', preventzoomaction, true);
}
screen = document.querySelector('img');
screen.addEventListener('load', function () {
@ -73,8 +98,9 @@
refresh_screen();
}
});
screen_src = screen.src;
window.setInterval(refresh_screen, 1000);
blank_src = screen_src;
screen_src = "/screenshot?canvasindex=10&type=png";
setInterval(refresh_screen, 1000);
}, true);
</script>
<style>
@ -89,12 +115,14 @@
table {
margin: 0;
padding: 0
padding: 0;
word-wrap: normal;
overflow-wrap: normal;
}
tr {
margin: 0;
padding: 0
padding: 0;
}
td {
@ -102,23 +130,32 @@
padding: 0;
text-align: center;
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 {
background-color: white;
color: black
color: black;
}
.enter {
font-size: 60%
font-size: 60%;
}
.enter tr:first-child {
font-size: 70%
font-size: 70%;
}
.enter tr:last-child {
font-size: 50%
font-size: 50%;
}
.enter td:first-child,
@ -148,11 +185,11 @@
</style>
</head>
<body style="width: 100%">
<body style="width: 100%" oncontextmenu="return false;">
<table class="enter" style="width: 100%">
<tr>
<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>
<td><br></td>
</tr>
@ -245,7 +282,7 @@
<td>Z</td>
<td>/</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>
</tr>
</table>
@ -283,7 +320,7 @@
<td>.</td>
<td>0</td>
<td
style="font-size: 3vw; width: 33.333333333333333333333333333333333333333333333333333333333333333333333%; /* :) */">
style="font-size: 3vw; width: 33.333333333333333333333333333333333333333333333333333333333333333333333%; /* :) */" class="disabled">
+/-
</td>
</tr>

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>