From 1b9f31c72629b1f301240e62d1899079ea5603a3 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sat, 3 Oct 2020 10:59:43 +0100 Subject: [PATCH] MCDU: stop calling getprop(page) literally dozens of times when a button is pushed. In addition, we switch more stuff to PTS. Slowly getting faster! --- Nasal/ECAM/ECAM-logic.nas | 2 +- Nasal/FMGC/FMGC.nas | 26 +- Nasal/FMGC/SimbriefParser.nas | 8 +- Nasal/FMGC/flightplan.nas | 6 +- Nasal/Libraries/property-tree-setup.nas | 7 + Nasal/MCDU/F-PLN.nas | 12 +- Nasal/MCDU/FUELPRED.nas | 74 +-- Nasal/MCDU/INITA.nas | 44 +- Nasal/MCDU/INITB.nas | 162 +++--- Nasal/MCDU/MCDU.nas | 728 ++++++++++++------------ Nasal/MCDU/WINDCLB.nas | 12 +- Nasal/MCDU/WINDCRZ.nas | 12 +- Nasal/MCDU/WINDDES.nas | 28 +- Nasal/Systems/FADEC/engines-cfm.nas | 16 +- Nasal/Systems/FADEC/engines-iae.nas | 16 +- 15 files changed, 588 insertions(+), 565 deletions(-) diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas index 270df6c6..0e7431cc 100644 --- a/Nasal/ECAM/ECAM-logic.nas +++ b/Nasal/ECAM/ECAM-logic.nas @@ -2268,7 +2268,7 @@ var messages_memo = func { outr_tk_fuel_xfrd.active = 0; } - if (getprop("/consumables/fuel/total-fuel-lbs") < 6000 and toMemoLine1.active != 1 and ldgMemoLine1.active != 1) { # assuming US short ton 2000lb + if (pts.Consumables.Fuel.totalFuelLbs.getValue() < 6000 and toMemoLine1.active != 1 and ldgMemoLine1.active != 1) { # assuming US short ton 2000lb fob_3T.active = 1; } else { fob_3T.active = 0; diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index c39b5ead..bbf2cf03 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -221,6 +221,10 @@ var FMGCInternal = { zfwcgSet: 0, block: 0.0, blockSet: 0, + blockCalculating: 0, + blockConfirmed: 0, + fuelCalculating: 0, + fuelRequest: 0, taxiFuel: 0.4, taxiFuelSet: 0, tripFuel: 0, @@ -281,8 +285,8 @@ setlistener("/gear/gear[0]/wow", func { }, 0, 0); var trimReset = func { - flaps = getprop("/controls/flight/flaps-pos"); - if (pts.Gear.wow[0].getBoolValue() and !FMGCInternal.takeoffState and (flaps >= 5 or (flaps >= 4 and getprop("/instrumentation/mk-viii/inputs/discretes/momentary-flap3-override") == 1))) { + flaps = pts.Controls.Flight.flapsPos.getValue(); + if (pts.Gear.wow[0].getBoolValue() and !FMGCInternal.takeoffState and (flaps >= 5 or (flaps >= 4 and pts.Instrumentation.MKVII.Inputs.Discretes.flap3Override.getValue() == 1))) { interpolate("/controls/flight/elevator-trim", 0.0, 1.5); } } @@ -486,16 +490,16 @@ var updateFuel = func { } # Misc fuel claclulations - if (getprop("/FMGC/internal/block-calculating")) { + if (fmgc.FMGCInternal.blockCalculating) { FMGCInternal.block = num(FMGCInternal.altFuel + FMGCInternal.finalFuel + FMGCInternal.tripFuel + FMGCInternal.rteRsv + FMGCInternal.taxiFuel); FMGCInternal.blockSet = 1; } - fmgc.FMGCInternal.fob = num(getprop("/consumables/fuel/total-fuel-lbs") / 1000); - fmgc.FMGCInternal.fuelPredGw = num(getprop("/fdm/jsbsim/inertia/weight-lbs") / 1000); + fmgc.FMGCInternal.fob = num(pts.Consumables.Fuel.totalFuelLbs.getValue() / 1000); + fmgc.FMGCInternal.fuelPredGw = num(pts.Fdm.JSBsim.Inertia.weightLbs.getValue() / 1000); fmgc.FMGCInternal.cg = fmgc.FMGCInternal.zfwcg; # Calcualte extra fuel - if (num(getprop("/engines/engine[0]/n1-actual")) > 0 or num(getprop("/engines/engine[1]/n1-actual")) > 0) { + if (num(pts.Engines.Engine.n1Actual[0].getValue()) > 0 or num(pts.Engines.Engine.n1Actual[1].getValue()) > 0) { extra_fuel = 1000 * num(FMGCInternal.fob - FMGCInternal.tripFuel - FMGCInternal.minDestFob - FMGCInternal.taxiFuel - FMGCInternal.rteRsv); } else { extra_fuel = 1000 * num(FMGCInternal.block - FMGCInternal.tripFuel - FMGCInternal.minDestFob - FMGCInternal.taxiFuel - FMGCInternal.rteRsv); @@ -614,8 +618,8 @@ var radios = maketimer(1, func() { }); var masterFMGC = maketimer(0.2, func { - n1_left = getprop("/engines/engine[0]/n1-actual"); - n1_right = getprop("/engines/engine[1]/n1-actual"); + n1_left = pts.Engines.Engine.n1Actual[0].getValue(); + n1_right = pts.Engines.Engine.n1Actual[1].getValue(); flaps = getprop("/controls/flight/flaps-pos"); modelat = getprop("/modes/pfd/fma/roll-mode"); mode = getprop("/modes/pfd/fma/pitch-mode"); @@ -761,7 +765,7 @@ var masterFMGC = maketimer(0.2, func { # calculate speeds ############################ flap = getprop("/controls/flight/flaps-pos"); - weight_lbs = getprop("/fdm/jsbsim/inertia/weight-lbs") / 1000; + weight_lbs = pts.Fdm.JSBsim.Inertia.weightLbs.getValue() / 1000; altitude = getprop("/instrumentation/altimeter/indicated-altitude-ft"); # current speeds @@ -1286,7 +1290,7 @@ var timer48gpsAlign3 = maketimer(1, func() { var timer3blockFuel = maketimer(1, func() { if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/block-fuel-time") + 3) { #updateFuel(); - setprop("/FMGC/internal/block-calculating", 0); + fmgc.FMGCInternal.blockCalculating = 0; setprop("/FMGC/internal/block-fuel-time", -99); timer3blockFuel.stop(); } @@ -1295,7 +1299,7 @@ var timer3blockFuel = maketimer(1, func() { var timer5fuelPred = maketimer(1, func() { if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/fuel-pred-time") + 5) { #updateFuel(); - setprop("/FMGC/internal/fuel-calculating", 0); + fmgc.FMGCInternal.fuelCalculating = 0; setprop("/FMGC/internal/fuel-pred-time", -99); timer5fuelPred.stop(); } diff --git a/Nasal/FMGC/SimbriefParser.nas b/Nasal/FMGC/SimbriefParser.nas index f75a56e6..11a9aabf 100644 --- a/Nasal/FMGC/SimbriefParser.nas +++ b/Nasal/FMGC/SimbriefParser.nas @@ -173,10 +173,10 @@ var SimbriefParser = { fmgc.FMGCInternal.zfw = me.store2.getChild("est_zfw").getValue() / 1000; fmgc.FMGCInternal.zfwSet = 1; fmgc.FMGCInternal.tow = fmgc.FMGCInternal.zfw + fmgc.FMGCInternal.block - fmgc.FMGCInternal.taxiFuel; - setprop("/FMGC/internal/fuel-request-set", 1); - setprop("/FMGC/internal/fuel-calculating", 1); - setprop("/FMGC/internal/block-calculating", 0); - setprop("/FMGC/internal/block-confirmed", 1); + fmgc.FMGCInternal.fuelRequest = 1; + fmgc.FMGCInternal.fuelCalculating = 1; + fmgc.FMGCInternal.blockCalculating = 0; + fmgc.FMGCInternal.blockConfirmed = 1; }, }; \ No newline at end of file diff --git a/Nasal/FMGC/flightplan.nas b/Nasal/FMGC/flightplan.nas index e4018ba7..874d5dbc 100644 --- a/Nasal/FMGC/flightplan.nas +++ b/Nasal/FMGC/flightplan.nas @@ -758,9 +758,9 @@ var flightPlanController = { fmgc.windController.updatePlans(); # push update to fuel - if (getprop("/FMGC/internal/block-confirmed")) { - setprop("/FMGC/internal/fuel-calculating", 0); - setprop("/FMGC/internal/fuel-calculating", 1); + if (fmgc.FMGCInternal.blockConfirmed) { + fmgc.FMGCInternal.fuelCalculating = 0; + fmgc.FMGCInternal.fuelCalculating = 1; } canvas_nd.A3XXRouteDriver.triggerSignal("fp-added"); }, diff --git a/Nasal/Libraries/property-tree-setup.nas b/Nasal/Libraries/property-tree-setup.nas index 63003361..82b79e67 100644 --- a/Nasal/Libraries/property-tree-setup.nas +++ b/Nasal/Libraries/property-tree-setup.nas @@ -148,6 +148,13 @@ var Instrumentation = { pnlModeNum: [props.globals.initNode("/instrumentation/efis[0]/mfd/pnl_mode-num", 2, "INT"), props.globals.initNode("/instrumentation/efis[1]/mfd/pnl_mode-num", 2, "INT")], }, }, + MKVII: { + Inputs: { + Discretes: { + flap3Override: props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/momentary-flap3-override"), + }, + }, + }, Nav: { gsDeflection: props.globals.getNode("/instrumentation/nav[0]/gs-needle-deflection-norm"), locDeflection: props.globals.getNode("/instrumentation/nav[0]/heading-needle-deflection-norm"), diff --git a/Nasal/MCDU/F-PLN.nas b/Nasal/MCDU/F-PLN.nas index 19f4d5c5..fb7f6d68 100644 --- a/Nasal/MCDU/F-PLN.nas +++ b/Nasal/MCDU/F-PLN.nas @@ -436,9 +436,9 @@ var fplnPage = { # this one is only created once, and then updated - remember th if (fmgc.flightPlanController.temporaryFlag[me.computer]) { fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 0); # push update to fuel - if (getprop("/FMGC/internal/block-confirmed")) { - setprop("/FMGC/internal/fuel-calculating", 0); - setprop("/FMGC/internal/fuel-calculating", 1); + if (fmgc.FMGCInternal.blockConfirmed) { + fmgc.FMGCInternal.fuelCalculating = 0; + fmgc.FMGCInternal.fuelCalculating = 1; } } else { if (canvas_mcdu.myLatRev[me.computer] != nil) { @@ -477,9 +477,9 @@ var fplnPage = { # this one is only created once, and then updated - remember th if (dirToFlag) { dirToFlag = 0; } fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 1); # push update to fuel - if (getprop("/FMGC/internal/block-confirmed")) { - setprop("/FMGC/internal/fuel-calculating", 0); - setprop("/FMGC/internal/fuel-calculating", 1); + if (fmgc.FMGCInternal.blockConfirmed) { + fmgc.FMGCInternal.fuelCalculating = 0; + fmgc.FMGCInternal.fuelCalculating = 1; } } else { mcdu_message(me.computer, "NOT ALLOWED"); diff --git a/Nasal/MCDU/FUELPRED.nas b/Nasal/MCDU/FUELPRED.nas index 59646a87..1749ce32 100644 --- a/Nasal/MCDU/FUELPRED.nas +++ b/Nasal/MCDU/FUELPRED.nas @@ -5,13 +5,13 @@ # From INIT-B var fuelPredInput = func(key, i) { var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; - if (key == "L3" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) { + if (key == "L3" and fmgc.FMGCInternal.blockConfirmed and !fmgc.FMGCInternal.fuelCalculating) { if (scratchpad == "CLR") { fmgc.FMGCInternal.rteRsv = 0.05 * fmgc.FMGCInternal.tripFuel; fmgc.FMGCInternal.rteRsvSet = 0; fmgc.FMGCInternal.rtePercent = 5.0; fmgc.FMGCInternal.rtePercentSet = 0; - setprop("/FMGC/internal/fuel-calculating", 1); + fmgc.FMGCInternal.fuelCalculating = 1; mcdu_scratchpad.scratchpads[i].empty(); } else if (fmgc.FMGCInternal.tripFuel != 0) { var tf = num(scratchpad); @@ -23,7 +23,7 @@ var fuelPredInput = func(key, i) { fmgc.FMGCInternal.rteRsvSet = 0; fmgc.FMGCInternal.rtePercent = perc; fmgc.FMGCInternal.rtePercentSet = 1; - setprop("/FMGC/internal/fuel-calculating", 1); + fmgc.FMGCInternal.fuelCalculating = 1; mcdu_scratchpad.scratchpads[i].empty(); } } else if (tfs >= 1 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 21.7) { @@ -35,7 +35,7 @@ var fuelPredInput = func(key, i) { fmgc.FMGCInternal.rtePercent = 15.0; # need reasearch on this value } fmgc.FMGCInternal.rtePercentSet = 0; - setprop("/FMGC/internal/fuel-calculating", 1); + fmgc.FMGCInternal.fuelCalculating = 1; mcdu_scratchpad.scratchpads[i].empty(); } else { mcdu_message(i, "NOT ALLOWED"); @@ -43,12 +43,12 @@ var fuelPredInput = func(key, i) { } else { mcdu_message(i, "NOT ALLOWED"); } - } else if (key == "L4" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating") and fmgc.FMGCInternal.altAirportSet) { + } else if (key == "L4" and fmgc.FMGCInternal.blockConfirmed and !fmgc.FMGCInternal.fuelCalculating and fmgc.FMGCInternal.altAirportSet) { if (scratchpad == "CLR") { fmgc.FMGCInternal.altFuel = 0.0; fmgc.FMGCInternal.altTime = "0000"; fmgc.FMGCInternal.altFuelSet = 0; - setprop("/FMGC/internal/fuel-calculating", 1); + fmgc.FMGCInternal.fuelCalculating = 1; mcdu_scratchpad.scratchpads[i].empty(); } else if (find(".", scratchpad) != -1) { var tf = num(scratchpad); @@ -57,7 +57,7 @@ var fuelPredInput = func(key, i) { fmgc.FMGCInternal.altFuel = tf; fmgc.FMGCInternal.altTime = "0000"; fmgc.FMGCInternal.altFuelSet = 1; - setprop("/FMGC/internal/fuel-calculating", 1); + fmgc.FMGCInternal.fuelCalculating = 1; mcdu_scratchpad.scratchpads[i].empty(); } else { mcdu_message(i, "NOT ALLOWED"); @@ -65,13 +65,13 @@ var fuelPredInput = func(key, i) { } else { mcdu_message(i, "NOT ALLOWED"); } - } else if (key == "L5" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) { + } else if (key == "L5" and fmgc.FMGCInternal.blockConfirmed and !fmgc.FMGCInternal.fuelCalculating) { if (scratchpad == "CLR") { fmgc.FMGCInternal.finalFuel = 0.0; fmgc.FMGCInternal.finalTime = "0030"; fmgc.FMGCInternal.finalFuelSet = 0; fmgc.FMGCInternal.finalTimeSet = 0; - setprop("/FMGC/internal/fuel-calculating", 1); + fmgc.FMGCInternal.fuelCalculating = 1; mcdu_scratchpad.scratchpads[i].empty(); } else if (find(".", scratchpad) != -1) { var tf = num(scratchpad); @@ -79,7 +79,7 @@ var fuelPredInput = func(key, i) { if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0) { fmgc.FMGCInternal.finalFuel = tf; fmgc.FMGCInternal.finalFuelSet = 1; - setprop("/FMGC/internal/fuel-calculating", 1); + fmgc.FMGCInternal.fuelCalculating = 1; mcdu_scratchpad.scratchpads[i].empty(); } else { mcdu_message(i, "NOT ALLOWED"); @@ -90,17 +90,17 @@ var fuelPredInput = func(key, i) { if (tfs == 4 and tf != nil and ((tf >= 0 and tf <= 59) or (tf >= 100 and tf <= 130))) { fmgc.FMGCInternal.finalTime = scratchpad; fmgc.FMGCInternal.finalTimeSet = 1; - setprop("/FMGC/internal/fuel-calculating", 1); + fmgc.FMGCInternal.fuelCalculating = 1; mcdu_scratchpad.scratchpads[i].empty(); } else { mcdu_message(i, "NOT ALLOWED"); } } - } else if (key == "L6" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) { + } else if (key == "L6" and fmgc.FMGCInternal.blockConfirmed and !fmgc.FMGCInternal.fuelCalculating) { if (scratchpad == "CLR") { fmgc.FMGCInternal.minDestFob = 0; fmgc.FMGCInternal.minDestFobSet = 0; - setprop("/FMGC/internal/fuel-calculating", 1); + fmgc.FMGCInternal.fuelCalculating = 1; mcdu_scratchpad.scratchpads[i].empty(); } else if (find(".", scratchpad) != -1) { var tf = num(scratchpad); @@ -108,7 +108,7 @@ var fuelPredInput = func(key, i) { if (tfs >= 3 and tfs <= 5 and tf != nil and tf >= 0 and tf <= 80.0) { fmgc.FMGCInternal.minDestFob = tf; fmgc.FMGCInternal.minDestFobSet = 1; - setprop("/FMGC/internal/fuel-calculating", 1); + fmgc.FMGCInternal.fuelCalculating = 1; mcdu_scratchpad.scratchpads[i].empty(); if (fmgc.FMGCInternal.minDestFob < fmgc.FMGCInternal.finalFuel + fmgc.FMGCInternal.altFuel) { mcdu_message(i, "CHECK MIN DEST FOB"); @@ -119,26 +119,26 @@ var fuelPredInput = func(key, i) { } else { mcdu_message(i, "NOT ALLOWED"); } - } else if (key == "R3" and !getprop("/FMGC/internal/fuel-calculating")) { + } else if (key == "R3" and !fmgc.FMGCInternal.fuelCalculating) { if (scratchpad == "CLR") { mcdu_message(i, "NOT ALLOWED"); } else { var zfw_min = 80.6; #make based on performance var zfw_max = 134.5; #61,000 kg, make based on performance if (size(scratchpad) == 0) { - var zfw = getprop("/fdm/jsbsim/inertia/weight-lbs") - getprop("/consumables/fuel/total-fuel-lbs"); + var zfw = pts.Fdm.JSBsim.Inertia.weightLbs.getValue() - pts.Consumables.Fuel.totalFuelLbs.getValue(); fmgc.FMGCInternal.zfw = sprintf("%3.1f", math.round(zfw / 1000, 0.1)); fmgc.FMGCInternal.zfwSet = 1; if (fmgc.FMGCInternal.blockSet != 1) { - fmgc.FMGCInternal.block = getprop("consumables/fuel/total-fuel-lbs") / 1000; + fmgc.FMGCInternal.block = pts.Consumables.Fuel.totalFuelLbs.getValue() / 1000; fmgc.FMGCInternal.blockSet = 1; fmgc.FMGCInternal.tow = fmgc.FMGCInternal.zfw + fmgc.FMGCInternal.block - fmgc.FMGCInternal.taxiFuel; - setprop("/FMGC/internal/fuel-request-set", 1); - setprop("/FMGC/internal/fuel-calculating", 1); - setprop("/FMGC/internal/block-calculating", 0); - setprop("/FMGC/internal/block-confirmed", 1); - } else if (getprop("/FMGC/internal/block-confirmed")) { - setprop("/FMGC/internal/fuel-calculating", 1); + fmgc.FMGCInternal.fuelRequest = 1; + fmgc.FMGCInternal.fuelCalculating = 1; + fmgc.FMGCInternal.blockCalculating = 0; + fmgc.FMGCInternal.blockConfirmed = 1; + } else if (fmgc.FMGCInternal.blockConfirmed) { + fmgc.FMGCInternal.fuelCalculating = 1; } mcdu_scratchpad.scratchpads[i].empty(); } else if (find("/", scratchpad) != -1) { @@ -154,15 +154,15 @@ var fuelPredInput = func(key, i) { fmgc.FMGCInternal.zfwcg = zfwcg; fmgc.FMGCInternal.zfwcgSet = 1; if (fmgc.FMGCInternal.blockSet != 1) { - fmgc.FMGCInternal.block = getprop("consumables/fuel/total-fuel-lbs") / 1000; + fmgc.FMGCInternal.block = pts.Consumables.Fuel.totalFuelLbs.getValue() / 1000; fmgc.FMGCInternal.blockSet = 1; fmgc.FMGCInternal.tow = fmgc.FMGCInternal.zfw + fmgc.FMGCInternal.block - fmgc.FMGCInternal.taxiFuel; - setprop("/FMGC/internal/fuel-request-set", 1); - setprop("/FMGC/internal/fuel-calculating", 1); - setprop("/FMGC/internal/block-calculating", 0); - setprop("/FMGC/internal/block-confirmed", 1); - } else if (getprop("/FMGC/internal/block-confirmed")) { - setprop("/FMGC/internal/fuel-calculating", 1); + fmgc.FMGCInternal.fuelRequest = 1; + fmgc.FMGCInternal.fuelCalculating = 1; + fmgc.FMGCInternal.blockCalculating = 0; + fmgc.FMGCInternal.blockConfirmed = 1; + } else if (fmgc.FMGCInternal.blockConfirmed) { + fmgc.FMGCInternal.fuelCalculating = 1; } mcdu_scratchpad.scratchpads[i].empty(); } else { @@ -184,15 +184,15 @@ var fuelPredInput = func(key, i) { fmgc.FMGCInternal.zfw = scratchpad; fmgc.FMGCInternal.zfwSet = 1; if (fmgc.FMGCInternal.blockSet != 1) { - fmgc.FMGCInternal.block = getprop("consumables/fuel/total-fuel-lbs") / 1000; + fmgc.FMGCInternal.block = pts.Consumables.Fuel.totalFuelLbs.getValue() / 1000; fmgc.FMGCInternal.blockSet = 1; fmgc.FMGCInternal.tow = fmgc.FMGCInternal.zfw + fmgc.FMGCInternal.block - fmgc.FMGCInternal.taxiFuel; - setprop("/FMGC/internal/fuel-request-set", 1); - setprop("/FMGC/internal/fuel-calculating", 1); - setprop("/FMGC/internal/block-calculating", 0); - setprop("/FMGC/internal/block-confirmed", 1); - } else if (getprop("/FMGC/internal/block-confirmed")) { - setprop("/FMGC/internal/fuel-calculating", 1); + fmgc.FMGCInternal.fuelRequest = 1; + fmgc.FMGCInternal.fuelCalculating = 1; + fmgc.FMGCInternal.blockCalculating = 0; + fmgc.FMGCInternal.blockConfirmed = 1; + } else if (fmgc.FMGCInternal.blockConfirmed) { + fmgc.FMGCInternal.fuelCalculating = 1; } mcdu_scratchpad.scratchpads[i].empty(); } else { diff --git a/Nasal/MCDU/INITA.nas b/Nasal/MCDU/INITA.nas index 3fffc6f9..b47f4d08 100644 --- a/Nasal/MCDU/INITA.nas +++ b/Nasal/MCDU/INITA.nas @@ -10,9 +10,9 @@ var initInputA = func(key, i) { fmgc.FMGCInternal.altAirport = ""; fmgc.FMGCInternal.altAirportSet = 0; fmgc.windController.updatePlans(); - if (getprop("/FMGC/internal/block-confirmed")) { - setprop("/FMGC/internal/fuel-calculating", 0); - setprop("/FMGC/internal/fuel-calculating", 1); + if (fmgc.FMGCInternal.blockConfirmed) { + fmgc.FMGCInternal.fuelCalculating = 0; + fmgc.FMGCInternal.fuelCalculating = 1; } mcdu_scratchpad.scratchpads[i].empty(); fmgc.updateARPT(); @@ -26,9 +26,9 @@ var initInputA = func(key, i) { fmgc.FMGCInternal.altAirport = scratchpad; fmgc.FMGCInternal.altAirportSet = 1; fmgc.windController.updatePlans(); - if (getprop("/FMGC/internal/block-confirmed")) { - setprop("/FMGC/internal/fuel-calculating", 0); - setprop("/FMGC/internal/fuel-calculating", 1); + if (fmgc.FMGCInternal.blockConfirmed) { + fmgc.FMGCInternal.fuelCalculating = 0; + fmgc.FMGCInternal.fuelCalculating = 1; } mcdu_scratchpad.scratchpads[i].empty(); fmgc.updateARPT(); @@ -90,9 +90,9 @@ var initInputA = func(key, i) { 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); + if (fmgc.FMGCInternal.blockConfirmed) { + fmgc.FMGCInternal.fuelCalculating = 0; + fmgc.FMGCInternal.fuelCalculating = 1; } mcdu_scratchpad.scratchpads[i].empty(); } else if (find("/", scratchpad) != -1) { @@ -110,9 +110,9 @@ var initInputA = func(key, i) { if (temp >= -99 and temp <= 99) { 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); + if (fmgc.FMGCInternal.blockConfirmed) { + fmgc.FMGCInternal.fuelCalculating = 0; + fmgc.FMGCInternal.fuelCalculating = 1; } mcdu_scratchpad.scratchpads[i].empty(); } else { @@ -129,9 +129,9 @@ var initInputA = func(key, i) { 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); + if (fmgc.FMGCInternal.blockConfirmed) { + fmgc.FMGCInternal.fuelCalculating = 0; + fmgc.FMGCInternal.fuelCalculating = 1; } mcdu_scratchpad.scratchpads[i].empty(); } else { @@ -157,9 +157,9 @@ var initInputA = func(key, i) { 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); + if (fmgc.FMGCInternal.blockConfirmed) { + fmgc.FMGCInternal.fuelCalculating = 0; + fmgc.FMGCInternal.fuelCalculating = 1; } mcdu_scratchpad.scratchpads[i].empty(); } else { @@ -180,9 +180,9 @@ var initInputA = func(key, i) { setprop("/FMGC/internal/align-ref-long", 0); setprop("/FMGC/internal/align-ref-lat-edit", 0); setprop("/FMGC/internal/align-ref-long-edit", 0); - if (getprop("/FMGC/internal/block-confirmed")) { - setprop("/FMGC/internal/fuel-calculating", 0); - setprop("/FMGC/internal/fuel-calculating", 1); + if (fmgc.FMGCInternal.blockConfirmed) { + fmgc.FMGCInternal.fuelCalculating = 0; + fmgc.FMGCInternal.fuelCalculating = 1; } fmgc.flightPlanController.reset(2); fmgc.flightPlanController.init(); @@ -224,7 +224,7 @@ var initInputA = func(key, i) { } } } else if (key == "R2") { - if (getprop("engines/engine[0]/state") != 3 and getprop("engines/engine[1]/state") != 3) { + if (pts.Engines.Engine.state[0].getValue() != 3 and pts.Engines.Engine.state[1].getValue() != 3) { if (!ecam.vhf3_voice.active) { if (atsu.ATSU.working) { if (getprop("/FMGC/simbrief-username") == "") { diff --git a/Nasal/MCDU/INITB.nas b/Nasal/MCDU/INITB.nas index 1694d1f4..8b75ec65 100644 --- a/Nasal/MCDU/INITB.nas +++ b/Nasal/MCDU/INITB.nas @@ -4,14 +4,14 @@ var initInputB = func(key, i) { var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; - if (key == "L1" and !getprop("/FMGC/internal/fuel-calculating")) { + if (key == "L1" and !fmgc.FMGCInternal.fuelCalculating) { if (scratchpad == "CLR") { fmgc.FMGCInternal.taxiFuel = 0.4; fmgc.FMGCInternal.taxiFuelSet = 0; - if (getprop("/FMGC/internal/block-confirmed")) { - setprop("/FMGC/internal/fuel-calculating", 1); - } else if (getprop("/FMGC/internal/fuel-request-set")) { - setprop("/FMGC/internal/block-calculating", 1); + if (fmgc.FMGCInternal.blockConfirmed) { + fmgc.FMGCInternal.fuelCalculating = 1; + } else if (fmgc.FMGCInternal.fuelRequest) { + fmgc.FMGCInternal.blockCalculating = 1; } mcdu_scratchpad.scratchpads[i].empty(); } else { @@ -20,10 +20,10 @@ var initInputB = func(key, i) { if (num(scratchpad) != nil and scratchpad >= 0.0 and scratchpad <= 9.9) { fmgc.FMGCInternal.taxiFuel = scratchpad; fmgc.FMGCInternal.taxiFuelSet = 1; - if (getprop("/FMGC/internal/block-confirmed")) { - setprop("/FMGC/internal/fuel-calculating", 1); - } else if (getprop("/FMGC/internal/fuel-request-set")) { - setprop("/FMGC/internal/block-calculating", 1); + if (fmgc.FMGCInternal.blockConfirmed) { + fmgc.FMGCInternal.fuelCalculating = 1; + } else if (fmgc.FMGCInternal.fuelRequest) { + fmgc.FMGCInternal.blockCalculating = 1; } mcdu_scratchpad.scratchpads[i].empty(); } else { @@ -33,13 +33,13 @@ var initInputB = func(key, i) { mcdu_message(i, "NOT ALLOWED"); } } - } else if (key == "L3" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) { + } else if (key == "L3" and fmgc.FMGCInternal.blockConfirmed and !fmgc.FMGCInternal.fuelCalculating) { if (scratchpad == "CLR") { fmgc.FMGCInternal.rteRsv = 0.05 * fmgc.FMGCInternal.tripFuel; fmgc.FMGCInternal.rteRsvSet = 0; fmgc.FMGCInternal.rtePercent = 5.0; fmgc.FMGCInternal.rtePercentSet = 0; - setprop("/FMGC/internal/fuel-calculating", 1); + fmgc.FMGCInternal.fuelCalculating = 1; mcdu_scratchpad.scratchpads[i].empty(); } else if (fmgc.FMGCInternal.tripFuel != 0) { var tf = num(scratchpad); @@ -51,7 +51,7 @@ var initInputB = func(key, i) { fmgc.FMGCInternal.rteRsvSet = 0; fmgc.FMGCInternal.rtePercent = perc; fmgc.FMGCInternal.rtePercentSet = 1; - setprop("/FMGC/internal/fuel-calculating", 1); + fmgc.FMGCInternal.fuelCalculating = 1; mcdu_scratchpad.scratchpads[i].empty(); } } else if (tfs >= 1 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 21.7) { @@ -63,7 +63,7 @@ var initInputB = func(key, i) { fmgc.FMGCInternal.rtePercent = 15.0; # need reasearch on this value } fmgc.FMGCInternal.rtePercentSet = 0; - setprop("/FMGC/internal/fuel-calculating", 1); + fmgc.FMGCInternal.fuelCalculating = 1; mcdu_scratchpad.scratchpads[i].empty(); } else { mcdu_message(i, "NOT ALLOWED"); @@ -71,12 +71,12 @@ var initInputB = func(key, i) { } else { mcdu_message(i, "NOT ALLOWED"); } - } else if (key == "L4" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating") and fmgc.FMGCInternal.altAirportSet) { + } else if (key == "L4" and fmgc.FMGCInternal.blockConfirmed and !fmgc.FMGCInternal.fuelCalculating and fmgc.FMGCInternal.altAirportSet) { if (scratchpad == "CLR") { fmgc.FMGCInternal.altFuel = 0.0; fmgc.FMGCInternal.altTime = "0000"; fmgc.FMGCInternal.altFuelSet = 0; - setprop("/FMGC/internal/fuel-calculating", 1); + fmgc.FMGCInternal.fuelCalculating = 1; mcdu_scratchpad.scratchpads[i].empty(); } else if (find(".", scratchpad) != -1) { var tf = num(scratchpad); @@ -85,7 +85,7 @@ var initInputB = func(key, i) { fmgc.FMGCInternal.altFuel = tf; fmgc.FMGCInternal.altTime = "0000"; fmgc.FMGCInternal.altFuelSet = 1; - setprop("/FMGC/internal/fuel-calculating", 1); + fmgc.FMGCInternal.fuelCalculating = 1; mcdu_scratchpad.scratchpads[i].empty(); } else { mcdu_message(i, "NOT ALLOWED"); @@ -93,13 +93,13 @@ var initInputB = func(key, i) { } else { mcdu_message(i, "NOT ALLOWED"); } - } else if (key == "L5" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) { + } else if (key == "L5" and fmgc.FMGCInternal.blockConfirmed and !fmgc.FMGCInternal.fuelCalculating) { if (scratchpad == "CLR") { fmgc.FMGCInternal.finalFuel = 0.0; fmgc.FMGCInternal.finalTime = "0030"; fmgc.FMGCInternal.finalFuelSet = 0; fmgc.FMGCInternal.finalTimeSet = 0; - setprop("/FMGC/internal/fuel-calculating", 1); + fmgc.FMGCInternal.fuelCalculating = 1; mcdu_scratchpad.scratchpads[i].empty(); } else if (find(".", scratchpad) != -1) { var tf = num(scratchpad); @@ -107,7 +107,7 @@ var initInputB = func(key, i) { if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0) { fmgc.FMGCInternal.finalFuel = tf; fmgc.FMGCInternal.finalFuelSet = 1; - setprop("/FMGC/internal/fuel-calculating", 1); + fmgc.FMGCInternal.fuelCalculating = 1; mcdu_scratchpad.scratchpads[i].empty(); } else { mcdu_message(i, "NOT ALLOWED"); @@ -118,17 +118,17 @@ var initInputB = func(key, i) { if (tfs == 4 and tf != nil and ((tf >= 0 and tf <= 59) or (tf >= 100 and tf <= 130))) { fmgc.FMGCInternal.finalTime = scratchpad; fmgc.FMGCInternal.finalTimeSet = 1; - setprop("/FMGC/internal/fuel-calculating", 1); + fmgc.FMGCInternal.fuelCalculating = 1; mcdu_scratchpad.scratchpads[i].empty(); } else { mcdu_message(i, "NOT ALLOWED"); } } - } else if (key == "L6" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) { + } else if (key == "L6" and fmgc.FMGCInternal.blockConfirmed and !fmgc.FMGCInternal.fuelCalculating) { if (scratchpad == "CLR") { fmgc.FMGCInternal.minDestFob = 0; fmgc.FMGCInternal.minDestFobSet = 0; - setprop("/FMGC/internal/fuel-calculating", 1); + fmgc.FMGCInternal.fuelCalculating = 1; mcdu_scratchpad.scratchpads[i].empty(); } else if (find(".", scratchpad) != -1) { var tf = num(scratchpad); @@ -136,7 +136,7 @@ var initInputB = func(key, i) { if (tfs >= 3 and tfs <= 5 and tf != nil and tf >= 0 and tf <= 80.0) { fmgc.FMGCInternal.minDestFob = tf; fmgc.FMGCInternal.minDestFobSet = 1; - setprop("/FMGC/internal/fuel-calculating", 1); + fmgc.FMGCInternal.fuelCalculating = 1; mcdu_scratchpad.scratchpads[i].empty(); if (fmgc.FMGCInternal.minDestFob < fmgc.FMGCInternal.finalFuel + fmgc.FMGCInternal.altFuel) { mcdu_message(i, "CHECK MIN DEST FOB"); @@ -147,26 +147,26 @@ var initInputB = func(key, i) { } else { mcdu_message(i, "NOT ALLOWED"); } - } else if (key == "R1" and !getprop("/FMGC/internal/fuel-calculating")) { + } else if (key == "R1" and !fmgc.FMGCInternal.fuelCalculating) { if (scratchpad == "CLR") { mcdu_message(i, "NOT ALLOWED"); } else { var zfw_min = 80.6; #make based on performance var zfw_max = 134.5; #61,000 kg, make based on performance if (size(scratchpad) == 0) { - var zfw = getprop("/fdm/jsbsim/inertia/weight-lbs") - getprop("/consumables/fuel/total-fuel-lbs"); + var zfw = pts.Fdm.JSBsim.Inertia.weightLbs.getValue() - pts.Consumables.Fuel.totalFuelLbs.getValue(); fmgc.FMGCInternal.zfw = sprintf("%3.1f", math.round(zfw / 1000, 0.1)); fmgc.FMGCInternal.zfwSet = 1; - if (!getprop("/FMGC/internal/block-confirmed") and fmgc.FMGCInternal.blockSet) { + if (!fmgc.FMGCInternal.blockConfirmed and fmgc.FMGCInternal.blockSet) { fmgc.FMGCInternal.tow = fmgc.FMGCInternal.zfw + fmgc.FMGCInternal.block - fmgc.FMGCInternal.taxiFuel; - setprop("/FMGC/internal/fuel-request-set", 1); - setprop("/FMGC/internal/fuel-calculating", 1); - setprop("/FMGC/internal/block-calculating", 0); - setprop("/FMGC/internal/block-confirmed", 1); - } else if (getprop("/FMGC/internal/block-confirmed")) { - setprop("/FMGC/internal/fuel-calculating", 1); - } else if (getprop("/FMGC/internal/fuel-request-set")) { - setprop("/FMGC/internal/block-calculating", 1); + fmgc.FMGCInternal.fuelRequest = 1; + fmgc.FMGCInternal.fuelCalculating = 1; + fmgc.FMGCInternal.blockCalculating = 0; + fmgc.FMGCInternal.blockConfirmed = 1; + } else if (fmgc.FMGCInternal.blockConfirmed) { + fmgc.FMGCInternal.fuelCalculating = 1; + } else if (fmgc.FMGCInternal.fuelRequest) { + fmgc.FMGCInternal.blockCalculating = 1; } mcdu_scratchpad.scratchpads[i].empty(); } else if (find("/", scratchpad) != -1) { @@ -181,16 +181,16 @@ var initInputB = func(key, i) { fmgc.FMGCInternal.zfwSet = 1; fmgc.FMGCInternal.zfwcg = zfwcg; fmgc.FMGCInternal.zfwcgSet = 1; - if (!getprop("/FMGC/internal/block-confirmed") and fmgc.FMGCInternal.blockSet) { + if (!fmgc.FMGCInternal.blockConfirmed and fmgc.FMGCInternal.blockSet) { fmgc.FMGCInternal.tow = fmgc.FMGCInternal.zfw + fmgc.FMGCInternal.block - fmgc.FMGCInternal.taxiFuel; - setprop("/FMGC/internal/fuel-request-set", 1); - setprop("/FMGC/internal/fuel-calculating", 1); - setprop("/FMGC/internal/block-calculating", 0); - setprop("/FMGC/internal/block-confirmed", 1); - } else if (getprop("/FMGC/internal/block-confirmed")) { - setprop("/FMGC/internal/fuel-calculating", 1); - } else if (getprop("/FMGC/internal/fuel-request-set")) { - setprop("/FMGC/internal/block-calculating", 1); + fmgc.FMGCInternal.fuelRequest = 1; + fmgc.FMGCInternal.fuelCalculating = 1; + fmgc.FMGCInternal.blockCalculating = 0; + fmgc.FMGCInternal.blockConfirmed = 1; + } else if (fmgc.FMGCInternal.blockConfirmed) { + fmgc.FMGCInternal.fuelCalculating = 1; + } else if (fmgc.FMGCInternal.fuelRequest) { + fmgc.FMGCInternal.blockCalculating = 1; } mcdu_scratchpad.scratchpads[i].empty(); } else { @@ -211,16 +211,16 @@ var initInputB = func(key, i) { if (scratchpad >= zfw_min and scratchpad <= zfw_max) { fmgc.FMGCInternal.zfw = scratchpad; fmgc.FMGCInternal.zfwSet = 1; - if (!getprop("/FMGC/internal/block-confirmed") and fmgc.FMGCInternal.blockSet) { + if (!fmgc.FMGCInternal.blockConfirmed and fmgc.FMGCInternal.blockSet) { fmgc.FMGCInternal.tow = fmgc.FMGCInternal.zfw + fmgc.FMGCInternal.block - fmgc.FMGCInternal.taxiFuel; - setprop("/FMGC/internal/fuel-request-set", 1); - setprop("/FMGC/internal/fuel-calculating", 1); - setprop("/FMGC/internal/block-calculating", 0); - setprop("/FMGC/internal/block-confirmed", 1); - } else if (getprop("/FMGC/internal/block-confirmed")) { - setprop("/FMGC/internal/fuel-calculating", 1); - } else if (getprop("/FMGC/internal/fuel-request-set")) { - setprop("/FMGC/internal/block-calculating", 1); + fmgc.FMGCInternal.fuelRequest = 1; + fmgc.FMGCInternal.fuelCalculating = 1; + fmgc.FMGCInternal.blockCalculating = 0; + fmgc.FMGCInternal.blockConfirmed = 1; + } else if (fmgc.FMGCInternal.blockConfirmed) { + fmgc.FMGCInternal.fuelCalculating = 1; + } else if (fmgc.FMGCInternal.fuelRequest) { + fmgc.FMGCInternal.blockCalculating = 1; } mcdu_scratchpad.scratchpads[i].empty(); } else { @@ -237,7 +237,7 @@ var initInputB = func(key, i) { fmgc.FMGCNodes.costIndex.setValue(fmgc.FMGCInternal.costIndex); } } - } else if (key == "R2" and !getprop("/FMGC/internal/fuel-calculating")) { + } else if (key == "R2" and !fmgc.FMGCInternal.fuelCalculating) { if (scratchpad == "CLR") { fmgc.FMGCInternal.block = 0.0; fmgc.FMGCInternal.blockSet = 0; @@ -265,23 +265,23 @@ var initInputB = func(key, i) { fmgc.FMGCInternal.fffqSensor = "FF+FQ"; fmgc.FMGCInternal.extraFuel = 0; fmgc.FMGCInternal.extraTime = "0000"; - setprop("/FMGC/internal/fuel-request-set", 0); - setprop("/FMGC/internal/fuel-calculating", 0); - setprop("/FMGC/internal/block-calculating", 0); - setprop("/FMGC/internal/block-confirmed", 0); + fmgc.FMGCInternal.fuelRequest = 0; + fmgc.FMGCInternal.fuelCalculating = 0; + fmgc.FMGCInternal.blockCalculating = 0; + fmgc.FMGCInternal.blockConfirmed = 0; mcdu_scratchpad.scratchpads[i].empty(); } else { var tfs = size(scratchpad); var maxblock = getprop("/options/maxblock"); if (tfs == 0) { - fmgc.FMGCInternal.block = sprintf("%3.1f", math.round(getprop("/consumables/fuel/total-fuel-lbs") / 1000, 0.1)); + fmgc.FMGCInternal.block = sprintf("%3.1f", math.round(pts.Consumables.Fuel.totalFuelLbs.getValue() / 1000, 0.1)); fmgc.FMGCInternal.blockSet = 1; if (fmgc.FMGCInternal.zfwSet) { fmgc.FMGCInternal.tow = num(fmgc.FMGCInternal.zfw + fmgc.FMGCInternal.block - fmgc.FMGCInternal.taxiFuel); - setprop("/FMGC/internal/fuel-request-set", 1); - setprop("/FMGC/internal/fuel-calculating", 1); - setprop("/FMGC/internal/block-calculating", 0); - setprop("/FMGC/internal/block-confirmed", 1); + fmgc.FMGCInternal.fuelRequest = 1; + fmgc.FMGCInternal.fuelCalculating = 1; + fmgc.FMGCInternal.blockCalculating = 0; + fmgc.FMGCInternal.blockConfirmed = 1; } } else if (tfs >= 1 and tfs <= 5) { if (num(scratchpad) != nil and scratchpad >= 1.0 and scratchpad <= maxblock) { @@ -289,10 +289,10 @@ var initInputB = func(key, i) { fmgc.FMGCInternal.blockSet = 1; if (fmgc.FMGCInternal.zfwSet) { fmgc.FMGCInternal.tow = num(fmgc.FMGCInternal.zfw + fmgc.FMGCInternal.block - fmgc.FMGCInternal.taxiFuel); - setprop("/FMGC/internal/fuel-request-set", 1); - setprop("/FMGC/internal/fuel-calculating", 1); - setprop("/FMGC/internal/block-calculating", 0); - setprop("/FMGC/internal/block-confirmed", 1); + fmgc.FMGCInternal.fuelRequest = 1; + fmgc.FMGCInternal.fuelCalculating = 1; + fmgc.FMGCInternal.blockCalculating = 0; + fmgc.FMGCInternal.blockConfirmed = 1; } mcdu_scratchpad.scratchpads[i].empty(); } else { @@ -303,21 +303,21 @@ var initInputB = func(key, i) { } } } else if (key == "R3") { - if (scratchpad == "" and fmgc.FMGCInternal.zfwSet and !getprop("/FMGC/internal/fuel-request-set")) { - setprop("/FMGC/internal/fuel-request-set", 1); - setprop("/FMGC/internal/block-calculating", 1); - } else if (scratchpad == "" and fmgc.FMGCInternal.zfwSet and getprop("/FMGC/internal/fuel-request-set") and !getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/block-calculating")) { - setprop("/FMGC/internal/block-confirmed", 1); - setprop("/FMGC/internal/fuel-calculating", 1); + if (scratchpad == "" and fmgc.FMGCInternal.zfwSet and !fmgc.FMGCInternal.fuelRequest) { + fmgc.FMGCInternal.fuelRequest = 1; + fmgc.FMGCInternal.blockCalculating = 1; + } else if (scratchpad == "" and fmgc.FMGCInternal.zfwSet and fmgc.FMGCInternal.fuelRequest and !fmgc.FMGCInternal.blockConfirmed and !fmgc.FMGCInternal.blockCalculating) { + fmgc.FMGCInternal.blockConfirmed = 1; + fmgc.FMGCInternal.fuelCalculating = 1; } else { mcdu_message(i, "NOT ALLOWED"); } - } else if (key == "R5" and !getprop("/FMGC/internal/fuel-calculating")) { + } else if (key == "R5" and !fmgc.FMGCInternal.fuelCalculating) { if (scratchpad == "CLR") { fmgc.FMGCInternal.tripWind = "HD000"; fmgc.FMGCInternal.tripWindValue = 0; - if (getprop("/FMGC/internal/block-confirmed")) { - setprop("/FMGC/internal/fuel-calculating", 1); + if (fmgc.FMGCInternal.blockConfirmed) { + fmgc.FMGCInternal.fuelCalculating = 1; } mcdu_scratchpad.scratchpads[i].empty(); } else { @@ -326,8 +326,8 @@ var initInputB = func(key, i) { if (int(effwind) != nil and effwind >= 0 and effwind <= 500) { fmgc.FMGCInternal.tripWind = scratchpad; fmgc.FMGCInternal.tripWindValue = effwind; - if (getprop("/FMGC/internal/block-confirmed")) { - setprop("/FMGC/internal/fuel-calculating", 1); + if (fmgc.FMGCInternal.blockConfirmed) { + fmgc.FMGCInternal.fuelCalculating = 1; } mcdu_scratchpad.scratchpads[i].empty(); } else { @@ -338,8 +338,8 @@ var initInputB = func(key, i) { if (int(effwind) != nil and effwind >= 0 and effwind <= 500) { fmgc.FMGCInternal.tripWind = scratchpad; fmgc.FMGCInternal.tripWindValue = effwind; - if (getprop("/FMGC/internal/block-confirmed")) { - setprop("/FMGC/internal/fuel-calculating", 1); + if (fmgc.FMGCInternal.blockConfirmed) { + fmgc.FMGCInternal.fuelCalculating = 1; } mcdu_scratchpad.scratchpads[i].empty(); } else { @@ -349,8 +349,8 @@ var initInputB = func(key, i) { if (num(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 500) { fmgc.FMGCInternal.tripWind = scratchpad; fmgc.FMGCInternal.tripWindValue = scratchpad; - if (getprop("/FMGC/internal/block-confirmed")) { - setprop("/FMGC/internal/fuel-calculating", 1); + if (fmgc.FMGCInternal.blockConfirmed) { + fmgc.FMGCInternal.fuelCalculating = 1; } mcdu_scratchpad.scratchpads[i].empty(); } else { diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 15c3a096..beb00ce8 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -3,6 +3,9 @@ # Copyright (c) 2020 Josh Davidson (Octal450) # Copyright (c) 2020 Matthew Maring (mattmaring) +var pageNode = [props.globals.getNode("/MCDU[0]/page"), props.globals.getNode("/MCDU[1]/page")]; +var page = nil; + var scratchpadNode = [nil, nil]; var MCDU_init = func(i) { MCDU_reset(i); @@ -14,7 +17,7 @@ var MCDU_reset = func(i) { setprop("it-autoflight/settings/togaspd", 157); #aka v2 clone setprop("/MCDU[" ~ i ~ "]/last-fmgc-page", "STATUS"); setprop("/MCDU[" ~ i ~ "]/last-atsu-page", "ATSUDLINK"); - setprop("/MCDU[" ~ i ~ "]/page", "MCDU"); + pageNode[i].setValue("MCDU"); setprop("/FMGC/keyboard-left", 0); setprop("/FMGC/keyboard-right", 0); @@ -122,10 +125,10 @@ var MCDU_reset = func(i) { fmgc.FMGCInternal.fffqSensor = "FF+FQ"; fmgc.FMGCInternal.extraFuel = 0; fmgc.FMGCInternal.extraTime = "0000"; - setprop("/FMGC/internal/fuel-request-set", 0); - setprop("/FMGC/internal/block-calculating", 0); - setprop("/FMGC/internal/block-confirmed", 0); - setprop("/FMGC/internal/fuel-calculating", 0); + fmgc.FMGCInternal.fuelRequest = 0; + fmgc.FMGCInternal.blockCalculating = 0; + fmgc.FMGCInternal.blockConfirmed = 0; + fmgc.FMGCInternal.fuelCalculating = 0; # FUELPRED fmgc.FMGCInternal.priUtc = "0000"; @@ -197,8 +200,9 @@ var setMode = func(will) { } var lskbutton = func(btn, i) { + page = pageNode[i].getValue(); if (btn == "1") { - if (getprop("/MCDU[" ~ i ~ "]/page") == "MCDU") { + if (page == "MCDU") { if (getprop("/MCDU[" ~ i ~ "]/atsu-active") == 1) { mcdu_message(i, "NOT ALLOWED"); } else { @@ -206,84 +210,84 @@ var lskbutton = func(btn, i) { mcdu_message(i, "WAIT FOR SYSTEM RESPONSE"); setprop("/MCDU[" ~ i ~ "]/active", 1); settimer(func(){ - setprop("/MCDU[" ~ i ~ "]/page", getprop("/MCDU[" ~ i ~ "]/last-fmgc-page")); + pageNode[i].setValue(getprop("/MCDU[" ~ i ~ "]/last-fmgc-page")); mcdu_scratchpad.scratchpads[i].empty(); setprop("/MCDU[" ~ i ~ "]/active", 2); }, 2); } else { - setprop("/MCDU[" ~ i ~ "]/page", getprop("/MCDU[" ~ i ~ "]/last-fmgc-page")); + pageNode[i].setValue(getprop("/MCDU[" ~ i ~ "]/last-fmgc-page")); mcdu_scratchpad.scratchpads[i].empty(); } } - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "IRSINIT") { + } else if (page == "IRSINIT") { initInputIRS("L1",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB") { + } else if (page == "INITB") { initInputB("L1",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { + } else if (page == "WINDCLB") { canvas_mcdu.myCLBWIND[i].pushButtonLeft(1); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") { + } else if (page == "WINDCRZ") { canvas_mcdu.myCRZWIND[i].pushButtonLeft(1); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") { + } else if (page == "WINDDES") { canvas_mcdu.myDESWIND[i].pushButtonLeft(1); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PROGTO") { + } else if (page == "PROGTO") { progTOInput("L1",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PROGCLB") { + } else if (page == "PROGCLB") { progCLBInput("L1",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PROGCRZ") { + } else if (page == "PROGCRZ") { progCRZInput("L1",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PROGDES") { + } else if (page == "PROGDES") { progDESInput("L1",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") { + } else if (page == "PERFTO") { perfTOInput("L1",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") { + } else if (page == "PERFAPPR") { perfAPPRInput("L1",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RADNAV") { + } else if (page == "RADNAV") { radnavInput("L1",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DATA") { + } else if (page == "DATA") { dataInput("L1",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC") { + } else if (page == "PRINTFUNC") { printInput("L1",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") { + } else if (page == "PRINTFUNC2") { printInput2("L1",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "LATREV") { + } else if (page == "LATREV") { if (canvas_mcdu.myLatRev[i].type == 0) { if (canvas_mcdu.myDeparture[i] != nil) { canvas_mcdu.myDeparture[i].del(); } canvas_mcdu.myDeparture[i] = nil; canvas_mcdu.myDeparture[i] = departurePage.new(canvas_mcdu.myLatRev[i].title[2], i); - setprop("/MCDU[" ~ i ~ "]/page", "DEPARTURE"); + pageNode[i].setValue("DEPARTURE"); } else { mcdu_message(i, "NOT ALLOWED"); } - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") { + } else if (page == "F-PLNA" or page == "F-PLNB") { canvas_mcdu.myFpln[i].pushButtonLeft(1); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DIRTO") { + } else if (page == "DIRTO") { canvas_mcdu.myDirTo[i].fieldL1(mcdu_scratchpad.scratchpads[i].scratchpad); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") { + } else if (page == "DUPLICATENAMES") { canvas_mcdu.myDuplicate[i].pushButtonLeft(1); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATSUDLINK") { - setprop("/MCDU[" ~ i ~ "]/page", "ATCMENU"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "COMMMENU") { - setprop("/MCDU[" ~ i ~ "]/page", "COMMINIT"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "COMPANYCALL") { + } else if (page == "ATSUDLINK") { + pageNode[i].setValue("ATCMENU"); + } else if (page == "COMMMENU") { + pageNode[i].setValue("COMMINIT"); + } else if (page == "COMPANYCALL") { if (atsu.CompanyCall.frequency != 999.99) { atsu.CompanyCall.tune(); } else { mcdu_message(i, "NOT ALLOWED"); } - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WEATHERREQ") { - setprop("/MCDU[" ~ i ~ "]/page", "WEATHERTYPE"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WEATHERTYPE") { + } else if (page == "WEATHERREQ") { + pageNode[i].setValue("WEATHERTYPE"); + } else if (page == "WEATHERTYPE") { atsu.AOC.selectedType = "HOURLY WX"; - setprop("/MCDU[" ~ i ~ "]/page", "WEATHERREQ"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") { + pageNode[i].setValue("WEATHERREQ"); + } else if (page == "RECEIVEDMSGS") { canvas_mcdu.myReceivedMessages[i].leftKey(1); } else { mcdu_message(i, "NOT ALLOWED"); } } else if (btn == "2") { - if (getprop("/MCDU[" ~ i ~ "]/page") == "MCDU") { + if (page == "MCDU") { if (getprop("/MCDU[" ~ i ~ "]/active") == 1) { mcdu_message(i, "NOT ALLOWED"); } else { @@ -291,52 +295,52 @@ var lskbutton = func(btn, i) { mcdu_message(i, "WAIT FOR SYSTEM RESPONSE"); setprop("/MCDU[" ~ i ~ "]/atsu-active", 1); settimer(func(){ - setprop("/MCDU[" ~ i ~ "]/page", getprop("/MCDU[" ~ i ~ "]/last-atsu-page")); + pageNode[i].setValue(getprop("/MCDU[" ~ i ~ "]/last-atsu-page")); mcdu_scratchpad.scratchpads[i].empty(); setprop("/MCDU[" ~ i ~ "]/atsu-active", 2); }, 2); } else { - setprop("/MCDU[" ~ i ~ "]/page", getprop("/MCDU[" ~ i ~ "]/last-atsu-page")); + pageNode[i].setValue(getprop("/MCDU[" ~ i ~ "]/last-atsu-page")); mcdu_scratchpad.scratchpads[i].empty(); } } - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") { + } else if (page == "INITA") { initInputA("L2",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { + } else if (page == "WINDCLB") { canvas_mcdu.myCLBWIND[i].pushButtonLeft(2); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") { + } else if (page == "WINDCRZ") { canvas_mcdu.myCRZWIND[i].pushButtonLeft(2); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") { + } else if (page == "WINDDES") { canvas_mcdu.myDESWIND[i].pushButtonLeft(2); - } else if (getprop("MCDU[" ~ i ~ "]/page") == "PERFTO") { + } else if (page == "PERFTO") { perfTOInput("L2",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") { + } else if (page == "PERFAPPR") { perfAPPRInput("L2",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RADNAV") { + } else if (page == "RADNAV") { radnavInput("L2",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFCLB") { + } else if (page == "PERFCLB") { perfCLBInput("L2",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFCRZ") { + } else if (page == "PERFCRZ") { perfCRZInput("L2",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFDES") { + } else if (page == "PERFDES") { perfDESInput("L2",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DATA") { + } else if (page == "DATA") { dataInput("L2",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC") { + } else if (page == "PRINTFUNC") { printInput("L2",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") { + } else if (page == "PRINTFUNC2") { printInput2("L2",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") { + } else if (page == "F-PLNA" or page == "F-PLNB") { canvas_mcdu.myFpln[i].pushButtonLeft(2); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DEPARTURE") { + } else if (page == "DEPARTURE") { canvas_mcdu.myDeparture[i].depPushbuttonLeft(2); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ARRIVAL") { + } else if (page == "ARRIVAL") { canvas_mcdu.myArrival[i].arrPushbuttonLeft(2); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DIRTO") { + } else if (page == "DIRTO") { canvas_mcdu.myDirTo[i].leftFieldBtn(2); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") { + } else if (page == "DUPLICATENAMES") { canvas_mcdu.myDuplicate[i].pushButtonLeft(2); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "NOTIFICATION") { + } else if (page == "NOTIFICATION") { var result = atsu.notificationSystem.inputAirport(mcdu_scratchpad.scratchpads[i].scratchpad); if (result == 1) { mcdu_message(i, "NOT ALLOWED"); @@ -345,236 +349,236 @@ var lskbutton = func(btn, i) { } else { mcdu_scratchpad.scratchpads[i].empty(); } - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "COMMMENU") { - setprop("/MCDU[" ~ i ~ "]/page", "DATAMODE"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") { + } else if (page == "COMMMENU") { + pageNode[i].setValue("DATAMODE"); + } else if (page == "RECEIVEDMSGS") { canvas_mcdu.myReceivedMessages[i].leftKey(2); } else { mcdu_message(i, "NOT ALLOWED"); } } else if (btn == "3") { - if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") { + if (page == "INITA") { initInputA("L3",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB") { + } else if (page == "INITB") { initInputB("L3",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "FUELPRED") { + } else if (page == "FUELPRED") { fuelPredInput("L3",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { + } else if (page == "WINDCLB") { canvas_mcdu.myCLBWIND[i].pushButtonLeft(3); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") { + } else if (page == "WINDCRZ") { canvas_mcdu.myCRZWIND[i].pushButtonLeft(3); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") { + } else if (page == "WINDDES") { canvas_mcdu.myDESWIND[i].pushButtonLeft(3); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") { + } else if (page == "PERFTO") { perfTOInput("L3",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") { + } else if (page == "PERFAPPR") { perfAPPRInput("L3",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "STATUS") { + } else if (page == "STATUS") { statusInput("L3",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RADNAV") { + } else if (page == "RADNAV") { radnavInput("L3",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC") { + } else if (page == "PRINTFUNC") { printInput("L3",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") { + } else if (page == "PRINTFUNC2") { printInput2("L3",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") { + } else if (page == "F-PLNA" or page == "F-PLNB") { canvas_mcdu.myFpln[i].pushButtonLeft(3); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DEPARTURE") { + } else if (page == "DEPARTURE") { canvas_mcdu.myDeparture[i].depPushbuttonLeft(3); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ARRIVAL") { + } else if (page == "ARRIVAL") { canvas_mcdu.myArrival[i].arrPushbuttonLeft(3); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DIRTO") { + } else if (page == "DIRTO") { canvas_mcdu.myDirTo[i].leftFieldBtn(3); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "LATREV") { + } else if (page == "LATREV") { if (canvas_mcdu.myLatRev[i].type != 0 and canvas_mcdu.myLatRev[i].type != 1) { if (canvas_mcdu.myHold[i] != nil) { canvas_mcdu.myHold[i].del(); } canvas_mcdu.myHold[i] = nil; canvas_mcdu.myHold[i] = holdPage.new(i, canvas_mcdu.myLatRev[i].wpt); - setprop("/MCDU[" ~ i ~ "]/page", "HOLD"); + pageNode[i].setValue("HOLD"); } else { mcdu_message(i, "NOT ALLOWED"); } - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") { + } else if (page == "DUPLICATENAMES") { canvas_mcdu.myDuplicate[i].pushButtonLeft(3); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "COMMMENU") { - setprop("/MCDU[" ~ i ~ "]/page", "VOICEDIRECTORY"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") { + } else if (page == "COMMMENU") { + pageNode[i].setValue("VOICEDIRECTORY"); + } else if (page == "RECEIVEDMSGS") { canvas_mcdu.myReceivedMessages[i].leftKey(3); } else { mcdu_message(i, "NOT ALLOWED"); } } else if (btn == "4") { - if (getprop("/MCDU[" ~ i ~ "]/page") == "DATA") { - setprop("/MCDU[" ~ i ~ "]/page", "STATUS"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB") { + if (page == "DATA") { + pageNode[i].setValue("STATUS"); + } else if (page == "INITB") { initInputB("L4",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "FUELPRED") { + } else if (page == "FUELPRED") { fuelPredInput("L4",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { + } else if (page == "WINDCLB") { canvas_mcdu.myCLBWIND[i].pushButtonLeft(4); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") { + } else if (page == "WINDCRZ") { canvas_mcdu.myCRZWIND[i].pushButtonLeft(4); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") { + } else if (page == "WINDDES") { canvas_mcdu.myDESWIND[i].pushButtonLeft(4); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") { + } else if (page == "PERFTO") { perfTOInput("L4",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") { + } else if (page == "PERFAPPR") { perfAPPRInput("L4",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RADNAV") { + } else if (page == "RADNAV") { radnavInput("L4",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") { + } else if (page == "PRINTFUNC2") { printInput2("L4",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") { + } else if (page == "F-PLNA" or page == "F-PLNB") { canvas_mcdu.myFpln[i].pushButtonLeft(4); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DEPARTURE") { + } else if (page == "DEPARTURE") { canvas_mcdu.myDeparture[i].depPushbuttonLeft(4); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ARRIVAL") { + } else if (page == "ARRIVAL") { canvas_mcdu.myArrival[i].arrPushbuttonLeft(4); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DIRTO") { + } else if (page == "DIRTO") { canvas_mcdu.myDirTo[i].leftFieldBtn(4); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") { + } else if (page == "DUPLICATENAMES") { canvas_mcdu.myDuplicate[i].pushButtonLeft(4); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "CONNECTSTATUS") { + } else if (page == "CONNECTSTATUS") { if (atsu.ADS.state != 0) { atsu.ADS.setState(0); } else { atsu.ADS.setState(1); } - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "VOICEDIRECTORY") { + } else if (page == "VOICEDIRECTORY") { if (atsu.CompanyCall.frequency != 999.99) { atsu.CompanyCall.tune(); } else { mcdu_message(i, "NOT ALLOWED"); } - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") { + } else if (page == "RECEIVEDMSGS") { canvas_mcdu.myReceivedMessages[i].leftKey(4); } else { mcdu_message(i, "NOT ALLOWED"); } } else if (btn == "5") { - if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") { + if (page == "INITA") { initInputA("L5",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB") { + } else if (page == "INITB") { initInputB("L5",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "FUELPRED") { + } else if (page == "FUELPRED") { fuelPredInput("L5",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { + } else if (page == "WINDCLB") { canvas_mcdu.myCLBWIND[i].pushButtonLeft(5); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") { + } else if (page == "WINDCRZ") { canvas_mcdu.myCRZWIND[i].pushButtonLeft(5); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") { + } else if (page == "WINDDES") { canvas_mcdu.myDESWIND[i].pushButtonLeft(5); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") { + } else if (page == "PERFTO") { perfTOInput("L5",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFCLB") { + } else if (page == "PERFCLB") { perfCLBInput("L5",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFCRZ") { + } else if (page == "PERFCRZ") { perfCRZInput("L5",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFDES") { + } else if (page == "PERFDES") { perfDESInput("L5",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") { + } else if (page == "PERFAPPR") { perfAPPRInput("L5",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFGA") { + } else if (page == "PERFGA") { perfGAInput("L5",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RADNAV") { + } else if (page == "RADNAV") { radnavInput("L5",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC") { + } else if (page == "PRINTFUNC") { printInput("L5",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") { + } else if (page == "PRINTFUNC2") { printInput2("L5",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DATA") { + } else if (page == "DATA") { dataInput("L5",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DATA2") { + } else if (page == "DATA2") { data2Input("L5",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") { + } else if (page == "F-PLNA" or page == "F-PLNB") { canvas_mcdu.myFpln[i].pushButtonLeft(5); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DEPARTURE") { + } else if (page == "DEPARTURE") { canvas_mcdu.myDeparture[i].depPushbuttonLeft(5); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ARRIVAL") { + } else if (page == "ARRIVAL") { canvas_mcdu.myArrival[i].arrPushbuttonLeft(5); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "VERTREV") { + } else if (page == "VERTREV") { canvas_mcdu.myVertRev[i].pushButtonLeft(5); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DIRTO") { + } else if (page == "DIRTO") { canvas_mcdu.myDirTo[i].leftFieldBtn(5); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") { + } else if (page == "DUPLICATENAMES") { canvas_mcdu.myDuplicate[i].pushButtonLeft(5); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "CLOSESTAIRPORT") { + } else if (page == "CLOSESTAIRPORT") { canvas_mcdu.myClosestAirport[i].manAirportCall(mcdu_scratchpad.scratchpads[i].scratchpad); mcdu_scratchpad.scratchpads[i].empty(); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU") { - setprop("/MCDU[" ~ i ~ "]/page", "NOTIFICATION"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") { + } else if (page == "ATCMENU") { + pageNode[i].setValue("NOTIFICATION"); + } else if (page == "RECEIVEDMSGS") { canvas_mcdu.myReceivedMessages[i].leftKey(5); } else { mcdu_message(i, "NOT ALLOWED"); } } else if (btn == "6") { - if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") { + if (page == "INITA") { initInputA("L6",i); - } else if (getprop("MCDU[" ~ i ~ "]/page") == "INITB") { + } else if (page == "INITB") { initInputB("L6",i); - } else if (getprop("MCDU[" ~ i ~ "]/page") == "FUELPRED") { + } else if (page == "FUELPRED") { fuelPredInput("L6",i); - } else if (getprop("MCDU[" ~ i ~ "]/page") == "IRSINIT") { + } else if (page == "IRSINIT") { initInputIRS("L6",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { + } else if (page == "WINDCLB") { canvas_mcdu.myCLBWIND[i].pushButtonLeft(6); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") { + } else if (page == "WINDCRZ") { canvas_mcdu.myCRZWIND[i].pushButtonLeft(6); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") { + } else if (page == "WINDDES") { canvas_mcdu.myDESWIND[i].pushButtonLeft(6); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDHIST") { + } else if (page == "WINDHIST") { if (canvas_mcdu.myCLBWIND[i] == nil) { canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i); } else { canvas_mcdu.myCLBWIND[i].reload(); } - setprop("MCDU[" ~ i ~ "]/page", "WINDCLB"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ROUTESELECTION") { + pageNode[i].setValue("WINDCLB"); + } else if (page == "ROUTESELECTION") { initInputROUTESEL("L6",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFCLB") { + } else if (page == "PERFCLB") { perfCLBInput("L6",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFCRZ") { + } else if (page == "PERFCRZ") { perfCRZInput("L6",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFDES") { + } else if (page == "PERFDES") { perfDESInput("L6",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") { + } else if (page == "PERFAPPR") { perfAPPRInput("L6",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFGA") { + } else if (page == "PERFGA") { perfGAInput("L6",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") { + } else if (page == "PRINTFUNC2") { printInput2("L6",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") { + } else if (page == "F-PLNA" or page == "F-PLNB") { canvas_mcdu.myFpln[i].pushButtonLeft(6); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "LATREV" or getprop("/MCDU[" ~ i ~ "]/page") == "VERTREV" or getprop("/MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") { - setprop("/MCDU[" ~ i ~ "]/page", "F-PLNA"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ARRIVAL") { + } else if (page == "LATREV" or page == "VERTREV" or page == "DUPLICATENAMES") { + pageNode[i].setValue("F-PLNA"); + } else if (page == "ARRIVAL") { canvas_mcdu.myArrival[i].arrPushbuttonLeft(6); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DEPARTURE" or getprop("/MCDU[" ~ i ~ "]/page") == "HOLD" or getprop("/MCDU[" ~ i ~ "]/page") == "AIRWAYS") { + } else if (page == "DEPARTURE" or page == "HOLD" or page == "AIRWAYS") { if (fmgc.flightPlanController.temporaryFlag[i]) { - setprop("/MCDU[" ~ i ~ "]/page", "F-PLNA"); + pageNode[i].setValue("F-PLNA"); } else { - setprop("/MCDU[" ~ i ~ "]/page", "LATREV"); + pageNode[i].setValue("LATREV"); } - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DIRTO") { + } else if (page == "DIRTO") { canvas_mcdu.myDirTo[i].fieldL6(); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "CLOSESTAIRPORT") { + } else if (page == "CLOSESTAIRPORT") { canvas_mcdu.myClosestAirport[i].freeze(); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "AOCMENU" or getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU" or getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU2") { - setprop("/MCDU[" ~ i ~ "]/page", "ATSUDLINK"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "NOTIFICATION" or getprop("/MCDU[" ~ i ~ "]/page") == "CONNECTSTATUS") { - setprop("/MCDU[" ~ i ~ "]/page", "ATCMENU"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WEATHERREQ" or getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") { - setprop("/MCDU[" ~ i ~ "]/page", "AOCMENU"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSG") { - setprop("/MCDU[" ~ i ~ "]/page", "RECEIVEDMSGS"); + } else if (page == "AOCMENU" or page == "ATCMENU" or page == "ATCMENU2") { + pageNode[i].setValue("ATSUDLINK"); + } else if (page == "NOTIFICATION" or page == "CONNECTSTATUS") { + pageNode[i].setValue("ATCMENU"); + } else if (page == "WEATHERREQ" or page == "RECEIVEDMSGS") { + pageNode[i].setValue("AOCMENU"); + } else if (page == "RECEIVEDMSG") { + pageNode[i].setValue("RECEIVEDMSGS"); canvas_mcdu.myReceivedMessages[i].update(); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "COMMMENU") { - setprop("/MCDU[" ~ i ~ "]/page", "ATSUDLINK"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "COMMINIT" or getprop("/MCDU[" ~ i ~ "]/page") == "VOICEDIRECTORY" or getprop("/MCDU[" ~ i ~ "]/page") == "DATAMODE" or getprop("/MCDU[" ~ i ~ "]/page") == "COMMSTATUS" or getprop("/MCDU[" ~ i ~ "]/page") == "COMPANYCALL") { - setprop("/MCDU[" ~ i ~ "]/page", "COMMMENU"); + } else if (page == "COMMMENU") { + pageNode[i].setValue("ATSUDLINK"); + } else if (page == "COMMINIT" or page == "VOICEDIRECTORY" or page == "DATAMODE" or page == "COMMSTATUS" or page == "COMPANYCALL") { + pageNode[i].setValue("COMMMENU"); } else { mcdu_message(i, "NOT ALLOWED"); } @@ -582,33 +586,34 @@ var lskbutton = func(btn, i) { } var rskbutton = func(btn, i) { + page = pageNode[i].getValue(); if (btn == "1") { - if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") { + if (page == "INITA") { initInputA("R1",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "IRSINIT") { + } else if (page == "IRSINIT") { initInputIRS("R1",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB") { + } else if (page == "INITB") { initInputB("R1",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { + } else if (page == "WINDCLB") { if (fmgc.FMGCInternal.phase == 0) { if (canvas_mcdu.myHISTWIND[i] == nil) { canvas_mcdu.myHISTWIND[i] = windHISTPage.new(i); } else { canvas_mcdu.myHISTWIND[i].reload(); } - setprop("MCDU[" ~ i ~ "]/page", "WINDHIST"); + pageNode[i].setValue("WINDHIST"); } else { mcdu_message(i, "NOT ALLOWED"); } - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") { + } else if (page == "WINDDES") { canvas_mcdu.myDESWIND[i].pushButtonRight(1); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RADNAV") { + } else if (page == "RADNAV") { radnavInput("R1",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC") { + } else if (page == "PRINTFUNC") { printInput("R1",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") { + } else if (page == "PRINTFUNC2") { printInput2("R1",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "LATREV") { + } else if (page == "LATREV") { if (canvas_mcdu.myLatRev[i].type == 1) { if (canvas_mcdu.myArrival[i] != nil) { canvas_mcdu.myArrival[i].del(); @@ -616,34 +621,34 @@ var rskbutton = func(btn, i) { canvas_mcdu.myArrival[i] = nil; canvas_mcdu.myArrival[i] = arrivalPage.new(canvas_mcdu.myLatRev[i].title[2], i); canvas_mcdu.myArrival[i]._setupPageWithData(); - setprop("/MCDU[" ~ i ~ "]/page", "ARRIVAL"); + pageNode[i].setValue("ARRIVAL"); } else { mcdu_message(i, "NOT ALLOWED"); } - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") { + } else if (page == "F-PLNA" or page == "F-PLNB") { canvas_mcdu.myFpln[i].pushButtonRight(1); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DATA2") { + } else if (page == "DATA2") { if (fmgc.WaypointDatabase.getCount() > 0) { if (canvas_mcdu.myPilotWP[i] != nil) { canvas_mcdu.myPilotWP[i].del(); } canvas_mcdu.myPilotWP[i] = nil; canvas_mcdu.myPilotWP[i] = pilotWaypointPage.new(i); - setprop("/MCDU[" ~ i ~ "]/page", "PILOTWP"); + pageNode[i].setValue("PILOTWP"); } else { mcdu_message(i, "NOT ALLOWED"); # todo spawn new waypoints page } - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "COMMMENU") { - setprop("/MCDU[" ~ i ~ "]/page", "COMMSTATUS"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "COMPANYCALL") { + } else if (page == "COMMMENU") { + pageNode[i].setValue("COMMSTATUS"); + } else if (page == "COMPANYCALL") { if (atsu.CompanyCall.frequency != 999.99) { atsu.CompanyCall.ack(); } else { mcdu_message(i, "NOT ALLOWED"); } - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATSUDLINK") { - setprop("/MCDU[" ~ i ~ "]/page", "AOCMENU"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WEATHERREQ") { + } else if (page == "ATSUDLINK") { + pageNode[i].setValue("AOCMENU"); + } else if (page == "WEATHERREQ") { var result = atsu.AOC.newStation(mcdu_scratchpad.scratchpads[i].scratchpad, i); if (result == 1) { mcdu_message(i, "NOT ALLOWED"); @@ -652,93 +657,93 @@ var rskbutton = func(btn, i) { } else { mcdu_scratchpad.scratchpads[i].empty(); } - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WEATHERTYPE") { + } else if (page == "WEATHERTYPE") { atsu.AOC.selectedType = "TERM FCST"; - setprop("/MCDU[" ~ i ~ "]/page", "WEATHERREQ"); + pageNode[i].setValue("WEATHERREQ"); } else { mcdu_message(i, "NOT ALLOWED"); } } else if (btn == "2") { - if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") { + if (page == "INITA") { initInputA("R2",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB") { + } else if (page == "INITB") { initInputB("R2",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") { + } else if (page == "PERFAPPR") { perfAPPRInput("R2",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RADNAV") { + } else if (page == "RADNAV") { radnavInput("R2",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC") { + } else if (page == "PRINTFUNC") { printInput("R2",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") { + } else if (page == "PRINTFUNC2") { printInput2("R2",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DEPARTURE") { + } else if (page == "DEPARTURE") { canvas_mcdu.myDeparture[i].depPushbuttonRight(2); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ARRIVAL") { + } else if (page == "ARRIVAL") { canvas_mcdu.myArrival[i].arrPushbuttonRight(2); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") { + } else if (page == "F-PLNA" or page == "F-PLNB") { canvas_mcdu.myFpln[i].pushButtonRight(2); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "NOTIFICATION") { + } else if (page == "NOTIFICATION") { var result = atsu.notificationSystem.notify(); if (result == 1) { mcdu_message(i, "NOT ALLOWED"); } - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "COMMMENU") { - setprop("/MCDU[" ~ i ~ "]/page", "COMPANYCALL"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "AOCMENU") { - setprop("/MCDU[" ~ i ~ "]/page", "WEATHERREQ"); + } else if (page == "COMMMENU") { + pageNode[i].setValue("COMPANYCALL"); + } else if (page == "AOCMENU") { + pageNode[i].setValue("WEATHERREQ"); } else { mcdu_message(i, "NOT ALLOWED"); } } else if (btn == "3") { - if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") { + if (page == "INITA") { initInputA("R3",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB") { + } else if (page == "INITB") { initInputB("R3",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "FUELPRED") { + } else if (page == "FUELPRED") { fuelPredInput("R3",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") { + } else if (page == "PERFTO") { perfTOInput("R3",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") { + } else if (page == "PERFAPPR") { perfAPPRInput("R3",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC") { + } else if (page == "PRINTFUNC") { printInput("R3",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") { + } else if (page == "PRINTFUNC2") { printInput2("R3",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DEPARTURE") { + } else if (page == "DEPARTURE") { canvas_mcdu.myDeparture[i].depPushbuttonRight(3); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ARRIVAL") { + } else if (page == "ARRIVAL") { canvas_mcdu.myArrival[i].arrPushbuttonRight(3); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "LATREV") { + } else if (page == "LATREV") { if (canvas_mcdu.myLatRev[i].type != 2) { canvas_mcdu.myLatRev[i].nextWpt(); } else { mcdu_message(i, "NOT ALLOWED"); } - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") { + } else if (page == "F-PLNA" or page == "F-PLNB") { canvas_mcdu.myFpln[i].pushButtonRight(3); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "AOCMENU") { + } else if (page == "AOCMENU") { if (canvas_mcdu.myReceivedMessages[i] != nil) { canvas_mcdu.myReceivedMessages[i].del(); } canvas_mcdu.myReceivedMessages[i] = nil; canvas_mcdu.myReceivedMessages[i] = receivedMessagesPage.new(i); - setprop("/MCDU[" ~ i ~ "]/page", "RECEIVEDMSGS"); + pageNode[i].setValue("RECEIVEDMSGS"); } else { mcdu_message(i, "NOT ALLOWED"); } } else if (btn == "4") { - if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") { + if (page == "INITA") { initInputA("R4",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "FUELPRED") { + } else if (page == "FUELPRED") { fuelPredInput("R4",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") { + } else if (page == "WINDCRZ") { if (canvas_mcdu.myCLBWIND[i] == nil) { canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i); } else { canvas_mcdu.myCLBWIND[i].reload(); } - setprop("MCDU[" ~ i ~ "]/page", "WINDCLB"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") { + pageNode[i].setValue("WINDCLB"); + } else if (page == "WINDDES") { if (fmgc.flightPlanController.temporaryFlag[i]) { if (fmgc.FMGCInternal.toFromSet and size(fmgc.windController.nav_indicies[i]) > 0) { if (canvas_mcdu.myCRZWIND[i] != nil) { @@ -768,30 +773,30 @@ var rskbutton = func(btn, i) { } } } - setprop("MCDU[" ~ i ~ "]/page", "WINDCRZ"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") { + pageNode[i].setValue("WINDCRZ"); + } else if (page == "PERFTO") { perfTOInput("R4",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") { + } else if (page == "PERFAPPR") { perfAPPRInput("R4",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RADNAV") { + } else if (page == "RADNAV") { radnavInput("R4",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") { + } else if (page == "PRINTFUNC2") { printInput2("R4",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DEPARTURE") { + } else if (page == "DEPARTURE") { canvas_mcdu.myDeparture[i].depPushbuttonRight(4); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ARRIVAL") { + } else if (page == "ARRIVAL") { canvas_mcdu.myArrival[i].arrPushbuttonRight(4); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") { + } else if (page == "F-PLNA" or page == "F-PLNB") { canvas_mcdu.myFpln[i].pushButtonRight(4); } else { mcdu_message(i, "NOT ALLOWED"); } } else if (btn == "5") { - if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") { + if (page == "INITA") { initInputA("R5",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB") { + } else if (page == "INITB") { initInputB("R5",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { + } else if (page == "WINDCLB") { if (fmgc.flightPlanController.temporaryFlag[i]) { if (fmgc.FMGCInternal.toFromSet and size(fmgc.windController.nav_indicies[i]) > 0) { if (canvas_mcdu.myCRZWIND[i] != nil) { @@ -821,46 +826,46 @@ var rskbutton = func(btn, i) { } } } - setprop("MCDU[" ~ i ~ "]/page", "WINDCRZ"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") { + pageNode[i].setValue("WINDCRZ"); + } else if (page == "WINDCRZ") { if (canvas_mcdu.myDESWIND[i] == nil) { canvas_mcdu.myDESWIND[i] = windDESPage.new(i, ""); } else { canvas_mcdu.myDESWIND[i].reload(); } - setprop("MCDU[" ~ i ~ "]/page", "WINDDES"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "STATUS") { + pageNode[i].setValue("WINDDES"); + } else if (page == "STATUS") { statusInput("R5",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") { + } else if (page == "PERFTO") { perfTOInput("R5",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") { + } else if (page == "PERFAPPR") { perfAPPRInput("R5",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFGA") { + } else if (page == "PERFGA") { perfGAInput("R5",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RADNAV") { + } else if (page == "RADNAV") { radnavInput("R5",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DATA") { + } else if (page == "DATA") { dataInput("R5",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DEPARTURE") { + } else if (page == "DEPARTURE") { canvas_mcdu.myDeparture[i].depPushbuttonRight(5); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ARRIVAL") { + } else if (page == "ARRIVAL") { canvas_mcdu.myArrival[i].arrPushbuttonRight(5); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") { + } else if (page == "F-PLNA" or page == "F-PLNB") { canvas_mcdu.myFpln[i].pushButtonRight(5); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "LATREV") { + } else if (page == "LATREV") { if (canvas_mcdu.myLatRev[i].type == 3) { if (canvas_mcdu.myAirways[i] != nil) { canvas_mcdu.myAirways[i].del(); } canvas_mcdu.myAirways[i] = nil; canvas_mcdu.myAirways[i] = airwaysPage.new(i, canvas_mcdu.myLatRev[i].wpt); - setprop("/MCDU[" ~ i ~ "]/page", "AIRWAYS"); + pageNode[i].setValue("AIRWAYS"); } else { mcdu_message(i, "NOT ALLOWED"); } - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU") { - setprop("/MCDU[" ~ i ~ "]/page", "CONNECTSTATUS"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WEATHERREQ") { + } else if (page == "ATCMENU") { + pageNode[i].setValue("CONNECTSTATUS"); + } else if (page == "WEATHERREQ") { var result = atsu.AOC.sendReq(i); if (result == 1) { mcdu_message(i, "NOT ALLOWED"); @@ -871,7 +876,7 @@ var rskbutton = func(btn, i) { } else { mcdu_scratchpad.scratchpads[i].empty(); } - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "VOICEDIRECTORY") { + } else if (page == "VOICEDIRECTORY") { for (var i = 0; i < 3; i = i + 1) { if (getprop("/systems/radio/rmp[" ~ i ~ "]/sel_chan") == "vhf3") { rmp.transfer(i + 1); @@ -881,39 +886,39 @@ var rskbutton = func(btn, i) { mcdu_message(i, "NOT ALLOWED"); } } else if (btn == "6") { - if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") { + if (page == "INITA") { initInputA("R6",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "IRSINIT") { + } else if (page == "IRSINIT") { initInputIRS("R6",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { + } else if (page == "WINDCLB") { canvas_mcdu.myCLBWIND[i].pushButtonRight(6); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") { + } else if (page == "WINDCRZ") { canvas_mcdu.myCRZWIND[i].pushButtonRight(6); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") { + } else if (page == "WINDDES") { canvas_mcdu.myDESWIND[i].pushButtonRight(6); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDHIST") { + } else if (page == "WINDHIST") { canvas_mcdu.myHISTWIND[i].pushButtonRight(6); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") { + } else if (page == "PERFTO") { perfTOInput("R6",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFCLB") { + } else if (page == "PERFCLB") { perfCLBInput("R6",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFCRZ") { + } else if (page == "PERFCRZ") { perfCRZInput("R6",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFDES") { + } else if (page == "PERFDES") { perfDESInput("R6",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") { + } else if (page == "PERFAPPR") { perfAPPRInput("R6",i); - } else if ((getprop("/MCDU[" ~ i ~ "]/page") == "DATA") or (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC") or (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC2")) { + } else if ((page == "DATA") or (page == "PRINTFUNC") or (page == "PRINTFUNC2")) { mcdu_message(i, "AOC DISABLED"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") { + } else if (page == "INITA") { initInputA("R6",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") { + } else if (page == "F-PLNA" or page == "F-PLNB") { canvas_mcdu.myFpln[i].pushButtonRight(6); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "VERTREV") { - setprop("/MCDU[" ~ i ~ "]/page", "F-PLNA"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DIRTO") { + } else if (page == "VERTREV") { + pageNode[i].setValue("F-PLNA"); + } else if (page == "DIRTO") { canvas_mcdu.myDirTo[i].fieldR6(); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PILOTWP") { + } else if (page == "PILOTWP") { if (canvas_mcdu.myPilotWP[i] != nil) { if (fmgc.WaypointDatabase.confirm[i]) { fmgc.WaypointDatabase.confirm[i] = 0; @@ -923,12 +928,12 @@ var rskbutton = func(btn, i) { canvas_mcdu.myPilotWP[i].deleteCmd(); } } - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "NOTIFICATION") { - setprop("/MCDU[" ~ i ~ "]/page", "CONNECTSTATUS"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATSUDLINK") { - setprop("/MCDU[" ~ i ~ "]/page", "COMMMENU"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "CONNECTSTATUS") { - setprop("/MCDU[" ~ i ~ "]/page", "NOTIFICATION"); + } else if (page == "NOTIFICATION") { + pageNode[i].setValue("CONNECTSTATUS"); + } else if (page == "ATSUDLINK") { + pageNode[i].setValue("COMMMENU"); + } else if (page == "CONNECTSTATUS") { + pageNode[i].setValue("NOTIFICATION"); } else { mcdu_message(i, "NOT ALLOWED"); } @@ -936,129 +941,131 @@ var rskbutton = func(btn, i) { } var arrowbutton = func(btn, i) { + page = pageNode[i].getValue(); if (btn == "left") { - if (getprop("/MCDU[" ~ i ~ "]/page") == "DATA") { - setprop("/MCDU[" ~ i ~ "]/page", "DATA2"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DATA2") { - setprop("/MCDU[" ~ i ~ "]/page", "DATA"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") { - if (getprop("engines/engine[0]/state") != 3 and getprop("engines/engine[1]/state") != 3) { - setprop("/MCDU[" ~ i ~ "]/page", "INITB"); + if (page == "DATA") { + pageNode[i].setValue("DATA2"); + } else if (page == "DATA2") { + pageNode[i].setValue("DATA"); + } else if (page == "INITA") { + if (pts.Engines.Engine.state[0].getValue() != 3 and pts.Engines.Engine.state[1].getValue() != 3) { + pageNode[i].setValue("INITB"); } else { - setprop("/MCDU[" ~ i ~ "]/page", "FUELPRED"); + pageNode[i].setValue("FUELPRED"); } - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB" or getprop("/MCDU[" ~ i ~ "]/page") == "FUELPRED") { - setprop("/MCDU[" ~ i ~ "]/page", "INITA"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC") { - setprop("/MCDU[" ~ i ~ "]/page", "PRINTFUNC2"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") { - setprop("/MCDU[" ~ i ~ "]/page", "PRINTFUNC"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DEPARTURE") { + } else if (page == "INITB" or page == "FUELPRED") { + pageNode[i].setValue("INITA"); + } else if (page == "PRINTFUNC") { + pageNode[i].setValue("PRINTFUNC2"); + } else if (page == "PRINTFUNC2") { + pageNode[i].setValue("PRINTFUNC"); + } else if (page == "DEPARTURE") { canvas_mcdu.myDeparture[i].scrollLeft(); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ARRIVAL") { + } else if (page == "ARRIVAL") { canvas_mcdu.myArrival[i].scrollLeft(); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PILOTWP") { + } else if (page == "PILOTWP") { canvas_mcdu.myPilotWP[i].scrollLeft(); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") { + } else if (page == "RECEIVEDMSGS") { canvas_mcdu.myReceivedMessages[i].scrollLeft(); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSG") { + } else if (page == "RECEIVEDMSG") { canvas_mcdu.myReceivedMessage[i].scrollLeft(); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU") { - setprop("/MCDU[" ~ i ~ "]/page", "ATCMENU2"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU2") { - setprop("/MCDU[" ~ i ~ "]/page", "ATCMENU"); + } else if (page == "ATCMENU") { + pageNode[i].setValue("ATCMENU2"); + } else if (page == "ATCMENU2") { + pageNode[i].setValue("ATCMENU"); } } else if (btn == "right") { - if (getprop("/MCDU[" ~ i ~ "]/page") == "DATA") { - setprop("/MCDU[" ~ i ~ "]/page", "DATA2"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DATA2") { - setprop("/MCDU[" ~ i ~ "]/page", "DATA"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") { - if (getprop("engines/engine[0]/state") != 3 and getprop("engines/engine[1]/state") != 3) { - setprop("/MCDU[" ~ i ~ "]/page", "INITB"); + if (page == "DATA") { + pageNode[i].setValue("DATA2"); + } else if (page == "DATA2") { + pageNode[i].setValue("DATA"); + } else if (page == "INITA") { + if (pts.Engines.Engine.state[0].getValue() != 3 and pts.Engines.Engine.state[1].getValue() != 3) { + pageNode[i].setValue("INITB"); } else { - setprop("/MCDU[" ~ i ~ "]/page", "FUELPRED"); + pageNode[i].setValue("FUELPRED"); } - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB" or getprop("/MCDU[" ~ i ~ "]/page") == "FUELPRED") { - setprop("/MCDU[" ~ i ~ "]/page", "INITA"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC") { - setprop("/MCDU[" ~ i ~ "]/page", "PRINTFUNC2"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") { - setprop("/MCDU[" ~ i ~ "]/page", "PRINTFUNC"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DEPARTURE") { + } else if (page == "INITB" or page == "FUELPRED") { + pageNode[i].setValue("INITA"); + } else if (page == "PRINTFUNC") { + pageNode[i].setValue("PRINTFUNC2"); + } else if (page == "PRINTFUNC2") { + pageNode[i].setValue("PRINTFUNC"); + } else if (page == "DEPARTURE") { canvas_mcdu.myDeparture[i].scrollRight(); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ARRIVAL") { + } else if (page == "ARRIVAL") { canvas_mcdu.myArrival[i].scrollRight(); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PILOTWP") { + } else if (page == "PILOTWP") { canvas_mcdu.myPilotWP[i].scrollRight(); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") { + } else if (page == "RECEIVEDMSGS") { canvas_mcdu.myReceivedMessages[i].scrollRight(); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSG") { + } else if (page == "RECEIVEDMSG") { canvas_mcdu.myReceivedMessage[i].scrollRight(); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU") { - setprop("/MCDU[" ~ i ~ "]/page", "ATCMENU2"); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU2") { - setprop("/MCDU[" ~ i ~ "]/page", "ATCMENU"); + } else if (page == "ATCMENU") { + pageNode[i].setValue("ATCMENU2"); + } else if (page == "ATCMENU2") { + pageNode[i].setValue("ATCMENU"); } } else if (btn == "up") { - if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") { + if (page == "F-PLNA" or page == "F-PLNB") { canvas_mcdu.myFpln[i].scrollUp(); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DEPARTURE") { + } else if (page == "DEPARTURE") { canvas_mcdu.myDeparture[i].scrollUp(); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ARRIVAL") { + } else if (page == "ARRIVAL") { canvas_mcdu.myArrival[i].scrollUp(); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DIRTO") { + } else if (page == "DIRTO") { canvas_mcdu.myDirTo[i].scrollUp(); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "IRSINIT") { + } else if (page == "IRSINIT") { initInputIRS("up",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") { + } else if (page == "WINDCRZ") { canvas_mcdu.myCRZWIND[i].pushButtonUp(); } } else if (btn == "down") { - if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") { + if (page == "F-PLNA" or page == "F-PLNB") { canvas_mcdu.myFpln[i].scrollDn(); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DEPARTURE") { + } else if (page == "DEPARTURE") { canvas_mcdu.myDeparture[i].scrollDn(); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ARRIVAL") { + } else if (page == "ARRIVAL") { canvas_mcdu.myArrival[i].scrollDn(); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DIRTO") { + } else if (page == "DIRTO") { canvas_mcdu.myDirTo[i].scrollDn(); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "IRSINIT") { + } else if (page == "IRSINIT") { initInputIRS("down",i); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") { + } else if (page == "WINDCRZ") { canvas_mcdu.myCRZWIND[i].pushButtonDown(); } } } var pagebutton = func(btn, i) { + page = pageNode[i].getValue(); setprop("/MCDU[" ~ i ~ "]/scratchpad-color", "wht"); - if (getprop("/MCDU[" ~ i ~ "]/page") != "MCDU") { + if (page != "MCDU") { if (btn == "radnav") { - setprop("/MCDU[" ~ i ~ "]/page", "RADNAV"); + pageNode[i].setValue("RADNAV"); } else if (btn == "prog") { if (fmgc.FMGCInternal.phase == 0 or fmgc.FMGCInternal.phase == 1) { - setprop("MCDU[" ~ i ~ "]/page", "PROGTO"); + pageNode[i].setValue("PROGTO"); } else if (fmgc.FMGCInternal.phase == 2) { - setprop("MCDU[" ~ i ~ "]/page", "PROGCLB"); + pageNode[i].setValue("PROGCLB"); } else if (fmgc.FMGCInternal.phase == 3) { - setprop("MCDU[" ~ i ~ "]/page", "PROGCRZ"); + pageNode[i].setValue("PROGCRZ"); } else if (fmgc.FMGCInternal.phase == 4 or fmgc.FMGCInternal.phase == 5 or fmgc.FMGCInternal.phase == 6) { - setprop("MCDU[" ~ i ~ "]/page", "PROGDES"); + pageNode[i].setValue("PROGDES"); } } else if (btn == "perf") { if (fmgc.FMGCInternal.phase == 0 or fmgc.FMGCInternal.phase == 1) { - setprop("MCDU[" ~ i ~ "]/page", "PERFTO"); + pageNode[i].setValue("PERFTO"); } else if (fmgc.FMGCInternal.phase == 2) { - setprop("MCDU[" ~ i ~ "]/page", "PERFCLB"); + pageNode[i].setValue("PERFCLB"); } else if (fmgc.FMGCInternal.phase == 3) { - setprop("MCDU[" ~ i ~ "]/page", "PERFCRZ"); + pageNode[i].setValue("PERFCRZ"); } else if (fmgc.FMGCInternal.phase == 4) { - setprop("MCDU[" ~ i ~ "]/page", "PERFDES"); + pageNode[i].setValue("PERFDES"); } else if (fmgc.FMGCInternal.phase == 5) { - setprop("MCDU[" ~ i ~ "]/page", "PERFAPPR"); + pageNode[i].setValue("PERFAPPR"); } else if (fmgc.FMGCInternal.phase == 6) { - setprop("MCDU[" ~ i ~ "]/page", "PERFGA"); + pageNode[i].setValue("PERFGA"); } else if (fmgc.FMGCInternal.phase == 7) { fmgc.reset_FMGC(); } @@ -1066,18 +1073,18 @@ var pagebutton = func(btn, i) { if (fmgc.FMGCInternal.phase == 7) { fmgc.reset_FMGC(); } - setprop("/MCDU[" ~ i ~ "]/page", "INITA"); + pageNode[i].setValue("INITA"); } else if (btn == "data") { - setprop("/MCDU[" ~ i ~ "]/page", "DATA"); + pageNode[i].setValue("DATA"); } else if (btn == "mcdu") { - var page = getprop("/MCDU[" ~ i ~ "]/page"); + var page = page; if (page != "ATSUDLINK" and page != "AOCMENU" and page != "WEATHERREQ" and page != "WEATHERTYPE" and page != "RECEIVEDMSGS" and page != "RECEIVEDMSG" and page != "ATCMENU" and page != "ATCMENU2" and page != "NOTIFICATION" and page != "CONNECTSTATUS" and page != "COMPANYCALL" and page != "VOICEDIRECTORY" and page != "DATAMODE" and page != "COMMMENU" and page != "COMMSTATUS" and page != "COMMINIT") { - setprop("/MCDU[" ~ i ~ "]/last-fmgc-page", getprop("/MCDU[" ~ i ~ "]/page")); + setprop("/MCDU[" ~ i ~ "]/last-fmgc-page", page); } else { - setprop("/MCDU[" ~ i ~ "]/last-atsu-page", getprop("/MCDU[" ~ i ~ "]/page")); + setprop("/MCDU[" ~ i ~ "]/last-atsu-page", page); } mcdu_message(i, "SELECT DESIRED SYSTEM"); - setprop("/MCDU[" ~ i ~ "]/page", "MCDU"); + pageNode[i].setValue("MCDU"); } else if (btn == "f-pln" or btn == "airport") { if (canvas_mcdu.myFpln[i] == nil) { canvas_mcdu.myFpln[i] = fplnPage.new(2, i); @@ -1095,10 +1102,10 @@ var pagebutton = func(btn, i) { } else { canvas_mcdu.myFpln[i].scroll = 0; } - setprop("/MCDU[" ~ i ~ "]/page", "F-PLNA"); + pageNode[i].setValue("F-PLNA"); } else if (btn == "fuel-pred") { - setprop("/MCDU[" ~ i ~ "]/page", "FUELPRED"); + pageNode[i].setValue("FUELPRED"); } else if (btn == "dirto") { if (fmgc.flightPlanController.temporaryFlag[i] and !dirToFlag) { mcdu_message(i, "INSERT/ERASE TMPY FIRST"); @@ -1106,25 +1113,26 @@ var pagebutton = func(btn, i) { } elsif (canvas_mcdu.myDirTo[i] == nil) { canvas_mcdu.myDirTo[i] = dirTo.new(i); } - setprop("/MCDU[" ~ i ~ "]/page", "DIRTO"); + pageNode[i].setValue("DIRTO"); } else if (btn == "atc") { if (getprop("/MCDU[" ~ i ~ "]/atsu-active") != 2) { mcdu_message(i, "WAIT FOR SYSTEM RESPONSE"); setprop("/MCDU[" ~ i ~ "]/atsu-active", 1); settimer(func(){ - setprop("/MCDU[" ~ i ~ "]/page", "ATCMENU"); + pageNode[i].setValue("ATCMENU"); mcdu_scratchpad.scratchpads[i].empty(); setprop("/MCDU[" ~ i ~ "]/atsu-active", 2); }, 2); } else { - setprop("/MCDU[" ~ i ~ "]/page", "ATCMENU"); + pageNode[i].setValue("ATCMENU"); } } } } var button = func(btn, i) { - if (getprop("/MCDU[" ~ i ~ "]/page") != "MCDU") { + page = pageNode[i].getValue(); + if (page != "MCDU") { var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; if (btn == "SLASH") { mcdu_scratchpad.scratchpads[i].addChar("/"); @@ -1153,9 +1161,9 @@ var mcdu_message = func(i, string, overrideStr = "") { } var screenFlash = func(time, i) { - var page = getprop("/MCDU[" ~ i ~ "]/page"); - setprop("/MCDU[" ~ i ~ "]/page", "NONE"); + page = pageNode[i].getValue(); + pageNode[i].setValue("NONE"); settimer(func { - setprop("/MCDU[" ~ i ~ "]/page", page); + pageNode[i].setValue(page); }, time); } \ No newline at end of file diff --git a/Nasal/MCDU/WINDCLB.nas b/Nasal/MCDU/WINDCLB.nas index a3b574dc..ac1eb6a1 100644 --- a/Nasal/MCDU/WINDCLB.nas +++ b/Nasal/MCDU/WINDCLB.nas @@ -178,9 +178,9 @@ var windCLBPage = { } else { fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 0); # push update to fuel - if (getprop("/FMGC/internal/block-confirmed")) { - setprop("/FMGC/internal/fuel-calculating", 0); - setprop("/FMGC/internal/fuel-calculating", 1); + if (fmgc.FMGCInternal.blockConfirmed) { + fmgc.FMGCInternal.fuelCalculating = 0; + fmgc.FMGCInternal.fuelCalculating = 1; } } me.reload(); @@ -316,9 +316,9 @@ var windCLBPage = { } else { fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 1); # push update to fuel - if (getprop("/FMGC/internal/block-confirmed")) { - setprop("/FMGC/internal/fuel-calculating", 0); - setprop("/FMGC/internal/fuel-calculating", 1); + if (fmgc.FMGCInternal.blockConfirmed) { + fmgc.FMGCInternal.fuelCalculating = 0; + fmgc.FMGCInternal.fuelCalculating = 1; } } me.reload(); diff --git a/Nasal/MCDU/WINDCRZ.nas b/Nasal/MCDU/WINDCRZ.nas index f33366c8..9fa99331 100644 --- a/Nasal/MCDU/WINDCRZ.nas +++ b/Nasal/MCDU/WINDCRZ.nas @@ -269,9 +269,9 @@ var windCRZPage = { } else { fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 0); # push update to fuel - if (getprop("/FMGC/internal/block-confirmed")) { - setprop("/FMGC/internal/fuel-calculating", 0); - setprop("/FMGC/internal/fuel-calculating", 1); + if (fmgc.FMGCInternal.blockConfirmed) { + fmgc.FMGCInternal.fuelCalculating = 0; + fmgc.FMGCInternal.fuelCalculating = 1; } } me.reload(); @@ -504,9 +504,9 @@ var windCRZPage = { } else { fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 1); # push update to fuel - if (getprop("/FMGC/internal/block-confirmed")) { - setprop("/FMGC/internal/fuel-calculating", 0); - setprop("/FMGC/internal/fuel-calculating", 1); + if (fmgc.FMGCInternal.blockConfirmed) { + fmgc.FMGCInternal.fuelCalculating = 0; + fmgc.FMGCInternal.fuelCalculating = 1; } } me.reload(); diff --git a/Nasal/MCDU/WINDDES.nas b/Nasal/MCDU/WINDDES.nas index 3ae5f763..980156b7 100644 --- a/Nasal/MCDU/WINDDES.nas +++ b/Nasal/MCDU/WINDDES.nas @@ -2,6 +2,9 @@ # Copyright (c) 2020 Matthew Maring (mattmaring) +var wind = nil; +var magVar = nil; + var windDESPage = { title: nil, titleColour: "wht", @@ -188,17 +191,18 @@ var windDESPage = { me.updateTmpy(); }, returnGRND: func() { - var wind = fmgc.windController.des_winds[2]; + wind = fmgc.windController.des_winds[2]; + magVar = pts.Environment.magVar.getValue(); if (wind.wind5.altitude == "GRND") { - return [geo.normdeg(wind.wind5.heading - getprop("/environment/magnetic-variation-deg")), wind.wind5.magnitude]; + return [geo.normdeg(wind.wind5.heading - magVar), wind.wind5.magnitude]; } else if (wind.wind4.altitude == "GRND") { - return [geo.normdeg(wind.wind4.heading - getprop("/environment/magnetic-variation-deg")), wind.wind4.magnitude]; + return [geo.normdeg(wind.wind4.heading - magVar), wind.wind4.magnitude]; } else if (wind.wind3.altitude == "GRND") { - return [geo.normdeg(wind.wind3.heading - getprop("/environment/magnetic-variation-deg")), wind.wind3.magnitude]; + return [geo.normdeg(wind.wind3.heading - magVar), wind.wind3.magnitude]; } else if (wind.wind2.altitude == "GRND") { - return [geo.normdeg(wind.wind2.heading - getprop("/environment/magnetic-variation-deg")), wind.wind2.magnitude]; + return [geo.normdeg(wind.wind2.heading - magVar), wind.wind2.magnitude]; } else if (wind.wind1.altitude == "GRND") { - return [geo.normdeg(wind.wind1.heading - getprop("/environment/magnetic-variation-deg")), wind.wind1.magnitude]; + return [geo.normdeg(wind.wind1.heading - magVar), wind.wind1.magnitude]; } else { return nil; } @@ -210,9 +214,9 @@ var windDESPage = { } else { fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 0); # push update to fuel - if (getprop("/FMGC/internal/block-confirmed")) { - setprop("/FMGC/internal/fuel-calculating", 0); - setprop("/FMGC/internal/fuel-calculating", 1); + if (fmgc.FMGCInternal.blockConfirmed) { + fmgc.FMGCInternal.fuelCalculating = 0; + fmgc.FMGCInternal.fuelCalculating = 1; } } me.reload(); @@ -382,9 +386,9 @@ var windDESPage = { } else { fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 1); # push update to fuel - if (getprop("/FMGC/internal/block-confirmed")) { - setprop("/FMGC/internal/fuel-calculating", 0); - setprop("/FMGC/internal/fuel-calculating", 1); + if (fmgc.FMGCInternal.blockConfirmed) { + fmgc.FMGCInternal.fuelCalculating = 0; + fmgc.FMGCInternal.fuelCalculating = 1; } } me.reload(); diff --git a/Nasal/Systems/FADEC/engines-cfm.nas b/Nasal/Systems/FADEC/engines-cfm.nas index e8749cbd..83a13e1f 100644 --- a/Nasal/Systems/FADEC/engines-cfm.nas +++ b/Nasal/Systems/FADEC/engines-cfm.nas @@ -199,7 +199,7 @@ var auto_start_one = func { } var eng_one_auto_start = maketimer(0.5, func { - if (getprop("/engines/engine[0]/n2-actual") >= 22) { + if (pts.Engines.Engine.n2Actual[0].getValue() >= 22) { eng_one_auto_start.stop(); setprop("/engines/engine[0]/state", 2); setprop("/controls/engines/engine[0]/cutoff", 0); @@ -219,7 +219,7 @@ var eng_one_auto_start = maketimer(0.5, func { }); var eng_one_man_start = maketimer(0.5, func { - if (getprop("/engines/engine[0]/n2-actual") >= 16.7) { + if (pts.Engines.Engine.n2Actual[0].getValue() >= 16.7) { eng_one_man_start.stop(); setprop("/engines/engine[0]/state", 2); setprop("/controls/engines/engine[0]/cutoff", 0); @@ -239,7 +239,7 @@ var eng_one_egt_check = maketimer(0.5, func { }); var eng_one_n2_check = maketimer(0.5, func { - if (getprop("/engines/engine[0]/n2-actual") >= 43.0) { + if (pts.Engines.Engine.n2Actual[0].getValue() >= 43.0) { if (getprop("/controls/engines/engine[0]/igniter-a") != 0) { setprop("/controls/engines/engine[0]/igniter-a", 0); } @@ -247,7 +247,7 @@ var eng_one_n2_check = maketimer(0.5, func { setprop("/controls/engines/engine[0]/igniter-b", 0); } } - if (getprop("/engines/engine[0]/n2-actual") >= 57.0) { + if (pts.Engines.Engine.n2Actual[0].getValue() >= 57.0) { eng_one_n2_check.stop(); setprop("/systems/pneumatics/valves/starter-valve-1", 0); setprop("/engines/engine[0]/state", 3); @@ -262,7 +262,7 @@ var auto_start_two = func { } var eng_two_auto_start = maketimer(0.5, func { - if (getprop("/engines/engine[1]/n2-actual") >= 22) { + if (pts.Engines.Engine.n2Actual[1].getValue() >= 22) { eng_two_auto_start.stop(); setprop("/engines/engine[1]/state", 2); setprop("/controls/engines/engine[1]/cutoff", 0); @@ -282,7 +282,7 @@ var eng_two_auto_start = maketimer(0.5, func { }); var eng_two_man_start = maketimer(0.5, func { - if (getprop("/engines/engine[1]/n2-actual") >= 16.7) { + if (pts.Engines.Engine.n2Actual[1].getValue() >= 16.7) { eng_two_man_start.stop(); setprop("/engines/engine[1]/state", 2); setprop("/controls/engines/engine[1]/cutoff", 0); @@ -302,7 +302,7 @@ var eng_two_egt_check = maketimer(0.5, func { }); var eng_two_n2_check = maketimer(0.5, func { - if (getprop("/engines/engine[1]/n2-actual") >= 50.0) { + if (pts.Engines.Engine.n2Actual[1].getValue() >= 50.0) { if (getprop("/controls/engines/engine[1]/igniter-a") != 0) { setprop("/controls/engines/engine[1]/igniter-a", 0); } @@ -310,7 +310,7 @@ var eng_two_n2_check = maketimer(0.5, func { setprop("/controls/engines/engine[1]/igniter-b", 0); } } - if (getprop("/engines/engine[1]/n2-actual") >= 57.0) { + if (pts.Engines.Engine.n2Actual[1].getValue() >= 57.0) { eng_two_n2_check.stop(); setprop("/systems/pneumatics/valves/starter-valve-2", 0); setprop("/engines/engine[1]/state", 3); diff --git a/Nasal/Systems/FADEC/engines-iae.nas b/Nasal/Systems/FADEC/engines-iae.nas index 41c8ccd2..09716355 100644 --- a/Nasal/Systems/FADEC/engines-iae.nas +++ b/Nasal/Systems/FADEC/engines-iae.nas @@ -199,7 +199,7 @@ var auto_start_one = func { } var eng_one_auto_start = maketimer(0.5, func { - if (getprop("/engines/engine[0]/n1-actual") >= 4.7) { + if (pts.Engines.Engine.n1Actual[0].getValue() >= 4.7) { eng_one_auto_start.stop(); setprop("/engines/engine[0]/state", 2); setprop("/controls/engines/engine[0]/cutoff", 0); @@ -219,7 +219,7 @@ var eng_one_auto_start = maketimer(0.5, func { }); var eng_one_man_start = maketimer(0.5, func { - if (getprop("/engines/engine[0]/n2-actual") >= 16.7) { + if (pts.Engines.Engine.n2Actual[0].getValue() >= 16.7) { eng_one_man_start.stop(); setprop("/engines/engine[0]/state", 2); setprop("/controls/engines/engine[0]/cutoff", 0); @@ -239,7 +239,7 @@ var eng_one_egt_check = maketimer(0.5, func { }); var eng_one_n2_check = maketimer(0.5, func { - if (getprop("/engines/engine[0]/n2-actual") >= 43.0) { + if (pts.Engines.Engine.n2Actual[0].getValue() >= 43.0) { if (getprop("/controls/engines/engine[0]/igniter-a") != 0) { setprop("/controls/engines/engine[0]/igniter-a", 0); } @@ -247,7 +247,7 @@ var eng_one_n2_check = maketimer(0.5, func { setprop("/controls/engines/engine[0]/igniter-b", 0); } } - if (getprop("/engines/engine[0]/n2-actual") >= 57.0) { + if (pts.Engines.Engine.n2Actual[0].getValue() >= 57.0) { eng_one_n2_check.stop(); setprop("/systems/pneumatics/valves/starter-valve-1", 0); setprop("/engines/engine[0]/state", 3); @@ -262,7 +262,7 @@ var auto_start_two = func { } var eng_two_auto_start = maketimer(0.5, func { - if (getprop("/engines/engine[1]/n1-actual") >= 4.7) { + if (pts.Engines.Engine.n1Actual[1].getValue() >= 4.7) { eng_two_auto_start.stop(); setprop("/engines/engine[1]/state", 2); setprop("/controls/engines/engine[1]/cutoff", 0); @@ -282,7 +282,7 @@ var eng_two_auto_start = maketimer(0.5, func { }); var eng_two_man_start = maketimer(0.5, func { - if (getprop("/engines/engine[1]/n2-actual") >= 16.7) { + if (pts.Engines.Engine.n2Actual[1].getValue() >= 16.7) { eng_two_man_start.stop(); setprop("/engines/engine[1]/state", 2); setprop("/controls/engines/engine[1]/cutoff", 0); @@ -302,7 +302,7 @@ var eng_two_egt_check = maketimer(0.5, func { }); var eng_two_n2_check = maketimer(0.5, func { - if (getprop("/engines/engine[1]/n2-actual") >= 43.0) { + if (pts.Engines.Engine.n2Actual[1].getValue() >= 43.0) { if (getprop("/controls/engines/engine[1]/igniter-a") != 0) { setprop("/controls/engines/engine[1]/igniter-a", 0); } @@ -310,7 +310,7 @@ var eng_two_n2_check = maketimer(0.5, func { setprop("/controls/engines/engine[1]/igniter-b", 0); } } - if (getprop("/engines/engine[1]/n2-actual") >= 57.0) { + if (pts.Engines.Engine.n2Actual[1].getValue() >= 57.0) { eng_two_n2_check.stop(); setprop("/systems/pneumatics/valves/starter-valve-2", 0); setprop("/engines/engine[1]/state", 3);