A3XX: Fix FMGC altitude selector in various conditions, fix FMA issues

This commit is contained in:
Joshua Davidson 2017-11-15 11:17:01 -05:00
parent 086e26daa6
commit a677268556
2 changed files with 52 additions and 50 deletions

View file

@ -93,6 +93,7 @@ setlistener("/it-autoflight/input/ap1", func {
setprop("/it-autoflight/sound/apoffsound", 1); setprop("/it-autoflight/sound/apoffsound", 1);
setprop("/it-autoflight/sound/enableapoffsound", 0); setprop("/it-autoflight/sound/enableapoffsound", 0);
} }
updateTimers();
} else if (apmas == 1 and ac_ess >= 110 and law == 0) { } else if (apmas == 1 and ac_ess >= 110 and law == 0) {
if ((getprop("/gear/gear[1]/wow") == 0) and (getprop("/gear/gear[2]/wow") == 0)) { if ((getprop("/gear/gear[1]/wow") == 0) and (getprop("/gear/gear[2]/wow") == 0)) {
if (getprop("/it-autoflight/output/lat") == 9) { if (getprop("/it-autoflight/output/lat") == 9) {
@ -125,6 +126,7 @@ setlistener("/it-autoflight/input/ap2", func {
setprop("/it-autoflight/sound/apoffsound2", 1); setprop("/it-autoflight/sound/apoffsound2", 1);
setprop("/it-autoflight/sound/enableapoffsound2", 0); setprop("/it-autoflight/sound/enableapoffsound2", 0);
} }
updateTimers();
} else if (apmas == 1 and ac_ess >= 110 and law == 0) { } else if (apmas == 1 and ac_ess >= 110 and law == 0) {
if ((getprop("/gear/gear[1]/wow") == 0) and (getprop("/gear/gear[2]/wow") == 0)) { if ((getprop("/gear/gear[1]/wow") == 0) and (getprop("/gear/gear[2]/wow") == 0)) {
if (getprop("/it-autoflight/output/lat") == 9) { if (getprop("/it-autoflight/output/lat") == 9) {
@ -162,6 +164,7 @@ setlistener("/it-autoflight/input/fd1", func {
if (fdmas == 0) { if (fdmas == 0) {
fmabox(); fmabox();
setprop("/it-autoflight/output/fd1", 0); setprop("/it-autoflight/output/fd1", 0);
updateTimers();
} else if (fdmas == 1) { } else if (fdmas == 1) {
fmabox(); fmabox();
setprop("/it-autoflight/output/fd1", 1); setprop("/it-autoflight/output/fd1", 1);
@ -174,6 +177,7 @@ setlistener("/it-autoflight/input/fd2", func {
if (fdmas == 0) { if (fdmas == 0) {
fmabox(); fmabox();
setprop("/it-autoflight/output/fd2", 0); setprop("/it-autoflight/output/fd2", 0);
updateTimers();
} else if (fdmas == 1) { } else if (fdmas == 1) {
fmabox(); fmabox();
setprop("/it-autoflight/output/fd2", 1); setprop("/it-autoflight/output/fd2", 1);
@ -651,6 +655,11 @@ var toga_reduc = func {
# Altitude Capture and FPA Timer Logic # Altitude Capture and FPA Timer Logic
setlistener("/it-autoflight/output/vert", func { setlistener("/it-autoflight/output/vert", func {
updateTimers();
});
var updateTimers = func {
if (getprop("/it-autoflight/output/fd1") == 1 or getprop("/it-autoflight/output/fd2") == 1 or getprop("/it-autoflight/output/ap1") == 1 or getprop("/it-autoflight/output/ap2") == 1) {
var vertm = getprop("/it-autoflight/output/vert"); var vertm = getprop("/it-autoflight/output/vert");
if (vertm == 1) { if (vertm == 1) {
altcaptt.start(); altcaptt.start();
@ -666,11 +675,18 @@ setlistener("/it-autoflight/output/vert", func {
} else if (vertm == 8) { } else if (vertm == 8) {
altcaptt.stop(); altcaptt.stop();
fpa_calct.stop(); fpa_calct.stop();
} else if (vertm == 9) {
altcaptt.start();
fpa_calct.stop();
} else { } else {
altcaptt.stop(); altcaptt.stop();
fpa_calct.stop(); fpa_calct.stop();
} }
}); } else {
altcaptt.start();
fpa_calct.stop();
}
}
# Altitude Capture # Altitude Capture
var altcapt = func { var altcapt = func {
@ -700,6 +716,7 @@ var altcapt = func {
setprop("/it-autoflight/internal/captvs", 1500); setprop("/it-autoflight/internal/captvs", 1500);
setprop("/it-autoflight/internal/captvsneg", -1500); setprop("/it-autoflight/internal/captvsneg", -1500);
} }
if (getprop("/it-autoflight/output/fd1") == 1 or getprop("/it-autoflight/output/fd2") == 1 or getprop("/it-autoflight/output/ap1") == 1 or getprop("/it-autoflight/output/ap2") == 1) {
var calt = getprop("/instrumentation/altimeter/indicated-altitude-ft"); var calt = getprop("/instrumentation/altimeter/indicated-altitude-ft");
var alt = getprop("/it-autoflight/internal/alt"); var alt = getprop("/it-autoflight/internal/alt");
var dif = calt - alt; var dif = calt - alt;
@ -714,6 +731,7 @@ var altcapt = func {
setprop("/it-autoflight/mode/thr", "THRUST"); setprop("/it-autoflight/mode/thr", "THRUST");
} }
} }
}
var altinput = getprop("/it-autoflight/input/alt"); var altinput = getprop("/it-autoflight/input/alt");
setprop("/it-autoflight/internal/alt", altinput); setprop("/it-autoflight/internal/alt", altinput);
} }
@ -1206,4 +1224,3 @@ var mng_altcaptt = maketimer(0.5, mng_altcapt);
var mng_minmaxt = maketimer(0.5, mng_minmax); var mng_minmaxt = maketimer(0.5, mng_minmax);
var mng_des_fpmt = maketimer(0.5, mng_des_fpm); var mng_des_fpmt = maketimer(0.5, mng_des_fpm);
var mng_des_todt = maketimer(0.5, mng_des_tod); var mng_des_todt = maketimer(0.5, mng_des_tod);

View file

@ -534,38 +534,23 @@ var boxchk = func {
var boxchk_b = func { var boxchk_b = func {
var newlat = getprop("/modes/pfd/fma/roll-mode"); var newlat = getprop("/modes/pfd/fma/roll-mode");
if (newlat != " ") { if (newlat != " ") {
setprop("/modes/pfd/fma/roll-mode-box", 1); setprop("/modes/pfd/fma/roll-mode-time", getprop("/sim/time/elapsed-sec"));
settimer(func {
setprop("/modes/pfd/fma/roll-mode-box", 0);
}, 5);
} }
var newvert = getprop("/modes/pfd/fma/pitch-mode"); var newvert = getprop("/modes/pfd/fma/pitch-mode");
if (newvert != " ") { if (newvert != " ") {
setprop("/modes/pfd/fma/pitch-mode-box", 1); setprop("/modes/pfd/fma/pitch-mode-time", getprop("/sim/time/elapsed-sec"));
settimer(func {
setprop("/modes/pfd/fma/pitch-mode-box", 0);
}, 5);
} }
var newarmr = getprop("/modes/pfd/fma/roll-mode-armed"); var newarmr = getprop("/modes/pfd/fma/roll-mode-armed");
if (newarmr != " ") { if (newarmr != " ") {
setprop("/modes/pfd/fma/roll-mode-armed-box", 1); setprop("/modes/pfd/fma/roll-mode-armed-time", getprop("/sim/time/elapsed-sec"));
settimer(func {
setprop("/modes/pfd/fma/roll-mode-armed-box", 0);
}, 5);
} }
var newarmp = getprop("/modes/pfd/fma/pitch-mode-armed"); var newarmp = getprop("/modes/pfd/fma/pitch-mode-armed");
if (newarmp != " ") { if (newarmp != " ") {
setprop("/modes/pfd/fma/pitch-mode-armed-box", 1); setprop("/modes/pfd/fma/pitch-mode-armed-time", getprop("/sim/time/elapsed-sec"));
settimer(func {
setprop("/modes/pfd/fma/pitch-mode-armed-box", 0);
}, 5);
} }
var newarmp2 = getprop("/modes/pfd/fma/pitch-mode2-armed"); var newarmp2 = getprop("/modes/pfd/fma/pitch-mode2-armed");
if (newarmp2 != " ") { if (newarmp2 != " ") {
setprop("/modes/pfd/fma/pitch-mode2-armed-box", 1); setprop("/modes/pfd/fma/pitch-mode2-armed-time", getprop("/sim/time/elapsed-sec"));
settimer(func {
setprop("/modes/pfd/fma/pitch-mode2-armed-box", 0);
}, 5);
} }
} }