1
0
Fork 0

Flight num, crz level, crz temp, tropo

This commit is contained in:
legoboyvdlp R 2020-07-10 01:09:19 +01:00
parent d77bc7dcdd
commit 79dae58581
12 changed files with 324 additions and 305 deletions

View file

@ -101,8 +101,6 @@ var vor1CRS = props.globals.getNode("/instrumentation/nav[2]/radials/selected-de
var vor2CRS = props.globals.getNode("/instrumentation/nav[3]/radials/selected-deg", 1); var vor2CRS = props.globals.getNode("/instrumentation/nav[3]/radials/selected-deg", 1);
# INT-A # INT-A
var flightNum = props.globals.getNode("/MCDUC/flight-num", 1);
var flightNumSet = props.globals.getNode("/MCDUC/flight-num-set", 1);
var depArpt = props.globals.getNode("/FMGC/internal/dep-arpt", 1); var depArpt = props.globals.getNode("/FMGC/internal/dep-arpt", 1);
var arrArpt = props.globals.getNode("/FMGC/internal/arr-arpt", 1); var arrArpt = props.globals.getNode("/FMGC/internal/arr-arpt", 1);
var toFromSet = props.globals.getNode("/FMGC/internal/tofrom-set", 1); var toFromSet = props.globals.getNode("/FMGC/internal/tofrom-set", 1);
@ -110,12 +108,6 @@ var alt_airport = props.globals.getNode("/FMGC/internal/alt-airport", 1);
var altSet = props.globals.getNode("/FMGC/internal/alt-set", 1); var altSet = props.globals.getNode("/FMGC/internal/alt-set", 1);
var costIndex = props.globals.getNode("/FMGC/internal/cost-index", 1); var costIndex = props.globals.getNode("/FMGC/internal/cost-index", 1);
var costIndexSet = props.globals.getNode("/FMGC/internal/cost-index-set", 1); var costIndexSet = props.globals.getNode("/FMGC/internal/cost-index-set", 1);
var cruiseFL = props.globals.getNode("/FMGC/internal/cruise-fl", 1);
var cruiseSet = props.globals.getNode("/FMGC/internal/cruise-lvl-set", 1);
var cruiseTemp = props.globals.getNode("/FMGC/internal/cruise-temp", 1);
var cruiseTempSet = props.globals.getNode("/FMGC/internal/cruise-temp-set", 1);
var tropo = props.globals.getNode("/FMGC/internal/tropo", 1);
var tropoSet = props.globals.getNode("/FMGC/internal/tropo-set", 1);
var gndtemp = props.globals.getNode("/FMGC/internal/gndtemp", 1); var gndtemp = props.globals.getNode("/FMGC/internal/gndtemp", 1);
var gndtempSet = props.globals.getNode("/FMGC/internal/gndtemp-set", 1); var gndtempSet = props.globals.getNode("/FMGC/internal/gndtemp-set", 1);
var ADIRSMCDUBTN = props.globals.getNode("/controls/adirs/mcducbtn", 1); var ADIRSMCDUBTN = props.globals.getNode("/controls/adirs/mcducbtn", 1);
@ -171,9 +163,6 @@ var fffq_sensor = props.globals.getNode("/FMGC/internal/fffq-sensor", 1);
var gw = props.globals.getNode("/FMGC/internal/fuel-pred-gw", 1); var gw = props.globals.getNode("/FMGC/internal/fuel-pred-gw", 1);
var cg = props.globals.getNode("/FMGC/internal/cg", 1); var cg = props.globals.getNode("/FMGC/internal/cg", 1);
# PROG
var cruiseFL_prog = props.globals.getNode("/FMGC/internal/cruise-fl-prog", 1);
# PERF # PERF
var altitude = props.globals.getNode("/instrumentation/altimeter/indicated-altitude-ft", 1); var altitude = props.globals.getNode("/instrumentation/altimeter/indicated-altitude-ft", 1);
@ -359,8 +348,8 @@ var canvas_MCDU_base = {
if (myFpln[i] != nil) { if (myFpln[i] != nil) {
if (flightNumSet.getValue()) { if (fmgc.FMGCInternal.flightNumSet) {
me["FPLN_Callsign"].setText(flightNum.getValue()); me["FPLN_Callsign"].setText(fmgc.FMGCInternal.flightNum);
me["FPLN_Callsign"].show(); me["FPLN_Callsign"].show();
} else { } else {
me["FPLN_Callsign"].hide(); me["FPLN_Callsign"].hide();
@ -1095,13 +1084,14 @@ var canvas_MCDU_base = {
pageSwitch[i].setBoolValue(1); pageSwitch[i].setBoolValue(1);
} }
if (flightNumSet.getValue() == 1) { if (fmgc.FMGCInternal.flightNumSet) {
me["INITA_FltNbr"].hide(); me["INITA_FltNbr"].hide();
me["Simple_L3"].show(); me["Simple_L3"].show();
} else { } else {
me["INITA_FltNbr"].show(); me["INITA_FltNbr"].show();
me["Simple_L3"].hide(); me["Simple_L3"].hide();
} }
if (toFromSet.getValue() != 1 and costIndexSet.getValue() != 1) { if (toFromSet.getValue() != 1 and costIndexSet.getValue() != 1) {
me["INITA_CostIndex"].hide(); me["INITA_CostIndex"].hide();
me["Simple_L5"].setColor(1,1,1); me["Simple_L5"].setColor(1,1,1);
@ -1116,20 +1106,20 @@ var canvas_MCDU_base = {
me["INITA_CostIndex"].show(); me["INITA_CostIndex"].show();
me["Simple_L5"].hide(); me["Simple_L5"].hide();
} }
if (toFromSet.getValue() != 1 and cruiseSet.getValue() != 1) { if (toFromSet.getValue() != 1 and !fmgc.FMGCInternal.crzSet) {
me["INITA_CruiseFLTemp"].hide(); me["INITA_CruiseFLTemp"].hide();
me["Simple_L6"].setColor(1,1,1); me["Simple_L6"].setColor(1,1,1);
me["Simple_L6"].setText("-----/---g"); me["Simple_L6"].setText("-----/---g");
} else if (cruiseSet.getValue() == 1 and cruiseTempSet.getValue() == 1) { } else if (fmgc.FMGCInternal.crzSet and fmgc.FMGCInternal.crzTempSet) {
me["INITA_CruiseFLTemp"].hide(); me["INITA_CruiseFLTemp"].hide();
me["Simple_L6"].setColor(0.0901,0.6039,0.7176); me["Simple_L6"].setColor(0.0901,0.6039,0.7176);
me["Simple_L6"].setText(sprintf("%s", "FL" ~ cruiseFL.getValue()) ~ sprintf("/%sg", cruiseTemp.getValue())); me["Simple_L6"].setText(sprintf("%s", "FL" ~ fmgc.FMGCInternal.crzFl) ~ sprintf("/%sg", fmgc.FMGCInternal.crzTemp));
} else if (cruiseSet.getValue() == 1) { } else if (fmgc.FMGCInternal.crzSet) {
me["INITA_CruiseFLTemp"].hide(); me["INITA_CruiseFLTemp"].hide();
me["Simple_L6"].setColor(0.0901,0.6039,0.7176); me["Simple_L6"].setColor(0.0901,0.6039,0.7176);
setprop("/FMGC/internal/cruise-temp", 15 - (2 * cruiseFL.getValue() / 10)); fmgc.FMGCInternal.crzTemp = 15 - (2 * fmgc.FMGCInternal.crzFl / 10);
setprop("/FMGC/internal/cruise-temp-set", 1); fmgc.FMGCInternal.crzTempSet = 1;
me["Simple_L6"].setText(sprintf("%s", "FL" ~ cruiseFL.getValue()) ~ sprintf("/%sg", cruiseTemp.getValue())); me["Simple_L6"].setText(sprintf("%s", "FL" ~ fmgc.FMGCInternal.crzFl) ~ sprintf("/%sg", fmgc.FMGCInternal.crzTemp));
} else { } else {
me["INITA_CruiseFLTemp"].show(); me["INITA_CruiseFLTemp"].show();
me["Simple_L6"].setColor(0.7333,0.3803,0); me["Simple_L6"].setColor(0.7333,0.3803,0);
@ -1167,7 +1157,7 @@ var canvas_MCDU_base = {
me["Simple_R3"].setColor(WHITE); me["Simple_R3"].setColor(WHITE);
me.showRightArrow(0, 0, 1, 0, 0, 0); me.showRightArrow(0, 0, 1, 0, 0, 0);
} }
if (tropoSet.getValue() == 1) { if (fmgc.FMGCInternal.tropoSet) {
me["Simple_R5"].setFontSize(normal); me["Simple_R5"].setFontSize(normal);
} else { } else {
me["Simple_R5"].setFontSize(small); me["Simple_R5"].setFontSize(small);
@ -1193,7 +1183,7 @@ var canvas_MCDU_base = {
me["Simple_L5S"].setText("COST INDEX"); me["Simple_L5S"].setText("COST INDEX");
me["Simple_L6S"].setText("CRZ FL/TEMP"); me["Simple_L6S"].setText("CRZ FL/TEMP");
me["Simple_L1"].setText("NONE"); me["Simple_L1"].setText("NONE");
me["Simple_L3"].setText(sprintf("%s", flightNum.getValue())); me["Simple_L3"].setText(sprintf("%s", fmgc.FMGCInternal.flightNum));
me["Simple_R1S"].setText("FROM/TO "); me["Simple_R1S"].setText("FROM/TO ");
me["Simple_R2S"].setText("INIT "); me["Simple_R2S"].setText("INIT ");
me["Simple_R5S"].setText("TROPO"); me["Simple_R5S"].setText("TROPO");
@ -1202,7 +1192,7 @@ var canvas_MCDU_base = {
me["Simple_R2"].setText("REQUEST "); me["Simple_R2"].setText("REQUEST ");
me["Simple_R3"].setText("IRS INIT "); me["Simple_R3"].setText("IRS INIT ");
me["Simple_R4"].setText("WIND "); me["Simple_R4"].setText("WIND ");
me["Simple_R5"].setText(sprintf("%5.0f", tropo.getValue())); me["Simple_R5"].setText(sprintf("%5.0f", fmgc.FMGCInternal.tropo));
} else if (page == "IRSINIT") { } else if (page == "IRSINIT") {
if (!pageSwitch[i].getBoolValue()) { if (!pageSwitch[i].getBoolValue()) {
me["Simple"].show(); me["Simple"].show();
@ -2112,15 +2102,15 @@ var canvas_MCDU_base = {
me["PERFAPPR"].hide(); me["PERFAPPR"].hide();
me["PERFGA"].hide(); me["PERFGA"].hide();
if (flightNumSet.getValue() == 1) { if (fmgc.FMGCInternal.flightNumSet) {
if (page == "PROGTO") { if (page == "PROGTO") {
me["Simple_Title"].setText(sprintf("TAKE OFF %s", flightNum.getValue())); me["Simple_Title"].setText(sprintf("TAKE OFF %s", fmgc.FMGCInternal.flightNum));
} else if (page == "PROGCLB") { } else if (page == "PROGCLB") {
me["Simple_Title"].setText(sprintf("CLIMB %s", flightNum.getValue())); me["Simple_Title"].setText(sprintf("CLIMB %s", fmgc.FMGCInternal.flightNum));
} else if (page == "PROGCRZ") { } else if (page == "PROGCRZ") {
me["Simple_Title"].setText(sprintf("CRUISE %s", flightNum.getValue())); me["Simple_Title"].setText(sprintf("CRUISE %s", fmgc.FMGCInternal.flightNum));
} else if (page == "PROGDES") { } else if (page == "PROGDES") {
me["Simple_Title"].setText(sprintf("DESCENT %s", flightNum.getValue())); me["Simple_Title"].setText(sprintf("DESCENT %s", fmgc.FMGCInternal.flightNum));
} }
} else { } else {
if (page == "PROGTO") { if (page == "PROGTO") {
@ -2186,11 +2176,11 @@ var canvas_MCDU_base = {
pageSwitch[i].setBoolValue(1); pageSwitch[i].setBoolValue(1);
} }
if (cruiseSet.getValue() == 1 and page != "PROGDES") { if (fmgc.FMGCInternal.crzSet and page != "PROGDES") {
if (getprop("/it-autoflight/input/alt") > cruiseFL_prog.getValue() * 100) { if (getprop("/it-autoflight/input/alt") > fmgc.FMGCInternal.crzProg * 100) {
me["Simple_L1"].setText(sprintf("%s", "FL" ~ getprop("/it-autoflight/input/alt") / 100)); me["Simple_L1"].setText(sprintf("%s", "FL" ~ getprop("/it-autoflight/input/alt") / 100));
} else { } else {
me["Simple_L1"].setText(sprintf("%s", "FL" ~ cruiseFL_prog.getValue())); me["Simple_L1"].setText(sprintf("%s", "FL" ~ fmgc.FMGCInternal.crzProg));
} }
} else { } else {
me["Simple_L1"].setText("----"); me["Simple_L1"].setText("----");

View file

@ -196,7 +196,7 @@ var FCUController = {
}, },
SPDPush: func() { SPDPush: func() {
if (me.FCUworking) { if (me.FCUworking) {
if (getprop("FMGC/internal/cruise-lvl-set") == 1 and getprop("FMGC/internal/cost-index-set") == 1) { if (fmgc.FMGCInternal.crzSet and getprop("FMGC/internal/cost-index-set") == 1) {
spdManaged.setBoolValue(1); spdManaged.setBoolValue(1);
fmgc.ManagedSPD.start(); fmgc.ManagedSPD.start();
} }

View file

@ -3,37 +3,36 @@
# Copyright (c) 2020 Josh Davidson (Octal450) # Copyright (c) 2020 Josh Davidson (Octal450)
setprop("FMGC/internal/cruise-ft", 10000); setprop("/it-autoflight/internal/alt", 10000);
setprop("it-autoflight/internal/alt", 10000); setprop("/modes/pfd/fma/throttle-mode", " ");
setprop("modes/pfd/fma/throttle-mode", " "); setprop("/modes/pfd/fma/pitch-mode", " ");
setprop("modes/pfd/fma/pitch-mode", " "); setprop("/modes/pfd/fma/pitch-mode-armed", " ");
setprop("modes/pfd/fma/pitch-mode-armed", " "); setprop("/modes/pfd/fma/pitch-mode2-armed", " ");
setprop("modes/pfd/fma/pitch-mode2-armed", " "); setprop("/modes/pfd/fma/roll-mode", " ");
setprop("modes/pfd/fma/roll-mode", " "); setprop("/modes/pfd/fma/roll-mode-armed", " ");
setprop("modes/pfd/fma/roll-mode-armed", " "); setprop("/modes/pfd/fma/ap-mode", " ");
setprop("modes/pfd/fma/ap-mode", " "); setprop("/modes/pfd/fma/fd-mode", " ");
setprop("modes/pfd/fma/fd-mode", " "); setprop("/modes/pfd/fma/at-mode", " ");
setprop("modes/pfd/fma/at-mode", " "); setprop("/modes/pfd/fma/athr-armed", 0);
setprop("modes/pfd/fma/athr-armed", 0); setprop("/modes/pfd/fma/throttle-mode-box", 0);
setprop("modes/pfd/fma/throttle-mode-box", 0); setprop("/modes/pfd/fma/pitch-mode-box", 0);
setprop("modes/pfd/fma/pitch-mode-box", 0); setprop("/modes/pfd/fma/pitch-mode-armed-box", 0);
setprop("modes/pfd/fma/pitch-mode-armed-box", 0); setprop("/modes/pfd/fma/pitch-mode2-armed-box", 0);
setprop("modes/pfd/fma/pitch-mode2-armed-box", 0); setprop("/modes/pfd/fma/roll-mode-box", 0);
setprop("modes/pfd/fma/roll-mode-box", 0); setprop("/modes/pfd/fma/roll-mode-armed-box", 0);
setprop("modes/pfd/fma/roll-mode-armed-box", 0); setprop("/modes/pfd/fma/ap-mode-box", 0);
setprop("modes/pfd/fma/ap-mode-box", 0); setprop("/modes/pfd/fma/fd-mode-box", 0);
setprop("modes/pfd/fma/fd-mode-box", 0); setprop("/modes/pfd/fma/athr-mode-box", 0);
setprop("modes/pfd/fma/athr-mode-box", 0); setprop("/modes/pfd/fma/throttle-mode-time", 0);
setprop("modes/pfd/fma/throttle-mode-time", 0); setprop("/modes/pfd/fma/pitch-mode-time", 0);
setprop("modes/pfd/fma/pitch-mode-time", 0); setprop("/modes/pfd/fma/pitch-mode-armed-time", 0);
setprop("modes/pfd/fma/pitch-mode-armed-time", 0); setprop("/modes/pfd/fma/pitch-mode2-armed-time", 0);
setprop("modes/pfd/fma/pitch-mode2-armed-time", 0); setprop("/modes/pfd/fma/roll-mode-time", 0);
setprop("modes/pfd/fma/roll-mode-time", 0); setprop("/modes/pfd/fma/roll-mode-armed-time", 0);
setprop("modes/pfd/fma/roll-mode-armed-time", 0); setprop("/modes/pfd/fma/ap-mode-time", 0);
setprop("modes/pfd/fma/ap-mode-time", 0); setprop("/modes/pfd/fma/fd-mode-time", 0);
setprop("modes/pfd/fma/fd-mode-time", 0); setprop("/modes/pfd/fma/athr-mode-time", 0);
setprop("modes/pfd/fma/athr-mode-time", 0); setprop("/modes/fcu/hdg-time", -45);
setprop("modes/fcu/hdg-time", -45);
setlistener("sim/signals/fdm-initialized", func { setlistener("sim/signals/fdm-initialized", func {
loopFMA.start(); loopFMA.start();
@ -43,49 +42,49 @@ setlistener("sim/signals/fdm-initialized", func {
var loopFMA = maketimer(0.05, func { var loopFMA = maketimer(0.05, func {
var state1 = getprop("systems/thrust/state1"); var state1 = getprop("systems/thrust/state1");
var state2 = getprop("systems/thrust/state2"); var state2 = getprop("systems/thrust/state2");
var newthr = getprop("modes/pfd/fma/throttle-mode"); var newthr = getprop("/modes/pfd/fma/throttle-mode");
var thr1 = getprop("controls/engines/engine[0]/throttle-pos"); var thr1 = getprop("controls/engines/engine[0]/throttle-pos");
var thr2 = getprop("controls/engines/engine[1]/throttle-pos"); var thr2 = getprop("controls/engines/engine[1]/throttle-pos");
if (state1 == "TOGA" or state2 == "TOGA") { if (state1 == "TOGA" or state2 == "TOGA") {
if (newthr != " ") { if (newthr != " ") {
setprop("modes/pfd/fma/throttle-mode", " "); setprop("/modes/pfd/fma/throttle-mode", " ");
} }
} else if ((state1 == "MAN THR" and thr1 >= 0.83) or (state2 == "MAN THR" and thr2 >= 0.83)) { } else if ((state1 == "MAN THR" and thr1 >= 0.83) or (state2 == "MAN THR" and thr2 >= 0.83)) {
if (newthr != " ") { if (newthr != " ") {
setprop("modes/pfd/fma/throttle-mode", " "); setprop("/modes/pfd/fma/throttle-mode", " ");
} }
} else if ((state1 == "MCT" or state2 == "MCT") and getprop("systems/thrust/eng-out") != 1) { } else if ((state1 == "MCT" or state2 == "MCT") and getprop("systems/thrust/eng-out") != 1) {
if (newthr != " ") { if (newthr != " ") {
setprop("modes/pfd/fma/throttle-mode", " "); setprop("/modes/pfd/fma/throttle-mode", " ");
} }
} else if (((state1 == "MAN THR" and thr1 < 0.83) or (state2 == "MAN THR" and thr2 < 0.83)) and getprop("systems/thrust/eng-out") != 1) { } else if (((state1 == "MAN THR" and thr1 < 0.83) or (state2 == "MAN THR" and thr2 < 0.83)) and getprop("systems/thrust/eng-out") != 1) {
if (newthr != " ") { if (newthr != " ") {
setprop("modes/pfd/fma/throttle-mode", " "); setprop("/modes/pfd/fma/throttle-mode", " ");
} }
} else { } else {
if ((getprop("it-autoflight/output/vert") == 4) or (getprop("it-autoflight/output/vert") == 6) or (getprop("it-autoflight/output/vert") == 7) or (getprop("it-autoflight/output/vert") == 8)) { if ((getprop("/it-autoflight/output/vert") == 4) or (getprop("/it-autoflight/output/vert") == 6) or (getprop("/it-autoflight/output/vert") == 7) or (getprop("/it-autoflight/output/vert") == 8)) {
if (getprop("it-autoflight/output/fd1") == 0 and getprop("it-autoflight/output/fd2") == 0 and getprop("it-autoflight/output/ap1") == 0 and getprop("it-autoflight/output/ap2") == 0) { if (getprop("/it-autoflight/output/fd1") == 0 and getprop("/it-autoflight/output/fd2") == 0 and getprop("/it-autoflight/output/ap1") == 0 and getprop("/it-autoflight/output/ap2") == 0) {
loopFMA_b(); loopFMA_b();
} else { } else {
var thr = getprop("it-autoflight/output/thr-mode"); var thr = getprop("/it-autoflight/output/thr-mode");
if (thr == 0) { if (thr == 0) {
loopFMA_b(); loopFMA_b();
} else if (thr == 1) { } else if (thr == 1) {
if (newthr != "THR IDLE") { if (newthr != "THR IDLE") {
setprop("modes/pfd/fma/throttle-mode", "THR IDLE"); setprop("/modes/pfd/fma/throttle-mode", "THR IDLE");
} }
} else if (thr == 2) { } else if (thr == 2) {
if (state1 == "MCT" or state2 == "MCT" and getprop("systems/thrust/eng-out") == 1) { if (state1 == "MCT" or state2 == "MCT" and getprop("systems/thrust/eng-out") == 1) {
if (newthr != "THR MCT") { if (newthr != "THR MCT") {
setprop("modes/pfd/fma/throttle-mode", "THR MCT"); setprop("/modes/pfd/fma/throttle-mode", "THR MCT");
} }
} else if (state1 == "CL" or state2 == "CL") { } else if (state1 == "CL" or state2 == "CL") {
if (newthr != "THR CLB") { if (newthr != "THR CLB") {
setprop("modes/pfd/fma/throttle-mode", "THR CLB"); setprop("/modes/pfd/fma/throttle-mode", "THR CLB");
} }
} else { } else {
if (newthr != "THR LVR") { if (newthr != "THR LVR") {
setprop("modes/pfd/fma/throttle-mode", "THR LVR"); setprop("/modes/pfd/fma/throttle-mode", "THR LVR");
} }
} }
} }
@ -96,28 +95,28 @@ var loopFMA = maketimer(0.05, func {
} }
# A/THR Armed/Active # A/THR Armed/Active
if (getprop("it-autoflight/output/athr") == 1 and (state1 == "MAN THR" or state2 == "MAN THR" or state1 == "MCT" or state2 == "MCT" or state1 == "TOGA" or state2 == "TOGA") and getprop("systems/thrust/eng-out") != 1) { if (getprop("/it-autoflight/output/athr") == 1 and (state1 == "MAN THR" or state2 == "MAN THR" or state1 == "MCT" or state2 == "MCT" or state1 == "TOGA" or state2 == "TOGA") and getprop("systems/thrust/eng-out") != 1) {
if (getprop("modes/pfd/fma/athr-armed") != 1) { if (getprop("/modes/pfd/fma/athr-armed") != 1) {
setprop("modes/pfd/fma/athr-armed", 1); setprop("/modes/pfd/fma/athr-armed", 1);
} }
} else if (getprop("it-autoflight/output/athr") == 1 and ((state1 == "MAN THR" and thr1 >= 0.83) or (state2 == "MAN THR" and thr2 >= 0.83) or (state1 == "MCT" and getprop("controls/engines/thrust-limit") == "FLX") or } else if (getprop("/it-autoflight/output/athr") == 1 and ((state1 == "MAN THR" and thr1 >= 0.83) or (state2 == "MAN THR" and thr2 >= 0.83) or (state1 == "MCT" and getprop("controls/engines/thrust-limit") == "FLX") or
(state2 == "MCT" and getprop("controls/engines/thrust-limit") == "FLX") or state1 == "TOGA" or state2 == "TOGA") and getprop("systems/thrust/eng-out") == 1) { (state2 == "MCT" and getprop("controls/engines/thrust-limit") == "FLX") or state1 == "TOGA" or state2 == "TOGA") and getprop("systems/thrust/eng-out") == 1) {
if (getprop("modes/pfd/fma/athr-armed") != 1) { if (getprop("/modes/pfd/fma/athr-armed") != 1) {
setprop("modes/pfd/fma/athr-armed", 1); setprop("/modes/pfd/fma/athr-armed", 1);
} }
} else { } else {
if (getprop("modes/pfd/fma/athr-armed") != 0) { if (getprop("/modes/pfd/fma/athr-armed") != 0) {
setprop("modes/pfd/fma/athr-armed", 0); setprop("/modes/pfd/fma/athr-armed", 0);
} }
} }
# SRS RWY Engagement # SRS RWY Engagement
var flx = getprop("systems/thrust/lim-flex"); var flx = getprop("systems/thrust/lim-flex");
var lat = getprop("it-autoflight/mode/lat"); var lat = getprop("/it-autoflight/mode/lat");
var newlat = getprop("modes/pfd/fma/roll-mode"); var newlat = getprop("/modes/pfd/fma/roll-mode");
var vert = getprop("it-autoflight/mode/vert"); var vert = getprop("/it-autoflight/mode/vert");
var newvert = getprop("modes/pfd/fma/pitch-mode"); var newvert = getprop("/modes/pfd/fma/pitch-mode");
var newvertarm = getprop("modes/pfd/fma/pitch-mode2-armed"); var newvertarm = getprop("/modes/pfd/fma/pitch-mode2-armed");
var thr1 = getprop("controls/engines/engine[0]/throttle-pos"); var thr1 = getprop("controls/engines/engine[0]/throttle-pos");
var thr2 = getprop("controls/engines/engine[1]/throttle-pos"); var thr2 = getprop("controls/engines/engine[1]/throttle-pos");
var wow = getprop("gear/gear[0]/wow"); var wow = getprop("gear/gear[0]/wow");
@ -125,135 +124,135 @@ var loopFMA = maketimer(0.05, func {
var engstate2 = getprop("engines/engine[1]/state"); var engstate2 = getprop("engines/engine[1]/state");
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)) { 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. # RWY Engagement would go here, but automatic ILS selection is not simulated yet.
if (wow and FMGCInternal.v2set and getprop("it-autoflight/output/vert") != 7) { if (wow and FMGCInternal.v2set and getprop("/it-autoflight/output/vert") != 7) {
ITAF.setVertMode(7); ITAF.setVertMode(7);
setprop("it-autoflight/mode/vert", "T/O CLB"); setprop("/it-autoflight/mode/vert", "T/O CLB");
} }
} else { } else {
var gear1 = getprop("gear/gear[1]/wow"); var gear1 = getprop("gear/gear[1]/wow");
var gear2 = getprop("gear/gear[2]/wow"); var gear2 = getprop("gear/gear[2]/wow");
if (getprop("it-autoflight/input/lat") == 5 and (gear1 or gear2)) { if (getprop("/it-autoflight/input/lat") == 5 and (gear1 or gear2)) {
ITAF.setLatMode(9); ITAF.setLatMode(9);
} }
if (getprop("it-autoflight/output/vert") == 7 and (gear1 or gear2)) { if (getprop("/it-autoflight/output/vert") == 7 and (gear1 or gear2)) {
ITAF.setVertMode(9); ITAF.setVertMode(9);
} }
} }
var trk = getprop("it-autoflight/custom/trk-fpa"); var trk = getprop("/it-autoflight/custom/trk-fpa");
if (lat == "HDG" and trk == 0) { if (lat == "HDG" and trk == 0) {
if (newlat != "HDG") { if (newlat != "HDG") {
setprop("modes/pfd/fma/roll-mode", "HDG"); setprop("/modes/pfd/fma/roll-mode", "HDG");
} }
} else if (lat == "HDG" and trk == 1) { } else if (lat == "HDG" and trk == 1) {
if (newlat != "TRACK") { if (newlat != "TRACK") {
setprop("modes/pfd/fma/roll-mode", "TRACK"); setprop("/modes/pfd/fma/roll-mode", "TRACK");
} }
} }
# Boxes # Boxes
var elapsedtime = getprop("sim/time/elapsed-sec"); var elapsedtime = getprop("sim/time/elapsed-sec");
if (getprop("modes/pfd/fma/ap-mode-time") + 10 >= elapsedtime) { if (getprop("/modes/pfd/fma/ap-mode-time") + 10 >= elapsedtime) {
setprop("modes/pfd/fma/ap-mode-box", 1); setprop("/modes/pfd/fma/ap-mode-box", 1);
} else { } else {
setprop("modes/pfd/fma/ap-mode-box", 0); setprop("/modes/pfd/fma/ap-mode-box", 0);
} }
if (getprop("modes/pfd/fma/fd-mode-time") + 10 >= elapsedtime) { if (getprop("/modes/pfd/fma/fd-mode-time") + 10 >= elapsedtime) {
setprop("modes/pfd/fma/fd-mode-box", 1); setprop("/modes/pfd/fma/fd-mode-box", 1);
} else { } else {
setprop("modes/pfd/fma/fd-mode-box", 0); setprop("/modes/pfd/fma/fd-mode-box", 0);
} }
if (getprop("modes/pfd/fma/athr-mode-time") + 10 >= elapsedtime) { if (getprop("/modes/pfd/fma/athr-mode-time") + 10 >= elapsedtime) {
setprop("modes/pfd/fma/athr-mode-box", 1); setprop("/modes/pfd/fma/athr-mode-box", 1);
} else { } else {
setprop("modes/pfd/fma/athr-mode-box", 0); setprop("/modes/pfd/fma/athr-mode-box", 0);
} }
if (getprop("modes/pfd/fma/throttle-mode-time") + 10 >= elapsedtime) { if (getprop("/modes/pfd/fma/throttle-mode-time") + 10 >= elapsedtime) {
setprop("modes/pfd/fma/throttle-mode-box", 1); setprop("/modes/pfd/fma/throttle-mode-box", 1);
} else { } else {
setprop("modes/pfd/fma/throttle-mode-box", 0); setprop("/modes/pfd/fma/throttle-mode-box", 0);
} }
if (getprop("modes/pfd/fma/roll-mode-time") + 10 >= elapsedtime) { if (getprop("/modes/pfd/fma/roll-mode-time") + 10 >= elapsedtime) {
setprop("modes/pfd/fma/roll-mode-box", 1); setprop("/modes/pfd/fma/roll-mode-box", 1);
} else { } else {
setprop("modes/pfd/fma/roll-mode-box", 0); setprop("/modes/pfd/fma/roll-mode-box", 0);
} }
if (getprop("modes/pfd/fma/pitch-mode-time") + 10 >= elapsedtime) { if (getprop("/modes/pfd/fma/pitch-mode-time") + 10 >= elapsedtime) {
setprop("modes/pfd/fma/pitch-mode-box", 1); setprop("/modes/pfd/fma/pitch-mode-box", 1);
} else { } else {
setprop("modes/pfd/fma/pitch-mode-box", 0); setprop("/modes/pfd/fma/pitch-mode-box", 0);
} }
if (getprop("modes/pfd/fma/roll-mode-armed-time") + 10 >= elapsedtime) { if (getprop("/modes/pfd/fma/roll-mode-armed-time") + 10 >= elapsedtime) {
setprop("modes/pfd/fma/roll-mode-armed-box", 1); setprop("/modes/pfd/fma/roll-mode-armed-box", 1);
} else { } else {
setprop("modes/pfd/fma/roll-mode-armed-box", 0); setprop("/modes/pfd/fma/roll-mode-armed-box", 0);
} }
if (getprop("modes/pfd/fma/pitch-mode-armed-time") + 10 >= elapsedtime) { if (getprop("/modes/pfd/fma/pitch-mode-armed-time") + 10 >= elapsedtime) {
setprop("modes/pfd/fma/pitch-mode-armed-box", 1); setprop("/modes/pfd/fma/pitch-mode-armed-box", 1);
} else { } else {
setprop("modes/pfd/fma/pitch-mode-armed-box", 0); setprop("/modes/pfd/fma/pitch-mode-armed-box", 0);
} }
if (getprop("modes/pfd/fma/pitch-mode2-armed-time") + 10 >= elapsedtime) { if (getprop("/modes/pfd/fma/pitch-mode2-armed-time") + 10 >= elapsedtime) {
setprop("modes/pfd/fma/pitch-mode2-armed-box", 1); setprop("/modes/pfd/fma/pitch-mode2-armed-box", 1);
} else { } else {
setprop("modes/pfd/fma/pitch-mode2-armed-box", 0); setprop("/modes/pfd/fma/pitch-mode2-armed-box", 0);
} }
}); });
var loopFMA_b = func { var loopFMA_b = func {
var newthr = getprop("modes/pfd/fma/throttle-mode"); var newthr = getprop("/modes/pfd/fma/throttle-mode");
if (getprop("it-autoflight/input/kts-mach") == 0) { if (getprop("/it-autoflight/input/kts-mach") == 0) {
if (newthr != "SPEED") { if (newthr != "SPEED") {
setprop("modes/pfd/fma/throttle-mode", "SPEED"); setprop("/modes/pfd/fma/throttle-mode", "SPEED");
} }
} else if (getprop("it-autoflight/input/kts-mach") == 1) { } else if (getprop("/it-autoflight/input/kts-mach") == 1) {
if (newthr != "MACH") { if (newthr != "MACH") {
setprop("modes/pfd/fma/throttle-mode", "MACH"); setprop("/modes/pfd/fma/throttle-mode", "MACH");
} }
} }
} }
# Master Lateral # Master Lateral
setlistener("/it-autoflight/mode/lat", func { setlistener("/it-autoflight/mode/lat", func {
var lat = getprop("it-autoflight/mode/lat"); var lat = getprop("/it-autoflight/mode/lat");
var newlat = getprop("modes/pfd/fma/roll-mode"); var newlat = getprop("/modes/pfd/fma/roll-mode");
if (lat == "LNAV") { if (lat == "LNAV") {
if (newlat != "NAV") { if (newlat != "NAV") {
setprop("modes/pfd/fma/roll-mode", "NAV"); setprop("/modes/pfd/fma/roll-mode", "NAV");
} }
} else if (lat == "LOC") { } else if (lat == "LOC") {
if (newlat != "LOC*" and newlat != "LOC") { if (newlat != "LOC*" and newlat != "LOC") {
setprop("modes/pfd/fma/roll-mode", "LOC*"); setprop("/modes/pfd/fma/roll-mode", "LOC*");
locupdate.start(); locupdate.start();
} }
} else if (lat == "ALGN") { } else if (lat == "ALGN") {
if (newlat != " ") { if (newlat != " ") {
setprop("modes/pfd/fma/roll-mode", " "); setprop("/modes/pfd/fma/roll-mode", " ");
} }
} else if (lat == "RLOU") { } else if (lat == "RLOU") {
if (newlat != " ") { if (newlat != " ") {
setprop("modes/pfd/fma/roll-mode", " "); setprop("/modes/pfd/fma/roll-mode", " ");
} }
} else if (lat == "T/O") { } else if (lat == "T/O") {
if (newlat != "RWY") { if (newlat != "RWY") {
setprop("modes/pfd/fma/roll-mode", "RWY"); setprop("/modes/pfd/fma/roll-mode", "RWY");
} }
} else if (lat == " ") { } else if (lat == " ") {
if (newlat != " ") { if (newlat != " ") {
setprop("modes/pfd/fma/roll-mode", " "); setprop("/modes/pfd/fma/roll-mode", " ");
} }
} }
}); });
var locupdate = maketimer(0.5, func { var locupdate = maketimer(0.5, func {
var lat = getprop("it-autoflight/mode/lat"); var lat = getprop("/it-autoflight/mode/lat");
var newlat = getprop("modes/pfd/fma/roll-mode"); var newlat = getprop("/modes/pfd/fma/roll-mode");
var nav_defl = getprop("instrumentation/nav[0]/heading-needle-deflection-norm"); var nav_defl = getprop("/instrumentation/nav[0]/heading-needle-deflection-norm");
if (lat == "LOC") { if (lat == "LOC") {
if (nav_defl > -0.06 and nav_defl < 0.06) { if (nav_defl > -0.06 and nav_defl < 0.06) {
locupdate.stop(); locupdate.stop();
if (newlat != "LOC") { if (newlat != "LOC") {
setprop("modes/pfd/fma/roll-mode", "LOC"); setprop("/modes/pfd/fma/roll-mode", "LOC");
} }
} }
} }
@ -261,82 +260,82 @@ var locupdate = maketimer(0.5, func {
# Master Vertical # Master Vertical
setlistener("/it-autoflight/mode/vert", func { setlistener("/it-autoflight/mode/vert", func {
var vert = getprop("it-autoflight/mode/vert"); var vert = getprop("/it-autoflight/mode/vert");
var newvert = getprop("modes/pfd/fma/pitch-mode"); var newvert = getprop("/modes/pfd/fma/pitch-mode");
var newvertarm = getprop("modes/pfd/fma/pitch-mode2-armed"); var newvertarm = getprop("/modes/pfd/fma/pitch-mode2-armed");
if (vert == "ALT HLD") { if (vert == "ALT HLD") {
altvert(); altvert();
if (newvertarm != " ") { if (newvertarm != " ") {
setprop("modes/pfd/fma/pitch-mode2-armed", " "); setprop("/modes/pfd/fma/pitch-mode2-armed", " ");
} }
} else if (vert == "ALT CAP") { } else if (vert == "ALT CAP") {
altvert(); altvert();
if (newvertarm != " ") { if (newvertarm != " ") {
setprop("modes/pfd/fma/pitch-mode2-armed", " "); setprop("/modes/pfd/fma/pitch-mode2-armed", " ");
} }
} else if (vert == "V/S") { } else if (vert == "V/S") {
if (newvert != "V/S") { if (newvert != "V/S") {
setprop("modes/pfd/fma/pitch-mode", "V/S"); setprop("/modes/pfd/fma/pitch-mode", "V/S");
} }
if (newvertarm != "ALT") { if (newvertarm != "ALT") {
setprop("modes/pfd/fma/pitch-mode2-armed", "ALT"); setprop("/modes/pfd/fma/pitch-mode2-armed", "ALT");
} }
} else if (vert == "G/S") { } else if (vert == "G/S") {
if (newvert != "G/S*" and newvert != "G/S") { if (newvert != "G/S*" and newvert != "G/S") {
setprop("modes/pfd/fma/pitch-mode", "G/S*"); setprop("/modes/pfd/fma/pitch-mode", "G/S*");
gsupdate.start(); gsupdate.start();
} }
if (newvertarm != " ") { if (newvertarm != " ") {
setprop("modes/pfd/fma/pitch-mode2-armed", " "); setprop("/modes/pfd/fma/pitch-mode2-armed", " ");
} }
} else if (vert == "SPD CLB") { } else if (vert == "SPD CLB") {
if (newvert != "OP CLB") { if (newvert != "OP CLB") {
setprop("modes/pfd/fma/pitch-mode", "OP CLB"); setprop("/modes/pfd/fma/pitch-mode", "OP CLB");
} }
if (newvertarm != "ALT") { if (newvertarm != "ALT") {
setprop("modes/pfd/fma/pitch-mode2-armed", "ALT"); setprop("/modes/pfd/fma/pitch-mode2-armed", "ALT");
} }
} else if (vert == "SPD DES") { } else if (vert == "SPD DES") {
if (newvert != "OP DES") { if (newvert != "OP DES") {
setprop("modes/pfd/fma/pitch-mode", "OP DES"); setprop("/modes/pfd/fma/pitch-mode", "OP DES");
} }
if (newvertarm != "ALT") { if (newvertarm != "ALT") {
setprop("modes/pfd/fma/pitch-mode2-armed", "ALT"); setprop("/modes/pfd/fma/pitch-mode2-armed", "ALT");
} }
} else if (vert == "FPA") { } else if (vert == "FPA") {
if (newvert != "FPA") { if (newvert != "FPA") {
setprop("modes/pfd/fma/pitch-mode", "FPA"); setprop("/modes/pfd/fma/pitch-mode", "FPA");
} }
if (newvertarm != "ALT") { if (newvertarm != "ALT") {
setprop("modes/pfd/fma/pitch-mode2-armed", "ALT"); setprop("/modes/pfd/fma/pitch-mode2-armed", "ALT");
} }
} else if (vert == "LAND") { } else if (vert == "LAND") {
if (newvert != "LAND") { if (newvert != "LAND") {
setprop("modes/pfd/fma/pitch-mode", "LAND"); setprop("/modes/pfd/fma/pitch-mode", "LAND");
} }
} else if (vert == "FLARE") { } else if (vert == "FLARE") {
if (newvert != "FLARE") { if (newvert != "FLARE") {
setprop("modes/pfd/fma/pitch-mode", "FLARE"); setprop("/modes/pfd/fma/pitch-mode", "FLARE");
} }
} else if (vert == "ROLLOUT") { } else if (vert == "ROLLOUT") {
if (newvert != "ROLL OUT") { if (newvert != "ROLL OUT") {
setprop("modes/pfd/fma/pitch-mode", "ROLL OUT"); setprop("/modes/pfd/fma/pitch-mode", "ROLL OUT");
} }
} else if (vert == "T/O CLB") { } else if (vert == "T/O CLB") {
if (newvert != "SRS") { if (newvert != "SRS") {
setprop("modes/pfd/fma/pitch-mode", "SRS"); setprop("/modes/pfd/fma/pitch-mode", "SRS");
} }
updatePitchArm2(); updatePitchArm2();
} else if (vert == "G/A CLB") { } else if (vert == "G/A CLB") {
if (newvert != "SRS") { if (newvert != "SRS") {
setprop("modes/pfd/fma/pitch-mode", "SRS"); setprop("/modes/pfd/fma/pitch-mode", "SRS");
} }
if (newvertarm != "ALT") { if (newvertarm != "ALT") {
setprop("modes/pfd/fma/pitch-mode2-armed", "ALT"); setprop("/modes/pfd/fma/pitch-mode2-armed", "ALT");
} }
} else if (vert == " ") { } else if (vert == " ") {
if (newvert != " ") { if (newvert != " ") {
setprop("modes/pfd/fma/pitch-mode", " "); setprop("/modes/pfd/fma/pitch-mode", " ");
} }
updatePitchArm2(); updatePitchArm2();
} }
@ -344,178 +343,175 @@ setlistener("/it-autoflight/mode/vert", func {
}); });
var updatePitchArm2 = func { var updatePitchArm2 = func {
var newvertarm = getprop("modes/pfd/fma/pitch-mode2-armed"); var newvertarm = getprop("/modes/pfd/fma/pitch-mode2-armed");
if (newvertarm != "CLB" and FMGCInternal.v2set) { if (newvertarm != "CLB" and FMGCInternal.v2set) {
setprop("modes/pfd/fma/pitch-mode2-armed", "CLB"); setprop("/modes/pfd/fma/pitch-mode2-armed", "CLB");
} else if (newvertarm != " " and FMGCInternal.v2set != 1) { } else if (newvertarm != " " and FMGCInternal.v2set != 1) {
setprop("modes/pfd/fma/pitch-mode2-armed", " "); setprop("/modes/pfd/fma/pitch-mode2-armed", " ");
} }
} }
var gsupdate = maketimer(0.5, func { var gsupdate = maketimer(0.5, func {
var vert = getprop("it-autoflight/mode/vert"); var vert = getprop("/it-autoflight/mode/vert");
var newvert = getprop("modes/pfd/fma/pitch-mode"); var newvert = getprop("/modes/pfd/fma/pitch-mode");
var gs_defl = getprop("instrumentation/nav[0]/gs-needle-deflection-norm"); var gs_defl = getprop("/instrumentation/nav[0]/gs-needle-deflection-norm");
if (vert == "G/S") { if (vert == "G/S") {
if (gs_defl > -0.06 and gs_defl < 0.06) { if (gs_defl > -0.06 and gs_defl < 0.06) {
gsupdate.stop(); gsupdate.stop();
if (newvert != "G/S") { if (newvert != "G/S") {
setprop("modes/pfd/fma/pitch-mode", "G/S"); setprop("/modes/pfd/fma/pitch-mode", "G/S");
} }
} }
} }
}); });
var altvert = func { var altvert = func {
var FMGCalt = getprop("FMGC/internal/cruise-ft"); var MCPalt = getprop("/it-autoflight/internal/alt");
var MCPalt = getprop("it-autoflight/internal/alt"); var ALTdif = abs(fmgc.FMGCInternal.crzFt - MCPalt);
var ALTdif = abs(FMGCalt - MCPalt); var vert = getprop("/it-autoflight/mode/vert");
var vert = getprop("it-autoflight/mode/vert"); var newvert = getprop("/modes/pfd/fma/pitch-mode");
var newvert = getprop("modes/pfd/fma/pitch-mode");
if (ALTdif <= 20) { if (ALTdif <= 20) {
if (vert == "ALT HLD") { if (vert == "ALT HLD") {
if (newvert != "ALT CRZ") { if (newvert != "ALT CRZ") {
setprop("modes/pfd/fma/pitch-mode", "ALT CRZ"); setprop("/modes/pfd/fma/pitch-mode", "ALT CRZ");
} }
} else if (vert == "ALT CAP") { } else if (vert == "ALT CAP") {
if (newvert != "ALT CRZ*") { if (newvert != "ALT CRZ*") {
setprop("modes/pfd/fma/pitch-mode", "ALT CRZ*"); setprop("/modes/pfd/fma/pitch-mode", "ALT CRZ*");
} }
} }
} else { } else {
if (vert == "ALT HLD") { if (vert == "ALT HLD") {
if (newvert != "ALT") { if (newvert != "ALT") {
setprop("modes/pfd/fma/pitch-mode", "ALT"); setprop("/modes/pfd/fma/pitch-mode", "ALT");
} }
} else if (vert == "ALT CAP") { } else if (vert == "ALT CAP") {
if (newvert != "ALT*") { if (newvert != "ALT*") {
setprop("modes/pfd/fma/pitch-mode", "ALT*"); setprop("/modes/pfd/fma/pitch-mode", "ALT*");
} }
} }
} }
} }
setlistener("/FMGC/internal/cruise-ft", altvert);
# Arm HDG or NAV # Arm HDG or NAV
setlistener("/it-autoflight/mode/arm", func { setlistener("/it-autoflight/mode/arm", func {
var arm = getprop("it-autoflight/mode/arm"); var arm = getprop("/it-autoflight/mode/arm");
var newarm = getprop("modes/pfd/fma/roll-mode-armed"); var newarm = getprop("/modes/pfd/fma/roll-mode-armed");
if (arm == "HDG") { if (arm == "HDG") {
if (newarm != "HDG") { if (newarm != "HDG") {
setprop("modes/pfd/fma/roll-mode-armed", " "); setprop("/modes/pfd/fma/roll-mode-armed", " ");
} }
} else if (arm == "LNV") { } else if (arm == "LNV") {
if (newarm != "NAV") { if (newarm != "NAV") {
setprop("modes/pfd/fma/roll-mode-armed", "NAV"); setprop("/modes/pfd/fma/roll-mode-armed", "NAV");
} }
} else if (arm == " ") { } else if (arm == " ") {
if (newarm != " ") { if (newarm != " ") {
setprop("modes/pfd/fma/roll-mode-armed", " "); setprop("/modes/pfd/fma/roll-mode-armed", " ");
} }
} }
}); });
# Arm LOC # Arm LOC
setlistener("/it-autoflight/output/loc-armed", func { setlistener("/it-autoflight/output/loc-armed", func {
var loca = getprop("it-autoflight/output/loc-armed"); var loca = getprop("/it-autoflight/output/loc-armed");
var newarm = getprop("modes/pfd/fma/roll-mode-armed"); var newarm = getprop("/modes/pfd/fma/roll-mode-armed");
if (loca) { if (loca) {
if (newarm != "LOC") { if (newarm != "LOC") {
setprop("modes/pfd/fma/roll-mode-armed", "LOC"); setprop("/modes/pfd/fma/roll-mode-armed", "LOC");
} }
} else { } else {
if (newarm != " ") { if (newarm != " ") {
setprop("modes/pfd/fma/roll-mode-armed", " "); setprop("/modes/pfd/fma/roll-mode-armed", " ");
} }
} }
}); });
# Arm G/S # Arm G/S
setlistener("/it-autoflight/output/appr-armed", func { setlistener("/it-autoflight/output/appr-armed", func {
var appa = getprop("it-autoflight/output/appr-armed"); var appa = getprop("/it-autoflight/output/appr-armed");
var newvert2arm = getprop("modes/pfd/fma/pitch-mode-armed"); var newvert2arm = getprop("/modes/pfd/fma/pitch-mode-armed");
if (appa) { if (appa) {
if (newvert2arm != "G/S") { if (newvert2arm != "G/S") {
setprop("modes/pfd/fma/pitch-mode-armed", "G/S"); setprop("/modes/pfd/fma/pitch-mode-armed", "G/S");
} }
} else { } else {
if (newvert2arm != " ") { if (newvert2arm != " ") {
setprop("modes/pfd/fma/pitch-mode-armed", " "); setprop("/modes/pfd/fma/pitch-mode-armed", " ");
} }
} }
}); });
# AP # AP
var ap = func { var ap = func {
var ap1 = getprop("it-autoflight/output/ap1"); var ap1 = getprop("/it-autoflight/output/ap1");
var ap2 = getprop("it-autoflight/output/ap2"); var ap2 = getprop("/it-autoflight/output/ap2");
var newap = getprop("modes/pfd/fma/ap-mode"); var newap = getprop("/modes/pfd/fma/ap-mode");
if (ap1 and ap2 and newap != "AP1+2") { if (ap1 and ap2 and newap != "AP1+2") {
setprop("modes/pfd/fma/ap-mode", "AP 1+2"); setprop("/modes/pfd/fma/ap-mode", "AP 1+2");
} else if (ap1 and !ap2 and newap != "AP 1") { } else if (ap1 and !ap2 and newap != "AP 1") {
setprop("modes/pfd/fma/ap-mode", "AP 1"); setprop("/modes/pfd/fma/ap-mode", "AP 1");
} else if (ap2 and !ap1 and newap != "AP 2") { } else if (ap2 and !ap1 and newap != "AP 2") {
setprop("modes/pfd/fma/ap-mode", "AP 2"); setprop("/modes/pfd/fma/ap-mode", "AP 2");
} else if (!ap1 and !ap2) { } else if (!ap1 and !ap2) {
setprop("modes/pfd/fma/ap-mode", " "); setprop("/modes/pfd/fma/ap-mode", " ");
} }
} }
# FD # FD
var fd = func { var fd = func {
var fd1 = getprop("it-autoflight/output/fd1"); var fd1 = getprop("/it-autoflight/output/fd1");
var fd2 = getprop("it-autoflight/output/fd2"); var fd2 = getprop("/it-autoflight/output/fd2");
var newfd = getprop("modes/pfd/fma/fd-mode"); var newfd = getprop("/modes/pfd/fma/fd-mode");
if (fd1 and fd2 and newfd != "1FD2") { if (fd1 and fd2 and newfd != "1FD2") {
setprop("modes/pfd/fma/fd-mode", "1 FD 2"); setprop("/modes/pfd/fma/fd-mode", "1 FD 2");
} else if (fd1 and !fd2 and newfd != "1 FD -") { } else if (fd1 and !fd2 and newfd != "1 FD -") {
setprop("modes/pfd/fma/fd-mode", "1 FD -"); setprop("/modes/pfd/fma/fd-mode", "1 FD -");
} else if (fd2 and !fd1 and newfd != "- FD 2") { } else if (fd2 and !fd1 and newfd != "- FD 2") {
setprop("modes/pfd/fma/fd-mode", "- FD 2"); setprop("/modes/pfd/fma/fd-mode", "- FD 2");
} else if (!fd1 and !fd2) { } else if (!fd1 and !fd2) {
setprop("modes/pfd/fma/fd-mode", " "); setprop("/modes/pfd/fma/fd-mode", " ");
} }
} }
# AT # AT
var at = func { var at = func {
var at = getprop("it-autoflight/output/athr"); var at = getprop("/it-autoflight/output/athr");
var newat = getprop("modes/pfd/fma/at-mode"); var newat = getprop("/modes/pfd/fma/at-mode");
if (at and newat != "A/THR") { if (at and newat != "A/THR") {
setprop("modes/pfd/fma/at-mode", "A/THR"); setprop("/modes/pfd/fma/at-mode", "A/THR");
} else if (!at) { } else if (!at) {
setprop("modes/pfd/fma/at-mode", " "); setprop("/modes/pfd/fma/at-mode", " ");
} }
} }
var boxchk = func { var boxchk = func {
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) { 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); setprop("/it-autoflight/input/lat", 3);
boxchk_b(); boxchk_b();
} }
} }
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-time", getprop("sim/time/elapsed-sec")); setprop("/modes/pfd/fma/roll-mode-time", getprop("sim/time/elapsed-sec"));
} }
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-time", getprop("sim/time/elapsed-sec")); setprop("/modes/pfd/fma/pitch-mode-time", getprop("sim/time/elapsed-sec"));
} }
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-time", getprop("sim/time/elapsed-sec")); setprop("/modes/pfd/fma/roll-mode-armed-time", getprop("sim/time/elapsed-sec"));
} }
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-time", getprop("sim/time/elapsed-sec")); setprop("/modes/pfd/fma/pitch-mode-armed-time", getprop("sim/time/elapsed-sec"));
} }
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-time", getprop("sim/time/elapsed-sec")); setprop("/modes/pfd/fma/pitch-mode2-armed-time", getprop("sim/time/elapsed-sec"));
} }
} }
@ -542,74 +538,74 @@ setlistener("/it-autoflight/output/athr", func {
# Boxes # Boxes
setlistener("/modes/pfd/fma/ap-mode", func { setlistener("/modes/pfd/fma/ap-mode", func {
if (getprop("modes/pfd/fma/ap-mode") != " ") { if (getprop("/modes/pfd/fma/ap-mode") != " ") {
setprop("modes/pfd/fma/ap-mode-time", getprop("sim/time/elapsed-sec")); setprop("/modes/pfd/fma/ap-mode-time", getprop("sim/time/elapsed-sec"));
} }
}); });
setlistener("/modes/pfd/fma/fd-mode", func { setlistener("/modes/pfd/fma/fd-mode", func {
if (getprop("modes/pfd/fma/fd-mode") != " ") { if (getprop("/modes/pfd/fma/fd-mode") != " ") {
setprop("modes/pfd/fma/fd-mode-time", getprop("sim/time/elapsed-sec")); setprop("/modes/pfd/fma/fd-mode-time", getprop("sim/time/elapsed-sec"));
} }
}); });
setlistener("/modes/pfd/fma/at-mode", func { setlistener("/modes/pfd/fma/at-mode", func {
if (getprop("modes/pfd/fma/at-mode") != " ") { if (getprop("/modes/pfd/fma/at-mode") != " ") {
setprop("modes/pfd/fma/throttle-mode-time", getprop("sim/time/elapsed-sec")); setprop("/modes/pfd/fma/throttle-mode-time", getprop("sim/time/elapsed-sec"));
setprop("modes/pfd/fma/athr-mode-time", getprop("sim/time/elapsed-sec")); setprop("/modes/pfd/fma/athr-mode-time", getprop("sim/time/elapsed-sec"));
} }
}); });
setlistener("/modes/pfd/fma/athr-armed", func { setlistener("/modes/pfd/fma/athr-armed", func {
if (getprop("modes/pfd/fma/at-mode") != " ") { if (getprop("/modes/pfd/fma/at-mode") != " ") {
setprop("modes/pfd/fma/athr-mode-time", getprop("sim/time/elapsed-sec")); setprop("/modes/pfd/fma/athr-mode-time", getprop("sim/time/elapsed-sec"));
} }
}); });
setlistener("/modes/pfd/fma/throttle-mode", func { setlistener("/modes/pfd/fma/throttle-mode", func {
var state1 = getprop("systems/thrust/state1"); var state1 = getprop("systems/thrust/state1");
var state2 = getprop("systems/thrust/state2"); var state2 = getprop("systems/thrust/state2");
if (getprop("it-autoflight/output/athr") == 1 and state1 != "MCT" and state2 != "MCT" and state1 != "MAN THR" and state2 != "MAN THR" and state1 != "TOGA" and state2 != "TOGA" and state1 != "IDLE" and state2 != "IDLE" and if (getprop("/it-autoflight/output/athr") == 1 and state1 != "MCT" and state2 != "MCT" and state1 != "MAN THR" and state2 != "MAN THR" and state1 != "TOGA" and state2 != "TOGA" and state1 != "IDLE" and state2 != "IDLE" and
getprop("systems/thrust/eng-out") != 1) { getprop("systems/thrust/eng-out") != 1) {
setprop("modes/pfd/fma/throttle-mode-time", getprop("sim/time/elapsed-sec")); setprop("/modes/pfd/fma/throttle-mode-time", getprop("sim/time/elapsed-sec"));
} else if (getprop("it-autoflight/output/athr") == 1 and state1 != "TOGA" and state2 != "TOGA" and state1 != "IDLE" and state2 != "IDLE" and getprop("systems/thrust/eng-out") == 1) { } else if (getprop("/it-autoflight/output/athr") == 1 and state1 != "TOGA" and state2 != "TOGA" and state1 != "IDLE" and state2 != "IDLE" and getprop("systems/thrust/eng-out") == 1) {
if (getprop("controls/engines/engine[0]/throttle-pos") < 0.83 and getprop("controls/engines/engine[1]/throttle-pos") < 0.83) { if (getprop("controls/engines/engine[0]/throttle-pos") < 0.83 and getprop("controls/engines/engine[1]/throttle-pos") < 0.83) {
setprop("modes/pfd/fma/throttle-mode-time", getprop("sim/time/elapsed-sec")); setprop("/modes/pfd/fma/throttle-mode-time", getprop("sim/time/elapsed-sec"));
} }
} }
}); });
setlistener("/modes/pfd/fma/roll-mode", func { setlistener("/modes/pfd/fma/roll-mode", 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-time", getprop("sim/time/elapsed-sec")); setprop("/modes/pfd/fma/roll-mode-time", getprop("sim/time/elapsed-sec"));
} }
}); });
setlistener("/modes/pfd/fma/pitch-mode", func { setlistener("/modes/pfd/fma/pitch-mode", func {
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-time", getprop("sim/time/elapsed-sec")); setprop("/modes/pfd/fma/pitch-mode-time", getprop("sim/time/elapsed-sec"));
} }
}); });
setlistener("/modes/pfd/fma/roll-mode-armed", func { setlistener("/modes/pfd/fma/roll-mode-armed", func {
var newarm = getprop("modes/pfd/fma/roll-mode-armed"); var newarm = getprop("/modes/pfd/fma/roll-mode-armed");
if (newarm != " ") { if (newarm != " ") {
setprop("modes/pfd/fma/roll-mode-armed-time", getprop("sim/time/elapsed-sec")); setprop("/modes/pfd/fma/roll-mode-armed-time", getprop("sim/time/elapsed-sec"));
} }
}); });
setlistener("/modes/pfd/fma/pitch-mode-armed", func { setlistener("/modes/pfd/fma/pitch-mode-armed", func {
var newarm = getprop("modes/pfd/fma/pitch-mode-armed"); var newarm = getprop("/modes/pfd/fma/pitch-mode-armed");
if (newarm != " ") { if (newarm != " ") {
setprop("modes/pfd/fma/pitch-mode-armed-time", getprop("sim/time/elapsed-sec")); setprop("/modes/pfd/fma/pitch-mode-armed-time", getprop("sim/time/elapsed-sec"));
} }
}); });
setlistener("/modes/pfd/fma/pitch-mode2-armed", func { setlistener("/modes/pfd/fma/pitch-mode2-armed", func {
var newarm = getprop("modes/pfd/fma/pitch-mode2-armed"); var newarm = getprop("/modes/pfd/fma/pitch-mode2-armed");
if (newarm != " ") { if (newarm != " ") {
setprop("modes/pfd/fma/pitch-mode2-armed-time", getprop("sim/time/elapsed-sec")); setprop("/modes/pfd/fma/pitch-mode2-armed-time", getprop("sim/time/elapsed-sec"));
} }
}); });

View file

@ -138,6 +138,7 @@ var FMGCinit = func {
} }
var FMGCInternal = { var FMGCInternal = {
# PERF
v1: 0, v1: 0,
v1set: 0, v1set: 0,
vr: 0, vr: 0,
@ -146,8 +147,27 @@ var FMGCInternal = {
v2set: 0, v2set: 0,
transAlt: 18000, transAlt: 18000,
transAltSet: 0, transAltSet: 0,
# INIT A
crzFt: 10000,
crzFl: 0,
crzSet: 0,
crzTemp: 15,
crzTempSet: 0,
tropo: 36090,
tropoSet: 0,
flightNum: "",
flightNumSet: 0,
}; };
var postInit = func() {
# Some properties had setlistener -- so to make sure all is o.k., we call function immediately like so:
altvert();
updateRouteManagerAlt();
mcdu.updateCrzLvlCallback();
}
var FMGCNodes = { var FMGCNodes = {
v1: props.globals.initNode("/FMGC/internal/v1", 0, "DOUBLE"), v1: props.globals.initNode("/FMGC/internal/v1", 0, "DOUBLE"),
v1set: props.globals.initNode("/FMGC/internal/v1-set", 0, "BOOL"), v1set: props.globals.initNode("/FMGC/internal/v1-set", 0, "BOOL"),
@ -185,9 +205,9 @@ var updateARPT = func {
} }
} }
setlistener("/FMGC/internal/cruise-ft", func { updateRouteManagerAlt = func() {
setprop("autopilot/route-manager/cruise/altitude-ft", getprop("/FMGC/internal/cruise-ft")); setprop("autopilot/route-manager/cruise/altitude-ft", FMGCInternal.crzFt);
}); };
######## ########
# FUEL # # FUEL #
@ -272,9 +292,9 @@ var updateFuel = func {
} }
# Calculate trip fuel # Calculate trip fuel
if (getprop("/FMGC/internal/tofrom-set") and getprop("/FMGC/internal/cruise-lvl-set") and getprop("/FMGC/internal/cruise-temp-set") and getprop("/FMGC/internal/zfw-set")) { if (getprop("/FMGC/internal/tofrom-set") and FMGCInternal.crzSet and FMGCInternal.crzTempSet and getprop("/FMGC/internal/zfw-set")) {
crz = getprop("/FMGC/internal/cruise-fl"); crz = FMGCInternal.crzFl;
temp = getprop("/FMGC/internal/cruise-temp"); temp = FMGCInternal.crzTemp;
dist = flightPlanController.arrivalDist; dist = flightPlanController.arrivalDist;
trpWind = getprop("/FMGC/internal/trip-wind"); trpWind = getprop("/FMGC/internal/trip-wind");
@ -396,8 +416,8 @@ var masterFMGC = maketimer(0.2, func {
gs = getprop("/velocities/groundspeed-kt"); gs = getprop("/velocities/groundspeed-kt");
alt = getprop("/instrumentation/altimeter/indicated-altitude-ft"); alt = getprop("/instrumentation/altimeter/indicated-altitude-ft");
aglalt = pts.Position.gearAglFt.getValue(); aglalt = pts.Position.gearAglFt.getValue();
cruiseft = getprop("/FMGC/internal/cruise-ft"); # cruiseft = FMGCInternal.crzFt;
cruiseft_b = getprop("/FMGC/internal/cruise-ft") - 200; # cruiseft_b = FMGCInternal.crzFt - 200;
newcruise = getprop("/it-autoflight/internal/alt"); newcruise = getprop("/it-autoflight/internal/alt");
phase = getprop("/FMGC/status/phase"); phase = getprop("/FMGC/status/phase");
state1 = getprop("/systems/thrust/state1"); state1 = getprop("/systems/thrust/state1");
@ -423,7 +443,6 @@ var masterFMGC = maketimer(0.2, func {
thr1 = getprop("/controls/engines/engine[0]/throttle-pos"); thr1 = getprop("/controls/engines/engine[0]/throttle-pos");
thr2 = getprop("/controls/engines/engine[1]/throttle-pos"); thr2 = getprop("/controls/engines/engine[1]/throttle-pos");
altSel = getprop("/it-autoflight/input/alt"); altSel = getprop("/it-autoflight/input/alt");
crzFl = getprop("/FMGC/internal/cruise-fl");
if (getprop("/gear/gear[0]/wow") != getprop("/gear/gear[0]/wow-fmgc")) { if (getprop("/gear/gear[0]/wow") != getprop("/gear/gear[0]/wow-fmgc")) {
setprop("gear/gear[0]/wow-fmgc", getprop("/gear/gear[0]/wow")); setprop("gear/gear[0]/wow-fmgc", getprop("/gear/gear[0]/wow"));
@ -449,13 +468,13 @@ var masterFMGC = maketimer(0.2, func {
setprop("systems/pressurization/mode", "CR"); setprop("systems/pressurization/mode", "CR");
} }
if (crzFl >= 200) { if (FMGCInternal.crzFl >= 200) {
if (phase == 3 and (flightPlanController.arrivalDist <= 200 or altSel < 20000)) { if (phase == 3 and (flightPlanController.arrivalDist <= 200 or altSel < 20000)) {
setprop("/FMGC/status/phase", 4); setprop("/FMGC/status/phase", 4);
setprop("systems/pressurization/mode", "DE"); setprop("systems/pressurization/mode", "DE");
} }
} else { } else {
if (phase == 3 and (flightPlanController.arrivalDist <= 200 or altSel < (crzFl * 100))) { # todo - not sure about crzFl condition, investigate what happens! if (phase == 3 and (flightPlanController.arrivalDist <= 200 or altSel < (FMGCInternal.crzFl * 100))) { # todo - not sure about crzFl condition, investigate what happens!
setprop("/FMGC/status/phase", 4); setprop("/FMGC/status/phase", 4);
setprop("systems/pressurization/mode", "DE"); setprop("systems/pressurization/mode", "DE");
} }
@ -868,7 +887,7 @@ var adf1 = func {
################# #################
var ManagedSPD = maketimer(0.25, func { var ManagedSPD = maketimer(0.25, func {
if (getprop("/FMGC/internal/cruise-lvl-set") == 1 and getprop("/FMGC/internal/cost-index-set") == 1) { if (FMGCInternal.crzSet and getprop("/FMGC/internal/cost-index-set") == 1) {
if (getprop("/it-autoflight/input/spd-managed") == 1) { if (getprop("/it-autoflight/input/spd-managed") == 1) {
altitude = getprop("/instrumentation/altimeter/indicated-altitude-ft"); altitude = getprop("/instrumentation/altimeter/indicated-altitude-ft");
mode = getprop("/modes/pfd/fma/pitch-mode"); mode = getprop("/modes/pfd/fma/pitch-mode");

View file

@ -240,6 +240,7 @@ var systemsInit = func {
setlistener("/sim/signals/fdm-initialized", func { setlistener("/sim/signals/fdm-initialized", func {
systemsInit(); systemsInit();
fmgc.postInit();
fmgc.flightPlanTimer.start(); fmgc.flightPlanTimer.start();
fmgc.WaypointDatabase.read(); fmgc.WaypointDatabase.read();
}); });

View file

@ -45,14 +45,14 @@ var initInputA = func(key, i) {
} }
} else if (key == "L3") { } else if (key == "L3") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("MCDUC/flight-num", ""); fmgc.FMGCInternal.flightNum = "";
setprop("MCDUC/flight-num-set", 0); fmgc.FMGCInternal.flightNumSet = 0;
mcdu_scratchpad.scratchpads[i].empty(); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
var flts = size(scratchpad); var flts = size(scratchpad);
if (flts >= 1 and flts <= 8) { if (flts >= 1 and flts <= 8) {
setprop("MCDUC/flight-num", scratchpad); fmgc.FMGCInternal.flightNum = scratchpad;
setprop("MCDUC/flight-num-set", 1); fmgc.FMGCInternal.flightNumSet = 1;
mcdu_scratchpad.scratchpads[i].empty(); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
mcdu_message(i, "NOT ALLOWED"); mcdu_message(i, "NOT ALLOWED");
@ -80,11 +80,14 @@ var initInputA = func(key, i) {
} }
} else if (key == "L6") { } else if (key == "L6") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/cruise-ft", 10000); fmgc.FMGCInternal.crzFt = 10000;
setprop("/FMGC/internal/cruise-fl", 100); fmgc.FMGCInternal.crzFl = 100;
setprop("/FMGC/internal/cruise-lvl-set", 0); fmgc.altvert();
setprop("/FMGC/internal/cruise-temp", 15); fmgc.updateRouteManagerAlt();
setprop("/FMGC/internal/cruise-temp-set", 0); fmgc.FMGCInternal.crzSet = 0;
updateCrzLvlCallback();
fmgc.FMGCInternal.crzTemp = 15;
fmgc.FMGCInternal.crzTempSet = 0;
if (getprop("/FMGC/internal/block-confirmed")) { if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0); setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
@ -101,9 +104,10 @@ var initInputA = func(key, i) {
} }
var temp = int(crztemp[1]); var temp = int(crztemp[1]);
var temps = size(crztemp[1]); var temps = size(crztemp[1]);
if (crzs == 0 and temps >= 1 and temps <= 3 and temp != nil and getprop("/FMGC/internal/cruise-lvl-set")) { if (crzs == 0 and temps >= 1 and temps <= 3 and temp != nil and fmgc.FMGCInternal.crzSet) {
if (temp >= -99 and temp <= 99) { if (temp >= -99 and temp <= 99) {
setprop("/FMGC/internal/cruise-temp", temp); fmgc.FMGCInternal.crzTemp = temp;
fmgc.FMGCInternal.crzTempSet = 1;
if (getprop("/FMGC/internal/block-confirmed")) { if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0); setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
@ -114,12 +118,15 @@ var initInputA = func(key, i) {
} }
} else if (crzs >= 1 and crzs <= 3 and crz != nil and temps >= 1 and temps <= 3 and temp != nil) { } else if (crzs >= 1 and crzs <= 3 and crz != nil and temps >= 1 and temps <= 3 and temp != nil) {
if (crz > 0 and crz <= 390 and temp >= -99 and temp <= 99) { if (crz > 0 and crz <= 390 and temp >= -99 and temp <= 99) {
setprop("/FMGC/internal/cruise-ft", crz * 100); fmgc.FMGCInternal.crzFt = crz * 100;
setprop("/FMGC/internal/cruise-fl", crz); fmgc.FMGCInternal.crzFl = crz;
setprop("/FMGC/internal/cruise-fl-prog", crz); fmgc.altvert();
setprop("/FMGC/internal/cruise-lvl-set", 1); fmgc.updateRouteManagerAlt();
setprop("/FMGC/internal/cruise-temp", temp); fmgc.FMGCInternal.crzSet = 1;
setprop("/FMGC/internal/cruise-temp-set", 1); updateCrzLvlCallback();
fmgc.FMGCInternal.crzTemp = temp;
fmgc.FMGCInternal.crzTempSet = 1;
fmgc.FMGCInternal.crzProg = crz;
if (getprop("/FMGC/internal/block-confirmed")) { if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0); setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
@ -141,10 +148,13 @@ var initInputA = func(key, i) {
} }
if (crzs >= 1 and crzs <= 3 and crz != nil) { if (crzs >= 1 and crzs <= 3 and crz != nil) {
if (crz > 0 and crz <= 390) { if (crz > 0 and crz <= 390) {
setprop("/FMGC/internal/cruise-ft", crz * 100); fmgc.FMGCInternal.crzFt = crz * 100;
setprop("/FMGC/internal/cruise-fl", crz); fmgc.FMGCInternal.crzFl = crz;
setprop("/FMGC/internal/cruise-fl-prog", crz); fmgc.altvert();
setprop("/FMGC/internal/cruise-lvl-set", 1); fmgc.updateRouteManagerAlt();
fmgc.FMGCInternal.crzSet = 1;
updateCrzLvlCallback();
fmgc.FMGCInternal.crzProg = crz;
if (getprop("/FMGC/internal/block-confirmed")) { if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0); setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
@ -236,14 +246,14 @@ var initInputA = func(key, i) {
setprop("MCDU[" ~ i ~ "]/page", "WINDCLB"); setprop("MCDU[" ~ i ~ "]/page", "WINDCLB");
} else if (key == "R5") { } else if (key == "R5") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/tropo", 36090); fmgc.FMGCInternal.tropo = 36090;
setprop("/FMGC/internal/tropo-set", 0); fmgc.FMGCInternal.tropoSet = 1;
mcdu_scratchpad.scratchpads[i].empty(); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
var tropo = size(scratchpad); var tropo = size(scratchpad);
if (tropo == 5 and scratchpad <= 99990) { if (tropo == 5 and scratchpad <= 99990) {
setprop("FMGC/internal/tropo-set", 1); fmgc.FMGCInternal.tropo = scratchpad;
setprop("FMGC/internal/tropo", scratchpad); fmgc.FMGCInternal.tropoSet = 1;
mcdu_scratchpad.scratchpads[i].empty(); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
mcdu_message(i, "NOT ALLOWED"); mcdu_message(i, "NOT ALLOWED");

View file

@ -50,8 +50,8 @@ var MCDU_reset = func(i) {
setprop("/FMGC/internal/adf2freq-set", 0); setprop("/FMGC/internal/adf2freq-set", 0);
# INT-A # INT-A
setprop("MCDUC/flight-num", ""); fmgc.FMGCInternal.flightNum = "";
setprop("MCDUC/flight-num-set", 0); fmgc.FMGCInternal.flightNumSet = 0;
setprop("/FMGC/internal/dep-arpt", ""); setprop("/FMGC/internal/dep-arpt", "");
setprop("/FMGC/internal/arr-arpt", ""); setprop("/FMGC/internal/arr-arpt", "");
setprop("/FMGC/internal/tofrom-set", 0); setprop("/FMGC/internal/tofrom-set", 0);
@ -59,13 +59,16 @@ var MCDU_reset = func(i) {
setprop("/FMGC/internal/alt-set", 0); setprop("/FMGC/internal/alt-set", 0);
setprop("/FMGC/internal/cost-index", "0"); setprop("/FMGC/internal/cost-index", "0");
setprop("/FMGC/internal/cost-index-set", 0); setprop("/FMGC/internal/cost-index-set", 0);
setprop("/FMGC/internal/cruise-ft", 10000); fmgc.FMGCInternal.crzFt = 10000;
setprop("/FMGC/internal/cruise-fl", 100); fmgc.altvert();
setprop("/FMGC/internal/cruise-lvl-set", 0); fmgc.updateRouteManagerAlt();
setprop("/FMGC/internal/tropo", 36090); fmgc.FMGCInternal.crzFl = 100;
setprop("/FMGC/internal/tropo-set", 0); fmgc.FMGCInternal.crzSet = 0;
setprop("/FMGC/internal/cruise-temp", 15); updateCrzLvlCallback();
setprop("/FMGC/internal/cruise-temp-set", 0); fmgc.FMGCInternal.tropo = 36090;
fmgc.FMGCInternal.tropoSet = 0;
fmgc.FMGCInternal.crzTemp = 15;
fmgc.FMGCInternal.crzTempSet = 0;
# IRSINIT # IRSINIT
setprop("/FMGC/internal/align-set", 0); setprop("/FMGC/internal/align-set", 0);
@ -131,7 +134,7 @@ var MCDU_reset = func(i) {
setprop("/FMGC/internal/cg", 0); setprop("/FMGC/internal/cg", 0);
# PROG # PROG
setprop("/FMGC/internal/cruise-fl-prog", 100); fmgc.FMGCInternal.crzProg = 100;
# PERF # PERF

View file

@ -4,7 +4,7 @@ var progCLBInput = func(key, i) {
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
if (key == "L1") { if (key == "L1") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/cruise-fl-prog", getprop("/FMGC/internal/cruise-fl")); fmgc.FMGCInternal.crzProg = fmgc.FMGCInternal.crzFl;
if (getprop("/FMGC/status/phase") == 5) { if (getprop("/FMGC/status/phase") == 5) {
setprop("/FMGC/status/phase", 3); setprop("/FMGC/status/phase", 3);
setprop("/FMGC/internal/activate-once", 0); setprop("/FMGC/internal/activate-once", 0);
@ -15,7 +15,7 @@ var progCLBInput = func(key, i) {
} else if (int(scratchpad) != nil) { } else if (int(scratchpad) != nil) {
var crzs = size(scratchpad); var crzs = size(scratchpad);
if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100) { if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100) {
setprop("/FMGC/internal/cruise-fl-prog", scratchpad); fmgc.FMGCInternal.crzProg = scratchpad;
mcdu_scratchpad.scratchpads[i].empty(); mcdu_scratchpad.scratchpads[i].empty();
if (getprop("/FMGC/status/phase") == 5) { if (getprop("/FMGC/status/phase") == 5) {
setprop("/FMGC/status/phase", 3); setprop("/FMGC/status/phase", 3);

View file

@ -4,7 +4,7 @@ var progCRZInput = func(key, i) {
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
if (key == "L1") { if (key == "L1") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/cruise-fl-prog", getprop("/FMGC/internal/cruise-fl")); fmgc.FMGCInternal.crzProg = fmgc.FMGCInternal.crzFl;
if (getprop("/FMGC/status/phase") == 5) { if (getprop("/FMGC/status/phase") == 5) {
setprop("/FMGC/status/phase", 3); setprop("/FMGC/status/phase", 3);
setprop("/FMGC/internal/activate-once", 0); setprop("/FMGC/internal/activate-once", 0);
@ -15,7 +15,7 @@ var progCRZInput = func(key, i) {
} else if (int(scratchpad) != nil) { } else if (int(scratchpad) != nil) {
var crzs = size(scratchpad); var crzs = size(scratchpad);
if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100) { if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100) {
setprop("/FMGC/internal/cruise-fl-prog", scratchpad); fmgc.FMGCInternal.crzProg = scratchpad;
mcdu_scratchpad.scratchpads[i].empty(); mcdu_scratchpad.scratchpads[i].empty();
if (getprop("/FMGC/status/phase") == 5) { if (getprop("/FMGC/status/phase") == 5) {
setprop("/FMGC/status/phase", 3); setprop("/FMGC/status/phase", 3);

View file

@ -4,7 +4,7 @@ var progDESInput = func(key, i) {
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
if (key == "L1") { if (key == "L1") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/cruise-fl-prog", getprop("/FMGC/internal/cruise-fl")); fmgc.FMGCInternal.crzProg = fmgc.FMGCInternal.crzFl;
if (getprop("/FMGC/status/phase") == 5 or getprop("/FMGC/status/phase") == 6) { if (getprop("/FMGC/status/phase") == 5 or getprop("/FMGC/status/phase") == 6) {
setprop("/FMGC/status/phase", 3); setprop("/FMGC/status/phase", 3);
setprop("/FMGC/internal/activate-once", 0); setprop("/FMGC/internal/activate-once", 0);
@ -15,7 +15,7 @@ var progDESInput = func(key, i) {
} else if (int(scratchpad) != nil) { } else if (int(scratchpad) != nil) {
var crzs = size(scratchpad); var crzs = size(scratchpad);
if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100) { if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100) {
setprop("/FMGC/internal/cruise-fl-prog", scratchpad); fmgc.FMGCInternal.crzProg = scratchpad;
mcdu_scratchpad.scratchpads[i].empty(); mcdu_scratchpad.scratchpads[i].empty();
if (getprop("/FMGC/status/phase") == 4 or getprop("/FMGC/status/phase") == 5 or getprop("/FMGC/status/phase") == 6) { if (getprop("/FMGC/status/phase") == 4 or getprop("/FMGC/status/phase") == 5 or getprop("/FMGC/status/phase") == 6) {
setprop("/FMGC/status/phase", 3); setprop("/FMGC/status/phase", 3);

View file

@ -6,12 +6,12 @@ var progTOInput = func(key, i) {
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
if (key == "L1") { if (key == "L1") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/cruise-fl-prog", getprop("/FMGC/internal/cruise-fl")); fmgc.FMGCInternal.crzProg = fmgc.FMGCInternal.crzFl;
mcdu_scratchpad.scratchpads[i].empty(); mcdu_scratchpad.scratchpads[i].empty();
} else if (int(scratchpad) != nil) { } else if (int(scratchpad) != nil) {
var crzs = size(scratchpad); var crzs = size(scratchpad);
if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100 and getprop("/FMGC/internal/cruise-lvl-set")) { if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100 and fmgc.FMGCInternal.crzSet) {
setprop("/FMGC/internal/cruise-fl-prog", scratchpad); fmgc.FMGCInternal.crzProg = scratchpad;
mcdu_scratchpad.scratchpads[i].empty(); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
mcdu_message(i, "NOT ALLOWED"); mcdu_message(i, "NOT ALLOWED");

View file

@ -126,7 +126,7 @@ var vertRev = {
} }
}, },
updateR5: func() { updateR5: func() {
if (getprop("FMGC/internal/cruise-lvl-set") and (getprop("FMGC/status/phase") < 4 or getprop("FMGC/status/phase") == 7)) { if (fmgc.FMGCInternal.crzSet and (getprop("FMGC/status/phase") < 4 or getprop("FMGC/status/phase") == 7)) {
me.R5 = ["STEP ALTS ", nil, "wht"]; me.R5 = ["STEP ALTS ", nil, "wht"];
me.arrowsMatrix[1][4] = 1; me.arrowsMatrix[1][4] = 1;
} else { } else {
@ -182,7 +182,7 @@ var vertRev = {
}, },
}; };
setlistener("FMGC/internal/cruise-lvl-set", func() { var updateCrzLvlCallback = func () {
if (canvas_mcdu.myVertRev[0] != nil) { if (canvas_mcdu.myVertRev[0] != nil) {
canvas_mcdu.myVertRev[0].updateR5(); canvas_mcdu.myVertRev[0].updateR5();
} }
@ -190,7 +190,7 @@ setlistener("FMGC/internal/cruise-lvl-set", func() {
if (canvas_mcdu.myVertRev[1] != nil) { if (canvas_mcdu.myVertRev[1] != nil) {
canvas_mcdu.myVertRev[1].updateR5(); canvas_mcdu.myVertRev[1].updateR5();
} }
}, 0, 0); };
setlistener("FMGC/status/phase", func() { setlistener("FMGC/status/phase", func() {
if (canvas_mcdu.myVertRev[0] != nil) { if (canvas_mcdu.myVertRev[0] != nil) {