FMGC: Begin to merge in new 4.0.5 and 4.0.6 updates redo FMA calling etc... incomplete and does not fly yet
This commit is contained in:
parent
b4fee1995b
commit
756fec2762
5 changed files with 319 additions and 349 deletions
|
@ -564,7 +564,7 @@ var canvas_PFD_base = {
|
||||||
} else {
|
} else {
|
||||||
me["FMA_pitch_box"].hide();
|
me["FMA_pitch_box"].hide();
|
||||||
}
|
}
|
||||||
if (pitch_mode_armed_act == " " and pitch_mode2_armed_act == " ") {
|
if (pitch_mode_armed_act == "" and pitch_mode2_armed_act == "") {
|
||||||
me["FMA_pitcharm_box"].hide();
|
me["FMA_pitcharm_box"].hide();
|
||||||
} else {
|
} else {
|
||||||
if ((pitch_mode_armed_box.getValue() == 1 or pitch_mode2_armed_box.getValue() == 1) and (ap1.getValue() == 1 or ap2.getValue() == 1 or fd1.getValue() == 1 or fd2.getValue() == 1)) {
|
if ((pitch_mode_armed_box.getValue() == 1 or pitch_mode2_armed_box.getValue() == 1) and (ap1.getValue() == 1 or ap2.getValue() == 1 or fd1.getValue() == 1 or fd2.getValue() == 1)) {
|
||||||
|
|
|
@ -323,12 +323,12 @@ var FCUController = {
|
||||||
if (latMode.getValue() == 2) {
|
if (latMode.getValue() == 2) {
|
||||||
latModeInput.setValue(0);
|
latModeInput.setValue(0);
|
||||||
} else {
|
} else {
|
||||||
fmgc.ITAF.disarmLOC();
|
fmgc.ITAF.disarmLoc();
|
||||||
}
|
}
|
||||||
if (vertTemp == 2 or vertTemp == 6) {
|
if (vertTemp == 2 or vertTemp == 6) {
|
||||||
me.VSPull();
|
me.VSPull();
|
||||||
} else {
|
} else {
|
||||||
fmgc.ITAF.disarmGS();
|
fmgc.ITAF.disarmAppr();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (pts.Position.gearAglFt.getValue() >= 400 and vertTemp != 7) {
|
if (pts.Position.gearAglFt.getValue() >= 400 and vertTemp != 7) {
|
||||||
|
@ -336,7 +336,7 @@ var FCUController = {
|
||||||
if (vertTemp == 2 or vertTemp == 6) {
|
if (vertTemp == 2 or vertTemp == 6) {
|
||||||
me.VSPull();
|
me.VSPull();
|
||||||
} else {
|
} else {
|
||||||
fmgc.ITAF.disarmGS();
|
fmgc.ITAF.disarmAppr();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -461,12 +461,12 @@ var FCUController = {
|
||||||
if (latMode.getValue() == 2) {
|
if (latMode.getValue() == 2) {
|
||||||
latModeInput.setValue(0);
|
latModeInput.setValue(0);
|
||||||
} else {
|
} else {
|
||||||
fmgc.ITAF.disarmLOC();
|
fmgc.ITAF.disarmLoc();
|
||||||
}
|
}
|
||||||
if (vertTemp == 2 or vertTemp == 6) {
|
if (vertTemp == 2 or vertTemp == 6) {
|
||||||
me.VSPull();
|
me.VSPull();
|
||||||
} else {
|
} else {
|
||||||
fmgc.ITAF.disarmGS();
|
fmgc.ITAF.disarmAppr();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (pts.Position.gearAglFt.getValue() >= 400 and vertTemp != 7) {
|
if (pts.Position.gearAglFt.getValue() >= 400 and vertTemp != 7) {
|
||||||
|
|
|
@ -75,14 +75,19 @@ var Velocities = {
|
||||||
};
|
};
|
||||||
|
|
||||||
# IT-AUTOFLIGHT
|
# IT-AUTOFLIGHT
|
||||||
|
var Fd = {
|
||||||
|
pitchBar: props.globals.initNode("/it-autoflight/fd/pitch-bar", 0, "DOUBLE"),
|
||||||
|
rollBar: props.globals.initNode("/it-autoflight/fd/roll-bar", 0, "DOUBLE"),
|
||||||
|
};
|
||||||
|
|
||||||
var Input = {
|
var Input = {
|
||||||
alt: props.globals.initNode("/it-autoflight/input/alt", 10000, "INT"),
|
alt: props.globals.initNode("/it-autoflight/input/alt", 10000, "INT"),
|
||||||
ap1: props.globals.initNode("/it-autoflight/input/ap1", 0, "BOOL"),
|
ap1: props.globals.initNode("/it-autoflight/input/ap1", 0, "BOOL"),
|
||||||
ap2: props.globals.initNode("/it-autoflight/input/ap2", 0, "BOOL"),
|
ap2: props.globals.initNode("/it-autoflight/input/ap2", 0, "BOOL"),
|
||||||
athr: props.globals.initNode("/it-autoflight/input/athr", 0, "BOOL"),
|
athr: props.globals.initNode("/it-autoflight/input/athr", 0, "BOOL"),
|
||||||
altDiff: 0,
|
altDiff: 0,
|
||||||
bankLimitSW: props.globals.initNode("/it-autoflight/input/bank-limit-sw", 0, "INT"),
|
bankLimitSw: props.globals.initNode("/it-autoflight/input/bank-limit-sw", 0, "INT"),
|
||||||
bankLimitSWTemp: 0,
|
bankLimitSwTemp: 0,
|
||||||
fd1: props.globals.initNode("/it-autoflight/input/fd1", 1, "BOOL"),
|
fd1: props.globals.initNode("/it-autoflight/input/fd1", 1, "BOOL"),
|
||||||
fd2: props.globals.initNode("/it-autoflight/input/fd2", 1, "BOOL"),
|
fd2: props.globals.initNode("/it-autoflight/input/fd2", 1, "BOOL"),
|
||||||
fpa: props.globals.initNode("/it-autoflight/input/fpa", 0, "DOUBLE"),
|
fpa: props.globals.initNode("/it-autoflight/input/fpa", 0, "DOUBLE"),
|
||||||
|
@ -113,6 +118,7 @@ var Internal = {
|
||||||
bankLimitAuto: 30,
|
bankLimitAuto: 30,
|
||||||
captVs: 0,
|
captVs: 0,
|
||||||
driftAngle: props.globals.initNode("/it-autoflight/internal/drift-angle-deg", 0, "DOUBLE"),
|
driftAngle: props.globals.initNode("/it-autoflight/internal/drift-angle-deg", 0, "DOUBLE"),
|
||||||
|
driftAngleTemp: 0,
|
||||||
flchActive: 0,
|
flchActive: 0,
|
||||||
fpa: props.globals.initNode("/it-autoflight/internal/fpa", 0, "DOUBLE"),
|
fpa: props.globals.initNode("/it-autoflight/internal/fpa", 0, "DOUBLE"),
|
||||||
hdgErrorDeg: props.globals.initNode("/it-autoflight/internal/heading-error-deg", 0, "DOUBLE"),
|
hdgErrorDeg: props.globals.initNode("/it-autoflight/internal/heading-error-deg", 0, "DOUBLE"),
|
||||||
|
@ -146,14 +152,13 @@ var Output = {
|
||||||
};
|
};
|
||||||
|
|
||||||
var Text = {
|
var Text = {
|
||||||
arm: props.globals.initNode("/it-autoflight/mode/arm", " ", "STRING"),
|
|
||||||
lat: props.globals.initNode("/it-autoflight/mode/lat", "T/O", "STRING"),
|
lat: props.globals.initNode("/it-autoflight/mode/lat", "T/O", "STRING"),
|
||||||
thr: props.globals.initNode("/it-autoflight/mode/thr", "PITCH", "STRING"),
|
thr: props.globals.initNode("/it-autoflight/mode/thr", "PITCH", "STRING"),
|
||||||
vert: props.globals.initNode("/it-autoflight/mode/vert", "T/O CLB", "STRING"),
|
vert: props.globals.initNode("/it-autoflight/mode/vert", "T/O CLB", "STRING"),
|
||||||
vertTemp: "T/O CLB",
|
vertTemp: "T/O CLB",
|
||||||
};
|
};
|
||||||
|
|
||||||
var Setting = {
|
var Settings = {
|
||||||
reducAglFt: props.globals.initNode("/it-autoflight/settings/accel-agl-ft", 1500, "INT"), # Changable from MCDU, eventually set to 1500 above runway
|
reducAglFt: props.globals.initNode("/it-autoflight/settings/accel-agl-ft", 1500, "INT"), # Changable from MCDU, eventually set to 1500 above runway
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -208,9 +213,9 @@ var ITAF = {
|
||||||
Output.athr.setBoolValue(0);
|
Output.athr.setBoolValue(0);
|
||||||
Output.fd1.setBoolValue(1);
|
Output.fd1.setBoolValue(1);
|
||||||
Output.fd2.setBoolValue(1);
|
Output.fd2.setBoolValue(1);
|
||||||
Output.lnavArm.setBoolValue(0);
|
me.updateLnavArm(0);
|
||||||
Output.locArm.setBoolValue(0);
|
me.updateLocArm(0);
|
||||||
Output.apprArm.setBoolValue(0);
|
me.updateApprArm(0);
|
||||||
Output.thrMode.setValue(0);
|
Output.thrMode.setValue(0);
|
||||||
Output.lat.setValue(9);
|
Output.lat.setValue(9);
|
||||||
Output.vert.setValue(9);
|
Output.vert.setValue(9);
|
||||||
|
@ -223,9 +228,9 @@ var ITAF = {
|
||||||
Input.kts.setValue(100);
|
Input.kts.setValue(100);
|
||||||
Input.mach.setValue(0.5);
|
Input.mach.setValue(0.5);
|
||||||
Text.thr.setValue("THRUST");
|
Text.thr.setValue("THRUST");
|
||||||
Text.arm.setValue(" ");
|
updateFma.arm();
|
||||||
Text.lat.setValue(" ");
|
me.updateLatText("");
|
||||||
Text.vert.setValue(" ");
|
me.updateVertText("");
|
||||||
Custom.showHdg.setBoolValue(1);
|
Custom.showHdg.setBoolValue(1);
|
||||||
Custom.Output.fmaPower.setBoolValue(1);
|
Custom.Output.fmaPower.setBoolValue(1);
|
||||||
ManagedSPD.stop();
|
ManagedSPD.stop();
|
||||||
|
@ -254,17 +259,17 @@ var ITAF = {
|
||||||
|
|
||||||
# LNAV Engagement
|
# LNAV Engagement
|
||||||
if (Output.lnavArm.getBoolValue()) {
|
if (Output.lnavArm.getBoolValue()) {
|
||||||
me.checkLNAV(1);
|
me.checkLnav(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
# VOR/LOC or ILS/LOC Capture
|
# VOR/LOC or ILS/LOC Capture
|
||||||
if (Output.locArm.getBoolValue()) {
|
if (Output.locArm.getBoolValue()) {
|
||||||
me.checkLOC(1, 0);
|
me.checkLoc(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
# G/S Capture
|
# G/S Capture
|
||||||
if (Output.apprArm.getBoolValue()) {
|
if (Output.apprArm.getBoolValue()) {
|
||||||
me.checkAPPR(1);
|
me.checkAppr(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Autoland Logic
|
# Autoland Logic
|
||||||
|
@ -275,25 +280,25 @@ var ITAF = {
|
||||||
}
|
}
|
||||||
if (Output.vertTemp == 2) {
|
if (Output.vertTemp == 2) {
|
||||||
if (Position.gearAglFtTemp <= 400 and Position.gearAglFtTemp >= 5) {
|
if (Position.gearAglFtTemp <= 400 and Position.gearAglFtTemp >= 5) {
|
||||||
Text.vert.setValue("LAND");
|
me.updateVertText("LAND");
|
||||||
|
|
||||||
if (Position.gearAglFtTemp <= 100) { # switch to internal flare logic at 100 feet -- but on FMA at 50!
|
if (Position.gearAglFtTemp <= 100) { # switch to internal flare logic at 100 feet -- but on FMA at 50!
|
||||||
me.setVertMode(6);
|
me.setVertMode(6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (Output.vertTemp == 6) {
|
} else if (Output.vertTemp == 6) {
|
||||||
if (Position.gearAglFtTemp <= 50 and Position.gearAglFtTemp >= 5) {
|
if (Position.gearAglFtTemp <= 50 and Position.gearAglFtTemp >= 5 and Text.vert.getValue() != "FLARE") {
|
||||||
Text.vert.setValue("FLARE");
|
me.updateVertText("FLARE");
|
||||||
}
|
}
|
||||||
if (Gear.wow1Temp and Gear.wow2Temp) {
|
if (Gear.wow1Temp and Gear.wow2Temp and Text.vert.getValue() != "ROLLOUT") {
|
||||||
Text.lat.setValue("RLOU");
|
me.updateLatText("RLOU");
|
||||||
Text.vert.setValue("ROLLOUT");
|
me.updateVertText("ROLLOUT");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# FLCH Engagement
|
# FLCH Engagement
|
||||||
if (Text.vertTemp == "T/O CLB") {
|
if (Text.vertTemp == "T/O CLB") {
|
||||||
me.checkFLCH(Setting.reducAglFt.getValue());
|
me.checkFlch(Settings.reducAglFt.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
# Altitude Capture/Sync Logic
|
# Altitude Capture/Sync Logic
|
||||||
|
@ -317,38 +322,14 @@ var ITAF = {
|
||||||
|
|
||||||
# Altitude Hold Min/Max Reset
|
# Altitude Hold Min/Max Reset
|
||||||
if (Internal.altCaptureActive) {
|
if (Internal.altCaptureActive) {
|
||||||
if (abs(Internal.altDiff) <= 20) {
|
if (abs(Internal.altDiff) <= 20 and Text.vert.getValue() != "ALT HLD") {
|
||||||
me.resetClimbRateLim();
|
me.resetClimbRateLim();
|
||||||
Text.vert.setValue("ALT HLD");
|
me.updateVertText("ALT HLD");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Thrust Mode Selector
|
# Thrust Mode Selector
|
||||||
if (Output.athr.getBoolValue() and Output.vertTemp != 7 and (Output.ap1Temp or Output.ap2Temp) and Position.gearAglFt.getValue() <= 30 and (Output.vertTemp == 2 or Output.vertTemp == 6)) {
|
me.updateThrustMode();
|
||||||
# Manual says 40 feet -- but video reference shows 30!
|
|
||||||
Output.thrMode.setValue(1);
|
|
||||||
Text.thr.setValue("RETARD");
|
|
||||||
} else if (Output.vertTemp == 4) {
|
|
||||||
if (Internal.altTemp >= Position.indicatedAltitudeFtTemp) {
|
|
||||||
Output.thrMode.setValue(2);
|
|
||||||
Text.thr.setValue("PITCH");
|
|
||||||
if (Internal.flchActive) { # Set before mode change to prevent it from overwriting by mistake
|
|
||||||
Text.vert.setValue("SPD CLB");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Output.thrMode.setValue(1);
|
|
||||||
Text.thr.setValue("PITCH");
|
|
||||||
if (Internal.flchActive) { # Set before mode change to prevent it from overwriting by mistake
|
|
||||||
Text.vert.setValue("SPD DES");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (Output.vertTemp == 7) {
|
|
||||||
Output.thrMode.setValue(2);
|
|
||||||
Text.thr.setValue("PITCH");
|
|
||||||
} else {
|
|
||||||
Output.thrMode.setValue(0);
|
|
||||||
Text.thr.setValue("THRUST");
|
|
||||||
}
|
|
||||||
|
|
||||||
# Custom Stuff Below
|
# Custom Stuff Below
|
||||||
# Heading Sync
|
# Heading Sync
|
||||||
|
@ -359,9 +340,9 @@ var ITAF = {
|
||||||
# Preselect Heading
|
# Preselect Heading
|
||||||
if (Output.latTemp != 0 and Output.latTemp != 9) { # Modes that always show HDG
|
if (Output.latTemp != 0 and Output.latTemp != 9) { # Modes that always show HDG
|
||||||
if (Custom.hdgTime.getValue() + 45 >= Misc.elapsedSec.getValue()) {
|
if (Custom.hdgTime.getValue() + 45 >= Misc.elapsedSec.getValue()) {
|
||||||
setprop("it-autoflight/custom/show-hdg", 1);
|
Custom.showHdg.setBoolValue(1);
|
||||||
} else {
|
} else {
|
||||||
setprop("it-autoflight/custom/show-hdg", 0);
|
Custom.showHdg.setBoolValue(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -543,76 +524,67 @@ var ITAF = {
|
||||||
setLatMode: func(n) {
|
setLatMode: func(n) {
|
||||||
Output.vertTemp = Output.vert.getValue();
|
Output.vertTemp = Output.vert.getValue();
|
||||||
if (n == 0) { # HDG SEL
|
if (n == 0) { # HDG SEL
|
||||||
Output.lnavArm.setBoolValue(0);
|
me.updateLnavArm(0);
|
||||||
Output.locArm.setBoolValue(0);
|
me.updateLocArm(0);
|
||||||
Output.apprArm.setBoolValue(0);
|
me.updateApprArm(0);
|
||||||
Output.lat.setValue(0);
|
Output.lat.setValue(0);
|
||||||
Custom.showHdg.setBoolValue(1);
|
Custom.showHdg.setBoolValue(1);
|
||||||
Text.lat.setValue("HDG");
|
me.updateLatText("HDG");
|
||||||
if (Output.vertTemp == 2 or Output.vertTemp == 6) { # Also cancel G/S or FLARE if active
|
if (Output.vertTemp == 2 or Output.vertTemp == 6) { # Also cancel G/S or FLARE if active
|
||||||
me.setVertMode(1);
|
me.setVertMode(1);
|
||||||
} else {
|
|
||||||
me.armTextCheck();
|
|
||||||
}
|
}
|
||||||
} else if (n == 1) { # LNAV
|
} else if (n == 1) { # LNAV
|
||||||
me.checkLNAV(0);
|
me.updateLocArm(0);
|
||||||
|
me.updateApprArm(0);
|
||||||
|
me.checkLnav(0);
|
||||||
} else if (n == 2) { # VOR/LOC
|
} else if (n == 2) { # VOR/LOC
|
||||||
Output.lnavArm.setBoolValue(0);
|
me.updateLnavArm(0);
|
||||||
me.armTextCheck();
|
me.checkLoc(0);
|
||||||
me.checkLOC(0, 0);
|
|
||||||
} else if (n == 3) { # HDG HLD
|
} else if (n == 3) { # HDG HLD
|
||||||
Output.lnavArm.setBoolValue(0);
|
me.updateLnavArm(0);
|
||||||
Output.locArm.setBoolValue(0);
|
me.updateLocArm(0);
|
||||||
Output.apprArm.setBoolValue(0);
|
me.updateApprArm(0);
|
||||||
me.syncHdg();
|
me.syncHdg();
|
||||||
Output.lat.setValue(0);
|
Output.lat.setValue(0);
|
||||||
Custom.showHdg.setBoolValue(1);
|
Custom.showHdg.setBoolValue(1);
|
||||||
Text.lat.setValue("HDG");
|
me.updateLatText("HDG");
|
||||||
if (Output.vertTemp == 2 or Output.vertTemp == 6) { # Also cancel G/S or FLARE if active
|
if (Output.vertTemp == 2 or Output.vertTemp == 6) { # Also cancel G/S or FLARE if active
|
||||||
me.setVertMode(1);
|
me.setVertMode(1);
|
||||||
} else {
|
|
||||||
me.armTextCheck();
|
|
||||||
}
|
}
|
||||||
} else if (n == 4) { # ALIGN
|
} else if (n == 4) { # ALIGN
|
||||||
Output.lnavArm.setBoolValue(0);
|
me.updateLnavArm(0);
|
||||||
Output.locArm.setBoolValue(0);
|
me.updateLocArm(0);
|
||||||
Output.apprArm.setBoolValue(0);
|
me.updateApprArm(0);
|
||||||
Output.lat.setValue(4);
|
Output.lat.setValue(4);
|
||||||
Custom.showHdg.setBoolValue(0);
|
Custom.showHdg.setBoolValue(0);
|
||||||
Text.lat.setValue("ALGN");
|
me.updateLatText("ALGN");
|
||||||
me.armTextCheck();
|
|
||||||
} else if (n == 5) { # RWY
|
} else if (n == 5) { # RWY
|
||||||
Output.lnavArm.setBoolValue(0);
|
me.updateLnavArm(0);
|
||||||
Output.locArm.setBoolValue(0);
|
me.updateLocArm(0);
|
||||||
Output.apprArm.setBoolValue(0);
|
me.updateApprArm(0);
|
||||||
Output.lat.setValue(5);
|
Output.lat.setValue(5);
|
||||||
Custom.showHdg.setBoolValue(0);
|
Custom.showHdg.setBoolValue(0);
|
||||||
Text.lat.setValue("T/O");
|
me.updateLatText("T/O");
|
||||||
me.armTextCheck();
|
|
||||||
} else if (n == 9) { # NONE
|
} else if (n == 9) { # NONE
|
||||||
Output.locArm.setBoolValue(0);
|
me.updateLocArm(0);
|
||||||
Output.lat.setValue(9);
|
Output.lat.setValue(9);
|
||||||
Custom.showHdg.setBoolValue(1);
|
Custom.showHdg.setBoolValue(1);
|
||||||
Text.lat.setValue(" ");
|
me.updateLatText("");
|
||||||
me.armTextCheck();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setLatArm: func(n) {
|
setLatArm: func(n) {
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
Output.lnavArm.setBoolValue(0);
|
me.updateLnavArm(0);
|
||||||
Custom.showHdg.setBoolValue(1);
|
Custom.showHdg.setBoolValue(1);
|
||||||
me.armTextCheck();
|
|
||||||
} else if (n == 1) {
|
} else if (n == 1) {
|
||||||
if (flightPlanController.num[2].getValue() > 0 and FPLN.active.getBoolValue()) {
|
if (flightPlanController.num[2].getValue() > 0 and FPLN.active.getBoolValue()) {
|
||||||
Output.lnavArm.setBoolValue(1);
|
me.updateLnavArm(1);
|
||||||
Custom.showHdg.setBoolValue(0);
|
Custom.showHdg.setBoolValue(0);
|
||||||
me.armTextCheck();
|
|
||||||
}
|
}
|
||||||
} else if (n == 3) {
|
} else if (n == 3) {
|
||||||
me.syncHdg();
|
me.syncHdg();
|
||||||
Output.lnavArm.setBoolValue(0);
|
me.updateLnavArm(0);
|
||||||
Custom.showHdg.setBoolValue(1);
|
Custom.showHdg.setBoolValue(1);
|
||||||
me.armTextCheck();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setVertMode: func(n) {
|
setVertMode: func(n) {
|
||||||
|
@ -620,167 +592,183 @@ var ITAF = {
|
||||||
if (n == 0) { # ALT HLD
|
if (n == 0) { # ALT HLD
|
||||||
Internal.flchActive = 0;
|
Internal.flchActive = 0;
|
||||||
Internal.altCaptureActive = 0;
|
Internal.altCaptureActive = 0;
|
||||||
Output.apprArm.setBoolValue(0);
|
me.updateApprArm(0);
|
||||||
Output.vert.setValue(0);
|
Output.vert.setValue(0);
|
||||||
me.resetClimbRateLim();
|
me.resetClimbRateLim();
|
||||||
Text.vert.setValue("ALT HLD");
|
me.updateVertText("ALT HLD");
|
||||||
me.syncAlt();
|
me.syncAlt();
|
||||||
me.armTextCheck();
|
me.updateThrustMode();
|
||||||
} else if (n == 1) { # V/S
|
} else if (n == 1) { # V/S
|
||||||
if (abs(Input.altDiff) >= 25) {
|
if (abs(Input.altDiff) >= 25) {
|
||||||
Internal.flchActive = 0;
|
Internal.flchActive = 0;
|
||||||
Internal.altCaptureActive = 0;
|
Internal.altCaptureActive = 0;
|
||||||
Output.apprArm.setBoolValue(0);
|
me.updateApprArm(0);
|
||||||
Output.vert.setValue(1);
|
Output.vert.setValue(1);
|
||||||
Text.vert.setValue("V/S");
|
me.updateVertText("V/S");
|
||||||
me.syncVs();
|
me.syncVs();
|
||||||
me.armTextCheck();
|
me.updateThrustMode();
|
||||||
} else {
|
} else {
|
||||||
Output.apprArm.setBoolValue(0);
|
me.updateApprArm(0);
|
||||||
me.armTextCheck();
|
|
||||||
}
|
}
|
||||||
} else if (n == 2) { # G/S
|
} else if (n == 2) { # G/S
|
||||||
me.checkLOC(0, 1);
|
me.updateLnavArm(0);
|
||||||
me.checkAPPR(0);
|
me.checkLoc(0);
|
||||||
|
me.checkAppr(0);
|
||||||
} else if (n == 3) { # ALT CAP
|
} else if (n == 3) { # ALT CAP
|
||||||
Internal.flchActive = 0;
|
Internal.flchActive = 0;
|
||||||
Output.vert.setValue(0);
|
Output.vert.setValue(0);
|
||||||
me.setClimbRateLim();
|
me.setClimbRateLim();
|
||||||
Internal.altCaptureActive = 1;
|
Internal.altCaptureActive = 1;
|
||||||
Text.vert.setValue("ALT CAP");
|
me.updateVertText("ALT CAP");
|
||||||
|
me.updateThrustMode();
|
||||||
} else if (n == 4) { # FLCH
|
} else if (n == 4) { # FLCH
|
||||||
Output.apprArm.setBoolValue(0);
|
me.updateApprArm(0);
|
||||||
Output.vert.setValue(1);
|
Output.vert.setValue(1);
|
||||||
Internal.alt.setValue(Input.alt.getValue());
|
Internal.alt.setValue(Input.alt.getValue());
|
||||||
Internal.altDiff = Internal.alt.getValue() - Position.indicatedAltitudeFt.getValue();
|
Internal.altDiff = Internal.alt.getValue() - Position.indicatedAltitudeFt.getValue();
|
||||||
if (abs(Internal.altDiff) >= 250) { # SPD CLB or SPD DES
|
if (abs(Internal.altDiff) >= 250) { # SPD CLB or SPD DES
|
||||||
if (Input.alt.getValue() >= Position.indicatedAltitudeFt.getValue()) { # Usually set Thrust Mode Selector, but we do it now due to timer lag
|
|
||||||
Text.vert.setValue("SPD CLB");
|
|
||||||
} else {
|
|
||||||
Text.vert.setValue("SPD DES");
|
|
||||||
}
|
|
||||||
Internal.altCaptureActive = 0;
|
Internal.altCaptureActive = 0;
|
||||||
Output.vert.setValue(4);
|
Output.vert.setValue(4);
|
||||||
Internal.flchActive = 1;
|
Internal.flchActive = 1;
|
||||||
|
me.updateThrustMode();
|
||||||
} else { # ALT CAP
|
} else { # ALT CAP
|
||||||
Internal.flchActive = 0;
|
Internal.flchActive = 0;
|
||||||
Internal.alt.setValue(Input.alt.getValue());
|
Internal.alt.setValue(Input.alt.getValue());
|
||||||
Internal.altCaptureActive = 1;
|
Internal.altCaptureActive = 1;
|
||||||
Output.vert.setValue(0);
|
Output.vert.setValue(0);
|
||||||
Text.vert.setValue("ALT CAP");
|
me.updateVertText("ALT CAP");
|
||||||
|
me.updateThrustMode();
|
||||||
}
|
}
|
||||||
me.armTextCheck();
|
|
||||||
} else if (n == 5) { # FPA
|
} else if (n == 5) { # FPA
|
||||||
if (abs(Input.altDiff) >= 25) {
|
if (abs(Input.altDiff) >= 25) {
|
||||||
Internal.flchActive = 0;
|
Internal.flchActive = 0;
|
||||||
Internal.altCaptureActive = 0;
|
Internal.altCaptureActive = 0;
|
||||||
Output.apprArm.setBoolValue(0);
|
me.updateApprArm(0);
|
||||||
Output.vert.setValue(5);
|
Output.vert.setValue(5);
|
||||||
Text.vert.setValue("FPA");
|
me.updateVertText("FPA");
|
||||||
me.syncFpa();
|
me.syncFpa();
|
||||||
me.armTextCheck();
|
me.updateThrustMode();
|
||||||
} else {
|
} else {
|
||||||
Output.apprArm.setBoolValue(0);
|
me.updateApprArm(0);
|
||||||
me.armTextCheck();
|
|
||||||
}
|
}
|
||||||
} else if (n == 6) { # FLARE/ROLLOUT
|
} else if (n == 6) { # FLARE/ROLLOUT
|
||||||
Internal.flchActive = 0;
|
Internal.flchActive = 0;
|
||||||
Internal.altCaptureActive = 0;
|
Internal.altCaptureActive = 0;
|
||||||
Output.apprArm.setBoolValue(0);
|
me.updateApprArm(0);
|
||||||
Output.vert.setValue(6);
|
Output.vert.setValue(6);
|
||||||
me.armTextCheck();
|
me.updateThrustMode();
|
||||||
} else if (n == 7) { # T/O CLB or G/A CLB, text is set by TOGA selector
|
} else if (n == 7) { # T/O CLB or G/A CLB, text is set by TOGA selector
|
||||||
Internal.flchActive = 0;
|
Internal.flchActive = 0;
|
||||||
Internal.altCaptureActive = 0;
|
Internal.altCaptureActive = 0;
|
||||||
Output.apprArm.setBoolValue(0);
|
me.updateApprArm(0);
|
||||||
Output.vert.setValue(7);
|
Output.vert.setValue(7);
|
||||||
me.armTextCheck();
|
me.updateThrustMode();
|
||||||
} else if (n == 9) { # NONE
|
} else if (n == 9) { # NONE
|
||||||
Internal.flchActive = 0;
|
Internal.flchActive = 0;
|
||||||
Internal.altCaptureActive = 0;
|
Internal.altCaptureActive = 0;
|
||||||
Output.apprArm.setBoolValue(0);
|
me.updateApprArm(0);
|
||||||
Output.vert.setValue(9);
|
Output.vert.setValue(9);
|
||||||
Text.vert.setValue(" ");
|
me.updateVertText("");
|
||||||
me.armTextCheck();
|
me.updateThrustMode();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
activateLNAV: func() {
|
updateThrustMode: func() {
|
||||||
|
Output.vertTemp = Output.vert.getValue();
|
||||||
|
if (Output.athr.getBoolValue() and Output.vertTemp != 7 and (Output.ap1.getBoolValue() or Output.ap2.getBoolValue()) and Position.gearAglFt.getValue() <= 30 and (Output.vertTemp == 2 or Output.vertTemp == 6)) {
|
||||||
|
# Manual says 40 feet - but video reference shows 30!
|
||||||
|
Output.thrMode.setValue(1);
|
||||||
|
Text.thr.setValue("RETARD");
|
||||||
|
} else if (Output.vertTemp == 4) {
|
||||||
|
if (Internal.alt.getValue() >= Position.indicatedAltitudeFt.getValue()) {
|
||||||
|
Output.thrMode.setValue(2);
|
||||||
|
Text.thr.setValue("PITCH");
|
||||||
|
if (Internal.flchActive and Text.vert.getValue() != "SPD CLB") { # Set before mode change to prevent it from overwriting by mistake
|
||||||
|
me.updateVertText("SPD CLB");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Output.thrMode.setValue(1);
|
||||||
|
Text.thr.setValue("PITCH");
|
||||||
|
if (Internal.flchActive and Text.vert.getValue() != "SPD DES") { # Set before mode change to prevent it from overwriting by mistake
|
||||||
|
me.updateVertText("SPD DES");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (Output.vertTemp == 7) {
|
||||||
|
Output.thrMode.setValue(2);
|
||||||
|
Text.thr.setValue("PITCH");
|
||||||
|
} else {
|
||||||
|
Output.thrMode.setValue(0);
|
||||||
|
Text.thr.setValue("THRUST");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
activateLnav: func() {
|
||||||
if (Output.lat.getValue() != 1) {
|
if (Output.lat.getValue() != 1) {
|
||||||
Output.lnavArm.setBoolValue(0);
|
me.updateLnavArm(0);
|
||||||
Output.locArm.setBoolValue(0);
|
me.updateLocArm(0);
|
||||||
Output.apprArm.setBoolValue(0);
|
me.updateApprArm(0);
|
||||||
Output.lat.setValue(1);
|
Output.lat.setValue(1);
|
||||||
Custom.showHdg.setBoolValue(0);
|
Custom.showHdg.setBoolValue(0);
|
||||||
Text.lat.setValue("LNAV");
|
me.updateLatText("LNAV");
|
||||||
if (Output.vertTemp == 2 or Output.vertTemp == 6) { # Also cancel G/S or FLARE if active
|
if (Output.vertTemp == 2 or Output.vertTemp == 6) { # Also cancel G/S or FLARE if active
|
||||||
me.setVertMode(1);
|
me.setVertMode(1);
|
||||||
} else {
|
|
||||||
me.armTextCheck();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
activateLOC: func() {
|
activateLoc: func() {
|
||||||
if (Output.lat.getValue() != 2) {
|
if (Output.lat.getValue() != 2) {
|
||||||
Output.lnavArm.setBoolValue(0);
|
me.updateLnavArm(0);
|
||||||
Output.locArm.setBoolValue(0);
|
me.updateLocArm(0);
|
||||||
Output.lat.setValue(2);
|
Output.lat.setValue(2);
|
||||||
Custom.showHdg.setBoolValue(0);
|
Custom.showHdg.setBoolValue(0);
|
||||||
Text.lat.setValue("LOC");
|
me.updateLatText("LOC");
|
||||||
me.armTextCheck();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
activateGS: func() {
|
activateGs: func() {
|
||||||
if (Output.vert.getValue() != 2) {
|
if (Output.vert.getValue() != 2) {
|
||||||
Internal.flchActive = 0;
|
Internal.flchActive = 0;
|
||||||
Internal.altCaptureActive = 0;
|
Internal.altCaptureActive = 0;
|
||||||
Output.apprArm.setBoolValue(0);
|
me.updateApprArm(0);
|
||||||
Output.vert.setValue(2);
|
Output.vert.setValue(2);
|
||||||
Text.vert.setValue("G/S");
|
me.updateVertText("G/S");
|
||||||
me.armTextCheck();
|
me.updateThrustMode();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
checkLNAV: func(t) {
|
checkLnav: func(t) {
|
||||||
if (flightPlanController.num[2].getValue() > 0 and FPLN.active.getBoolValue() and Position.gearAglFt.getValue() >= 30) {
|
if (flightPlanController.num[2].getValue() > 0 and FPLN.active.getBoolValue() and Position.gearAglFt.getValue() >= 30) {
|
||||||
me.activateLNAV();
|
me.activateLnav();
|
||||||
} else if (FPLN.active.getBoolValue() and Output.lat.getValue() != 1 and t != 1) {
|
} else if (FPLN.active.getBoolValue() and Output.lat.getValue() != 1 and t != 1) {
|
||||||
Output.lnavArm.setBoolValue(1);
|
me.updateLnavArm(1);
|
||||||
me.armTextCheck();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
checkFLCH: func(a) {
|
checkFlch: func(a) {
|
||||||
if (Position.indicatedAltitudeFt.getValue() >= a and a != 0 and !Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue()) {
|
if (Position.indicatedAltitudeFt.getValue() >= a and a != 0 and !Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue()) {
|
||||||
me.setVertMode(4);
|
me.setVertMode(4);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
checkLOC: func(t, a) {
|
checkLoc: func(t) {
|
||||||
if (Radio.inRange[Radio.radioSel].getBoolValue()) { # # Only evaulate the rest of the condition unless we are in range
|
if (Radio.inRange[Radio.radioSel].getBoolValue()) { # # Only evaulate the rest of the condition unless we are in range
|
||||||
Radio.locDeflTemp = Radio.locDefl[Radio.radioSel].getValue();
|
Radio.locDeflTemp = Radio.locDefl[Radio.radioSel].getValue();
|
||||||
Radio.signalQualityTemp = Radio.signalQuality[Radio.radioSel].getValue();
|
Radio.signalQualityTemp = Radio.signalQuality[Radio.radioSel].getValue();
|
||||||
if (abs(Radio.locDeflTemp) <= 0.95 and Radio.locDeflTemp != 0 and Radio.signalQualityTemp >= 0.99) {
|
if (abs(Radio.locDeflTemp) <= 0.95 and Radio.locDeflTemp != 0 and Radio.signalQualityTemp >= 0.99) {
|
||||||
me.activateLOC();
|
me.activateLoc();
|
||||||
} else if (t != 1) { # Do not do this if loop calls it
|
} else if (t != 1) { # Do not do this if loop calls it
|
||||||
if (Output.lat.getValue() != 2) {
|
if (Output.lat.getValue() != 2) {
|
||||||
Output.lnavArm.setBoolValue(0);
|
me.updateLnavArm(0);
|
||||||
Output.locArm.setBoolValue(1);
|
me.updateLocArm(1);
|
||||||
if (a != 1) { # Don't call this if arming with G/S
|
|
||||||
me.armTextCheck();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { # Prevent bad behavior due to FG not updating it when not in range
|
} else { # Prevent bad behavior due to FG not updating it when not in range
|
||||||
Radio.signalQuality[Radio.radioSel].setValue(0);
|
Radio.signalQuality[Radio.radioSel].setValue(0);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
checkAPPR: func(t) {
|
checkAppr: func(t) {
|
||||||
if (Radio.inRange[Radio.radioSel].getBoolValue()) { # # Only evaulate the rest of the condition unless we are in range
|
if (Radio.inRange[Radio.radioSel].getBoolValue()) { # # Only evaulate the rest of the condition unless we are in range
|
||||||
Radio.gsDeflTemp = Radio.gsDefl[Radio.radioSel].getValue();
|
Radio.gsDeflTemp = Radio.gsDefl[Radio.radioSel].getValue();
|
||||||
if (abs(Radio.gsDeflTemp) <= 0.2 and Radio.gsDeflTemp != 0 and Output.lat.getValue() == 2) { # Only capture if LOC is active
|
if (abs(Radio.gsDeflTemp) <= 0.2 and Radio.gsDeflTemp != 0 and Output.lat.getValue() == 2) { # Only capture if LOC is active
|
||||||
me.activateGS();
|
me.activateGs();
|
||||||
} else if (t != 1) { # Do not do this if loop calls it
|
} else if (t != 1) { # Do not do this if loop calls it
|
||||||
if (Output.vert.getValue() != 2) {
|
if (Output.vert.getValue() != 2) {
|
||||||
Output.apprArm.setBoolValue(1);
|
me.updateApprArm(1);
|
||||||
}
|
}
|
||||||
me.armTextCheck();
|
|
||||||
}
|
}
|
||||||
} else { # Prevent bad behavior due to FG not updating it when not in range
|
} else { # Prevent bad behavior due to FG not updating it when not in range
|
||||||
Radio.signalQuality[Radio.radioSel].setValue(0);
|
Radio.signalQuality[Radio.radioSel].setValue(0);
|
||||||
|
@ -818,8 +806,7 @@ var ITAF = {
|
||||||
if ((Output.vertTemp == 2 or Output.vertTemp == 6) and Velocities.indicatedAirspeedKt.getValue() >= 80) {
|
if ((Output.vertTemp == 2 or Output.vertTemp == 6) and Velocities.indicatedAirspeedKt.getValue() >= 80) {
|
||||||
me.setLatMode(3);
|
me.setLatMode(3);
|
||||||
me.setVertMode(7); # Must be before kicking AP off
|
me.setVertMode(7); # Must be before kicking AP off
|
||||||
Text.vert.setValue("G/A CLB");
|
me.updateVertText("G/A CLB");
|
||||||
Input.ktsMach.setBoolValue(0);
|
|
||||||
me.syncKtsGa();
|
me.syncKtsGa();
|
||||||
if (Gear.wow1.getBoolValue() or Gear.wow2.getBoolValue()) {
|
if (Gear.wow1.getBoolValue() or Gear.wow2.getBoolValue()) {
|
||||||
me.ap1Master(0);
|
me.ap1Master(0);
|
||||||
|
@ -831,18 +818,7 @@ var ITAF = {
|
||||||
me.setLatMode(5);
|
me.setLatMode(5);
|
||||||
}
|
}
|
||||||
me.setVertMode(7);
|
me.setVertMode(7);
|
||||||
Text.vert.setValue("T/O CLB");
|
me.updateVertText("T/O CLB");
|
||||||
}
|
|
||||||
},
|
|
||||||
armTextCheck: func() {
|
|
||||||
if (Output.apprArm.getBoolValue()) {
|
|
||||||
Text.arm.setValue("ILS");
|
|
||||||
} else if (Output.locArm.getBoolValue()) {
|
|
||||||
Text.arm.setValue("LOC");
|
|
||||||
} else if (Output.lnavArm.getBoolValue()) {
|
|
||||||
Text.arm.setValue("LNV");
|
|
||||||
} else {
|
|
||||||
Text.arm.setValue(" ");
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
syncKts: func() {
|
syncKts: func() {
|
||||||
|
@ -893,12 +869,12 @@ var ITAF = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
disarmLOC: func() {
|
disarmLoc: func() {
|
||||||
Output.locArm.setBoolValue(0);
|
me.updateLocArm(0);
|
||||||
ITAF.armTextCheck();
|
ITAF.armTextCheck();
|
||||||
},
|
},
|
||||||
disarmGS: func() {
|
disarmAppr: func() {
|
||||||
Output.apprArm.setBoolValue(0);
|
me.updateApprArm(0);
|
||||||
ITAF.armTextCheck();
|
ITAF.armTextCheck();
|
||||||
},
|
},
|
||||||
toggleTrkFpa: func() {
|
toggleTrkFpa: func() {
|
||||||
|
@ -940,59 +916,86 @@ var ITAF = {
|
||||||
}
|
}
|
||||||
Input.hdg.setValue(Input.hdgCalc);
|
Input.hdg.setValue(Input.hdgCalc);
|
||||||
},
|
},
|
||||||
|
updateLatText: func(t) {
|
||||||
|
Text.lat.setValue(t);
|
||||||
|
updateFma.lat();
|
||||||
|
},
|
||||||
|
updateVertText: func(t) {
|
||||||
|
Text.vert.setValue(t);
|
||||||
|
updateFma.vert();
|
||||||
|
},
|
||||||
|
updateLnavArm: func(n) {
|
||||||
|
Output.lnavArm.setBoolValue(n);
|
||||||
|
updateFma.arm();
|
||||||
|
},
|
||||||
|
updateLocArm: func(n) {
|
||||||
|
Output.locArm.setBoolValue(n);
|
||||||
|
updateFma.arm();
|
||||||
|
},
|
||||||
|
updateApprArm: func(n) {
|
||||||
|
Output.apprArm.setBoolValue(n);
|
||||||
|
updateFma.arm();
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
setlistener("/it-autoflight/input/ap1", func {
|
setlistener("/it-autoflight/input/ap1", func() {
|
||||||
Input.ap1Temp = Input.ap1.getBoolValue();
|
Input.ap1Temp = Input.ap1.getBoolValue();
|
||||||
if (Input.ap1Temp != Output.ap1.getBoolValue()) {
|
if (Input.ap1Temp != Output.ap1.getBoolValue()) {
|
||||||
ITAF.ap1Master(Input.ap1Temp);
|
ITAF.ap1Master(Input.ap1Temp);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setlistener("/it-autoflight/input/ap2", func {
|
setlistener("/it-autoflight/input/ap2", func() {
|
||||||
Input.ap2Temp = Input.ap2.getBoolValue();
|
Input.ap2Temp = Input.ap2.getBoolValue();
|
||||||
if (Input.ap2Temp != Output.ap2.getBoolValue()) {
|
if (Input.ap2Temp != Output.ap2.getBoolValue()) {
|
||||||
ITAF.ap2Master(Input.ap2Temp);
|
ITAF.ap2Master(Input.ap2Temp);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setlistener("/it-autoflight/input/athr", func {
|
setlistener("/it-autoflight/input/athr", func() {
|
||||||
Input.athrTemp = Input.athr.getBoolValue();
|
Input.athrTemp = Input.athr.getBoolValue();
|
||||||
if (Input.athrTemp != Output.athr.getBoolValue()) {
|
if (Input.athrTemp != Output.athr.getBoolValue()) {
|
||||||
ITAF.athrMaster(Input.athrTemp);
|
ITAF.athrMaster(Input.athrTemp);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setlistener("/it-autoflight/input/fd1", func {
|
setlistener("/it-autoflight/input/fd1", func() {
|
||||||
Input.fd1Temp = Input.fd1.getBoolValue();
|
Input.fd1Temp = Input.fd1.getBoolValue();
|
||||||
if (Input.fd1Temp != Output.fd1.getBoolValue()) {
|
if (Input.fd1Temp != Output.fd1.getBoolValue()) {
|
||||||
ITAF.fd1Master(Input.fd1Temp);
|
ITAF.fd1Master(Input.fd1Temp);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setlistener("/it-autoflight/input/fd2", func {
|
setlistener("/it-autoflight/input/fd2", func() {
|
||||||
Input.fd2Temp = Input.fd2.getBoolValue();
|
Input.fd2Temp = Input.fd2.getBoolValue();
|
||||||
if (Input.fd2Temp != Output.fd2.getBoolValue()) {
|
if (Input.fd2Temp != Output.fd2.getBoolValue()) {
|
||||||
ITAF.fd2Master(Input.fd2Temp);
|
ITAF.fd2Master(Input.fd2Temp);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setlistener("/it-autoflight/input/kts-mach", func {
|
|
||||||
if (Input.ktsMach.getBoolValue()) {
|
setlistener("/it-autoflight/input/kts-mach", func() {
|
||||||
ITAF.syncMach();
|
if (Output.vert.getValue() == 7) { # Mach is not allowed in Mode 7, and don't sync
|
||||||
|
if (Input.ktsMach.getBoolValue()) {
|
||||||
|
Input.ktsMach.setBoolValue(0);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ITAF.syncKts();
|
if (Input.ktsMach.getBoolValue()) {
|
||||||
|
ITAF.syncMach();
|
||||||
|
} else {
|
||||||
|
ITAF.syncKts();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, 0, 0);
|
}, 0, 0);
|
||||||
|
|
||||||
setlistener("/it-autoflight/input/toga", func {
|
setlistener("/it-autoflight/input/toga", func() {
|
||||||
if (Input.toga.getBoolValue()) {
|
if (Input.toga.getBoolValue()) {
|
||||||
ITAF.takeoffGoAround();
|
ITAF.takeoffGoAround();
|
||||||
Input.toga.setBoolValue(0);
|
Input.toga.setBoolValue(0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setlistener("/it-autoflight/input/lat", func {
|
setlistener("/it-autoflight/input/lat", func() {
|
||||||
Input.latTemp = Input.lat.getValue();
|
Input.latTemp = Input.lat.getValue();
|
||||||
Output.ap1Temp = Output.ap1.getBoolValue();
|
Output.ap1Temp = Output.ap1.getBoolValue();
|
||||||
Output.ap2Temp = Output.ap2.getBoolValue();
|
Output.ap2Temp = Output.ap2.getBoolValue();
|
||||||
|
@ -1013,7 +1016,7 @@ setlistener("/it-autoflight/input/lat", func {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setlistener("/it-autoflight/input/vert", func {
|
setlistener("/it-autoflight/input/vert", func() {
|
||||||
if (!Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue() and (Output.ap1.getBoolValue() or Output.ap2.getBoolValue() or Output.fd1.getBoolValue() or Output.fd2.getBoolValue())) {
|
if (!Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue() and (Output.ap1.getBoolValue() or Output.ap2.getBoolValue() or Output.fd1.getBoolValue() or Output.fd2.getBoolValue())) {
|
||||||
ITAF.setVertMode(Input.vert.getValue());
|
ITAF.setVertMode(Input.vert.getValue());
|
||||||
} else {
|
} else {
|
||||||
|
@ -1021,16 +1024,16 @@ setlistener("/it-autoflight/input/vert", func {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setlistener("/sim/signals/fdm-initialized", func {
|
setlistener("/sim/signals/fdm-initialized", func() {
|
||||||
ITAF.init();
|
ITAF.init();
|
||||||
});
|
});
|
||||||
|
|
||||||
# For Canvas Nav Display.
|
# For Canvas Nav Display.
|
||||||
setlistener("/it-autoflight/input/hdg", func {
|
setlistener("/it-autoflight/input/hdg", func() {
|
||||||
setprop("/autopilot/settings/heading-bug-deg", Input.hdg.getValue());
|
setprop("/autopilot/settings/heading-bug-deg", Input.hdg.getValue());
|
||||||
}, 0, 0);
|
}, 0, 0);
|
||||||
|
|
||||||
setlistener("/it-autoflight/internal/alt", func {
|
setlistener("/it-autoflight/internal/alt", func() {
|
||||||
setprop("/autopilot/settings/target-altitude-ft", Internal.alt.getValue());
|
setprop("/autopilot/settings/target-altitude-ft", Internal.alt.getValue());
|
||||||
}, 0, 0);
|
}, 0, 0);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# A3XX FMGC/Autoflight
|
# A3XX FMGC/Autoflight
|
||||||
# Joshua Davidson (Octal450) and Jonathan Redpath (legoboyvdlp)
|
# Copyright (c) 2020 Josh Davidson (Octal450) and Jonathan Redpath (legoboyvdlp)
|
||||||
|
|
||||||
# Copyright (c) 2020 Josh Davidson (Octal450)
|
|
||||||
|
|
||||||
var at = nil;
|
var at = nil;
|
||||||
var athr = nil;
|
var athr = nil;
|
||||||
|
@ -284,38 +282,137 @@ var loopFMA_b = func {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Master Lateral
|
# Master FMA
|
||||||
setlistener("/it-autoflight/mode/lat", func {
|
var updateFma = {
|
||||||
latText = Text.lat.getValue();
|
lat: func() {
|
||||||
newlat = Modes.PFD.FMA.rollMode.getValue();
|
latText = Text.lat.getValue();
|
||||||
if (latText == "LNAV") {
|
newlat = Modes.PFD.FMA.rollMode.getValue();
|
||||||
if (newlat != "NAV") {
|
if (latText == "LNAV") {
|
||||||
Modes.PFD.FMA.rollMode.setValue("NAV");
|
if (newlat != "NAV") {
|
||||||
|
Modes.PFD.FMA.rollMode.setValue("NAV");
|
||||||
|
}
|
||||||
|
} else if (latText == "LOC") {
|
||||||
|
if (newlat != "LOC*" and newlat != "LOC") {
|
||||||
|
Modes.PFD.FMA.rollMode.setValue("LOC*");
|
||||||
|
locupdate.start();
|
||||||
|
}
|
||||||
|
} else if (latText == "ALGN") {
|
||||||
|
if (newlat != " ") {
|
||||||
|
Modes.PFD.FMA.rollMode.setValue(" ");
|
||||||
|
}
|
||||||
|
} else if (latText == "RLOU") {
|
||||||
|
if (newlat != " ") {
|
||||||
|
Modes.PFD.FMA.rollMode.setValue(" ");
|
||||||
|
}
|
||||||
|
} else if (latText == "T/O") {
|
||||||
|
if (newlat != "RWY") {
|
||||||
|
Modes.PFD.FMA.rollMode.setValue("RWY");
|
||||||
|
}
|
||||||
|
} else if (latText == "") {
|
||||||
|
if (newlat != " ") {
|
||||||
|
Modes.PFD.FMA.rollMode.setValue(" ");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (latText == "LOC") {
|
},
|
||||||
if (newlat != "LOC*" and newlat != "LOC") {
|
vert: func() {
|
||||||
Modes.PFD.FMA.rollMode.setValue("LOC*");
|
vertText = Text.vert.getValue();
|
||||||
locupdate.start();
|
newvert = Modes.PFD.FMA.pitchMode.getValue();
|
||||||
|
newvertarm = Modes.PFD.FMA.pitchMode2Armed.getValue();
|
||||||
|
if (vertText == "ALT HLD") {
|
||||||
|
altvert();
|
||||||
|
if (newvertarm != " ") {
|
||||||
|
Modes.PFD.FMA.pitchMode2Armed.setValue(" ");
|
||||||
|
}
|
||||||
|
} else if (vertText == "ALT CAP") {
|
||||||
|
altvert();
|
||||||
|
if (newvertarm != " ") {
|
||||||
|
Modes.PFD.FMA.pitchMode2Armed.setValue(" ");
|
||||||
|
}
|
||||||
|
} else if (vertText == "V/S") {
|
||||||
|
if (newvert != "V/S") {
|
||||||
|
Modes.PFD.FMA.pitchMode.setValue("V/S");
|
||||||
|
}
|
||||||
|
if (newvertarm != "ALT") {
|
||||||
|
Modes.PFD.FMA.pitchMode2Armed.setValue("ALT");
|
||||||
|
}
|
||||||
|
} else if (vertText == "G/S") {
|
||||||
|
if (newvert != "G/S*" and newvert != "G/S") {
|
||||||
|
Modes.PFD.FMA.pitchMode.setValue("G/S*");
|
||||||
|
gsupdate.start();
|
||||||
|
}
|
||||||
|
if (newvertarm != " ") {
|
||||||
|
Modes.PFD.FMA.pitchMode2Armed.setValue(" ");
|
||||||
|
}
|
||||||
|
} else if (vertText == "SPD CLB") {
|
||||||
|
if (newvert != "OP CLB") {
|
||||||
|
Modes.PFD.FMA.pitchMode.setValue("OP CLB");
|
||||||
|
}
|
||||||
|
if (newvertarm != "ALT") {
|
||||||
|
Modes.PFD.FMA.pitchMode2Armed.setValue("ALT");
|
||||||
|
}
|
||||||
|
} else if (vertText == "SPD DES") {
|
||||||
|
if (newvert != "OP DES") {
|
||||||
|
Modes.PFD.FMA.pitchMode.setValue("OP DES");
|
||||||
|
}
|
||||||
|
if (newvertarm != "ALT") {
|
||||||
|
Modes.PFD.FMA.pitchMode2Armed.setValue("ALT");
|
||||||
|
}
|
||||||
|
} else if (vertText == "FPA") {
|
||||||
|
if (newvert != "FPA") {
|
||||||
|
Modes.PFD.FMA.pitchMode.setValue("FPA");
|
||||||
|
}
|
||||||
|
if (newvertarm != "ALT") {
|
||||||
|
Modes.PFD.FMA.pitchMode2Armed.setValue("ALT");
|
||||||
|
}
|
||||||
|
} else if (vertText == "LAND") {
|
||||||
|
if (newvert != "LAND") {
|
||||||
|
Modes.PFD.FMA.pitchMode.setValue("LAND");
|
||||||
|
}
|
||||||
|
} else if (vertText == "FLARE") {
|
||||||
|
if (newvert != "FLARE") {
|
||||||
|
Modes.PFD.FMA.pitchMode.setValue("FLARE");
|
||||||
|
}
|
||||||
|
} else if (vertText == "ROLLOUT") {
|
||||||
|
if (newvert != "ROLL OUT") {
|
||||||
|
Modes.PFD.FMA.pitchMode.setValue("ROLL OUT");
|
||||||
|
}
|
||||||
|
} else if (vertText == "T/O CLB") {
|
||||||
|
if (newvert != "SRS") {
|
||||||
|
Modes.PFD.FMA.pitchMode.setValue("SRS");
|
||||||
|
}
|
||||||
|
updatePitchArm2();
|
||||||
|
} else if (vertText == "G/A CLB") {
|
||||||
|
if (newvert != "SRS") {
|
||||||
|
Modes.PFD.FMA.pitchMode.setValue("SRS");
|
||||||
|
}
|
||||||
|
if (newvertarm != "ALT") {
|
||||||
|
Modes.PFD.FMA.pitchMode2Armed.setValue("ALT");
|
||||||
|
}
|
||||||
|
} else if (vertText == "") {
|
||||||
|
if (newvert != " ") {
|
||||||
|
Modes.PFD.FMA.pitchMode.setValue(" ");
|
||||||
|
}
|
||||||
|
updatePitchArm2();
|
||||||
}
|
}
|
||||||
} else if (latText == "ALGN") {
|
altvert();
|
||||||
if (newlat != " ") {
|
},
|
||||||
Modes.PFD.FMA.rollMode.setValue(" ");
|
arm: func() {
|
||||||
|
if (Output.locArm.getBoolValue()) {
|
||||||
|
Modes.PFD.FMA.rollModeArmed.setValue("LOC");
|
||||||
|
} else if (Output.lnavArm.getBoolValue()) {
|
||||||
|
Modes.PFD.FMA.rollModeArmed.setValue("NAV");
|
||||||
|
} else {
|
||||||
|
Modes.PFD.FMA.rollModeArmed.setValue(" ");
|
||||||
}
|
}
|
||||||
} else if (latText == "RLOU") {
|
if (Output.apprArm.getBoolValue()) {
|
||||||
if (newlat != " ") {
|
Modes.PFD.FMA.pitchModeArmed.setValue("G/S");
|
||||||
Modes.PFD.FMA.rollMode.setValue(" ");
|
} else {
|
||||||
|
Modes.PFD.FMA.pitchModeArmed.setValue(" ");
|
||||||
}
|
}
|
||||||
} else if (latText == "T/O") {
|
},
|
||||||
if (newlat != "RWY") {
|
};
|
||||||
Modes.PFD.FMA.rollMode.setValue("RWY");
|
|
||||||
}
|
|
||||||
} else if (latText == " ") {
|
|
||||||
if (newlat != " ") {
|
|
||||||
Modes.PFD.FMA.rollMode.setValue(" ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
# Lateral Special
|
||||||
var locupdate = maketimer(0.5, func {
|
var locupdate = maketimer(0.5, func {
|
||||||
latText = Text.lat.getValue();
|
latText = Text.lat.getValue();
|
||||||
newlat = Modes.PFD.FMA.rollMode.getValue();
|
newlat = Modes.PFD.FMA.rollMode.getValue();
|
||||||
|
@ -330,90 +427,7 @@ var locupdate = maketimer(0.5, func {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
# Master Vertical
|
# Vertical Special
|
||||||
setlistener("/it-autoflight/mode/vert", func {
|
|
||||||
vertText = Text.vert.getValue();
|
|
||||||
newvert = Modes.PFD.FMA.pitchMode.getValue();
|
|
||||||
newvertarm = Modes.PFD.FMA.pitchMode2Armed.getValue();
|
|
||||||
if (vertText == "ALT HLD") {
|
|
||||||
altvert();
|
|
||||||
if (newvertarm != " ") {
|
|
||||||
Modes.PFD.FMA.pitchMode2Armed.setValue(" ");
|
|
||||||
}
|
|
||||||
} else if (vertText == "ALT CAP") {
|
|
||||||
altvert();
|
|
||||||
if (newvertarm != " ") {
|
|
||||||
Modes.PFD.FMA.pitchMode2Armed.setValue(" ");
|
|
||||||
}
|
|
||||||
} else if (vertText == "V/S") {
|
|
||||||
if (newvert != "V/S") {
|
|
||||||
Modes.PFD.FMA.pitchMode.setValue("V/S");
|
|
||||||
}
|
|
||||||
if (newvertarm != "ALT") {
|
|
||||||
Modes.PFD.FMA.pitchMode2Armed.setValue("ALT");
|
|
||||||
}
|
|
||||||
} else if (vertText == "G/S") {
|
|
||||||
if (newvert != "G/S*" and newvert != "G/S") {
|
|
||||||
Modes.PFD.FMA.pitchMode.setValue("G/S*");
|
|
||||||
gsupdate.start();
|
|
||||||
}
|
|
||||||
if (newvertarm != " ") {
|
|
||||||
Modes.PFD.FMA.pitchMode2Armed.setValue(" ");
|
|
||||||
}
|
|
||||||
} else if (vertText == "SPD CLB") {
|
|
||||||
if (newvert != "OP CLB") {
|
|
||||||
Modes.PFD.FMA.pitchMode.setValue("OP CLB");
|
|
||||||
}
|
|
||||||
if (newvertarm != "ALT") {
|
|
||||||
Modes.PFD.FMA.pitchMode2Armed.setValue("ALT");
|
|
||||||
}
|
|
||||||
} else if (vertText == "SPD DES") {
|
|
||||||
if (newvert != "OP DES") {
|
|
||||||
Modes.PFD.FMA.pitchMode.setValue("OP DES");
|
|
||||||
}
|
|
||||||
if (newvertarm != "ALT") {
|
|
||||||
Modes.PFD.FMA.pitchMode2Armed.setValue("ALT");
|
|
||||||
}
|
|
||||||
} else if (vertText == "FPA") {
|
|
||||||
if (newvert != "FPA") {
|
|
||||||
Modes.PFD.FMA.pitchMode.setValue("FPA");
|
|
||||||
}
|
|
||||||
if (newvertarm != "ALT") {
|
|
||||||
Modes.PFD.FMA.pitchMode2Armed.setValue("ALT");
|
|
||||||
}
|
|
||||||
} else if (vertText == "LAND") {
|
|
||||||
if (newvert != "LAND") {
|
|
||||||
Modes.PFD.FMA.pitchMode.setValue("LAND");
|
|
||||||
}
|
|
||||||
} else if (vertText == "FLARE") {
|
|
||||||
if (newvert != "FLARE") {
|
|
||||||
Modes.PFD.FMA.pitchMode.setValue("FLARE");
|
|
||||||
}
|
|
||||||
} else if (vertText == "ROLLOUT") {
|
|
||||||
if (newvert != "ROLL OUT") {
|
|
||||||
Modes.PFD.FMA.pitchMode.setValue("ROLL OUT");
|
|
||||||
}
|
|
||||||
} else if (vertText == "T/O CLB") {
|
|
||||||
if (newvert != "SRS") {
|
|
||||||
Modes.PFD.FMA.pitchMode.setValue("SRS");
|
|
||||||
}
|
|
||||||
updatePitchArm2();
|
|
||||||
} else if (vertText == "G/A CLB") {
|
|
||||||
if (newvert != "SRS") {
|
|
||||||
Modes.PFD.FMA.pitchMode.setValue("SRS");
|
|
||||||
}
|
|
||||||
if (newvertarm != "ALT") {
|
|
||||||
Modes.PFD.FMA.pitchMode2Armed.setValue("ALT");
|
|
||||||
}
|
|
||||||
} else if (vertText == " ") {
|
|
||||||
if (newvert != " ") {
|
|
||||||
Modes.PFD.FMA.pitchMode.setValue(" ");
|
|
||||||
}
|
|
||||||
updatePitchArm2();
|
|
||||||
}
|
|
||||||
altvert();
|
|
||||||
});
|
|
||||||
|
|
||||||
var updatePitchArm2 = func {
|
var updatePitchArm2 = func {
|
||||||
newvertarm = Modes.PFD.FMA.pitchMode2Armed.getValue();
|
newvertarm = Modes.PFD.FMA.pitchMode2Armed.getValue();
|
||||||
if (newvertarm != "CLB" and FMGCInternal.v2set) {
|
if (newvertarm != "CLB" and FMGCInternal.v2set) {
|
||||||
|
@ -465,53 +479,6 @@ var altvert = func {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Arm HDG or NAV
|
|
||||||
setlistener("/it-autoflight/mode/arm", func {
|
|
||||||
arm = Text.arm.getValue();
|
|
||||||
newarm = Modes.PFD.FMA.rollModeArmed.getValue();
|
|
||||||
if (arm == "HDG") {
|
|
||||||
if (newarm != "HDG") {
|
|
||||||
Modes.PFD.FMA.rollModeArmed.setValue(" ");
|
|
||||||
}
|
|
||||||
} else if (arm == "LNV") {
|
|
||||||
if (newarm != "NAV") {
|
|
||||||
Modes.PFD.FMA.rollModeArmed.setValue("NAV");
|
|
||||||
}
|
|
||||||
} else if (arm == " ") {
|
|
||||||
if (newarm != " ") {
|
|
||||||
Modes.PFD.FMA.rollModeArmed.setValue(" ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
# Arm LOC
|
|
||||||
setlistener("/it-autoflight/output/loc-armed", func {
|
|
||||||
newarm = Modes.PFD.FMA.rollModeArmed.getValue();
|
|
||||||
if (Output.locArm.getValue()) {
|
|
||||||
if (newarm != "LOC") {
|
|
||||||
Modes.PFD.FMA.rollModeArmed.setValue("LOC");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (newarm != " ") {
|
|
||||||
Modes.PFD.FMA.rollModeArmed.setValue(" ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
# Arm G/S
|
|
||||||
setlistener("/it-autoflight/output/appr-armed", func {
|
|
||||||
newvert2arm = Modes.PFD.FMA.pitchModeArmed.getValue();
|
|
||||||
if (Output.apprArm.getValue()) {
|
|
||||||
if (newvert2arm != "G/S") {
|
|
||||||
Modes.PFD.FMA.pitchModeArmed.setValue("G/S");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (newvert2arm != " ") {
|
|
||||||
Modes.PFD.FMA.pitchModeArmed.setValue(" ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
# AP
|
# AP
|
||||||
var ap = func {
|
var ap = func {
|
||||||
ap1 = Output.ap1.getValue();
|
ap1 = Output.ap1.getValue();
|
||||||
|
|
|
@ -613,7 +613,7 @@ 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
|
if ((n1_left < 85 or n1_right < 85) and gs < 90 and mode == "" and gear0 and FMGCInternal.phase == 1) { # rejected takeoff
|
||||||
FMGCInternal.phase = 0;
|
FMGCInternal.phase = 0;
|
||||||
systems.PNEU.pressMode.setValue("GN");
|
systems.PNEU.pressMode.setValue("GN");
|
||||||
}
|
}
|
||||||
|
@ -1025,7 +1025,7 @@ var ManagedSPD = maketimer(0.25, func {
|
||||||
FMGCInternal.machSwitchover = 0;
|
FMGCInternal.machSwitchover = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mode == " " or mode == "SRS") and (FMGCInternal.phase == 0 or FMGCInternal.phase == 1)) {
|
if ((mode == "" or mode == "SRS") and (FMGCInternal.phase == 0 or FMGCInternal.phase == 1)) {
|
||||||
if (FMGCInternal.mngKtsMach) {
|
if (FMGCInternal.mngKtsMach) {
|
||||||
FMGCInternal.mngKtsMach = 0;
|
FMGCInternal.mngKtsMach = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue