2016-11-05 03:39:28 +00:00
|
|
|
# This file converts the IT-AUTOFLIGHT Mode numbers, and converts them into text strings for the Airbus Style PFD.
|
|
|
|
# Joshua Davidson (it0uchpods/411)
|
|
|
|
|
|
|
|
# Speed or Mach?
|
|
|
|
var speedmach = func {
|
2016-12-05 20:20:56 +00:00
|
|
|
if (getprop("/it-autoflight/output/vert") == 4) {
|
2016-11-05 03:39:28 +00:00
|
|
|
# Do nothing because it's in FLCH mode.
|
|
|
|
} else {
|
2016-12-05 20:20:56 +00:00
|
|
|
if (getprop("/it-autoflight/input/kts-mach") == 0) {
|
2016-11-05 03:39:28 +00:00
|
|
|
setprop("/modes/pfd/fma/throttle-mode", "SPEED");
|
2016-12-05 20:20:56 +00:00
|
|
|
} else if (getprop("/it-autoflight/input/kts-mach") == 1) {
|
2016-11-05 03:39:28 +00:00
|
|
|
setprop("/modes/pfd/fma/throttle-mode", "MACH");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Update Speed or Mach
|
2016-12-05 20:20:56 +00:00
|
|
|
setlistener("/it-autoflight/input/kts-mach", func {
|
2016-11-05 03:39:28 +00:00
|
|
|
speedmach();
|
|
|
|
});
|
|
|
|
|
|
|
|
# Master Thrust
|
2016-12-05 20:20:56 +00:00
|
|
|
setlistener("/it-autoflight/output/thr-mode", func {
|
|
|
|
var thr = getprop("/it-autoflight/output/thr-mode");
|
|
|
|
if (thr == 0) {
|
2016-11-05 03:39:28 +00:00
|
|
|
speedmach();
|
2016-12-05 20:20:56 +00:00
|
|
|
} else if (thr == 1) {
|
2016-11-05 03:39:28 +00:00
|
|
|
setprop("/modes/pfd/fma/throttle-mode", "THR IDLE");
|
2016-12-05 20:20:56 +00:00
|
|
|
} else if (thr == 2) {
|
2016-11-05 03:39:28 +00:00
|
|
|
setprop("/modes/pfd/fma/throttle-mode", "THR CLB");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
# Master Lateral
|
2016-12-05 20:20:56 +00:00
|
|
|
setlistener("/it-autoflight/mode/lat", func {
|
|
|
|
var lat = getprop("/it-autoflight/mode/lat");
|
|
|
|
if (lat == "HDG") {
|
2016-11-05 03:39:28 +00:00
|
|
|
setprop("/modes/pfd/fma/roll-mode", "HDG");
|
2016-12-05 20:20:56 +00:00
|
|
|
} else if (lat == "LNAV") {
|
2016-11-05 03:39:28 +00:00
|
|
|
setprop("/modes/pfd/fma/roll-mode", "NAV");
|
2016-12-05 20:20:56 +00:00
|
|
|
} else if (lat == "LOC") {
|
2016-11-05 03:39:28 +00:00
|
|
|
setprop("/modes/pfd/fma/roll-mode", "LOC");
|
2016-12-05 20:20:56 +00:00
|
|
|
} else if (lat == "ALGN") {
|
|
|
|
setprop("/modes/pfd/fma/roll-mode", "ALN");
|
2016-11-05 03:39:28 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
# Master Vertical
|
2016-12-05 20:20:56 +00:00
|
|
|
setlistener("/it-autoflight/mode/vert", func {
|
|
|
|
var vert = getprop("/it-autoflight/mode/vert");
|
|
|
|
if (vert == "ALT HLD") {
|
2016-11-05 03:39:28 +00:00
|
|
|
setprop("/modes/pfd/fma/pitch-mode", "ALT HLD");
|
2016-12-05 20:20:56 +00:00
|
|
|
} else if (vert == "ALT CAP") {
|
|
|
|
setprop("/modes/pfd/fma/pitch-mode", "ALT CAP");
|
|
|
|
} else if (vert == "V/S") {
|
2016-11-05 03:39:28 +00:00
|
|
|
setprop("/modes/pfd/fma/pitch-mode", "V/S");
|
2016-12-05 20:20:56 +00:00
|
|
|
} else if (vert == "G/S") {
|
2016-11-05 03:39:28 +00:00
|
|
|
setprop("/modes/pfd/fma/pitch-mode", "G/S");
|
2016-12-05 20:20:56 +00:00
|
|
|
} else if (vert == "SPD CLB") {
|
|
|
|
setprop("/modes/pfd/fma/pitch-mode", "OP CLB");
|
|
|
|
} else if (vert == "SPD DES") {
|
|
|
|
setprop("/modes/pfd/fma/pitch-mode", "OP DES");
|
|
|
|
} else if (vert == "LAND 3") {
|
2016-11-05 03:39:28 +00:00
|
|
|
setprop("/modes/pfd/fma/pitch-mode", "LAND");
|
2016-12-05 20:20:56 +00:00
|
|
|
} else if (vert == "FLARE") {
|
|
|
|
setprop("/modes/pfd/fma/pitch-mode", "FLARE");
|
2016-11-05 03:39:28 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
# Arm LOC
|
2016-12-05 20:20:56 +00:00
|
|
|
setlistener("/it-autoflight/output/loc-armed", func {
|
|
|
|
var loca = getprop("/it-autoflight/output/loc-armed");
|
2016-11-05 03:39:28 +00:00
|
|
|
if (loca) {
|
|
|
|
setprop("/modes/pfd/fma/roll-mode-armed", "LOC");
|
|
|
|
} else {
|
|
|
|
setprop("/modes/pfd/fma/roll-mode-armed", " ");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
# Arm G/S
|
2016-12-05 20:20:56 +00:00
|
|
|
setlistener("/it-autoflight/output/appr-armed", func {
|
|
|
|
var appa = getprop("/it-autoflight/output/appr-armed");
|
2016-11-05 03:39:28 +00:00
|
|
|
if (appa) {
|
|
|
|
setprop("/modes/pfd/fma/pitch-mode-armed", "G/S");
|
|
|
|
} else {
|
|
|
|
setprop("/modes/pfd/fma/pitch-mode-armed", " ");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
# AP
|
|
|
|
var ap = func {
|
2016-12-05 20:20:56 +00:00
|
|
|
var ap1 = getprop("/it-autoflight/output/ap1");
|
|
|
|
var ap2 = getprop("/it-autoflight/output/ap2");
|
2016-11-05 03:39:28 +00:00
|
|
|
if (ap1 and ap2) {
|
|
|
|
setprop("/modes/pfd/fma/ap-mode", "AP1+2");
|
|
|
|
} else if (ap1 and !ap2) {
|
|
|
|
setprop("/modes/pfd/fma/ap-mode", "AP1");
|
|
|
|
} else if (ap2 and !ap1) {
|
|
|
|
setprop("/modes/pfd/fma/ap-mode", "AP2");
|
|
|
|
} else {
|
|
|
|
setprop("/modes/pfd/fma/ap-mode", " ");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# FD
|
|
|
|
var fd = func {
|
2016-12-05 20:20:56 +00:00
|
|
|
var fd1 = getprop("/it-autoflight/output/fd1");
|
|
|
|
var fd2 = getprop("/it-autoflight/output/fd2");
|
2016-11-05 03:39:28 +00:00
|
|
|
if (fd1 and fd2) {
|
|
|
|
setprop("/modes/pfd/fma/fd-mode", "1FD2");
|
|
|
|
} else if (fd1 and !fd2) {
|
|
|
|
setprop("/modes/pfd/fma/fd-mode", "FD1");
|
|
|
|
} else if (fd2 and !fd1) {
|
|
|
|
setprop("/modes/pfd/fma/fd-mode", "FD2");
|
|
|
|
} else {
|
|
|
|
setprop("/modes/pfd/fma/fd-mode", " ");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# AT
|
|
|
|
var at = func {
|
2016-12-05 20:20:56 +00:00
|
|
|
var at = getprop("/it-autoflight/output/athr");
|
2016-11-05 03:39:28 +00:00
|
|
|
if (at) {
|
|
|
|
setprop("/modes/pfd/fma/at-mode", "A/THR");
|
|
|
|
} else {
|
|
|
|
setprop("/modes/pfd/fma/at-mode", " ");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-05 20:20:56 +00:00
|
|
|
# Update AP FD ATHR
|
|
|
|
setlistener("/it-autoflight/output/ap1", func {
|
2016-11-05 03:39:28 +00:00
|
|
|
ap();
|
|
|
|
});
|
2016-12-05 20:20:56 +00:00
|
|
|
setlistener("/it-autoflight/output/ap2", func {
|
2016-11-05 03:39:28 +00:00
|
|
|
ap();
|
|
|
|
});
|
2016-12-05 20:20:56 +00:00
|
|
|
setlistener("/it-autoflight/output/fd1", func {
|
2016-11-05 03:39:28 +00:00
|
|
|
fd();
|
|
|
|
});
|
2016-12-05 20:20:56 +00:00
|
|
|
setlistener("/it-autoflight/output/fd2", func {
|
2016-11-05 03:39:28 +00:00
|
|
|
fd();
|
|
|
|
});
|
2016-12-05 20:20:56 +00:00
|
|
|
setlistener("/it-autoflight/output/athr", func {
|
2016-11-05 03:39:28 +00:00
|
|
|
at();
|
|
|
|
});
|
|
|
|
|