diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index e0eebc6e..bc31e62a 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -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); # 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 arrArpt = props.globals.getNode("/FMGC/internal/arr-arpt", 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 costIndex = props.globals.getNode("/FMGC/internal/cost-index", 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 gndtempSet = props.globals.getNode("/FMGC/internal/gndtemp-set", 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 cg = props.globals.getNode("/FMGC/internal/cg", 1); -# PROG -var cruiseFL_prog = props.globals.getNode("/FMGC/internal/cruise-fl-prog", 1); - # PERF var altitude = props.globals.getNode("/instrumentation/altimeter/indicated-altitude-ft", 1); @@ -359,8 +348,8 @@ var canvas_MCDU_base = { if (myFpln[i] != nil) { - if (flightNumSet.getValue()) { - me["FPLN_Callsign"].setText(flightNum.getValue()); + if (fmgc.FMGCInternal.flightNumSet) { + me["FPLN_Callsign"].setText(fmgc.FMGCInternal.flightNum); me["FPLN_Callsign"].show(); } else { me["FPLN_Callsign"].hide(); @@ -1095,13 +1084,14 @@ var canvas_MCDU_base = { pageSwitch[i].setBoolValue(1); } - if (flightNumSet.getValue() == 1) { + if (fmgc.FMGCInternal.flightNumSet) { me["INITA_FltNbr"].hide(); me["Simple_L3"].show(); } else { me["INITA_FltNbr"].show(); me["Simple_L3"].hide(); } + if (toFromSet.getValue() != 1 and costIndexSet.getValue() != 1) { me["INITA_CostIndex"].hide(); me["Simple_L5"].setColor(1,1,1); @@ -1116,20 +1106,20 @@ var canvas_MCDU_base = { me["INITA_CostIndex"].show(); 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["Simple_L6"].setColor(1,1,1); 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["Simple_L6"].setColor(0.0901,0.6039,0.7176); - me["Simple_L6"].setText(sprintf("%s", "FL" ~ cruiseFL.getValue()) ~ sprintf("/%sg", cruiseTemp.getValue())); - } else if (cruiseSet.getValue() == 1) { + me["Simple_L6"].setText(sprintf("%s", "FL" ~ fmgc.FMGCInternal.crzFl) ~ sprintf("/%sg", fmgc.FMGCInternal.crzTemp)); + } else if (fmgc.FMGCInternal.crzSet) { me["INITA_CruiseFLTemp"].hide(); me["Simple_L6"].setColor(0.0901,0.6039,0.7176); - setprop("/FMGC/internal/cruise-temp", 15 - (2 * cruiseFL.getValue() / 10)); - setprop("/FMGC/internal/cruise-temp-set", 1); - me["Simple_L6"].setText(sprintf("%s", "FL" ~ cruiseFL.getValue()) ~ sprintf("/%sg", cruiseTemp.getValue())); + fmgc.FMGCInternal.crzTemp = 15 - (2 * fmgc.FMGCInternal.crzFl / 10); + fmgc.FMGCInternal.crzTempSet = 1; + me["Simple_L6"].setText(sprintf("%s", "FL" ~ fmgc.FMGCInternal.crzFl) ~ sprintf("/%sg", fmgc.FMGCInternal.crzTemp)); } else { me["INITA_CruiseFLTemp"].show(); me["Simple_L6"].setColor(0.7333,0.3803,0); @@ -1167,7 +1157,7 @@ var canvas_MCDU_base = { me["Simple_R3"].setColor(WHITE); me.showRightArrow(0, 0, 1, 0, 0, 0); } - if (tropoSet.getValue() == 1) { + if (fmgc.FMGCInternal.tropoSet) { me["Simple_R5"].setFontSize(normal); } else { me["Simple_R5"].setFontSize(small); @@ -1193,7 +1183,7 @@ var canvas_MCDU_base = { me["Simple_L5S"].setText("COST INDEX"); me["Simple_L6S"].setText("CRZ FL/TEMP"); 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_R2S"].setText("INIT "); me["Simple_R5S"].setText("TROPO"); @@ -1202,7 +1192,7 @@ var canvas_MCDU_base = { me["Simple_R2"].setText("REQUEST "); me["Simple_R3"].setText("IRS INIT "); 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") { if (!pageSwitch[i].getBoolValue()) { me["Simple"].show(); @@ -2112,15 +2102,15 @@ var canvas_MCDU_base = { me["PERFAPPR"].hide(); me["PERFGA"].hide(); - if (flightNumSet.getValue() == 1) { + if (fmgc.FMGCInternal.flightNumSet) { 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") { - me["Simple_Title"].setText(sprintf("CLIMB %s", flightNum.getValue())); + me["Simple_Title"].setText(sprintf("CLIMB %s", fmgc.FMGCInternal.flightNum)); } 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") { - me["Simple_Title"].setText(sprintf("DESCENT %s", flightNum.getValue())); + me["Simple_Title"].setText(sprintf("DESCENT %s", fmgc.FMGCInternal.flightNum)); } } else { if (page == "PROGTO") { @@ -2186,11 +2176,11 @@ var canvas_MCDU_base = { pageSwitch[i].setBoolValue(1); } - if (cruiseSet.getValue() == 1 and page != "PROGDES") { - if (getprop("/it-autoflight/input/alt") > cruiseFL_prog.getValue() * 100) { + if (fmgc.FMGCInternal.crzSet and page != "PROGDES") { + if (getprop("/it-autoflight/input/alt") > fmgc.FMGCInternal.crzProg * 100) { me["Simple_L1"].setText(sprintf("%s", "FL" ~ getprop("/it-autoflight/input/alt") / 100)); } else { - me["Simple_L1"].setText(sprintf("%s", "FL" ~ cruiseFL_prog.getValue())); + me["Simple_L1"].setText(sprintf("%s", "FL" ~ fmgc.FMGCInternal.crzProg)); } } else { me["Simple_L1"].setText("----"); diff --git a/Nasal/FMGC/FCU.nas b/Nasal/FMGC/FCU.nas index eccfaf09..f9d709c4 100644 --- a/Nasal/FMGC/FCU.nas +++ b/Nasal/FMGC/FCU.nas @@ -196,7 +196,7 @@ var FCUController = { }, SPDPush: func() { 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); fmgc.ManagedSPD.start(); } diff --git a/Nasal/FMGC/FMGC-c.nas b/Nasal/FMGC/FMGC-c.nas index dd9fe448..44eecee4 100644 --- a/Nasal/FMGC/FMGC-c.nas +++ b/Nasal/FMGC/FMGC-c.nas @@ -3,37 +3,36 @@ # Copyright (c) 2020 Josh Davidson (Octal450) -setprop("FMGC/internal/cruise-ft", 10000); -setprop("it-autoflight/internal/alt", 10000); -setprop("modes/pfd/fma/throttle-mode", " "); -setprop("modes/pfd/fma/pitch-mode", " "); -setprop("modes/pfd/fma/pitch-mode-armed", " "); -setprop("modes/pfd/fma/pitch-mode2-armed", " "); -setprop("modes/pfd/fma/roll-mode", " "); -setprop("modes/pfd/fma/roll-mode-armed", " "); -setprop("modes/pfd/fma/ap-mode", " "); -setprop("modes/pfd/fma/fd-mode", " "); -setprop("modes/pfd/fma/at-mode", " "); -setprop("modes/pfd/fma/athr-armed", 0); -setprop("modes/pfd/fma/throttle-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-mode2-armed-box", 0); -setprop("modes/pfd/fma/roll-mode-box", 0); -setprop("modes/pfd/fma/roll-mode-armed-box", 0); -setprop("modes/pfd/fma/ap-mode-box", 0); -setprop("modes/pfd/fma/fd-mode-box", 0); -setprop("modes/pfd/fma/athr-mode-box", 0); -setprop("modes/pfd/fma/throttle-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-mode2-armed-time", 0); -setprop("modes/pfd/fma/roll-mode-time", 0); -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", -45); +setprop("/it-autoflight/internal/alt", 10000); +setprop("/modes/pfd/fma/throttle-mode", " "); +setprop("/modes/pfd/fma/pitch-mode", " "); +setprop("/modes/pfd/fma/pitch-mode-armed", " "); +setprop("/modes/pfd/fma/pitch-mode2-armed", " "); +setprop("/modes/pfd/fma/roll-mode", " "); +setprop("/modes/pfd/fma/roll-mode-armed", " "); +setprop("/modes/pfd/fma/ap-mode", " "); +setprop("/modes/pfd/fma/fd-mode", " "); +setprop("/modes/pfd/fma/at-mode", " "); +setprop("/modes/pfd/fma/athr-armed", 0); +setprop("/modes/pfd/fma/throttle-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-mode2-armed-box", 0); +setprop("/modes/pfd/fma/roll-mode-box", 0); +setprop("/modes/pfd/fma/roll-mode-armed-box", 0); +setprop("/modes/pfd/fma/ap-mode-box", 0); +setprop("/modes/pfd/fma/fd-mode-box", 0); +setprop("/modes/pfd/fma/athr-mode-box", 0); +setprop("/modes/pfd/fma/throttle-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-mode2-armed-time", 0); +setprop("/modes/pfd/fma/roll-mode-time", 0); +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", -45); setlistener("sim/signals/fdm-initialized", func { loopFMA.start(); @@ -43,49 +42,49 @@ setlistener("sim/signals/fdm-initialized", func { var loopFMA = maketimer(0.05, func { var state1 = getprop("systems/thrust/state1"); 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 thr2 = getprop("controls/engines/engine[1]/throttle-pos"); if (state1 == "TOGA" or state2 == "TOGA") { 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)) { 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) { 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) { if (newthr != " ") { - setprop("modes/pfd/fma/throttle-mode", " "); + setprop("/modes/pfd/fma/throttle-mode", " "); } } 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/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/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) { loopFMA_b(); } else { - var thr = getprop("it-autoflight/output/thr-mode"); + var thr = getprop("/it-autoflight/output/thr-mode"); if (thr == 0) { loopFMA_b(); } else if (thr == 1) { if (newthr != "THR IDLE") { - setprop("modes/pfd/fma/throttle-mode", "THR IDLE"); + setprop("/modes/pfd/fma/throttle-mode", "THR IDLE"); } } else if (thr == 2) { if (state1 == "MCT" or state2 == "MCT" and getprop("systems/thrust/eng-out") == 1) { 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") { if (newthr != "THR CLB") { - setprop("modes/pfd/fma/throttle-mode", "THR CLB"); + setprop("/modes/pfd/fma/throttle-mode", "THR CLB"); } } else { 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 - 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) { - setprop("modes/pfd/fma/athr-armed", 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) { + 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) { - if (getprop("modes/pfd/fma/athr-armed") != 1) { - setprop("modes/pfd/fma/athr-armed", 1); + if (getprop("/modes/pfd/fma/athr-armed") != 1) { + setprop("/modes/pfd/fma/athr-armed", 1); } } else { - if (getprop("modes/pfd/fma/athr-armed") != 0) { - setprop("modes/pfd/fma/athr-armed", 0); + if (getprop("/modes/pfd/fma/athr-armed") != 0) { + setprop("/modes/pfd/fma/athr-armed", 0); } } # SRS RWY Engagement var flx = getprop("systems/thrust/lim-flex"); - var lat = getprop("it-autoflight/mode/lat"); - var newlat = getprop("modes/pfd/fma/roll-mode"); - var vert = getprop("it-autoflight/mode/vert"); - var newvert = getprop("modes/pfd/fma/pitch-mode"); - var newvertarm = getprop("modes/pfd/fma/pitch-mode2-armed"); + var lat = getprop("/it-autoflight/mode/lat"); + var newlat = getprop("/modes/pfd/fma/roll-mode"); + var vert = getprop("/it-autoflight/mode/vert"); + var newvert = getprop("/modes/pfd/fma/pitch-mode"); + var newvertarm = getprop("/modes/pfd/fma/pitch-mode2-armed"); var thr1 = getprop("controls/engines/engine[0]/throttle-pos"); var thr2 = getprop("controls/engines/engine[1]/throttle-pos"); var wow = getprop("gear/gear[0]/wow"); @@ -125,135 +124,135 @@ var loopFMA = maketimer(0.05, func { 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)) { # 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); - setprop("it-autoflight/mode/vert", "T/O CLB"); + setprop("/it-autoflight/mode/vert", "T/O CLB"); } } 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)) { + if (getprop("/it-autoflight/input/lat") == 5 and (gear1 or gear2)) { 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); } } - var trk = getprop("it-autoflight/custom/trk-fpa"); + var trk = getprop("/it-autoflight/custom/trk-fpa"); if (lat == "HDG" and trk == 0) { if (newlat != "HDG") { - setprop("modes/pfd/fma/roll-mode", "HDG"); + setprop("/modes/pfd/fma/roll-mode", "HDG"); } } else if (lat == "HDG" and trk == 1) { if (newlat != "TRACK") { - setprop("modes/pfd/fma/roll-mode", "TRACK"); + setprop("/modes/pfd/fma/roll-mode", "TRACK"); } } # Boxes var elapsedtime = getprop("sim/time/elapsed-sec"); - if (getprop("modes/pfd/fma/ap-mode-time") + 10 >= elapsedtime) { - setprop("modes/pfd/fma/ap-mode-box", 1); + if (getprop("/modes/pfd/fma/ap-mode-time") + 10 >= elapsedtime) { + setprop("/modes/pfd/fma/ap-mode-box", 1); } 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) { - setprop("modes/pfd/fma/fd-mode-box", 1); + if (getprop("/modes/pfd/fma/fd-mode-time") + 10 >= elapsedtime) { + setprop("/modes/pfd/fma/fd-mode-box", 1); } 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) { - setprop("modes/pfd/fma/athr-mode-box", 1); + if (getprop("/modes/pfd/fma/athr-mode-time") + 10 >= elapsedtime) { + setprop("/modes/pfd/fma/athr-mode-box", 1); } 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) { - setprop("modes/pfd/fma/throttle-mode-box", 1); + if (getprop("/modes/pfd/fma/throttle-mode-time") + 10 >= elapsedtime) { + setprop("/modes/pfd/fma/throttle-mode-box", 1); } 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) { - setprop("modes/pfd/fma/roll-mode-box", 1); + if (getprop("/modes/pfd/fma/roll-mode-time") + 10 >= elapsedtime) { + setprop("/modes/pfd/fma/roll-mode-box", 1); } 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) { - setprop("modes/pfd/fma/pitch-mode-box", 1); + if (getprop("/modes/pfd/fma/pitch-mode-time") + 10 >= elapsedtime) { + setprop("/modes/pfd/fma/pitch-mode-box", 1); } 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) { - setprop("modes/pfd/fma/roll-mode-armed-box", 1); + if (getprop("/modes/pfd/fma/roll-mode-armed-time") + 10 >= elapsedtime) { + setprop("/modes/pfd/fma/roll-mode-armed-box", 1); } 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) { - setprop("modes/pfd/fma/pitch-mode-armed-box", 1); + if (getprop("/modes/pfd/fma/pitch-mode-armed-time") + 10 >= elapsedtime) { + setprop("/modes/pfd/fma/pitch-mode-armed-box", 1); } 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) { - setprop("modes/pfd/fma/pitch-mode2-armed-box", 1); + if (getprop("/modes/pfd/fma/pitch-mode2-armed-time") + 10 >= elapsedtime) { + setprop("/modes/pfd/fma/pitch-mode2-armed-box", 1); } else { - setprop("modes/pfd/fma/pitch-mode2-armed-box", 0); + setprop("/modes/pfd/fma/pitch-mode2-armed-box", 0); } }); var loopFMA_b = func { - var newthr = getprop("modes/pfd/fma/throttle-mode"); - if (getprop("it-autoflight/input/kts-mach") == 0) { + var newthr = getprop("/modes/pfd/fma/throttle-mode"); + if (getprop("/it-autoflight/input/kts-mach") == 0) { 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") { - setprop("modes/pfd/fma/throttle-mode", "MACH"); + setprop("/modes/pfd/fma/throttle-mode", "MACH"); } } } # Master Lateral setlistener("/it-autoflight/mode/lat", func { - var lat = getprop("it-autoflight/mode/lat"); - var newlat = getprop("modes/pfd/fma/roll-mode"); + var lat = getprop("/it-autoflight/mode/lat"); + var newlat = getprop("/modes/pfd/fma/roll-mode"); if (lat == "LNAV") { if (newlat != "NAV") { - setprop("modes/pfd/fma/roll-mode", "NAV"); + setprop("/modes/pfd/fma/roll-mode", "NAV"); } } else if (lat == "LOC") { if (newlat != "LOC*" and newlat != "LOC") { - setprop("modes/pfd/fma/roll-mode", "LOC*"); + setprop("/modes/pfd/fma/roll-mode", "LOC*"); locupdate.start(); } } else if (lat == "ALGN") { if (newlat != " ") { - setprop("modes/pfd/fma/roll-mode", " "); + setprop("/modes/pfd/fma/roll-mode", " "); } } else if (lat == "RLOU") { if (newlat != " ") { - setprop("modes/pfd/fma/roll-mode", " "); + setprop("/modes/pfd/fma/roll-mode", " "); } } else if (lat == "T/O") { if (newlat != "RWY") { - setprop("modes/pfd/fma/roll-mode", "RWY"); + setprop("/modes/pfd/fma/roll-mode", "RWY"); } } else if (lat == " ") { if (newlat != " ") { - setprop("modes/pfd/fma/roll-mode", " "); + setprop("/modes/pfd/fma/roll-mode", " "); } } }); var locupdate = maketimer(0.5, func { - var lat = getprop("it-autoflight/mode/lat"); - var newlat = getprop("modes/pfd/fma/roll-mode"); - var nav_defl = getprop("instrumentation/nav[0]/heading-needle-deflection-norm"); + var lat = getprop("/it-autoflight/mode/lat"); + var newlat = getprop("/modes/pfd/fma/roll-mode"); + var nav_defl = getprop("/instrumentation/nav[0]/heading-needle-deflection-norm"); if (lat == "LOC") { if (nav_defl > -0.06 and nav_defl < 0.06) { locupdate.stop(); 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 setlistener("/it-autoflight/mode/vert", func { - var vert = getprop("it-autoflight/mode/vert"); - var newvert = getprop("modes/pfd/fma/pitch-mode"); - var newvertarm = getprop("modes/pfd/fma/pitch-mode2-armed"); + var vert = getprop("/it-autoflight/mode/vert"); + var newvert = getprop("/modes/pfd/fma/pitch-mode"); + var newvertarm = getprop("/modes/pfd/fma/pitch-mode2-armed"); if (vert == "ALT HLD") { altvert(); if (newvertarm != " ") { - setprop("modes/pfd/fma/pitch-mode2-armed", " "); + setprop("/modes/pfd/fma/pitch-mode2-armed", " "); } } else if (vert == "ALT CAP") { altvert(); if (newvertarm != " ") { - setprop("modes/pfd/fma/pitch-mode2-armed", " "); + setprop("/modes/pfd/fma/pitch-mode2-armed", " "); } } else if (vert == "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") { - setprop("modes/pfd/fma/pitch-mode2-armed", "ALT"); + setprop("/modes/pfd/fma/pitch-mode2-armed", "ALT"); } } else if (vert == "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(); } if (newvertarm != " ") { - setprop("modes/pfd/fma/pitch-mode2-armed", " "); + setprop("/modes/pfd/fma/pitch-mode2-armed", " "); } } else if (vert == "SPD CLB") { if (newvert != "OP CLB") { - setprop("modes/pfd/fma/pitch-mode", "OP CLB"); + setprop("/modes/pfd/fma/pitch-mode", "OP CLB"); } if (newvertarm != "ALT") { - setprop("modes/pfd/fma/pitch-mode2-armed", "ALT"); + setprop("/modes/pfd/fma/pitch-mode2-armed", "ALT"); } } else if (vert == "SPD DES") { if (newvert != "OP DES") { - setprop("modes/pfd/fma/pitch-mode", "OP DES"); + setprop("/modes/pfd/fma/pitch-mode", "OP DES"); } if (newvertarm != "ALT") { - setprop("modes/pfd/fma/pitch-mode2-armed", "ALT"); + setprop("/modes/pfd/fma/pitch-mode2-armed", "ALT"); } } else if (vert == "FPA") { if (newvert != "FPA") { - setprop("modes/pfd/fma/pitch-mode", "FPA"); + setprop("/modes/pfd/fma/pitch-mode", "FPA"); } if (newvertarm != "ALT") { - setprop("modes/pfd/fma/pitch-mode2-armed", "ALT"); + setprop("/modes/pfd/fma/pitch-mode2-armed", "ALT"); } } else if (vert == "LAND") { if (newvert != "LAND") { - setprop("modes/pfd/fma/pitch-mode", "LAND"); + setprop("/modes/pfd/fma/pitch-mode", "LAND"); } } else if (vert == "FLARE") { if (newvert != "FLARE") { - setprop("modes/pfd/fma/pitch-mode", "FLARE"); + setprop("/modes/pfd/fma/pitch-mode", "FLARE"); } } else if (vert == "ROLLOUT") { 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") { if (newvert != "SRS") { - setprop("modes/pfd/fma/pitch-mode", "SRS"); + setprop("/modes/pfd/fma/pitch-mode", "SRS"); } updatePitchArm2(); } else if (vert == "G/A CLB") { if (newvert != "SRS") { - setprop("modes/pfd/fma/pitch-mode", "SRS"); + setprop("/modes/pfd/fma/pitch-mode", "SRS"); } if (newvertarm != "ALT") { - setprop("modes/pfd/fma/pitch-mode2-armed", "ALT"); + setprop("/modes/pfd/fma/pitch-mode2-armed", "ALT"); } } else if (vert == " ") { if (newvert != " ") { - setprop("modes/pfd/fma/pitch-mode", " "); + setprop("/modes/pfd/fma/pitch-mode", " "); } updatePitchArm2(); } @@ -344,178 +343,175 @@ setlistener("/it-autoflight/mode/vert", 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) { - setprop("modes/pfd/fma/pitch-mode2-armed", "CLB"); + setprop("/modes/pfd/fma/pitch-mode2-armed", "CLB"); } 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 vert = getprop("it-autoflight/mode/vert"); - var newvert = getprop("modes/pfd/fma/pitch-mode"); - var gs_defl = getprop("instrumentation/nav[0]/gs-needle-deflection-norm"); + var vert = getprop("/it-autoflight/mode/vert"); + var newvert = getprop("/modes/pfd/fma/pitch-mode"); + var gs_defl = getprop("/instrumentation/nav[0]/gs-needle-deflection-norm"); if (vert == "G/S") { if (gs_defl > -0.06 and gs_defl < 0.06) { gsupdate.stop(); if (newvert != "G/S") { - setprop("modes/pfd/fma/pitch-mode", "G/S"); + setprop("/modes/pfd/fma/pitch-mode", "G/S"); } } } }); var altvert = func { - var FMGCalt = getprop("FMGC/internal/cruise-ft"); - var MCPalt = getprop("it-autoflight/internal/alt"); - var ALTdif = abs(FMGCalt - MCPalt); - var vert = getprop("it-autoflight/mode/vert"); - var newvert = getprop("modes/pfd/fma/pitch-mode"); + var MCPalt = getprop("/it-autoflight/internal/alt"); + var ALTdif = abs(fmgc.FMGCInternal.crzFt - MCPalt); + var vert = getprop("/it-autoflight/mode/vert"); + var newvert = getprop("/modes/pfd/fma/pitch-mode"); if (ALTdif <= 20) { if (vert == "ALT HLD") { 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") { if (newvert != "ALT CRZ*") { - setprop("modes/pfd/fma/pitch-mode", "ALT CRZ*"); + setprop("/modes/pfd/fma/pitch-mode", "ALT CRZ*"); } } } else { if (vert == "ALT HLD") { if (newvert != "ALT") { - setprop("modes/pfd/fma/pitch-mode", "ALT"); + setprop("/modes/pfd/fma/pitch-mode", "ALT"); } } else if (vert == "ALT CAP") { 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 setlistener("/it-autoflight/mode/arm", func { - var arm = getprop("it-autoflight/mode/arm"); - var newarm = getprop("modes/pfd/fma/roll-mode-armed"); + var arm = getprop("/it-autoflight/mode/arm"); + var newarm = getprop("/modes/pfd/fma/roll-mode-armed"); if (arm == "HDG") { if (newarm != "HDG") { - setprop("modes/pfd/fma/roll-mode-armed", " "); + setprop("/modes/pfd/fma/roll-mode-armed", " "); } } else if (arm == "LNV") { if (newarm != "NAV") { - setprop("modes/pfd/fma/roll-mode-armed", "NAV"); + setprop("/modes/pfd/fma/roll-mode-armed", "NAV"); } } else if (arm == " ") { if (newarm != " ") { - setprop("modes/pfd/fma/roll-mode-armed", " "); + setprop("/modes/pfd/fma/roll-mode-armed", " "); } } }); # Arm LOC setlistener("/it-autoflight/output/loc-armed", func { - var loca = getprop("it-autoflight/output/loc-armed"); - var newarm = getprop("modes/pfd/fma/roll-mode-armed"); + var loca = getprop("/it-autoflight/output/loc-armed"); + var newarm = getprop("/modes/pfd/fma/roll-mode-armed"); if (loca) { if (newarm != "LOC") { - setprop("modes/pfd/fma/roll-mode-armed", "LOC"); + setprop("/modes/pfd/fma/roll-mode-armed", "LOC"); } } else { if (newarm != " ") { - setprop("modes/pfd/fma/roll-mode-armed", " "); + setprop("/modes/pfd/fma/roll-mode-armed", " "); } } }); # Arm G/S setlistener("/it-autoflight/output/appr-armed", func { - var appa = getprop("it-autoflight/output/appr-armed"); - var newvert2arm = getprop("modes/pfd/fma/pitch-mode-armed"); + var appa = getprop("/it-autoflight/output/appr-armed"); + var newvert2arm = getprop("/modes/pfd/fma/pitch-mode-armed"); if (appa) { if (newvert2arm != "G/S") { - setprop("modes/pfd/fma/pitch-mode-armed", "G/S"); + setprop("/modes/pfd/fma/pitch-mode-armed", "G/S"); } } else { if (newvert2arm != " ") { - setprop("modes/pfd/fma/pitch-mode-armed", " "); + setprop("/modes/pfd/fma/pitch-mode-armed", " "); } } }); # AP var ap = func { - var ap1 = getprop("it-autoflight/output/ap1"); - var ap2 = getprop("it-autoflight/output/ap2"); - var newap = getprop("modes/pfd/fma/ap-mode"); + var ap1 = getprop("/it-autoflight/output/ap1"); + var ap2 = getprop("/it-autoflight/output/ap2"); + var newap = getprop("/modes/pfd/fma/ap-mode"); 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") { - 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") { - setprop("modes/pfd/fma/ap-mode", "AP 2"); + setprop("/modes/pfd/fma/ap-mode", "AP 2"); } else if (!ap1 and !ap2) { - setprop("modes/pfd/fma/ap-mode", " "); + setprop("/modes/pfd/fma/ap-mode", " "); } } # FD var fd = func { - var fd1 = getprop("it-autoflight/output/fd1"); - var fd2 = getprop("it-autoflight/output/fd2"); - var newfd = getprop("modes/pfd/fma/fd-mode"); + var fd1 = getprop("/it-autoflight/output/fd1"); + var fd2 = getprop("/it-autoflight/output/fd2"); + var newfd = getprop("/modes/pfd/fma/fd-mode"); 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 -") { - 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") { - setprop("modes/pfd/fma/fd-mode", "- FD 2"); + setprop("/modes/pfd/fma/fd-mode", "- FD 2"); } else if (!fd1 and !fd2) { - setprop("modes/pfd/fma/fd-mode", " "); + setprop("/modes/pfd/fma/fd-mode", " "); } } # AT var at = func { - var at = getprop("it-autoflight/output/athr"); - var newat = getprop("modes/pfd/fma/at-mode"); + var at = getprop("/it-autoflight/output/athr"); + var newat = getprop("/modes/pfd/fma/at-mode"); 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) { - setprop("modes/pfd/fma/at-mode", " "); + setprop("/modes/pfd/fma/at-mode", " "); } } 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) { - setprop("it-autoflight/input/lat", 3); + 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(); } } var boxchk_b = func { - var newlat = getprop("modes/pfd/fma/roll-mode"); + var newlat = getprop("/modes/pfd/fma/roll-mode"); 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 != " ") { - 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 != " ") { - 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 != " ") { - 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 != " ") { - 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 setlistener("/modes/pfd/fma/ap-mode", func { - if (getprop("modes/pfd/fma/ap-mode") != " ") { - setprop("modes/pfd/fma/ap-mode-time", getprop("sim/time/elapsed-sec")); + if (getprop("/modes/pfd/fma/ap-mode") != " ") { + setprop("/modes/pfd/fma/ap-mode-time", getprop("sim/time/elapsed-sec")); } }); setlistener("/modes/pfd/fma/fd-mode", func { - if (getprop("modes/pfd/fma/fd-mode") != " ") { - setprop("modes/pfd/fma/fd-mode-time", getprop("sim/time/elapsed-sec")); + if (getprop("/modes/pfd/fma/fd-mode") != " ") { + setprop("/modes/pfd/fma/fd-mode-time", getprop("sim/time/elapsed-sec")); } }); setlistener("/modes/pfd/fma/at-mode", func { - if (getprop("modes/pfd/fma/at-mode") != " ") { - setprop("modes/pfd/fma/throttle-mode-time", getprop("sim/time/elapsed-sec")); - setprop("modes/pfd/fma/athr-mode-time", getprop("sim/time/elapsed-sec")); + if (getprop("/modes/pfd/fma/at-mode") != " ") { + setprop("/modes/pfd/fma/throttle-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 { - if (getprop("modes/pfd/fma/at-mode") != " ") { - setprop("modes/pfd/fma/athr-mode-time", getprop("sim/time/elapsed-sec")); + if (getprop("/modes/pfd/fma/at-mode") != " ") { + setprop("/modes/pfd/fma/athr-mode-time", getprop("sim/time/elapsed-sec")); } }); setlistener("/modes/pfd/fma/throttle-mode", func { var state1 = getprop("systems/thrust/state1"); 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) { - 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) { + 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) { 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 { - var newlat = getprop("modes/pfd/fma/roll-mode"); + var newlat = getprop("/modes/pfd/fma/roll-mode"); 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 { - var newvert = getprop("modes/pfd/fma/pitch-mode"); + var newvert = getprop("/modes/pfd/fma/pitch-mode"); 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 { - var newarm = getprop("modes/pfd/fma/roll-mode-armed"); + var newarm = getprop("/modes/pfd/fma/roll-mode-armed"); 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 { - var newarm = getprop("modes/pfd/fma/pitch-mode-armed"); + var newarm = getprop("/modes/pfd/fma/pitch-mode-armed"); 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 { - var newarm = getprop("modes/pfd/fma/pitch-mode2-armed"); + var newarm = getprop("/modes/pfd/fma/pitch-mode2-armed"); 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")); } }); diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index 1925ac3e..0f8ea92d 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -138,6 +138,7 @@ var FMGCinit = func { } var FMGCInternal = { + # PERF v1: 0, v1set: 0, vr: 0, @@ -146,8 +147,27 @@ var FMGCInternal = { v2set: 0, transAlt: 18000, 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 = { v1: props.globals.initNode("/FMGC/internal/v1", 0, "DOUBLE"), v1set: props.globals.initNode("/FMGC/internal/v1-set", 0, "BOOL"), @@ -185,9 +205,9 @@ var updateARPT = func { } } -setlistener("/FMGC/internal/cruise-ft", func { - setprop("autopilot/route-manager/cruise/altitude-ft", getprop("/FMGC/internal/cruise-ft")); -}); +updateRouteManagerAlt = func() { + setprop("autopilot/route-manager/cruise/altitude-ft", FMGCInternal.crzFt); +}; ######## # FUEL # @@ -272,9 +292,9 @@ var updateFuel = func { } # 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")) { - crz = getprop("/FMGC/internal/cruise-fl"); - temp = getprop("/FMGC/internal/cruise-temp"); + if (getprop("/FMGC/internal/tofrom-set") and FMGCInternal.crzSet and FMGCInternal.crzTempSet and getprop("/FMGC/internal/zfw-set")) { + crz = FMGCInternal.crzFl; + temp = FMGCInternal.crzTemp; dist = flightPlanController.arrivalDist; trpWind = getprop("/FMGC/internal/trip-wind"); @@ -396,8 +416,8 @@ var masterFMGC = maketimer(0.2, func { gs = getprop("/velocities/groundspeed-kt"); alt = getprop("/instrumentation/altimeter/indicated-altitude-ft"); aglalt = pts.Position.gearAglFt.getValue(); - cruiseft = getprop("/FMGC/internal/cruise-ft"); - cruiseft_b = getprop("/FMGC/internal/cruise-ft") - 200; + # cruiseft = FMGCInternal.crzFt; + # cruiseft_b = FMGCInternal.crzFt - 200; newcruise = getprop("/it-autoflight/internal/alt"); phase = getprop("/FMGC/status/phase"); state1 = getprop("/systems/thrust/state1"); @@ -423,7 +443,6 @@ var masterFMGC = maketimer(0.2, func { thr1 = getprop("/controls/engines/engine[0]/throttle-pos"); thr2 = getprop("/controls/engines/engine[1]/throttle-pos"); altSel = getprop("/it-autoflight/input/alt"); - crzFl = getprop("/FMGC/internal/cruise-fl"); if (getprop("/gear/gear[0]/wow") != getprop("/gear/gear[0]/wow-fmgc")) { 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"); } - if (crzFl >= 200) { + if (FMGCInternal.crzFl >= 200) { if (phase == 3 and (flightPlanController.arrivalDist <= 200 or altSel < 20000)) { setprop("/FMGC/status/phase", 4); setprop("systems/pressurization/mode", "DE"); } } 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("systems/pressurization/mode", "DE"); } @@ -868,7 +887,7 @@ var adf1 = 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) { altitude = getprop("/instrumentation/altimeter/indicated-altitude-ft"); mode = getprop("/modes/pfd/fma/pitch-mode"); diff --git a/Nasal/Libraries/libraries.nas b/Nasal/Libraries/libraries.nas index ace16fa7..9bd1a1a7 100644 --- a/Nasal/Libraries/libraries.nas +++ b/Nasal/Libraries/libraries.nas @@ -240,6 +240,7 @@ var systemsInit = func { setlistener("/sim/signals/fdm-initialized", func { systemsInit(); + fmgc.postInit(); fmgc.flightPlanTimer.start(); fmgc.WaypointDatabase.read(); }); diff --git a/Nasal/MCDU/INITA.nas b/Nasal/MCDU/INITA.nas index 5a9fef65..2d030906 100644 --- a/Nasal/MCDU/INITA.nas +++ b/Nasal/MCDU/INITA.nas @@ -45,14 +45,14 @@ var initInputA = func(key, i) { } } else if (key == "L3") { if (scratchpad == "CLR") { - setprop("MCDUC/flight-num", ""); - setprop("MCDUC/flight-num-set", 0); + fmgc.FMGCInternal.flightNum = ""; + fmgc.FMGCInternal.flightNumSet = 0; mcdu_scratchpad.scratchpads[i].empty(); } else { var flts = size(scratchpad); if (flts >= 1 and flts <= 8) { - setprop("MCDUC/flight-num", scratchpad); - setprop("MCDUC/flight-num-set", 1); + fmgc.FMGCInternal.flightNum = scratchpad; + fmgc.FMGCInternal.flightNumSet = 1; mcdu_scratchpad.scratchpads[i].empty(); } else { mcdu_message(i, "NOT ALLOWED"); @@ -80,11 +80,14 @@ var initInputA = func(key, i) { } } else if (key == "L6") { if (scratchpad == "CLR") { - setprop("/FMGC/internal/cruise-ft", 10000); - setprop("/FMGC/internal/cruise-fl", 100); - setprop("/FMGC/internal/cruise-lvl-set", 0); - setprop("/FMGC/internal/cruise-temp", 15); - setprop("/FMGC/internal/cruise-temp-set", 0); + fmgc.FMGCInternal.crzFt = 10000; + fmgc.FMGCInternal.crzFl = 100; + fmgc.altvert(); + fmgc.updateRouteManagerAlt(); + fmgc.FMGCInternal.crzSet = 0; + updateCrzLvlCallback(); + fmgc.FMGCInternal.crzTemp = 15; + fmgc.FMGCInternal.crzTempSet = 0; if (getprop("/FMGC/internal/block-confirmed")) { setprop("/FMGC/internal/fuel-calculating", 0); setprop("/FMGC/internal/fuel-calculating", 1); @@ -101,9 +104,10 @@ var initInputA = func(key, i) { } var temp = int(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) { - setprop("/FMGC/internal/cruise-temp", temp); + fmgc.FMGCInternal.crzTemp = temp; + fmgc.FMGCInternal.crzTempSet = 1; if (getprop("/FMGC/internal/block-confirmed")) { setprop("/FMGC/internal/fuel-calculating", 0); 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) { if (crz > 0 and crz <= 390 and temp >= -99 and temp <= 99) { - setprop("/FMGC/internal/cruise-ft", crz * 100); - setprop("/FMGC/internal/cruise-fl", crz); - setprop("/FMGC/internal/cruise-fl-prog", crz); - setprop("/FMGC/internal/cruise-lvl-set", 1); - setprop("/FMGC/internal/cruise-temp", temp); - setprop("/FMGC/internal/cruise-temp-set", 1); + fmgc.FMGCInternal.crzFt = crz * 100; + fmgc.FMGCInternal.crzFl = crz; + fmgc.altvert(); + fmgc.updateRouteManagerAlt(); + fmgc.FMGCInternal.crzSet = 1; + updateCrzLvlCallback(); + fmgc.FMGCInternal.crzTemp = temp; + fmgc.FMGCInternal.crzTempSet = 1; + fmgc.FMGCInternal.crzProg = crz; if (getprop("/FMGC/internal/block-confirmed")) { setprop("/FMGC/internal/fuel-calculating", 0); 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 (crz > 0 and crz <= 390) { - setprop("/FMGC/internal/cruise-ft", crz * 100); - setprop("/FMGC/internal/cruise-fl", crz); - setprop("/FMGC/internal/cruise-fl-prog", crz); - setprop("/FMGC/internal/cruise-lvl-set", 1); + fmgc.FMGCInternal.crzFt = crz * 100; + fmgc.FMGCInternal.crzFl = crz; + fmgc.altvert(); + fmgc.updateRouteManagerAlt(); + fmgc.FMGCInternal.crzSet = 1; + updateCrzLvlCallback(); + fmgc.FMGCInternal.crzProg = crz; if (getprop("/FMGC/internal/block-confirmed")) { setprop("/FMGC/internal/fuel-calculating", 0); setprop("/FMGC/internal/fuel-calculating", 1); @@ -236,14 +246,14 @@ var initInputA = func(key, i) { setprop("MCDU[" ~ i ~ "]/page", "WINDCLB"); } else if (key == "R5") { if (scratchpad == "CLR") { - setprop("/FMGC/internal/tropo", 36090); - setprop("/FMGC/internal/tropo-set", 0); + fmgc.FMGCInternal.tropo = 36090; + fmgc.FMGCInternal.tropoSet = 1; mcdu_scratchpad.scratchpads[i].empty(); } else { var tropo = size(scratchpad); if (tropo == 5 and scratchpad <= 99990) { - setprop("FMGC/internal/tropo-set", 1); - setprop("FMGC/internal/tropo", scratchpad); + fmgc.FMGCInternal.tropo = scratchpad; + fmgc.FMGCInternal.tropoSet = 1; mcdu_scratchpad.scratchpads[i].empty(); } else { mcdu_message(i, "NOT ALLOWED"); diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 5bbbd8ed..0ab8422a 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -50,8 +50,8 @@ var MCDU_reset = func(i) { setprop("/FMGC/internal/adf2freq-set", 0); # INT-A - setprop("MCDUC/flight-num", ""); - setprop("MCDUC/flight-num-set", 0); + fmgc.FMGCInternal.flightNum = ""; + fmgc.FMGCInternal.flightNumSet = 0; setprop("/FMGC/internal/dep-arpt", ""); setprop("/FMGC/internal/arr-arpt", ""); setprop("/FMGC/internal/tofrom-set", 0); @@ -59,13 +59,16 @@ var MCDU_reset = func(i) { setprop("/FMGC/internal/alt-set", 0); setprop("/FMGC/internal/cost-index", "0"); setprop("/FMGC/internal/cost-index-set", 0); - setprop("/FMGC/internal/cruise-ft", 10000); - setprop("/FMGC/internal/cruise-fl", 100); - setprop("/FMGC/internal/cruise-lvl-set", 0); - setprop("/FMGC/internal/tropo", 36090); - setprop("/FMGC/internal/tropo-set", 0); - setprop("/FMGC/internal/cruise-temp", 15); - setprop("/FMGC/internal/cruise-temp-set", 0); + fmgc.FMGCInternal.crzFt = 10000; + fmgc.altvert(); + fmgc.updateRouteManagerAlt(); + fmgc.FMGCInternal.crzFl = 100; + fmgc.FMGCInternal.crzSet = 0; + updateCrzLvlCallback(); + fmgc.FMGCInternal.tropo = 36090; + fmgc.FMGCInternal.tropoSet = 0; + fmgc.FMGCInternal.crzTemp = 15; + fmgc.FMGCInternal.crzTempSet = 0; # IRSINIT setprop("/FMGC/internal/align-set", 0); @@ -131,7 +134,7 @@ var MCDU_reset = func(i) { setprop("/FMGC/internal/cg", 0); # PROG - setprop("/FMGC/internal/cruise-fl-prog", 100); + fmgc.FMGCInternal.crzProg = 100; # PERF diff --git a/Nasal/MCDU/PROGCLB.nas b/Nasal/MCDU/PROGCLB.nas index db5fcb53..fcb746e3 100644 --- a/Nasal/MCDU/PROGCLB.nas +++ b/Nasal/MCDU/PROGCLB.nas @@ -4,7 +4,7 @@ var progCLBInput = func(key, i) { var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; if (key == "L1") { 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) { setprop("/FMGC/status/phase", 3); setprop("/FMGC/internal/activate-once", 0); @@ -15,7 +15,7 @@ var progCLBInput = func(key, i) { } else if (int(scratchpad) != nil) { var crzs = size(scratchpad); 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(); if (getprop("/FMGC/status/phase") == 5) { setprop("/FMGC/status/phase", 3); diff --git a/Nasal/MCDU/PROGCRZ.nas b/Nasal/MCDU/PROGCRZ.nas index 38eccee2..f3e761e8 100644 --- a/Nasal/MCDU/PROGCRZ.nas +++ b/Nasal/MCDU/PROGCRZ.nas @@ -4,7 +4,7 @@ var progCRZInput = func(key, i) { var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; if (key == "L1") { 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) { setprop("/FMGC/status/phase", 3); setprop("/FMGC/internal/activate-once", 0); @@ -15,7 +15,7 @@ var progCRZInput = func(key, i) { } else if (int(scratchpad) != nil) { var crzs = size(scratchpad); 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(); if (getprop("/FMGC/status/phase") == 5) { setprop("/FMGC/status/phase", 3); diff --git a/Nasal/MCDU/PROGDES.nas b/Nasal/MCDU/PROGDES.nas index 69cbc55e..c40824bf 100644 --- a/Nasal/MCDU/PROGDES.nas +++ b/Nasal/MCDU/PROGDES.nas @@ -4,7 +4,7 @@ var progDESInput = func(key, i) { var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; if (key == "L1") { 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) { setprop("/FMGC/status/phase", 3); setprop("/FMGC/internal/activate-once", 0); @@ -15,7 +15,7 @@ var progDESInput = func(key, i) { } else if (int(scratchpad) != nil) { var crzs = size(scratchpad); 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(); if (getprop("/FMGC/status/phase") == 4 or getprop("/FMGC/status/phase") == 5 or getprop("/FMGC/status/phase") == 6) { setprop("/FMGC/status/phase", 3); diff --git a/Nasal/MCDU/PROGTO.nas b/Nasal/MCDU/PROGTO.nas index d3dfbd65..da7244e7 100644 --- a/Nasal/MCDU/PROGTO.nas +++ b/Nasal/MCDU/PROGTO.nas @@ -6,12 +6,12 @@ var progTOInput = func(key, i) { var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; if (key == "L1") { 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(); } else if (int(scratchpad) != nil) { 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")) { - setprop("/FMGC/internal/cruise-fl-prog", scratchpad); + if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100 and fmgc.FMGCInternal.crzSet) { + fmgc.FMGCInternal.crzProg = scratchpad; mcdu_scratchpad.scratchpads[i].empty(); } else { mcdu_message(i, "NOT ALLOWED"); diff --git a/Nasal/MCDU/VERTREV.nas b/Nasal/MCDU/VERTREV.nas index 86bd332b..26058af3 100644 --- a/Nasal/MCDU/VERTREV.nas +++ b/Nasal/MCDU/VERTREV.nas @@ -126,7 +126,7 @@ var vertRev = { } }, 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.arrowsMatrix[1][4] = 1; } else { @@ -182,7 +182,7 @@ var vertRev = { }, }; -setlistener("FMGC/internal/cruise-lvl-set", func() { +var updateCrzLvlCallback = func () { if (canvas_mcdu.myVertRev[0] != nil) { canvas_mcdu.myVertRev[0].updateR5(); } @@ -190,7 +190,7 @@ setlistener("FMGC/internal/cruise-lvl-set", func() { if (canvas_mcdu.myVertRev[1] != nil) { canvas_mcdu.myVertRev[1].updateR5(); } -}, 0, 0); +}; setlistener("FMGC/status/phase", func() { if (canvas_mcdu.myVertRev[0] != nil) {