System: New autopilot controller based on IT-AUTOFLIGHT V4 -- needs more testing and possibly fixing
This commit is contained in:
parent
b1f7290ca6
commit
18720ea36b
6 changed files with 977 additions and 1373 deletions
|
@ -3226,7 +3226,7 @@
|
|||
<value>1</value>
|
||||
</equals>
|
||||
<equals>
|
||||
<property>it-autoflight/input/lat-arm</property>
|
||||
<property>it-autoflight/output/lnav-armed</property>
|
||||
<value>1</value>
|
||||
</equals>
|
||||
</or>
|
||||
|
|
2259
Nasal/FMGC-b.nas
2259
Nasal/FMGC-b.nas
File diff suppressed because it is too large
Load diff
|
@ -33,7 +33,7 @@ setprop("/modes/pfd/fma/roll-mode-armed-time", 0);
|
|||
setprop("/modes/pfd/fma/ap-mode-time", 0);
|
||||
setprop("/modes/pfd/fma/fd-mode-time", 0);
|
||||
setprop("/modes/pfd/fma/athr-mode-time", 0);
|
||||
setprop("/modes/fcu/hdg-time", 0);
|
||||
setprop("/modes/fcu/hdg-time", -45);
|
||||
|
||||
setlistener("sim/signals/fdm-initialized", func {
|
||||
loopFMA.start();
|
||||
|
@ -126,20 +126,17 @@ var loopFMA = maketimer(0.05, func {
|
|||
if (((state1 == "TOGA" or state2 == "TOGA") or (flx == 1 and (state1 == "MCT" or state2 == "MCT")) or (flx == 1 and ((state1 == "MAN THR" and thr1 >= 0.83) or (state2 == "MAN THR" and thr2 >= 0.83)))) and (engstate1 == 3 or engstate2 == 3)) {
|
||||
# RWY Engagement would go here, but automatic ILS selection is not simulated yet.
|
||||
if (wow and getprop("/FMGC/internal/v2-set") == 1 and getprop("/it-autoflight/output/vert") != 7) {
|
||||
setprop("/it-autoflight/input/vert", 7);
|
||||
ITAF.setVertMode(7);
|
||||
setprop("/it-autoflight/mode/vert", "T/O CLB");
|
||||
fmgc.vertical();
|
||||
}
|
||||
} else {
|
||||
var gear1 = getprop("/gear/gear[1]/wow");
|
||||
var gear2 = getprop("/gear/gear[2]/wow");
|
||||
if (getprop("/it-autoflight/input/lat") == 5 and (gear1 or gear2)) {
|
||||
setprop("/it-autoflight/input/lat", 9);
|
||||
fmgc.lateral();
|
||||
ITAF.setLatMode(9);
|
||||
}
|
||||
if (getprop("/it-autoflight/output/vert") == 7 and (gear1 or gear2)) {
|
||||
setprop("/it-autoflight/input/vert", 9);
|
||||
fmgc.vertical();
|
||||
ITAF.setVertMode(9);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -201,13 +198,6 @@ var loopFMA = maketimer(0.05, func {
|
|||
} else {
|
||||
setprop("/modes/pfd/fma/pitch-mode2-armed-box", 0);
|
||||
}
|
||||
|
||||
# Preselect HDG
|
||||
if (getprop("/modes/fcu/hdg-time") + 45 >= elapsedtime) {
|
||||
setprop("/it-autoflight/custom/show-hdg", 1);
|
||||
} else if (getprop("/it-autoflight/output/lat") != 0 and getprop("/it-autoflight/output/lat") != 5 and getprop("/it-autoflight/output/lat") != 9) {
|
||||
setprop("/it-autoflight/custom/show-hdg", 0);
|
||||
}
|
||||
});
|
||||
|
||||
var loopFMA_b = func {
|
||||
|
@ -344,34 +334,6 @@ setlistener("/it-autoflight/mode/vert", func {
|
|||
if (newvertarm != "ALT") {
|
||||
setprop("/modes/pfd/fma/pitch-mode2-armed", "ALT");
|
||||
}
|
||||
} else if (vert == "MNG HLD") {
|
||||
if (newvert != "ALT") {
|
||||
setprop("/modes/pfd/fma/pitch-mode", "ALT");
|
||||
}
|
||||
if (newvertarm != " ") {
|
||||
setprop("/modes/pfd/fma/pitch-mode2-armed", " ");
|
||||
}
|
||||
} else if (vert == "MNG CAP") {
|
||||
if (newvert != "ALT*") {
|
||||
setprop("/modes/pfd/fma/pitch-mode", "ALT*");
|
||||
}
|
||||
if (newvertarm != " ") {
|
||||
setprop("/modes/pfd/fma/pitch-mode2-armed", " ");
|
||||
}
|
||||
} else if (vert == "MNG CLB") {
|
||||
if (newvert != "CLB") {
|
||||
setprop("/modes/pfd/fma/pitch-mode", "CLB");
|
||||
}
|
||||
if (newvertarm != "ALT") {
|
||||
setprop("/modes/pfd/fma/pitch-mode2-armed", "ALT");
|
||||
}
|
||||
} else if (vert == "MNG DES") {
|
||||
if (newvert != "DES") {
|
||||
setprop("/modes/pfd/fma/pitch-mode", "DES");
|
||||
}
|
||||
if (newvertarm != "ALT") {
|
||||
setprop("/modes/pfd/fma/pitch-mode2-armed", "ALT");
|
||||
}
|
||||
} else if (vert == " ") {
|
||||
if (newvert != " ") {
|
||||
setprop("/modes/pfd/fma/pitch-mode", " ");
|
||||
|
@ -532,21 +494,7 @@ var at = func {
|
|||
}
|
||||
|
||||
var boxchk = func {
|
||||
var ap1 = getprop("/it-autoflight/output/ap1");
|
||||
var ap2 = getprop("/it-autoflight/output/ap2");
|
||||
var fd1 = getprop("/it-autoflight/output/fd1");
|
||||
var fd2 = getprop("/it-autoflight/output/fd2");
|
||||
var fma_pwr = getprop("/it-autoflight/output/fma-pwr");
|
||||
if (ap1 and !ap2 and !fd1 and !fd2 and !fma_pwr) {
|
||||
setprop("/it-autoflight/input/lat", 3);
|
||||
boxchk_b();
|
||||
} else if (!ap1 and ap2 and !fd1 and !fd2 and !fma_pwr) {
|
||||
setprop("/it-autoflight/input/lat", 3);
|
||||
boxchk_b();
|
||||
} else if (!ap1 and !ap2 and fd1 and !fd2 and !fma_pwr) {
|
||||
setprop("/it-autoflight/input/lat", 3);
|
||||
boxchk_b();
|
||||
} else if (!ap1 and !ap2 and !fd1 and fd2 and !fma_pwr) {
|
||||
if ((getprop("/it-autoflight/output/ap1") or getprop("/it-autoflight/output/ap2") or getprop("/it-autoflight/output/fd1") or getprop("/it-autoflight/output/fd2")) and getprop("/it-autoflight/output/fma-pwr") == 0) {
|
||||
setprop("/it-autoflight/input/lat", 3);
|
||||
boxchk_b();
|
||||
}
|
||||
|
|
|
@ -300,7 +300,7 @@ var reset_FMGC = func {
|
|||
spd = getprop("/it-autoflight/input/spd-kts");
|
||||
hdg = getprop("/it-autoflight/input/hdg");
|
||||
alt = getprop("/it-autoflight/input/alt");
|
||||
APinit();
|
||||
ITAF.init();
|
||||
FMGCinit();
|
||||
mcdu.MCDU_reset(0);
|
||||
mcdu.MCDU_reset(1);
|
||||
|
@ -353,9 +353,6 @@ var various2 = maketimer(0.5, func {
|
|||
nav3();
|
||||
adf0();
|
||||
adf1();
|
||||
if (getprop("/it-autoflight/output/lat") == 0) {
|
||||
setprop("/it-autoflight/custom/show-hdg", 1);
|
||||
}
|
||||
});
|
||||
|
||||
var nav0 = func {
|
||||
|
|
|
@ -52,7 +52,7 @@ var variousReset = func {
|
|||
setprop("/controls/lighting/DU/du6", 1);
|
||||
setprop("/controls/lighting/DU/mcdu1", 1);
|
||||
setprop("/controls/lighting/DU/mcdu2", 1);
|
||||
setprop("/modes/fcu/hdg-time", 0);
|
||||
setprop("/modes/fcu/hdg-time", -45);
|
||||
setprop("/controls/switching/ATTHDG", 0);
|
||||
setprop("/controls/switching/AIRDATA", 0);
|
||||
setprop("/controls/switches/no-smoking-sign", 1);
|
||||
|
@ -358,10 +358,8 @@ var APPanel = {
|
|||
if (fd1.getBoolValue() or fd2.getBoolValue() or ap1.getBoolValue() or ap2.getBoolValue()) {
|
||||
if (latMode.getValue() == 0 or !showHDG.getBoolValue()) {
|
||||
setprop("/it-autoflight/input/lat", 3);
|
||||
showHDG.setBoolValue(1);
|
||||
} else {
|
||||
setprop("/it-autoflight/input/lat", 0);
|
||||
showHDG.setBoolValue(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -399,26 +397,26 @@ var APPanel = {
|
|||
if (latMode.getValue() == 2) {
|
||||
setprop("/it-autoflight/input/lat", 0);
|
||||
} else {
|
||||
fmgc.disarmLOC();
|
||||
fmgc.ITAF.disarmLOC();
|
||||
}
|
||||
if (vertTemp == 2 or vertTemp == 6) {
|
||||
me.VSPull();
|
||||
} else {
|
||||
fmgc.disarmGS();
|
||||
fmgc.ITAF.disarmGS();
|
||||
}
|
||||
} else {
|
||||
setprop("/it-autoflight/input/lat", 2);
|
||||
if (vertTemp == 2 or vertTemp == 6) {
|
||||
me.VSPull();
|
||||
} else {
|
||||
fmgc.disarmGS();
|
||||
fmgc.ITAF.disarmGS();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
TRKFPA: func() {
|
||||
if (dcEss.getValue() >= 25) {
|
||||
fmgc.toggle_trkfpa();
|
||||
fmgc.ITAF.toggleTrkFpa();
|
||||
}
|
||||
},
|
||||
ALTPush: func() {
|
||||
|
@ -535,12 +533,12 @@ var APPanel = {
|
|||
if (latMode.getValue() == 2) {
|
||||
setprop("/it-autoflight/input/lat", 0);
|
||||
} else {
|
||||
fmgc.disarmLOC();
|
||||
fmgc.ITAF.disarmLOC();
|
||||
}
|
||||
if (vertTemp == 2 or vertTemp == 6) {
|
||||
me.VSPull();
|
||||
} else {
|
||||
fmgc.disarmGS();
|
||||
fmgc.ITAF.disarmGS();
|
||||
}
|
||||
} else {
|
||||
setprop("/it-autoflight/input/vert", 2);
|
||||
|
|
|
@ -192,7 +192,7 @@ var systemsInit = func {
|
|||
systems.fire_init();
|
||||
systems.autobrake_init();
|
||||
fadec.FADEC.init();
|
||||
fmgc.APinit();
|
||||
fmgc.ITAF.init();
|
||||
fmgc.FMGCinit();
|
||||
mcdu.MCDU_init(0);
|
||||
mcdu.MCDU_init(1);
|
||||
|
@ -235,10 +235,6 @@ var systemsLoop = maketimer(0.1, func {
|
|||
setprop("/systems/shake/effect", 0);
|
||||
}
|
||||
|
||||
if (getprop("/it-autoflight/custom/show-hdg") == 0 and getprop("/it-autoflight/output/lat") != 4) {
|
||||
setprop("/it-autoflight/input/hdg", math.round(getprop("/instrumentation/pfd/heading-scale")));
|
||||
}
|
||||
|
||||
if (getprop("/instrumentation/mk-viii/inputs/discretes/momentary-flap-all-override") == 1 or (getprop("/instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override") == 1 and getprop("/controls/flight/flap-pos") >= 4)) {
|
||||
setprop("/instrumentation/mk-viii/inputs/discretes/momentary-flap-override", 1);
|
||||
} else {
|
||||
|
|
Reference in a new issue