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,26 +655,38 @@ 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 {
var vertm = getprop("/it-autoflight/output/vert"); updateTimers();
if (vertm == 1) { });
altcaptt.start();
fpa_calct.stop(); var updateTimers = func {
} else if (vertm == 4) { 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) {
altcaptt.start(); var vertm = getprop("/it-autoflight/output/vert");
fpa_calct.stop(); if (vertm == 1) {
} else if (vertm == 5) { altcaptt.start();
altcaptt.start(); fpa_calct.stop();
} else if (vertm == 7) { } else if (vertm == 4) {
altcaptt.start(); altcaptt.start();
fpa_calct.stop(); fpa_calct.stop();
} else if (vertm == 8) { } else if (vertm == 5) {
altcaptt.stop(); altcaptt.start();
fpa_calct.stop(); } else if (vertm == 7) {
altcaptt.start();
fpa_calct.stop();
} else if (vertm == 8) {
altcaptt.stop();
fpa_calct.stop();
} else if (vertm == 9) {
altcaptt.start();
fpa_calct.stop();
} else {
altcaptt.stop();
fpa_calct.stop();
}
} else { } else {
altcaptt.stop(); altcaptt.start();
fpa_calct.stop(); fpa_calct.stop();
} }
}); }
# Altitude Capture # Altitude Capture
var altcapt = func { var altcapt = func {
@ -700,18 +716,20 @@ 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);
} }
var calt = getprop("/instrumentation/altimeter/indicated-altitude-ft"); 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 alt = getprop("/it-autoflight/internal/alt"); var calt = getprop("/instrumentation/altimeter/indicated-altitude-ft");
var dif = calt - alt; var alt = getprop("/it-autoflight/internal/alt");
if (dif < getprop("/it-autoflight/internal/captvs") and dif > getprop("/it-autoflight/internal/captvsneg")) { var dif = calt - alt;
if (vsnow > 0 and dif < 0) { if (dif < getprop("/it-autoflight/internal/captvs") and dif > getprop("/it-autoflight/internal/captvsneg")) {
setprop("/it-autoflight/input/vert", 3); if (vsnow > 0 and dif < 0) {
setprop("/it-autoflight/output/thr-mode", 0); setprop("/it-autoflight/input/vert", 3);
setprop("/it-autoflight/mode/thr", "THRUST"); setprop("/it-autoflight/output/thr-mode", 0);
} else if (vsnow < 0 and dif > 0) { setprop("/it-autoflight/mode/thr", "THRUST");
setprop("/it-autoflight/input/vert", 3); } else if (vsnow < 0 and dif > 0) {
setprop("/it-autoflight/output/thr-mode", 0); setprop("/it-autoflight/input/vert", 3);
setprop("/it-autoflight/mode/thr", "THRUST"); setprop("/it-autoflight/output/thr-mode", 0);
setprop("/it-autoflight/mode/thr", "THRUST");
}
} }
} }
var altinput = getprop("/it-autoflight/input/alt"); var altinput = getprop("/it-autoflight/input/alt");
@ -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);
} }
} }