From 13609e116bdfb17dd88371562d554b7af127669e Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Sat, 15 Sep 2018 20:11:39 -0400 Subject: [PATCH 1/5] DU: Temporarily roll back problematic code update, IESI: Fix not-initialized variable --- Models/Instruments/IESI/IESI.nas | 2 + Models/Instruments/ND/canvas/ND.nas | 89 ++-- Models/Instruments/PFD/PFD.nas | 639 ++++++++++++---------------- revision.txt | 2 +- 4 files changed, 317 insertions(+), 415 deletions(-) diff --git a/Models/Instruments/IESI/IESI.nas b/Models/Instruments/IESI/IESI.nas index 1cf475d4..bf58e721 100644 --- a/Models/Instruments/IESI/IESI.nas +++ b/Models/Instruments/IESI/IESI.nas @@ -11,6 +11,8 @@ var elapsedtime = 0; var ASI = 0; var alt = 0; var altTens = 0; +var airspeed_act = 0; +var mach_act = 0; # props.nas nodes var iesi_init = props.globals.initNode("/instrumentation/iesi/iesi-init", 0, "BOOL"); diff --git a/Models/Instruments/ND/canvas/ND.nas b/Models/Instruments/ND/canvas/ND.nas index a44e8ab9..2dd1149d 100644 --- a/Models/Instruments/ND/canvas/ND.nas +++ b/Models/Instruments/ND/canvas/ND.nas @@ -15,20 +15,12 @@ var ND_2 = nil; var ND_1_test = nil; var ND_2_test = nil; var elapsedtime = 0; -var du1_test = props.globals.getNode("/instrumentation/du/du1-test", 1); -var du1_test_time = props.globals.getNode("/instrumentation/du/du1-test-time", 1); -var du1_test_amount = props.globals.getNode("/instrumentation/du/du1-test-amount", 1); -var du2_test = props.globals.getNode("/instrumentation/du/du2-test", 1); -var du2_test_time = props.globals.getNode("/instrumentation/du/du2-test-time", 1); -var du2_test_amount = props.globals.getNode("/instrumentation/du/du2-test-amount", 1); -var du5_test = props.globals.getNode("/instrumentation/du/du5-test", 1); -var du5_test_time = props.globals.getNode("/instrumentation/du/du5-test-time", 1); -var du5_test_amount = props.globals.getNode("/instrumentation/du/du5-test-amount", 1); -var du6_test = props.globals.getNode("/instrumentation/du/du6-test", 1); -var du6_test_time = props.globals.getNode("/instrumentation/du/du6-test-time", 1); -var du6_test_amount = props.globals.getNode("/instrumentation/du/du6-test-amount", 1); -var cpt_du_xfr = props.globals.getNode("/modes/cpt-du-xfr"); -var fo_du_xfr = props.globals.getNode("/modes/fo-du-xfr"); +setprop("/instrumentation/du/du2-test", 0); +setprop("/instrumentation/du/du2-test-time", 0); +setprop("/instrumentation/du/du2-test-amount", 0); +setprop("/instrumentation/du/du5-test", 0); +setprop("/instrumentation/du/du5-test-time", 0); +setprop("/instrumentation/du/du5-test-amount", 0); var nd_display = {}; @@ -87,38 +79,38 @@ var canvas_nd_base = { update: func() { elapsedtime = getprop("/sim/time/elapsed-sec"); if (getprop("/systems/electrical/bus/ac-ess-shed") >= 110) { - if (getprop("/systems/acconfig/autoconfig-running") != 1 and du2_test.getValue() != 1) { - du2_test.setValue(1); - du2_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); - du2_test_time.setValue(getprop("/sim/time/elapsed-sec")); - } else if (getprop("/systems/acconfig/autoconfig-running") == 1 and du2_test.getValue() != 1) { - du2_test.setValue(1); - du2_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); - du2_test_time.setValue(getprop("/sim/time/elapsed-sec") - 30); + if (getprop("/systems/acconfig/autoconfig-running") != 1 and getprop("/instrumentation/du/du2-test") != 1) { + setprop("/instrumentation/du/du2-test", 1); + setprop("/instrumentation/du/du2-test-amount", math.round((rand() * 5 ) + 35, 0.1)); + setprop("/instrumentation/du/du2-test-time", getprop("/sim/time/elapsed-sec")); + } else if (getprop("/systems/acconfig/autoconfig-running") == 1 and getprop("/instrumentation/du/du2-test") != 1) { + setprop("/instrumentation/du/du2-test", 1); + setprop("/instrumentation/du/du2-test-amount", math.round((rand() * 5 ) + 35, 0.1)); + setprop("/instrumentation/du/du2-test-time", getprop("/sim/time/elapsed-sec") - 30); } } else { - du2_test.setValue(0); + setprop("/instrumentation/du/du2-test", 0); } if (getprop("/systems/electrical/bus/ac2") >= 110) { - if (getprop("/systems/acconfig/autoconfig-running") != 1 and du5_test.getValue() != 1) { - du5_test.setValue(1); - du5_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); - du5_test_time.setValue(getprop("/sim/time/elapsed-sec")); - } else if (getprop("/systems/acconfig/autoconfig-running") == 1 and du5_test.getValue() != 1) { - du5_test.setValue(1); - du5_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); - du5_test_time.setValue(getprop("/sim/time/elapsed-sec") - 30); + if (getprop("/systems/acconfig/autoconfig-running") != 1 and getprop("/instrumentation/du/du5-test") != 1) { + setprop("/instrumentation/du/du5-test", 1); + setprop("/instrumentation/du/du5-test-amount", math.round((rand() * 5 ) + 35, 0.1)); + setprop("/instrumentation/du/du5-test-time", getprop("/sim/time/elapsed-sec")); + } else if (getprop("/systems/acconfig/autoconfig-running") == 1 and getprop("/instrumentation/du/du5-test") != 1) { + setprop("/instrumentation/du/du5-test", 1); + setprop("/instrumentation/du/du5-test-amount", math.round((rand() * 5 ) + 35, 0.1)); + setprop("/instrumentation/du/du5-test-time", getprop("/sim/time/elapsed-sec") - 30); } } else { - du5_test.setValue(0); + setprop("/instrumentation/du/du5-test", 0); } if (getprop("/systems/electrical/bus/ac-ess-shed") >= 110 and getprop("/controls/lighting/DU/du2") > 0) { - if (du2_test_time.getValue() + du2_test_amount.getValue() >= elapsedtime and cpt_du_xfr.getValue() != 1) { + if (getprop("/instrumentation/du/du2-test-time") + getprop("/instrumentation/du/du2-test-amount") >= elapsedtime and getprop("/modes/cpt-du-xfr") != 1) { ND_1.page.hide(); ND_1_test.page.show(); ND_1_test.update(); - } else if (du1_test_time.getValue() + du1_test_amount.getValue() >= elapsedtime and cpt_du_xfr.getValue() == 1) { + } else if (getprop("/instrumentation/du/du1-test-time") + getprop("/instrumentation/du/du1-test-amount") >= elapsedtime and getprop("/modes/cpt-du-xfr") == 1) { ND_1.page.hide(); ND_1_test.page.show(); ND_1_test.update(); @@ -132,11 +124,11 @@ var canvas_nd_base = { ND_1.page.hide(); } if (getprop("/systems/electrical/bus/ac2") >= 110 and getprop("/controls/lighting/DU/du5") > 0) { - if (du5_test_time.getValue() + du5_test_amount.getValue() >= elapsedtime and fo_du_xfr.getValue() != 1) { + if (getprop("/instrumentation/du/du5-test-time") + getprop("/instrumentation/du/du6-test-amount") >= elapsedtime and getprop("/modes/fo-du-xfr") != 1) { ND_2.page.hide(); ND_2_test.page.show(); ND_2_test.update(); - } else if (du6_test_time.getValue() + du6_test_amount.getValue() >= elapsedtime and fo_du_xfr.getValue() == 1) { + } else if (getprop("/instrumentation/du/du6-test-time") + getprop("/instrumentation/du/du5-test-amount") >= elapsedtime and getprop("/modes/fo-du-xfr") == 1) { ND_2.page.hide(); ND_2_test.page.show(); ND_2_test.update(); @@ -219,12 +211,10 @@ var canvas_ND_1_test = { return ["Test_white","Test_text"]; }, update: func() { - elapsedtime = getprop("/sim/time/elapsed-sec") or 0; - if ((du2_test_time.getValue() + 1 >= elapsedtime) and getprop("/modes/cpt-du-xfr") != 1) { + if (getprop("/instrumentation/du/du2-test-time") + 1 >= elapsedtime and getprop("/modes/cpt-du-xfr") != 1) { me["Test_white"].show(); me["Test_text"].hide(); - } else if ((du1_test_time.getValue() + 1 >= elapsedtime) and getprop("/modes/cpt-du-xfr") != 0) { - print(getprop("/modes/cpt-du-xfr")); + } else if (getprop("/instrumentation/du/du1-test-time") + 1 >= elapsedtime and getprop("/modes/cpt-du-xfr") == 1) { me["Test_white"].show(); me["Test_text"].hide(); } else { @@ -261,11 +251,10 @@ var canvas_ND_2_test = { return ["Test_white","Test_text"]; }, update: func() { - elapsedtime = getprop("/sim/time/elapsed-sec") or 0; - if ((du5_test_time.getValue() + 1 >= elapsedtime) and getprop("/modes/cpt-du-xfr") != 1) { + if (getprop("/instrumentation/du/du5-test-time") + 1 >= elapsedtime and getprop("/modes/cpt-du-xfr") != 1) { me["Test_white"].show(); me["Test_text"].hide(); - } else if ((du6_test_time.getValue() + 1 >= elapsedtime) and getprop("/modes/cpt-du-xfr") != 0) { + } else if (getprop("/instrumentation/du/du6-test-time") + 1 >= elapsedtime and getprop("/modes/cpt-du-xfr") == 1) { me["Test_white"].show(); me["Test_text"].hide(); } else { @@ -319,7 +308,7 @@ var nd_update = maketimer(0.05, func { canvas_nd_base.update(); }); -for (i = 0; i < 2; i = i + 1 ) { +for (i = 0; i < 2; i = i + 1) { setlistener("/instrumentation/efis["~i~"]/nd/display-mode", func(node) { var par = node.getParent().getParent(); var idx = par.getIndex(); @@ -330,18 +319,14 @@ for (i = 0; i < 2; i = i + 1 ) { var centered = 1; if (mode == "ILS") { cvs_mode = "APP"; - } - else if (mode == "VOR") { + } else if (mode == "VOR") { cvs_mode = "VOR"; - } - else if (mode == "NAV"){ + } else if (mode == "NAV") { cvs_mode = "MAP"; - } - else if (mode == "ARC"){ + } else if (mode == "ARC") { cvs_mode = "MAP"; centered = 0; - } - else if (mode == "PLAN"){ + } else if (mode == "PLAN") { cvs_mode = "PLAN"; } setprop(canvas_mode, cvs_mode); diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 3c14e043..e68b8cdf 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -22,131 +22,61 @@ var ASItrgtdiff = 0; var ASImax = 0; var ASItrend = 0; var altTens = 0; - -var state1 = props.globals.getNode("/systems/thrust/state1"); -var state2 = props.globals.getNode("/systems/thrust/state2"); -var managed_spd = props.globals.getNode("/it-autoflight/input/spd-managed"); -var ap1 = props.globals.getNode("/it-autoflight/output/ap1"); -var ap2 = props.globals.getNode("/it-autoflight/output/ap2"); -var fd1 = props.globals.getNode("/it-autoflight/output/fd1"); -var fd2 = props.globals.getNode("/it-autoflight/output/fd2"); -var athr = props.globals.getNode("/it-autoflight/output/athr"); -var throttle_mode = props.globals.getNode("/modes/pfd/fma/throttle-mode"); -var pitch_mode = props.globals.getNode("/modes/pfd/fma/pitch-mode"); -var pitch_mode_armed = props.globals.getNode("/modes/pfd/fma/pitch-mode-armed"); -var pitch_mode2_armed = props.globals.getNode("/modes/pfd/fma/pitch-mode2-armed"); -var pitch_mode_armed_box = props.globals.getNode("/modes/pfd/fma/pitch-mode-armed-box"); -var pitch_mode2_armed_box = props.globals.getNode("/modes/pfd/fma/pitch-mode2-armed-box"); -var roll_mode = props.globals.getNode("/modes/pfd/fma/roll-mode"); -var roll_mode_armed = props.globals.getNode("/modes/pfd/fma/roll-mode-armed"); -var roll_mode_box = props.globals.getNode("/modes/pfd/fma/roll-mode-box"); -var roll_mode_armed_box = props.globals.getNode("/modes/pfd/fma/roll-mode-armed-box"); -var thr1 = props.globals.getNode("/controls/engines/engine[0]/throttle-pos"); -var thr2 = props.globals.getNode("/controls/engines/engine[1]/throttle-pos"); -var wow1 = props.globals.getNode("/gear/gear[1]/wow"); -var wow2 = props.globals.getNode("/gear/gear[2]/wow"); -var pitch = props.globals.getNode("/orientation/pitch-deg"); -var roll = props.globals.getNode("/orientation/roll-deg"); -var vs_needle = props.globals.initNode("/instrumentation/pfd/vs-needle", 0.0, "DOUBLE"); -var vs_needle_trans = props.globals.initNode("/instrumentation/pfd/vs-digit-trans", 0.0, "DOUBLE"); -var target_ias = props.globals.initNode("/FMGC/internal/target-ias-pfd", 0.0, "DOUBLE"); -var alt_diff = props.globals.initNode("/instrumentation/pfd/alt-diff", 0.0, "DOUBLE"); -var heading = props.globals.initNode("/instrumentation/pfd/heading-deg", 0.0, "DOUBLE"); -var horizon_pitch = props.globals.initNode("/instrumentation/pfd/horizon-pitch", 0.0, "DOUBLE"); -var horizon_ground = props.globals.initNode("/instrumentation/pfd/horizon-ground", 0.0, "DOUBLE"); -var hdg_diff = props.globals.initNode("/instrumentation/pfd/hdg-diff", 0.0, "DOUBLE"); -var hdg_scale = props.globals.initNode("/instrumentation/pfd/heading-scale", 0.0, "DOUBLE"); -var track = props.globals.initNode("/instrumentation/pfd/track-deg", 0.0, "DOUBLE"); -var track_diff = props.globals.initNode("/instrumentation/pfd/track-hdg-diff", 0.0, "DOUBLE"); -var speed_pred = props.globals.initNode("/instrumentation/pfd/speed-lookahead", 0.0, "DOUBLE"); -var du1_test = props.globals.initNode("/instrumentation/du/du1-test", 0, "BOOL"); -var du1_test_time = props.globals.initNode("/instrumentation/du/du1-test-time", 0.0, "DOUBLE"); -var du1_test_amount = props.globals.initNode("/instrumentation/du/du1-test-amount", 0.0, "DOUBLE"); -var du2_test = props.globals.initNode("/instrumentation/du/du2-test", 0, "BOOL"); -var du2_test_time = props.globals.initNode("/instrumentation/du/du2-test-time", 0.0, "DOUBLE"); -var du2_test_amount = props.globals.initNode("/instrumentation/du/du2-test-amount", 0.0, "DOUBLE"); -var du5_test = props.globals.initNode("/instrumentation/du/du5-test", 0, "BOOL"); -var du5_test_time = props.globals.initNode("/instrumentation/du/du5-test-time", 0.0, "DOUBLE"); -var du5_test_amount = props.globals.initNode("/instrumentation/du/du5-test-amount", 0.0, "DOUBLE"); -var du6_test = props.globals.initNode("/instrumentation/du/du6-test", 0, "BOOL"); -var du6_test_time = props.globals.initNode("/instrumentation/du/du6-test-time", 0.0, "DOUBLE"); -var du6_test_amount = props.globals.initNode("/instrumentation/du/du6-test-amount", 0.0, "DOUBLE"); -var vspeed_pfr = props.globals.getNode("/it-autoflight/internal/vert-speed-fpm-pfd", 1); -var gear_agl = props.globals.getNode("/position/gear-agl-ft", 1); -var aileron_input = props.globals.getNode("/controls/flight/aileron-input-fast", 1); -var elevator_input = props.globals.getNode("/controls/flight/elevator-input-fast", 1); -var adirs0_active = props.globals.getNode("/instrumentation/adirs/adr[0]/active", 1); -var adirs1_active = props.globals.getNode("/instrumentation/adirs/adr[1]/active", 1); -var adirs2_active = props.globals.getNode("/instrumentation/adirs/adr[2]/active", 1); -var ir0_aligned = props.globals.getNode("/instrumentation/adirs/ir[0]/aligned", 1); -var ir1_aligned = props.globals.getNode("/instrumentation/adirs/ir[1]/aligned", 1); -var ir2_aligned = props.globals.getNode("/instrumentation/adirs/ir[2]/aligned", 1); -var att_switch = props.globals.getNode("/controls/switching/ATTHDG", 1); -var air_switch = props.globals.getNode("/controls/switching/AIRDATA", 1); -var elapsedtime = props.globals.getNode("/sim/time/elapsed-sec", 1); -var acess = props.globals.getNode("/systems/electrical/bus/ac-ess", 1); -var ac2 = props.globals.getNode("/systems/electrical/bus/ac2", 1); -var du1_lgt = props.globals.getNode("/controls/lighting/DU/du1", 1); -var du6_lgt = props.globals.getNode("/controls/lighting/DU/du6", 1); -var acconfig = props.globals.getNode("/systems/acconfig/autoconfig-running", 1); -var acconfig_mismatch = props.globals.getNode("/systems/acconfig/mismatch-code", 1); -var cpt_du_xfr = props.globals.getNode("/modes/cpt-du-xfr", 1); -var fo_du_xfr = props.globals.getNode("/modes/fo-du-xfr", 1); -var eng_out = props.globals.getNode("/systems/thrust/eng-out", 1); -var eng0_state = props.globals.getNode("/engines/engine[0]/state", 1); -var eng1_state = props.globals.getNode("/engines/engine[1]/state", 1); -var alpha_floor = props.globals.getNode("/systems/thrust/alpha-floor", 1); -var toga_lk = props.globals.getNode("/systems/thrust/toga-lk", 1); -var thrust_limit = props.globals.getNode("/controls/engines/thrust-limit", 1); -var flex = props.globals.getNode("/FMGC/internal/flex", 1); -var lvr_clb = props.globals.getNode("/systems/thrust/lvrclb", 1); -var throt_box = props.globals.getNode("/modes/pfd/fma/throttle-mode-box", 1); -var pitch_box = props.globals.getNode("/modes/pfd/fma/pitch-mode-box", 1); -var ap_box = props.globals.getNode("/modes/pfd/fma/ap-mode-box", 1); -var fd_box = props.globals.getNode("/modes/pfd/fma/fd-mode-box", 1); -var at_box = props.globals.getNode("/modes/pfd/fma/athr-mode-box", 1); -var fbw_law = props.globals.getNode("/it-fbw/law", 1); -var ap_mode = props.globals.getNode("/modes/pfd/fma/ap-mode", 1); -var fd_mode = props.globals.getNode("/modes/pfd/fma/fd-mode", 1); -var at_mode = props.globals.getNode("/modes/pfd/fma/at-mode", 1); -var alt_std_mode = props.globals.getNode("/modes/altimeter/std", 1); -var alt_inhg_mode = props.globals.getNode("/modes/altimeter/inhg", 1); -var alt_hpa = props.globals.getNode("/instrumentation/altimeter/setting-hpa", 1); -var alt_inhg = props.globals.getNode("/instrumentation/altimeter/setting-inhg", 1); -var altitude = props.globals.getNode("/instrumentation/altimeter/indicated-altitude-ft", 1); -var altitude_pfd = props.globals.getNode("/instrumentation/altimeter/indicated-altitude-ft-pfd", 1); -var alt_diff = props.globals.getNode("/instrumentation/pfd/alt-diff", 1); -var ap_alt = props.globals.getNode("/it-autoflight/internal/alt", 1); -var vs_needle = props.globals.getNode("/instrumentation/pfd/vs-needle", 1); -var vs_digit = props.globals.getNode("/instrumentation/pfd/vs-digit-trans", 1); -var ap_vs_pfd = props.globals.getNode("/it-autoflight/internal/vert-speed-fpm-pfd", 1); -var athr_arm = props.globals.getNode("/modes/pfd/fma/athr-armed", 1); -var FMGC_max_spd = props.globals.getNode("/FMGC/internal/maxspeed", 1); -var ind_spd_kt = props.globals.getNode("/instrumentation/airspeed-indicator/indicated-speed-kt", 1); -var ind_spd_mach = props.globals.getNode("/instrumentation/airspeed-indicator/indicated-mach", 1); -var at_spd_managed = props.globals.getNode("/it-autoflight/input/spd-managed", 1); -var at_tgt_ias = props.globals.getNode("/FMGC/internal/target-ias-pfd", 1); -var at_mach_mode = props.globals.getNode("/it-autoflight/input/kts-mach", 1); -var at_input_spd_mach = props.globals.getNode("/it-autoflight/input/spd-mach", 1); -var at_input_spd_kts = props.globals.getNode("/it-autoflight/input/spd-kts", 1); -var fd_roll = props.globals.getNode("/it-autoflight/fd/roll-bar", 1); -var fd_pitch = props.globals.getNode("/it-autoflight/fd/pitch-bar", 1); -var decision = props.globals.getNode("/instrumentation/mk-viii/inputs/arinc429/decision-height", 1); -var skid_slip = props.globals.getNode("/instrumentation/slip-skid-ball/indicated-slip-skid", 1); -var FMGCphase = props.globals.getNode("/FMGC/status/phase", 1); -var loc = props.globals.getNode("/instrumentation/nav[0]/heading-needle-deflection-norm", 1); -var gs = props.globals.getNode("/instrumentation/nav[0]/gs-needle-deflection-norm", 1); -var show_hdg = props.globals.getNode("/it-autoflight/custom/show-hdg", 1); -var ap_hdg = props.globals.getNode("/it-autoflight/input/hdg", 1); -var ap_trk_sw = props.globals.getNode("/it-autoflight/custom/trk-fpa", 1); -var ap_ils_mode = props.globals.getNode("/modes/pfd/ILS1", 1); -var ap_ils_mode2 = props.globals.getNode("/modes/pfd/ILS2", 1); -var loc_in_range = props.globals.getNode("/instrumentation/nav[0]/in-range", 1); -var gs_in_range = props.globals.getNode("/instrumentation/nav[0]/gs-in-range", 1); -var nav0_signalq = props.globals.getNode("/instrumentation/nav[0]/signal-quality-norm", 1); -var hasloc = props.globals.getNode("/instrumentation/nav[0]/nav-loc", 1); -var hasgs = props.globals.getNode("/instrumentation/nav[0]/has-gs", 1); -var pfdrate = props.globals.getNode("/systems/acconfig/options/pfd-rate", 1); +var state1 = getprop("/systems/thrust/state1"); +var state2 = getprop("/systems/thrust/state2"); +var ap1 = getprop("/it-autoflight/output/ap1"); +var ap2 = getprop("/it-autoflight/output/ap2"); +var fd1 = getprop("/it-autoflight/output/fd1"); +var fd2 = getprop("/it-autoflight/output/fd2"); +var athr = getprop("/it-autoflight/output/athr"); +var throttle_mode = getprop("/modes/pfd/fma/throttle-mode"); +var pitch_mode = getprop("/modes/pfd/fma/pitch-mode"); +var pitch_mode_armed = getprop("/modes/pfd/fma/pitch-mode-armed"); +var pitch_mode2_armed = getprop("/modes/pfd/fma/pitch-mode2-armed"); +var roll_mode = getprop("/modes/pfd/fma/roll-mode"); +var roll_mode_armed = getprop("/modes/pfd/fma/roll-mode-armed"); +var thr1 = getprop("/controls/engines/engine[0]/throttle-pos"); +var thr2 = getprop("/controls/engines/engine[1]/throttle-pos"); +var wow1 = getprop("/gear/gear[1]/wow"); +var wow2 = getprop("/gear/gear[2]/wow"); +var pitch = 0; +var roll = 0; +setprop("/instrumentation/pfd/vs-needle", 0); +setprop("/instrumentation/pfd/vs-digit-trans", 0); +setprop("/it-autoflight/input/spd-managed", 0); +setprop("/FMGC/internal/target-ias-pfd", 0); +setprop("/it-autoflight/output/ap1", 0); +setprop("/it-autoflight/output/ap2", 0); +setprop("/it-autoflight/output/fd1", 0); +setprop("/it-autoflight/output/fd2", 0); +setprop("/it-autoflight/output/athr", 0); +setprop("/instrumentation/pfd/alt-diff", 0); +setprop("/instrumentation/pfd/heading-deg", 0); +setprop("/instrumentation/pfd/horizon-pitch", 0); +setprop("/instrumentation/pfd/horizon-ground", 0); +setprop("/instrumentation/pfd/hdg-diff", 0); +setprop("/instrumentation/pfd/heading-scale", 0); +setprop("/instrumentation/pfd/track-deg", 0); +setprop("/instrumentation/pfd/track-hdg-diff", 0); +setprop("/instrumentation/pfd/speed-lookahead", 0); +setprop("/instrumentation/du/du1-test", 0); +setprop("/instrumentation/du/du1-test-time", 0); +setprop("/instrumentation/du/du1-test-amount", 0); +setprop("/instrumentation/du/du6-test", 0); +setprop("/instrumentation/du/du6-test-time", 0); +setprop("/instrumentation/du/du6-test-amount", 0); +setprop("/it-autoflight/internal/vert-speed-fpm-pfd", 0); +setprop("/position/gear-agl-ft", 0); +setprop("/controls/flight/aileron-input-fast", 0); +setprop("/controls/flight/elevator-input-fast", 0); +setprop("/instrumentation/adirs/adr[0]/active", 0); +setprop("/instrumentation/adirs/adr[1]/active", 0); +setprop("/instrumentation/adirs/adr[2]/active", 0); +setprop("/instrumentation/adirs/ir[0]/aligned", 0); +setprop("/instrumentation/adirs/ir[1]/aligned", 0); +setprop("/instrumentation/adirs/ir[2]/aligned", 0); +setprop("/controls/switching/ATTHDG", 0); +setprop("/controls/switching/AIRDATA", 0); var canvas_PFD_base = { init: func(canvas_group, file) { @@ -201,45 +131,44 @@ var canvas_PFD_base = { "TRK_pointer"]; }, update: func() { - elapsedtime_act = elapsedtime.getValue(); - if (acess.getValue() >= 110) { - if (acconfig.getValue() != 1 and du1_test.getValue() != 1) { - du1_test.setValue(1); - du1_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); - du1_test_time.setValue(elapsedtime_act); - } else if (acconfig.getValue() == 1 and du1_test.getValue() != 1) { - du1_test.setValue(1); - du1_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); - du1_test_time.setValue(elapsedtime_act - 30); + elapsedtime = getprop("/sim/time/elapsed-sec"); + if (getprop("/systems/electrical/bus/ac-ess") >= 110) { + if (getprop("/systems/acconfig/autoconfig-running") != 1 and getprop("/instrumentation/du/du1-test") != 1) { + setprop("/instrumentation/du/du1-test", 1); + setprop("/instrumentation/du/du1-test-amount", math.round((rand() * 5 ) + 35, 0.1)); + setprop("/instrumentation/du/du1-test-time", getprop("/sim/time/elapsed-sec")); + } else if (getprop("/systems/acconfig/autoconfig-running") == 1 and getprop("/instrumentation/du/du1-test") != 1) { + setprop("/instrumentation/du/du1-test", 1); + setprop("/instrumentation/du/du1-test-amount", math.round((rand() * 5 ) + 35, 0.1)); + setprop("/instrumentation/du/du1-test-time", getprop("/sim/time/elapsed-sec") - 30); } } else { - du1_test.setValue(0); + setprop("/instrumentation/du/du1-test", 0); } - - if (ac2.getValue() >= 110) { - if (acconfig.getValue != 1 and du6_test.getValue() != 1) { - du6_test.setValue(1); - du6_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); - du6_test_time.setValue(elapsedtime_act); - } else if (acconfig.getValue() == 1 and du6_test.getValue() != 1) { - du6_test.setValue(1); - du6_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); - du6_test_time.setValue(elapsedtime_act - 30); + if (getprop("/systems/electrical/bus/ac2") >= 110) { + if (getprop("/systems/acconfig/autoconfig-running") != 1 and getprop("/instrumentation/du/du6-test") != 1) { + setprop("/instrumentation/du/du6-test", 1); + setprop("/instrumentation/du/du6-test-amount", math.round((rand() * 5 ) + 35, 0.1)); + setprop("/instrumentation/du/du6-test-time", getprop("/sim/time/elapsed-sec")); + } else if (getprop("/systems/acconfig/autoconfig-running") == 1 and getprop("/instrumentation/du/du6-test") != 1) { + setprop("/instrumentation/du/du6-test", 1); + setprop("/instrumentation/du/du6-test-amount", math.round((rand() * 5 ) + 35, 0.1)); + setprop("/instrumentation/du/du6-test-time", getprop("/sim/time/elapsed-sec") - 30); } } else { - du6_test.setValue(0); + setprop("/instrumentation/du/du6-test", 0); } - if (acconfig_mismatch.getValue() == "0x000") { + if (getprop("/systems/acconfig/mismatch-code") == "0x000") { PFD_1_mismatch.page.hide(); PFD_2_mismatch.page.hide(); - if (acess.getValue() >= 110 and du1_lgt.getValue() > 0) { - if (du1_test_time.getValue() + du1_test_amount.getValue() >= elapsedtime_act and cpt_du_xfr.getValue() != 1) { + if (getprop("/systems/electrical/bus/ac-ess") >= 110 and getprop("/controls/lighting/DU/du1") > 0) { + if (getprop("/instrumentation/du/du1-test-time") + getprop("/instrumentation/du/du1-test-amount") >= elapsedtime and getprop("/modes/cpt-du-xfr") != 1) { PFD_1_test.update(); updateL = 0; PFD_1.page.hide(); PFD_1_test.page.show(); - } else if (du2_test_time.getValue() + du2_test_amount.getValue() >= elapsedtime_act and cpt_du_xfr.getValue() == 1) { + } else if (getprop("/instrumentation/du/du2-test-time") + getprop("/instrumentation/du/du2-test-amount") >= elapsedtime and getprop("/modes/cpt-du-xfr") == 1) { PFD_1_test.update(); updateL = 0; PFD_1.page.hide(); @@ -256,13 +185,13 @@ var canvas_PFD_base = { PFD_1_test.page.hide(); PFD_1.page.hide(); } - if (ac2.getValue() >= 110 and du6_lgt.getValue() > 0) { - if (du6_test_time.getValue() + du6_test_amount.getValue() >= elapsedtime_act and fo_du_xfr.getValue() != 1) { + if (getprop("/systems/electrical/bus/ac2") >= 110 and getprop("/controls/lighting/DU/du6") > 0) { + if (getprop("/instrumentation/du/du6-test-time") + getprop("/instrumentation/du/du6-test-amount") >= elapsedtime and getprop("/modes/fo-du-xfr") != 1) { PFD_2_test.update(); updateR = 0; PFD_2.page.hide(); PFD_2_test.page.show(); - } else if (du5_test_time.getValue() + du5_test_amount.getValue() >= elapsedtime_act and fo_du_xfr.getValue() == 1) { + } else if (getprop("/instrumentation/du/du5-test-time") + getprop("/instrumentation/du/du5-test-amount") >= elapsedtime and getprop("/modes/fo-du-xfr") == 1) { PFD_2_test.update(); updateR = 0; PFD_2.page.hide(); @@ -301,69 +230,81 @@ var canvas_PFD_base = { } }, updateCommon: func () { + state1 = getprop("/systems/thrust/state1"); + state2 = getprop("/systems/thrust/state2"); + ap1 = getprop("/it-autoflight/output/ap1"); + ap2 = getprop("/it-autoflight/output/ap2"); + fd1 = getprop("/it-autoflight/output/fd1"); + fd2 = getprop("/it-autoflight/output/fd2"); + athr = getprop("/it-autoflight/output/athr"); + throttle_mode = getprop("/modes/pfd/fma/throttle-mode"); + pitch_mode = getprop("/modes/pfd/fma/pitch-mode"); + pitch_mode_armed = getprop("/modes/pfd/fma/pitch-mode-armed"); + pitch_mode2_armed = getprop("/modes/pfd/fma/pitch-mode2-armed"); + roll_mode = getprop("/modes/pfd/fma/roll-mode"); + roll_mode_armed = getprop("/modes/pfd/fma/roll-mode-armed"); + thr1 = getprop("/controls/engines/engine[0]/throttle-pos"); + thr2 = getprop("/controls/engines/engine[1]/throttle-pos"); + pitch = getprop("/orientation/pitch-deg"); + roll = getprop("/orientation/roll-deg"); + wow1 = getprop("/gear/gear[1]/wow"); + wow2 = getprop("/gear/gear[2]/wow"); + # FMA MAN TOGA MCT FLX THR - # Set properties used a lot to a variable to avoid calling getValue() multiple times - state1_act = state1.getValue(); - state2_act = state2.getValue(); - thrust_limit_act = thrust_limit.getValue(); - alpha_floor_act = alpha_floor.getValue(); - toga_lk_act = toga_lk.getValue(); - thr1_act = thr1.getValue(); - thr2_act = thr2.getValue(); - if (athr.getValue() == 1 and (state1_act == "TOGA" or state1_act == "MCT" or state1_act == "MAN THR" or state2_act == "TOGA" or state2_act == "MCT" or state2_act == "MAN THR") and eng_out.getValue() != 1 and alpha_floor_act != 1 and - toga_lk_act != 1) { + if (athr == 1 and (state1 == "TOGA" or state1 == "MCT" or state1 == "MAN THR" or state2 == "TOGA" or state2 == "MCT" or state2 == "MAN THR") and getprop("/systems/thrust/eng-out") != 1 and getprop("/systems/thrust/alpha-floor") != 1 and + getprop("/systems/thrust/toga-lk") != 1) { me["FMA_man"].show(); me["FMA_manmode"].show(); - if (state1_act == "TOGA" or state2_act == "TOGA") { + if (state1 == "TOGA" or state2 == "TOGA") { me["FMA_flx_box"].hide(); me["FMA_flxtemp"].hide(); me["FMA_man_box"].show(); me["FMA_manmode"].setText("TOGA"); me["FMA_man_box"].setColor(0.8078,0.8039,0.8078); - } else if ((state1_act == "MAN THR" and thr1_act >= 0.83) or (state2_act == "MAN THR" and thr2_act >= 0.83)) { + } else if ((state1 == "MAN THR" and thr1 >= 0.83) or (state2 == "MAN THR" and thr2 >= 0.83)) { me["FMA_flx_box"].hide(); me["FMA_flxtemp"].hide(); me["FMA_man_box"].show(); me["FMA_manmode"].setText("THR"); me["FMA_man_box"].setColor(0.7333,0.3803,0); - } else if ((state1_act == "MCT" or state2_act == "MCT") and thrust_limit_act != "FLX") { + } else if ((state1 == "MCT" or state2 == "MCT") and getprop("/controls/engines/thrust-limit") != "FLX") { me["FMA_flx_box"].hide(); me["FMA_flxtemp"].hide(); me["FMA_man_box"].show(); me["FMA_manmode"].setText("MCT"); me["FMA_man_box"].setColor(0.8078,0.8039,0.8078); - } else if ((state1_act == "MCT" or state2_act == "MCT") and thrust_limit_act == "FLX") { - me["FMA_flxtemp"].setText(sprintf("%s", "+" ~ flex.getValue())); + } else if ((state1 == "MCT" or state2 == "MCT") and getprop("/controls/engines/thrust-limit") == "FLX") { + me["FMA_flxtemp"].setText(sprintf("%s", "+" ~ getprop("/FMGC/internal/flex"))); me["FMA_man_box"].hide(); me["FMA_flx_box"].show(); me["FMA_flxtemp"].show(); me["FMA_manmode"].setText("FLX "); me["FMA_man_box"].setColor(0.8078,0.8039,0.8078); - } else if ((state1_act == "MAN THR" and thr1_act < 0.83) or (state2_act == "MAN THR" and thr2_act < 0.83)) { + } else if ((state1 == "MAN THR" and thr1 < 0.83) or (state2 == "MAN THR" and thr2 < 0.83)) { me["FMA_flx_box"].hide(); me["FMA_flxtemp"].hide(); me["FMA_man_box"].show(); me["FMA_manmode"].setText("THR"); me["FMA_man_box"].setColor(0.7333,0.3803,0); } - } else if (athr.getValue() == 1 and (state1_act == "TOGA" or (state1_act == "MCT" and thrust_limit_act == "FLX") or (state1_act == "MAN THR" and thr1_act >= 0.83) or state2_act == "TOGA" or (state2_act == "MCT" and - thrust_limit_act == "FLX") or (state2_act == "MAN THR" and thr2_act >= 0.83)) and eng_out.getValue() == 1 and alpha_floor_act != 1 and toga_lk_act != 1) { + } else if (athr == 1 and (state1 == "TOGA" or (state1 == "MCT" and getprop("/controls/engines/thrust-limit") == "FLX") or (state1 == "MAN THR" and thr1 >= 0.83) or state2 == "TOGA" or (state2 == "MCT" and + getprop("/controls/engines/thrust-limit") == "FLX") or (state2 == "MAN THR" and thr2 >= 0.83)) and getprop("/systems/thrust/eng-out") == 1 and getprop("/systems/thrust/alpha-floor") != 1 and getprop("/systems/thrust/toga-lk") != 1) { me["FMA_man"].show(); me["FMA_manmode"].show(); - if (state1_act == "TOGA" or state2_act == "TOGA") { + if (state1 == "TOGA" or state2 == "TOGA") { me["FMA_flx_box"].hide(); me["FMA_flxtemp"].hide(); me["FMA_man_box"].show(); me["FMA_manmode"].setText("TOGA"); me["FMA_man_box"].setColor(0.8078,0.8039,0.8078); - } else if ((state1_act == "MAN THR" and thr1_act >= 0.83) or (state2_act == "MAN THR" and thr2_act >= 0.83)) { + } else if ((state1 == "MAN THR" and thr1 >= 0.83) or (state2 == "MAN THR" and thr2 >= 0.83)) { me["FMA_flx_box"].hide(); me["FMA_flxtemp"].hide(); me["FMA_man_box"].show(); me["FMA_manmode"].setText("THR"); me["FMA_man_box"].setColor(0.7333,0.3803,0); - } else if ((state1_act == "MCT" or state2_act == "MCT") and thrust_limit_act == "FLX") { - me["FMA_flxtemp"].setText(sprintf("%s", "+" ~ flex.getValue())); + } else if ((state1 == "MCT" or state2 == "MCT") and getprop("/controls/engines/thrust-limit") == "FLX") { + me["FMA_flxtemp"].setText(sprintf("%s", "+" ~ getprop("/FMGC/internal/flex"))); me["FMA_man_box"].hide(); me["FMA_flx_box"].show(); me["FMA_flxtemp"].show(); @@ -378,35 +319,35 @@ var canvas_PFD_base = { me["FMA_flxtemp"].hide(); } - if ((state1_act == "CL" and state2_act != "CL") or (state1_act != "CL" and state2_act == "CL") and eng_out.getValue() != 1) { + if ((state1 == "CL" and state2 != "CL") or (state1 != "CL" and state2 == "CL") and getprop("/systems/thrust/eng-out") != 1) { me["FMA_lvrclb"].setText("LVR ASYM"); } else { - if (eng_out.getValue() == 1) { + if (getprop("/systems/thrust/eng-out") == 1) { me["FMA_lvrclb"].setText("LVR MCT"); } else { me["FMA_lvrclb"].setText("LVR CLB"); } } - if (athr.getValue() == 1 and lvr_clb.getValue() == 1) { + if (athr == 1 and getprop("/systems/thrust/lvrclb") == 1) { me["FMA_lvrclb"].show(); } else { me["FMA_lvrclb"].hide(); } # FMA A/THR - if (alpha_floor_act != 1 and toga_lk_act != 1) { - if (athr.getValue() == 1 and eng_out.getValue() != 1 and (state1_act == "MAN" or state1_act == "CL") and (state2_act == "MAN" or state2_act == "CL")) { + if (getprop("/systems/thrust/alpha-floor") != 1 and getprop("/systems/thrust/toga-lk") != 1) { + if (athr == 1 and getprop("/systems/thrust/eng-out") != 1 and (state1 == "MAN" or state1 == "CL") and (state2 == "MAN" or state2 == "CL")) { me["FMA_thrust"].show(); - if (throt_box.getValue() == 1 and throttle_mode.getValue() != " ") { + if (getprop("/modes/pfd/fma/throttle-mode-box") == 1 and throttle_mode != " ") { me["FMA_thrust_box"].show(); } else { me["FMA_thrust_box"].hide(); } - } else if (athr.getValue() == 1 and eng_out.getValue() == 1 and (state1_act == "MAN" or state1_act == "CL" or (state1_act == "MAN THR" and thr1_act < 0.83) or (state1_act == "MCT" and thrust_limit_act != "FLX")) and - (state2_act == "MAN" or state2_act == "CL" or (state2_act == "MAN THR" and thr2_act < 0.83) or (state2_act == "MCT" and thrust_limit_act != "FLX"))) { + } else if (athr == 1 and getprop("/systems/thrust/eng-out") == 1 and (state1 == "MAN" or state1 == "CL" or (state1 == "MAN THR" and thr1 < 0.83) or (state1 == "MCT" and getprop("/controls/engines/thrust-limit") != "FLX")) and + (state2 == "MAN" or state2 == "CL" or (state2 == "MAN THR" and thr2 < 0.83) or (state2 == "MCT" and getprop("/controls/engines/thrust-limit") != "FLX"))) { me["FMA_thrust"].show(); - if (throt_box.getValue() == 1 and throttle_mode.getValue() != " ") { + if (getprop("/modes/pfd/fma/throttle-mode-box") == 1 and throttle_mode != " ") { me["FMA_thrust_box"].show(); } else { me["FMA_thrust_box"].hide(); @@ -420,28 +361,21 @@ var canvas_PFD_base = { me["FMA_thrust_box"].show(); } - if (alpha_floor_act == 1) { + if (getprop("/systems/thrust/alpha-floor") == 1) { me["FMA_thrust"].setText("A.FLOOR"); me["FMA_thrust_box"].setColor(0.7333,0.3803,0); - } else if (toga_lk_act == 1) { + } else if (getprop("/systems/thrust/toga-lk") == 1) { me["FMA_thrust"].setText("TOGA LK"); me["FMA_thrust_box"].setColor(0.7333,0.3803,0); } else { - me["FMA_thrust"].setText(sprintf("%s", throttle_mode.getValue())); + me["FMA_thrust"].setText(sprintf("%s", throttle_mode)); me["FMA_thrust_box"].setColor(0.8078,0.8039,0.8078); } # FMA Pitch Roll Common - pitch_mode_act = pitch_mode.getValue(); # only call getValue once per loop, not multiple times - pitch_mode_armed_act = pitch_mode_armed.getValue(); - pitch_mode2_armed_act = pitch_mode2_armed.getValue(); - roll_mode_act = roll_mode.getValue(); - roll_mode_armed_act = roll_mode_armed.getValue(); - fbw = fbw_law.getValue(); - me["FMA_combined"].setText(sprintf("%s", pitch_mode_act)); + me["FMA_combined"].setText(sprintf("%s", pitch_mode)); - - if (pitch_mode_act == "LAND" or pitch_mode_act == "FLARE" or pitch_mode_act == "ROLL OUT") { + if (pitch_mode == "LAND" or pitch_mode == "FLARE" or pitch_mode == "ROLL OUT") { me["FMA_pitch"].hide(); me["FMA_roll"].hide(); me["FMA_pitch_box"].hide(); @@ -450,11 +384,11 @@ var canvas_PFD_base = { me["FMA_rollarm_box"].hide(); me["FMA_Middle1"].hide(); me["FMA_Middle2"].hide(); - if (fbw == 2) { + if (getprop("/it-fbw/law") == 2) { me["FMA_ctr_msg"].setText("USE MAN PITCH TRIM"); me["FMA_ctr_msg"].setColor(0.7333,0.3803,0); me["FMA_ctr_msg"].show(); - } else if (fbw == 3) { + } else if (getprop("/it-fbw/law") == 3) { me["FMA_ctr_msg"].setText("MAN PITCH TRIM ONLY"); me["FMA_ctr_msg"].setColor(1,0,0); me["FMA_ctr_msg"].show(); @@ -462,7 +396,7 @@ var canvas_PFD_base = { me["FMA_ctr_msg"].hide(); } me["FMA_combined"].show(); - if (pitch_box.getValue() == 1 and pitch_mode_act != " ") { + if (getprop("/modes/pfd/fma/pitch-mode-box") == 1 and pitch_mode != " ") { me["FMA_combined_box"].show(); } else { me["FMA_combined_box"].hide(); @@ -470,13 +404,13 @@ var canvas_PFD_base = { } else { me["FMA_combined"].hide(); me["FMA_combined_box"].hide(); - if (fbw == 2) { + if (getprop("/it-fbw/law") == 2) { me["FMA_ctr_msg"].setText("USE MAN PITCH TRIM"); me["FMA_ctr_msg"].setColor(0.7333,0.3803,0); me["FMA_Middle1"].hide(); me["FMA_Middle2"].show(); me["FMA_ctr_msg"].show(); - } else if (fbw == 3) { + } else if (getprop("/it-fbw/law") == 3) { me["FMA_ctr_msg"].setText("MAN PITCH TRIM ONLY"); me["FMA_ctr_msg"].setColor(1,0,0); me["FMA_Middle1"].hide(); @@ -488,40 +422,40 @@ var canvas_PFD_base = { me["FMA_Middle2"].hide(); } - if (ap1.getValue() == 1 or ap2.getValue() == 1 or fd1.getValue() == 1 or fd2.getValue() == 1) { + if (ap1 or ap2 or fd1 or fd2) { me["FMA_pitch"].show(); me["FMA_roll"].show(); } else { me["FMA_pitch"].hide(); me["FMA_roll"].hide(); } - if (pitch_box.getValue() == 1 and pitch_mode_act != " " and (ap1.getValue() == 1 or ap2.getValue() == 1 or fd1.getValue() == 1 or fd2.getValue() == 1)) { + if (getprop("/modes/pfd/fma/pitch-mode-box") == 1 and pitch_mode != " " and (ap1 or ap2 or fd1 or fd2)) { me["FMA_pitch_box"].show(); } else { me["FMA_pitch_box"].hide(); } - if (pitch_mode_armed_act == " " and pitch_mode2_armed_act == " ") { + if (pitch_mode_armed == " " and pitch_mode2_armed == " ") { me["FMA_pitcharm_box"].hide(); } else { - if ((pitch_mode_armed_box.getValue() == 1 or pitch_mode2_armed_box.getValue() == 1) and (ap1.getValue() == 1 or ap2.getValue() == 1 or fd1.getValue() == 1 or fd2.getValue() == 1)) { + if ((getprop("/modes/pfd/fma/pitch-mode-armed-box") == 1 or getprop("/modes/pfd/fma/pitch-mode2-armed-box") == 1) and (ap1 or ap2 or fd1 or fd2)) { me["FMA_pitcharm_box"].show(); } else { me["FMA_pitcharm_box"].hide(); } } - if (roll_mode_box.getValue() == 1 and roll_mode_act != " " and (ap1.getValue() == 1 or ap2.getValue() == 1 or fd1.getValue() == 1 or fd2.getValue() == 1)) { + if (getprop("/modes/pfd/fma/roll-mode-box") == 1 and roll_mode != " " and (ap1 or ap2 or fd1 or fd2)) { me["FMA_roll_box"].show(); } else { me["FMA_roll_box"].hide(); } - if (roll_mode_armed_box.getValue() == 1 and roll_mode_armed_act != " " and (ap1.getValue() == 1 or ap2.getValue() == 1 or fd1.getValue() == 1 or fd2.getValue() == 1)) { + if (getprop("/modes/pfd/fma/roll-mode-armed-box") == 1 and roll_mode_armed != " " and (ap1 or ap2 or fd1 or fd2)) { me["FMA_rollarm_box"].show(); } else { me["FMA_rollarm_box"].hide(); } } - if (ap1.getValue() == 1 or ap2.getValue() == 1 or fd1.getValue() == 1 or fd2.getValue() == 1) { + if (ap1 or ap2 or fd1 or fd2) { me["FMA_pitcharm"].show(); me["FMA_pitcharm2"].show(); me["FMA_rollarm"].show(); @@ -532,13 +466,13 @@ var canvas_PFD_base = { } # FMA Pitch - me["FMA_pitch"].setText(sprintf("%s", pitch_mode_act)); - me["FMA_pitcharm"].setText(sprintf("%s", pitch_mode_armed_act)); - me["FMA_pitcharm2"].setText(sprintf("%s", pitch_mode2_armed_act)); + me["FMA_pitch"].setText(sprintf("%s", pitch_mode)); + me["FMA_pitcharm"].setText(sprintf("%s", pitch_mode_armed)); + me["FMA_pitcharm2"].setText(sprintf("%s", pitch_mode2_armed)); # FMA Roll - me["FMA_roll"].setText(sprintf("%s", roll_mode_act)); - me["FMA_rollarm"].setText(sprintf("%s", roll_mode_armed_act)); + me["FMA_roll"].setText(sprintf("%s", roll_mode)); + me["FMA_rollarm"].setText(sprintf("%s", roll_mode_armed)); # FMA CAT DH me["FMA_catmode"].hide(); @@ -550,48 +484,48 @@ var canvas_PFD_base = { me["FMA_dh_box"].hide(); # FMA AP FD ATHR - me["FMA_ap"].setText(sprintf("%s", ap_mode.getValue())); - me["FMA_fd"].setText(sprintf("%s", fd_mode.getValue())); - me["FMA_athr"].setText(sprintf("%s", at_mode.getValue())); + me["FMA_ap"].setText(sprintf("%s", getprop("/modes/pfd/fma/ap-mode"))); + me["FMA_fd"].setText(sprintf("%s", getprop("/modes/pfd/fma/fd-mode"))); + me["FMA_athr"].setText(sprintf("%s", getprop("/modes/pfd/fma/at-mode"))); - if (athr_arm.getValue() != 1) { + if (getprop("/modes/pfd/fma/athr-armed") != 1) { me["FMA_athr"].setColor(0.8078,0.8039,0.8078); } else { me["FMA_athr"].setColor(0.0901,0.6039,0.7176); } - if (ap_box.getValue() == 1 and ap_mode.getValue() != " ") { + if (getprop("/modes/pfd/fma/ap-mode-box") == 1 and getprop("/modes/pfd/fma/ap-mode") != " ") { me["FMA_ap_box"].show(); } else { me["FMA_ap_box"].hide(); } - if (fd_box.getValue() == 1 and fd_mode.getValue() != " ") { + if (getprop("/modes/pfd/fma/fd-mode-box") == 1 and getprop("/modes/pfd/fma/fd-mode") != " ") { me["FMA_fd_box"].show(); } else { me["FMA_fd_box"].hide(); } - if (at_box.getValue() == 1 and at_mode.getValue() != " ") { + if (getprop("/modes/pfd/fma/athr-mode-box") == 1 and getprop("/modes/pfd/fma/at-mode") != " ") { me["FMA_athr_box"].show(); } else { me["FMA_athr_box"].hide(); } # QNH - if (alt_std_mode.getValue() == 1) { + if (getprop("/modes/altimeter/std") == 1) { me["QNH"].hide(); me["QNH_setting"].hide(); me["QNH_std"].show(); me["QNH_box"].show(); - } else if (alt_inhg_mode.getValue() == 0) { - me["QNH_setting"].setText(sprintf("%4.0f", alt_hpa.getValue())); + } else if (getprop("/modes/altimeter/inhg") == 0) { + me["QNH_setting"].setText(sprintf("%4.0f", getprop("/instrumentation/altimeter/setting-hpa"))); me["QNH"].show(); me["QNH_setting"].show(); me["QNH_std"].hide(); me["QNH_box"].hide(); - } else if (alt_inhg_mode.getValue() == 1) { - me["QNH_setting"].setText(sprintf("%2.2f", alt_inhg.getValue())); + } else if (getprop("/modes/altimeter/inhg") == 1) { + me["QNH_setting"].setText(sprintf("%2.2f", getprop("/instrumentation/altimeter/setting-inhg"))); me["QNH"].show(); me["QNH_setting"].show(); me["QNH_std"].hide(); @@ -600,30 +534,27 @@ var canvas_PFD_base = { }, updateCommonFast: func() { # Airspeed - ind_spd = ind_spd_kt.getValue(); # Subtract 30, since the scale starts at 30, but don"t allow less than 0, or more than 420 situations - if (ind_spd <= 30) { + if (getprop("/instrumentation/airspeed-indicator/indicated-speed-kt") <= 30) { ASI = 0; - } else if (ind_spd >= 420) { + } else if (getprop("/instrumentation/airspeed-indicator/indicated-speed-kt") >= 420) { ASI = 390; } else { - ASI = ind_spd - 30; + ASI = getprop("/instrumentation/airspeed-indicator/indicated-speed-kt") - 30; } - FMGC_max = FMGC_max_spd.getValue(); - if (FMGC_max <= 30) { + if (getprop("/FMGC/internal/maxspeed") <= 30) { ASImax = 0 - ASI; - } else if (FMGC_max >= 420) { + } else if (getprop("/FMGC/internal/maxspeed") >= 420) { ASImax = 390 - ASI; } else { - ASImax = FMGC_max - 30 - ASI; + ASImax = getprop("/FMGC/internal/maxspeed") - 30 - ASI; } me["ASI_scale"].setTranslation(0, ASI * 6.6); me["ASI_max"].setTranslation(0, ASImax * -6.6); - ind_mach = ind_spd_mach.getValue(); - if (ind_mach >= 0.5) { + if (getprop("/instrumentation/airspeed-indicator/indicated-mach") >= 0.5) { me["ASI_mach_decimal"].show(); me["ASI_mach"].show(); } else { @@ -631,13 +562,13 @@ var canvas_PFD_base = { me["ASI_mach"].hide(); } - if (ind_mach >= 0.999) { + if (getprop("/instrumentation/airspeed-indicator/indicated-mach") >= 0.999) { me["ASI_mach"].setText("999"); } else { - me["ASI_mach"].setText(sprintf("%3.0f", ind_mach * 1000)); + me["ASI_mach"].setText(sprintf("%3.0f", getprop("/instrumentation/airspeed-indicator/indicated-mach") * 1000)); } - if (at_spd_managed.getValue() == 1) { + if (getprop("/it-autoflight/input/spd-managed") == 1) { me["ASI_target"].setColor(0.6901,0.3333,0.7450); me["ASI_digit_UP"].setColor(0.6901,0.3333,0.7450); me["ASI_decimal_UP"].setColor(0.6901,0.3333,0.7450); @@ -651,16 +582,15 @@ var canvas_PFD_base = { me["ASI_decimal_DN"].setColor(0.0901,0.6039,0.7176); } - tgt_ias = at_tgt_ias.getValue(); - if (tgt_ias <= 30) { + if (getprop("/FMGC/internal/target-ias-pfd") <= 30) { ASItrgt = 0 - ASI; - } else if (tgt_ias >= 420) { + } else if (getprop("/FMGC/internal/target-ias-pfd") >= 420) { ASItrgt = 390 - ASI; } else { - ASItrgt = tgt_ias - 30 - ASI; + ASItrgt = getprop("/FMGC/internal/target-ias-pfd") - 30 - ASI; } - ASItrgtdiff = tgt_ias - ind_spd; + ASItrgtdiff = getprop("/FMGC/internal/target-ias-pfd") - getprop("/instrumentation/airspeed-indicator/indicated-speed-kt"); if (ASItrgtdiff >= -42 and ASItrgtdiff <= 42) { me["ASI_target"].setTranslation(0, ASItrgt * -6.6); @@ -670,12 +600,12 @@ var canvas_PFD_base = { me["ASI_decimal_DN"].hide(); me["ASI_target"].show(); } else if (ASItrgtdiff < -42) { - if (at_mach_mode.getValue() == 1) { - me["ASI_digit_DN"].setText(sprintf("%3.0f", at_input_spd_mach.getValue() * 1000)); + if (getprop("/it-autoflight/input/kts-mach") == 1) { + me["ASI_digit_DN"].setText(sprintf("%3.0f", getprop("/it-autoflight/input/spd-mach") * 1000)); me["ASI_decimal_UP"].hide(); me["ASI_decimal_DN"].show(); } else { - me["ASI_digit_DN"].setText(sprintf("%3.0f", at_input_spd_kts.getValue())); + me["ASI_digit_DN"].setText(sprintf("%3.0f", getprop("/it-autoflight/input/spd-kts"))); me["ASI_decimal_UP"].hide(); me["ASI_decimal_DN"].hide(); } @@ -683,12 +613,12 @@ var canvas_PFD_base = { me["ASI_digit_UP"].hide(); me["ASI_target"].hide(); } else if (ASItrgtdiff > 42) { - if (at_mach_mode.getValue() == 1) { - me["ASI_digit_UP"].setText(sprintf("%3.0f", at_input_spd_mach.getValue() * 1000)); + if (getprop("/it-autoflight/input/kts-mach") == 1) { + me["ASI_digit_UP"].setText(sprintf("%3.0f", getprop("/it-autoflight/input/spd-mach") * 1000)); me["ASI_decimal_UP"].show(); me["ASI_decimal_DN"].hide(); } else { - me["ASI_digit_UP"].setText(sprintf("%3.0f", at_input_spd_kts.getValue())); + me["ASI_digit_UP"].setText(sprintf("%3.0f", getprop("/it-autoflight/input/spd-kts"))); me["ASI_decimal_UP"].hide(); me["ASI_decimal_DN"].hide(); } @@ -697,7 +627,7 @@ var canvas_PFD_base = { me["ASI_target"].hide(); } - ASItrend = speed_pred.getValue() - ASI; + ASItrend = getprop("/instrumentation/pfd/speed-lookahead") - ASI; me["ASI_trend_up"].setTranslation(0, math.clamp(ASItrend, 0, 50) * -6.6); me["ASI_trend_down"].setTranslation(0, math.clamp(ASItrend, -50, 0) * -6.6); @@ -713,19 +643,19 @@ var canvas_PFD_base = { } # Attitude Indicator - pitch_cur = pitch.getValue(); - roll_cur = roll.getValue(); + pitch = getprop("/orientation/pitch-deg") or 0; + roll = getprop("/orientation/roll-deg") or 0; - me.AI_horizon_trans.setTranslation(0, pitch_cur * 11.825); - me.AI_horizon_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter()); - me.AI_horizon_ground_trans.setTranslation(0, horizon_ground.getValue() * 11.825); - me.AI_horizon_ground_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter()); - me.AI_horizon_sky_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter()); + me.AI_horizon_trans.setTranslation(0, pitch * 11.825); + me.AI_horizon_rot.setRotation(-roll * D2R, me["AI_center"].getCenter()); + me.AI_horizon_ground_trans.setTranslation(0, getprop("/instrumentation/pfd/horizon-ground") * 11.825); + me.AI_horizon_ground_rot.setRotation(-roll * D2R, me["AI_center"].getCenter()); + me.AI_horizon_sky_rot.setRotation(-roll * D2R, me["AI_center"].getCenter()); - me["AI_slipskid"].setTranslation(math.clamp(skid_slip.getValue(), -7, 7) * -15, 0); - me["AI_bank"].setRotation(-roll_cur * D2R); + me["AI_slipskid"].setTranslation(math.clamp(getprop("/instrumentation/slip-skid-ball/indicated-slip-skid"), -7, 7) * -15, 0); + me["AI_bank"].setRotation(-roll * D2R); - if (fbw_law.getValue() == 0) { + if (getprop("/it-fbw/law") == 0) { me["AI_bank_lim"].show(); me["AI_pitch_lim"].show(); me["AI_bank_lim_X"].hide(); @@ -737,39 +667,33 @@ var canvas_PFD_base = { me["AI_pitch_lim_X"].show(); } - fd_roll_cur = fd_roll.getValue(); - fd_pitch_cur = fd_pitch.getValue(); - if (fd_roll_cur != nil) { - me["FD_roll"].setTranslation((fd_roll_cur) * 2.2, 0); + if (getprop("/it-autoflight/fd/roll-bar") != nil) { + me["FD_roll"].setTranslation((getprop("/it-autoflight/fd/roll-bar")) * 2.2, 0); } - if (fd_pitch_cur != nil) { - me["FD_pitch"].setTranslation(0, -(fd_pitch_cur) * 3.8); + if (getprop("/it-autoflight/fd/pitch-bar") != nil) { + me["FD_pitch"].setTranslation(0, -(getprop("/it-autoflight/fd/pitch-bar")) * 3.8); } - gear_agl_cur = gear_agl.getValue(); + me["AI_agl"].setText(sprintf("%s", math.round(getprop("/position/gear-agl-ft")))); - me["AI_agl"].setText(sprintf("%s", math.round(gear_agl_cur))); - - if (gear_agl_cur <= decision.getValue()) { + if (getprop("/position/gear-agl-ft") <= getprop("/instrumentation/mk-viii/inputs/arinc429/decision-height")) { me["AI_agl"].setColor(0.7333,0.3803,0); } else { me["AI_agl"].setColor(0.0509,0.7529,0.2941); } - if (gear_agl_cur <= 2500) { + if (getprop("/position/gear-agl-ft") <= 2500) { me["AI_agl"].show(); } else { me["AI_agl"].hide(); } - me["AI_agl_g"].setRotation(-roll_cur * D2R); + me["AI_agl_g"].setRotation(-roll * D2R); - FMGCphase_act = FMGCphase.getValue(); - if ((wow1.getValue() == 1 or wow2.getValue() == 1) and FMGCphase_act != 0 and FMGCphase_act != 1) { + if ((wow1 or wow2) and getprop("/FMGC/status/phase") != 0 and getprop("/FMGC/status/phase") != 1) { me["AI_stick"].show(); me["AI_stick_pos"].show(); - - } else if ((wow1.getValue() == 1 or wow2.getValue() == 1) and (FMGCphase_act == 0 or FMGCphase_act == 1) and (eng0_state.getValue() == 3 or eng1_state.getValue() == 3)) { + } else if ((wow1 or wow2) and (getprop("/FMGC/status/phase") == 0 or getprop("/FMGC/status/phase") == 1) and (getprop("/engines/engine[0]/state") == 3 or getprop("/engines/engine[1]/state") == 3)) { me["AI_stick"].show(); me["AI_stick_pos"].show(); } else { @@ -777,10 +701,10 @@ var canvas_PFD_base = { me["AI_stick_pos"].hide(); } - me["AI_stick_pos"].setTranslation(aileron_input.getValue() * 196.8, elevator_input.getValue() * 151.5); + me["AI_stick_pos"].setTranslation(getprop("/controls/flight/aileron-input-fast") * 196.8, getprop("/controls/flight/elevator-input-fast") * 151.5); # Altitude - me.altitude = altitude.getValue(); + me.altitude = getprop("/instrumentation/altimeter/indicated-altitude-ft"); me.altOffset = me.altitude / 500 - int(me.altitude / 500); me.middleAltText = roundaboutAlt(me.altitude / 100); me.middleAltOffset = nil; @@ -797,40 +721,38 @@ var canvas_PFD_base = { me["ALT_two"].setText(sprintf("%03d", abs(me.middleAltText-5))); me["ALT_one"].setText(sprintf("%03d", abs(me.middleAltText-10))); - me["ALT_digits"].setText(sprintf("%s", altitude_pfd.getValue())); - altTens = num(right(sprintf("%02d", altitude.getValue()), 2)); + me["ALT_digits"].setText(sprintf("%s", getprop("/instrumentation/altimeter/indicated-altitude-ft-pfd"))); + altTens = num(right(sprintf("%02d", getprop("/instrumentation/altimeter/indicated-altitude-ft")), 2)); me["ALT_tens"].setTranslation(0, altTens * 1.392); - ap_alt_cur = ap_alt.getValue(); - alt_diff_cur = alt_diff.getValue(); - if (alt_diff_cur >= -565 and alt_diff_cur <= 565) { - me["ALT_target"].setTranslation(0, (alt_diff_cur / 100) * -48.66856); - me["ALT_target_digit"].setText(sprintf("%03d", math.round(ap_alt_cur / 100))); + if (getprop("/instrumentation/pfd/alt-diff") >= -565 and getprop("/instrumentation/pfd/alt-diff") <= 565) { + me["ALT_target"].setTranslation(0, (getprop("/instrumentation/pfd/alt-diff") / 100) * -48.66856); + me["ALT_target_digit"].setText(sprintf("%03d", math.round(getprop("/it-autoflight/internal/alt") / 100))); me["ALT_digit_UP"].hide(); me["ALT_digit_DN"].hide(); me["ALT_target"].show(); - } else if (alt_diff_cur < -565) { - if (alt_std_mode.getValue() == 1) { - if (ap_alt_cur < 10000) { - me["ALT_digit_DN"].setText(sprintf("%s", "FL " ~ ap_alt_cur / 100)); + } else if (getprop("/instrumentation/pfd/alt-diff") < -565) { + if (getprop("/modes/altimeter/std") == 1) { + if (getprop("/it-autoflight/internal/alt") < 10000) { + me["ALT_digit_DN"].setText(sprintf("%s", "FL " ~ getprop("/it-autoflight/internal/alt") / 100)); } else { - me["ALT_digit_DN"].setText(sprintf("%s", "FL " ~ ap_alt_cur / 100)); + me["ALT_digit_DN"].setText(sprintf("%s", "FL " ~ getprop("/it-autoflight/internal/alt") / 100)); } } else { - me["ALT_digit_DN"].setText(sprintf("%5.0f", ap_alt_cur)); + me["ALT_digit_DN"].setText(sprintf("%5.0f", getprop("/it-autoflight/internal/alt"))); } me["ALT_digit_DN"].show(); me["ALT_digit_UP"].hide(); me["ALT_target"].hide(); - } else if (alt_diff_cur > 565) { - if (alt_std_mode.getValue() == 1) { - if (ap_alt_cur < 10000) { - me["ALT_digit_UP"].setText(sprintf("%s", "FL " ~ ap_alt_cur / 100)); + } else if (getprop("/instrumentation/pfd/alt-diff") > 565) { + if (getprop("/modes/altimeter/std") == 1) { + if (getprop("/it-autoflight/internal/alt") < 10000) { + me["ALT_digit_UP"].setText(sprintf("%s", "FL " ~ getprop("/it-autoflight/internal/alt") / 100)); } else { - me["ALT_digit_UP"].setText(sprintf("%s", "FL " ~ ap_alt_cur / 100)); + me["ALT_digit_UP"].setText(sprintf("%s", "FL " ~ getprop("/it-autoflight/internal/alt") / 100)); } } else { - me["ALT_digit_UP"].setText(sprintf("%5.0f", ap_alt_cur)); + me["ALT_digit_UP"].setText(sprintf("%5.0f", getprop("/it-autoflight/internal/alt"))); } me["ALT_digit_UP"].show(); me["ALT_digit_DN"].hide(); @@ -838,30 +760,29 @@ var canvas_PFD_base = { } # Vertical Speed - me["VS_pointer"].setRotation(vs_needle.getValue() * D2R); + me["VS_pointer"].setRotation(getprop("/instrumentation/pfd/vs-needle") * D2R); - me["VS_box"].setTranslation(0, vs_digit.getValue()); + me["VS_box"].setTranslation(0, getprop("/instrumentation/pfd/vs-digit-trans")); - var vs_pfd_cur = ap_vs_pfd.getValue(); - if (vs_pfd_cur < 2) { + if (getprop("/it-autoflight/internal/vert-speed-fpm-pfd") < 2) { me["VS_box"].hide(); } else { me["VS_box"].show(); } - if (vs_pfd_cur < 10) { - me["VS_digit"].setText(sprintf("%02d", "0" ~ vs_pfd_cur)); + if (getprop("/it-autoflight/internal/vert-speed-fpm-pfd") < 10) { + me["VS_digit"].setText(sprintf("%02d", "0" ~ getprop("/it-autoflight/internal/vert-speed-fpm-pfd"))); } else { - me["VS_digit"].setText(sprintf("%02d", vs_pfd_cur)); + me["VS_digit"].setText(sprintf("%02d", getprop("/it-autoflight/internal/vert-speed-fpm-pfd"))); } # ILS - me["LOC_pointer"].setTranslation(loc.getValue() * 197, 0); + me["LOC_pointer"].setTranslation(getprop("/instrumentation/nav[0]/heading-needle-deflection-norm") * 197, 0); - me["GS_pointer"].setTranslation(0, gs.getValue() * -197); + me["GS_pointer"].setTranslation(0, getprop("/instrumentation/nav[0]/gs-needle-deflection-norm") * -197); # Heading - me.heading = hdg_scale.getValue(); + me.heading = getprop("/instrumentation/pfd/heading-scale"); me.headOffset = me.heading / 10 - int(me.heading / 10); me.middleText = roundabout(me.heading / 10); me.middleOffset = nil; @@ -897,20 +818,18 @@ var canvas_PFD_base = { me["HDG_seven"].setFontSize(fontSizeHDG(me.rightText3), 1); me["HDG_one"].setFontSize(fontSizeHDG(me.leftText3), 1); - show_hdg_act = show_hdg.getValue(); - hdg_diff_act = hdg_diff.getValue(); - if (show_hdg_act == 1 and hdg_diff_act >= -23.62 and hdg_diff_act <= 23.62) { - me["HDG_target"].setTranslation((hdg_diff_act / 10) * 98.5416, 0); + if (getprop("/it-autoflight/custom/show-hdg") == 1 and getprop("/instrumentation/pfd/hdg-diff") >= -23.62 and getprop("/instrumentation/pfd/hdg-diff") <= 23.62) { + me["HDG_target"].setTranslation((getprop("/instrumentation/pfd/hdg-diff") / 10) * 98.5416, 0); me["HDG_digit_L"].hide(); me["HDG_digit_R"].hide(); me["HDG_target"].show(); - } else if (show_hdg_act == 1 and hdg_diff_act < -23.62 and hdg_diff_act >= -180) { - me["HDG_digit_L"].setText(sprintf("%3.0f", ap_hdg.getValue())); + } else if (getprop("/it-autoflight/custom/show-hdg") == 1 and getprop("/instrumentation/pfd/hdg-diff") < -23.62 and getprop("/instrumentation/pfd/hdg-diff") >= -180) { + me["HDG_digit_L"].setText(sprintf("%3.0f", getprop("/it-autoflight/input/hdg"))); me["HDG_digit_L"].show(); me["HDG_digit_R"].hide(); me["HDG_target"].hide(); - } else if (show_hdg_act == 1 and hdg_diff_act > 23.62 and hdg_diff_act <= 180) { - me["HDG_digit_R"].setText(sprintf("%3.0f", ap_hdg.getValue())); + } else if (getprop("/it-autoflight/custom/show-hdg") == 1 and getprop("/instrumentation/pfd/hdg-diff") > 23.62 and getprop("/instrumentation/pfd/hdg-diff") <= 180) { + me["HDG_digit_R"].setText(sprintf("%3.0f", getprop("/it-autoflight/input/hdg"))); me["HDG_digit_R"].show(); me["HDG_digit_L"].hide(); me["HDG_target"].hide(); @@ -920,13 +839,13 @@ var canvas_PFD_base = { me["HDG_target"].hide(); } - me["TRK_pointer"].setTranslation((track_diff.getValue() / 10) * 98.5416, 0); + me["TRK_pointer"].setTranslation((getprop("/instrumentation/pfd/track-hdg-diff") / 10) * 98.5416, 0); me["CRS_pointer"].hide(); # AI HDG - me.AI_horizon_hdg_trans.setTranslation(me.middleOffset, horizon_pitch.getValue() * 11.825); - me.AI_horizon_hdg_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter()); + me.AI_horizon_hdg_trans.setTranslation(me.middleOffset, getprop("/instrumentation/pfd/horizon-pitch") * 11.825); + me.AI_horizon_hdg_rot.setRotation(-roll * D2R, me["AI_center"].getCenter()); me["AI_heading"].update(); }, }; @@ -939,16 +858,17 @@ var canvas_PFD_1 = { return m; }, update: func() { - fd1_act = fd1.getValue(); - pitch_mode_cur = pitch_mode.getValue(); - roll_mode_cur = roll_mode.getValue(); - pitch_cur = pitch.getValue(); - roll_cur = roll.getValue(); - wow1_act = wow1.getValue(); - wow2_act = wow2.getValue(); + fd1 = getprop("/it-autoflight/output/fd1"); + fd2 = getprop("/it-autoflight/output/fd2"); + pitch_mode = getprop("/modes/pfd/fma/pitch-mode"); + roll_mode = getprop("/modes/pfd/fma/roll-mode"); + pitch = getprop("/orientation/pitch-deg"); + roll = getprop("/orientation/roll-deg"); + wow1 = getprop("/gear/gear[1]/wow"); + wow2 = getprop("/gear/gear[2]/wow"); # Errors - if ((adirs0_active.getValue() == 1) or (air_switch.getValue() == -1 and adirs2_active.getValue() == 1)) { + if ((getprop("/instrumentation/adirs/adr[0]/active") == 1) or (getprop("/controls/switching/AIRDATA") == -1 and getprop("/instrumentation/adirs/adr[2]/active") == 1)) { me["ASI_group"].show(); me["ALT_group"].show(); me["ALT_group2"].show(); @@ -972,7 +892,7 @@ var canvas_PFD_1 = { me["VS_group"].hide(); } - if ((ir0_aligned.getValue() == 1) or (ir2_aligned.getValue() == 1 and att_switch.getValue() == -1)) { + if ((getprop("/instrumentation/adirs/ir[0]/aligned") == 1) or (getprop("/instrumentation/adirs/ir[2]/aligned") == 1 and getprop("/controls/switching/ATTHDG") == -1)) { me["AI_group"].show(); me["HDG_group"].show(); me["AI_error"].hide(); @@ -987,20 +907,20 @@ var canvas_PFD_1 = { } # FD - if (fd1_act == 1 and ((!wow1_act and !wow2_act and roll_mode_cur != " ") or roll_mode_cur != " ") and ap_trk_sw.getValue() == 0 and pitch_cur < 25 and pitch_cur > -13 and roll_cur < 45 and roll_cur > -45) { + if (fd1 == 1 and ((!wow1 and !wow2 and roll_mode != " ") or roll_mode != " ") and getprop("/it-autoflight/custom/trk-fpa") == 0 and pitch < 25 and pitch > -13 and roll < 45 and roll > -45) { me["FD_roll"].show(); } else { me["FD_roll"].hide(); } - if (fd1_act == 1 and ((!wow1_act and !wow2_act and pitch_mode_cur != " ") or pitch_mode_cur != " ") and ap_trk_sw.getValue() == 0 and pitch_cur < 25 and pitch_cur > -13 and roll_cur < 45 and roll_cur > -45) { + if (fd1 == 1 and ((!wow1 and !wow2 and pitch_mode != " ") or pitch_mode != " ") and getprop("/it-autoflight/custom/trk-fpa") == 0 and pitch < 25 and pitch > -13 and roll < 45 and roll > -45) { me["FD_pitch"].show(); } else { me["FD_pitch"].hide(); } # ILS - if (ap_ils_mode.getValue() == 1) { + if (getprop("/modes/pfd/ILS1") == 1) { me["LOC_scale"].show(); me["GS_scale"].show(); } else { @@ -1008,12 +928,12 @@ var canvas_PFD_1 = { me["GS_scale"].hide(); } - if (ap_ils_mode.getValue() == 1 and loc_in_range.getValue() == 1 and hasloc.getValue() == 1 and nav0_signalq.getValue() > 0.99) { + if (getprop("/modes/pfd/ILS1") == 1 and getprop("/instrumentation/nav[0]/in-range") == 1 and getprop("/instrumentation/nav[0]/nav-loc") == 1 and getprop("/instrumentation/nav[0]/signal-quality-norm") > 0.99) { me["LOC_pointer"].show(); } else { me["LOC_pointer"].hide(); } - if (ap_ils_mode.getValue() == 1 and gs_in_range.getValue() == 1 and hasgs.getValue() == 1 and nav0_signalq.getValue() > 0.99) { + if (getprop("/modes/pfd/ILS1") == 1 and getprop("/instrumentation/nav[0]/gs-in-range") == 1 and getprop("/instrumentation/nav[0]/has-gs") == 1 and getprop("/instrumentation/nav[0]/signal-quality-norm") > 0.99) { me["GS_pointer"].show(); } else { me["GS_pointer"].hide(); @@ -1034,16 +954,17 @@ var canvas_PFD_2 = { return m; }, update: func() { - fd2_act = fd2.getValue(); - pitch_mode_cur = pitch_mode.getValue(); - roll_mode_cur = roll_mode.getValue(); - pitch_cur = pitch.getValue(); - roll_cur = roll.getValue(); - wow1_act = wow1.getValue(); - wow2_act = wow2.getValue(); + fd1 = getprop("/it-autoflight/output/fd1"); + fd2 = getprop("/it-autoflight/output/fd2"); + pitch_mode = getprop("/modes/pfd/fma/pitch-mode"); + roll_mode = getprop("/modes/pfd/fma/roll-mode"); + pitch = getprop("/orientation/pitch-deg"); + roll = getprop("/orientation/roll-deg"); + wow1 = getprop("/gear/gear[1]/wow"); + wow2 = getprop("/gear/gear[2]/wow"); # Errors - if ((adirs1_active.getValue() == 1) or (air_switch.getValue() == 1 and adirs2_active.getValue() == 1)) { + if ((getprop("/instrumentation/adirs/adr[1]/active") == 1) or (getprop("/controls/switching/AIRDATA") == 1 and getprop("/instrumentation/adirs/adr[2]/active") == 1)) { me["ASI_group"].show(); me["ALT_group"].show(); me["ALT_group2"].show(); @@ -1067,7 +988,7 @@ var canvas_PFD_2 = { me["VS_group"].hide(); } - if ((ir1_aligned.getValue() == 1) or (ir2_aligned.getValue() == 1 and att_switch.getValue() == 1)) { + if ((getprop("/instrumentation/adirs/ir[1]/aligned") == 1) or (getprop("/instrumentation/adirs/ir[2]/aligned") == 1 and getprop("/controls/switching/ATTHDG") == 1)) { me["AI_group"].show(); me["HDG_group"].show(); me["AI_error"].hide(); @@ -1082,20 +1003,20 @@ var canvas_PFD_2 = { } # FD - if (fd2_act == 1 and ((!wow1_act and !wow2_act and roll_mode_cur != " ") or roll_mode_cur != " ") and ap_trk_sw.getValue() == 0 and pitch_cur < 25 and pitch_cur > -13 and roll_cur < 45 and roll_cur > -45) { + if (fd2 == 1 and ((!wow1 and !wow2 and roll_mode != " ") or roll_mode != " ") and getprop("/it-autoflight/custom/trk-fpa") == 0 and pitch < 25 and pitch > -13 and roll < 45 and roll > -45) { me["FD_roll"].show(); } else { me["FD_roll"].hide(); } - if (fd2_act == 1 and ((!wow1_act and !wow2_act and pitch_mode_cur != " ") or pitch_mode_cur != " ") and ap_trk_sw.getValue() == 0 and pitch_cur < 25 and pitch_cur > -13 and roll_cur < 45 and roll_cur > -45) { + if (fd2 == 1 and ((!wow1 and !wow2 and pitch_mode != " ") or pitch_mode != " ") and getprop("/it-autoflight/custom/trk-fpa") == 0 and pitch < 25 and pitch > -13 and roll < 45 and roll > -45) { me["FD_pitch"].show(); } else { me["FD_pitch"].hide(); } # ILS - if (ap_ils_mode2.getValue() == 1) { + if (getprop("/modes/pfd/ILS2") == 1) { me["LOC_scale"].show(); me["GS_scale"].show(); } else { @@ -1103,12 +1024,12 @@ var canvas_PFD_2 = { me["GS_scale"].hide(); } - if (ap_ils_mode2.getValue() == 1 and loc_in_range.getValue() == 1 and hasloc.getValue() == 1 and nav0_signalq.getValue() > 0.99) { + if (getprop("/modes/pfd/ILS2") == 1 and getprop("/instrumentation/nav[0]/in-range") == 1 and getprop("/instrumentation/nav[0]/nav-loc") == 1 and getprop("/instrumentation/nav[0]/signal-quality-norm") > 0.99) { me["LOC_pointer"].show(); } else { me["LOC_pointer"].hide(); } - if (ap_ils_mode2.getValue() == 1 and gs_in_range.getValue() == 1 and hasgs.getValue() == 1 and nav0_signalq.getValue() > 0.99) { + if (getprop("/modes/pfd/ILS2") == 1 and getprop("/instrumentation/nav[0]/gs-in-range") == 1 and getprop("/instrumentation/nav[0]/has-gs") == 1 and getprop("/instrumentation/nav[0]/signal-quality-norm") > 0.99) { me["GS_pointer"].show(); } else { me["GS_pointer"].hide(); @@ -1148,14 +1069,10 @@ var canvas_PFD_1_test = { return ["Test_white","Test_text"]; }, update: func() { - et = elapsedtime.getValue() or 0; - if ((du1_test_time.getValue() + 1 >= et) and cpt_du_xfr.getValue() != 1) { + if (getprop("/instrumentation/du/du1-test-time") + 1 >= elapsedtime and getprop("/modes/cpt-du-xfr") != 1) { me["Test_white"].show(); me["Test_text"].hide(); - } else if ((du2_test_time.getValue() + 1 >= et) and cpt_du_xfr.getValue() != 0) { - print(du2_test_time.getValue()); - print(elapsedtime.getValue()); - print(cpt_du_xfr.getValue()); + } else if (getprop("/instrumentation/du/du2-test-time") + 1 >= elapsedtime and getprop("/modes/cpt-du-xfr") == 1) { me["Test_white"].show(); me["Test_text"].hide(); } else { @@ -1192,11 +1109,10 @@ var canvas_PFD_2_test = { return ["Test_white","Test_text"]; }, update: func() { - et = elapsedtime.getValue() or 0; - if ((du6_test_time.getValue() + 1 >= et) and fo_du_xfr.getValue() != 1) { + if (getprop("/instrumentation/du/du6-test-time") + 1 >= elapsedtime and getprop("/modes/fo-du-xfr") != 1) { me["Test_white"].show(); me["Test_text"].hide(); - } else if ((du5_test_time.getValue() + 1 >= et) and fo_du_xfr.getValue() != 0) { + } else if (getprop("/instrumentation/du/du5-test-time") + 1 >= elapsedtime and getprop("/modes/fo-du-xfr") == 1) { me["Test_white"].show(); me["Test_text"].hide(); } else { @@ -1233,7 +1149,7 @@ var canvas_PFD_1_mismatch = { return ["ERRCODE"]; }, update: func() { - me["ERRCODE"].setText(acconfig_mismatch.getValue()); + me["ERRCODE"].setText(getprop("/systems/acconfig/mismatch-code")); }, }; @@ -1264,7 +1180,7 @@ var canvas_PFD_2_mismatch = { return ["ERRCODE"]; }, update: func() { - me["ERRCODE"].setText(acconfig_mismatch.getValue()); + me["ERRCODE"].setText(getprop("/systems/acconfig/mismatch-code")); }, }; @@ -1299,15 +1215,14 @@ setlistener("sim/signals/fdm-initialized", func { PFD_update.start(); PFD_update_fast.start(); - - if (pfdrate.getValue() == 1) { + if (getprop("/systems/acconfig/options/pfd-rate") > 1) { rateApply(); } }); var rateApply = func { - PFD_update.restart(0.15 * pfdrate.getValue()); - PFD_update_fast.restart(0.05 * pfdrate.getValue()); + PFD_update.restart(0.15 * getprop("/systems/acconfig/options/pfd-rate")); + PFD_update_fast.restart(0.05 * getprop("/systems/acconfig/options/pfd-rate")); } var PFD_update = maketimer(0.15, func { diff --git a/revision.txt b/revision.txt index 0f166631..3231dc6f 100644 --- a/revision.txt +++ b/revision.txt @@ -1 +1 @@ -4640 \ No newline at end of file +4641 \ No newline at end of file From 0a96b4e1f15e66f2bd3a465ae4367072c3b31231 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Tue, 18 Sep 2018 20:09:27 +0100 Subject: [PATCH 2/5] PFD: props.nas redo --- Models/Instruments/PFD/PFD.nas | 646 +++++++++++++++++++-------------- revision.txt | 2 +- 2 files changed, 366 insertions(+), 282 deletions(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index e68b8cdf..c4827781 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -22,62 +22,131 @@ var ASItrgtdiff = 0; var ASImax = 0; var ASItrend = 0; var altTens = 0; -var state1 = getprop("/systems/thrust/state1"); -var state2 = getprop("/systems/thrust/state2"); -var ap1 = getprop("/it-autoflight/output/ap1"); -var ap2 = getprop("/it-autoflight/output/ap2"); -var fd1 = getprop("/it-autoflight/output/fd1"); -var fd2 = getprop("/it-autoflight/output/fd2"); -var athr = getprop("/it-autoflight/output/athr"); -var throttle_mode = getprop("/modes/pfd/fma/throttle-mode"); -var pitch_mode = getprop("/modes/pfd/fma/pitch-mode"); -var pitch_mode_armed = getprop("/modes/pfd/fma/pitch-mode-armed"); -var pitch_mode2_armed = getprop("/modes/pfd/fma/pitch-mode2-armed"); -var roll_mode = getprop("/modes/pfd/fma/roll-mode"); -var roll_mode_armed = getprop("/modes/pfd/fma/roll-mode-armed"); -var thr1 = getprop("/controls/engines/engine[0]/throttle-pos"); -var thr2 = getprop("/controls/engines/engine[1]/throttle-pos"); -var wow1 = getprop("/gear/gear[1]/wow"); -var wow2 = getprop("/gear/gear[2]/wow"); -var pitch = 0; -var roll = 0; -setprop("/instrumentation/pfd/vs-needle", 0); -setprop("/instrumentation/pfd/vs-digit-trans", 0); -setprop("/it-autoflight/input/spd-managed", 0); -setprop("/FMGC/internal/target-ias-pfd", 0); -setprop("/it-autoflight/output/ap1", 0); -setprop("/it-autoflight/output/ap2", 0); -setprop("/it-autoflight/output/fd1", 0); -setprop("/it-autoflight/output/fd2", 0); -setprop("/it-autoflight/output/athr", 0); -setprop("/instrumentation/pfd/alt-diff", 0); -setprop("/instrumentation/pfd/heading-deg", 0); -setprop("/instrumentation/pfd/horizon-pitch", 0); -setprop("/instrumentation/pfd/horizon-ground", 0); -setprop("/instrumentation/pfd/hdg-diff", 0); -setprop("/instrumentation/pfd/heading-scale", 0); -setprop("/instrumentation/pfd/track-deg", 0); -setprop("/instrumentation/pfd/track-hdg-diff", 0); -setprop("/instrumentation/pfd/speed-lookahead", 0); -setprop("/instrumentation/du/du1-test", 0); -setprop("/instrumentation/du/du1-test-time", 0); -setprop("/instrumentation/du/du1-test-amount", 0); -setprop("/instrumentation/du/du6-test", 0); -setprop("/instrumentation/du/du6-test-time", 0); -setprop("/instrumentation/du/du6-test-amount", 0); -setprop("/it-autoflight/internal/vert-speed-fpm-pfd", 0); -setprop("/position/gear-agl-ft", 0); -setprop("/controls/flight/aileron-input-fast", 0); -setprop("/controls/flight/elevator-input-fast", 0); -setprop("/instrumentation/adirs/adr[0]/active", 0); -setprop("/instrumentation/adirs/adr[1]/active", 0); -setprop("/instrumentation/adirs/adr[2]/active", 0); -setprop("/instrumentation/adirs/ir[0]/aligned", 0); -setprop("/instrumentation/adirs/ir[1]/aligned", 0); -setprop("/instrumentation/adirs/ir[2]/aligned", 0); -setprop("/controls/switching/ATTHDG", 0); -setprop("/controls/switching/AIRDATA", 0); +# Fetch nodes: +var state1 = props.globals.getNode("/systems/thrust/state1", 1); +var state2 = props.globals.getNode("/systems/thrust/state2", 1); +var throttle_mode = props.globals.getNode("/modes/pfd/fma/throttle-mode", 1); +var pitch_mode = props.globals.getNode("/modes/pfd/fma/pitch-mode", 1); +var pitch_mode_armed = props.globals.getNode("/modes/pfd/fma/pitch-mode-armed", 1); +var pitch_mode2_armed = props.globals.getNode("/modes/pfd/fma/pitch-mode2-armed", 1); +var pitch_mode_armed_box = props.globals.getNode("/modes/pfd/fma/pitch-mode-armed-box", 1); +var pitch_mode2_armed_box = props.globals.getNode("/modes/pfd/fma/pitch-mode2-armed-box", 1); +var roll_mode = props.globals.getNode("/modes/pfd/fma/roll-mode", 1); +var roll_mode_armed = props.globals.getNode("/modes/pfd/fma/roll-mode-armed", 1); +var roll_mode_box = props.globals.getNode("/modes/pfd/fma/roll-mode-box", 1); +var roll_mode_armed_box = props.globals.getNode("/modes/pfd/fma/roll-mode-armed-box", 1); +var thr1 = props.globals.getNode("/controls/engines/engine[0]/throttle-pos", 1); +var thr2 = props.globals.getNode("/controls/engines/engine[1]/throttle-pos", 1); +var wow1 = props.globals.getNode("/gear/gear[1]/wow", 1); +var wow2 = props.globals.getNode("/gear/gear[2]/wow", 1); +var pitch = props.globals.getNode("/orientation/pitch-deg", 1); +var roll = props.globals.getNode("/orientation/roll-deg", 1); +var elapsedtime = props.globals.getNode("/sim/time/elapsed-sec", 1); +var acess = props.globals.getNode("/systems/electrical/bus/ac-ess", 1); +var ac2 = props.globals.getNode("/systems/electrical/bus/ac2", 1); +var du1_lgt = props.globals.getNode("/controls/lighting/DU/du1", 1); +var du6_lgt = props.globals.getNode("/controls/lighting/DU/du6", 1); +var acconfig = props.globals.getNode("/systems/acconfig/autoconfig-running", 1); +var acconfig_mismatch = props.globals.getNode("/systems/acconfig/mismatch-code", 1); +var cpt_du_xfr = props.globals.getNode("/modes/cpt-du-xfr", 1); +var fo_du_xfr = props.globals.getNode("/modes/fo-du-xfr", 1); +var eng_out = props.globals.getNode("/systems/thrust/eng-out", 1); +var eng0_state = props.globals.getNode("/engines/engine[0]/state", 1); +var eng1_state = props.globals.getNode("/engines/engine[1]/state", 1); +var alpha_floor = props.globals.getNode("/systems/thrust/alpha-floor", 1); +var toga_lk = props.globals.getNode("/systems/thrust/toga-lk", 1); +var thrust_limit = props.globals.getNode("/controls/engines/thrust-limit", 1); +var flex = props.globals.getNode("/FMGC/internal/flex", 1); +var lvr_clb = props.globals.getNode("/systems/thrust/lvrclb", 1); +var throt_box = props.globals.getNode("/modes/pfd/fma/throttle-mode-box", 1); +var pitch_box = props.globals.getNode("/modes/pfd/fma/pitch-mode-box", 1); +var ap_box = props.globals.getNode("/modes/pfd/fma/ap-mode-box", 1); +var fd_box = props.globals.getNode("/modes/pfd/fma/fd-mode-box", 1); +var at_box = props.globals.getNode("/modes/pfd/fma/athr-mode-box", 1); +var fbw_law = props.globals.getNode("/it-fbw/law", 1); +var ap_mode = props.globals.getNode("/modes/pfd/fma/ap-mode", 1); +var fd_mode = props.globals.getNode("/modes/pfd/fma/fd-mode", 1); +var at_mode = props.globals.getNode("/modes/pfd/fma/at-mode", 1); +var alt_std_mode = props.globals.getNode("/modes/altimeter/std", 1); +var alt_inhg_mode = props.globals.getNode("/modes/altimeter/inhg", 1); +var alt_hpa = props.globals.getNode("/instrumentation/altimeter/setting-hpa", 1); +var alt_inhg = props.globals.getNode("/instrumentation/altimeter/setting-inhg", 1); +var altitude = props.globals.getNode("/instrumentation/altimeter/indicated-altitude-ft", 1); +var altitude_pfd = props.globals.getNode("/instrumentation/altimeter/indicated-altitude-ft-pfd", 1); +var alt_diff = props.globals.getNode("/instrumentation/pfd/alt-diff", 1); +var ap_alt = props.globals.getNode("/it-autoflight/internal/alt", 1); +var vs_needle = props.globals.getNode("/instrumentation/pfd/vs-needle", 1); +var vs_digit = props.globals.getNode("/instrumentation/pfd/vs-digit-trans", 1); +var ap_vs_pfd = props.globals.getNode("/it-autoflight/internal/vert-speed-fpm-pfd", 1); +var athr_arm = props.globals.getNode("/modes/pfd/fma/athr-armed", 1); +var FMGC_max_spd = props.globals.getNode("/FMGC/internal/maxspeed", 1); +var ind_spd_kt = props.globals.getNode("/instrumentation/airspeed-indicator/indicated-speed-kt", 1); +var ind_spd_mach = props.globals.getNode("/instrumentation/airspeed-indicator/indicated-mach", 1); +var at_mach_mode = props.globals.getNode("/it-autoflight/input/kts-mach", 1); +var at_input_spd_mach = props.globals.getNode("/it-autoflight/input/spd-mach", 1); +var at_input_spd_kts = props.globals.getNode("/it-autoflight/input/spd-kts", 1); +var fd_roll = props.globals.getNode("/it-autoflight/fd/roll-bar", 1); +var fd_pitch = props.globals.getNode("/it-autoflight/fd/pitch-bar", 1); +var decision = props.globals.getNode("/instrumentation/mk-viii/inputs/arinc429/decision-height", 1); +var skid_slip = props.globals.getNode("/instrumentation/slip-skid-ball/indicated-slip-skid", 1); +var FMGCphase = props.globals.getNode("/FMGC/status/phase", 1); +var loc = props.globals.getNode("/instrumentation/nav[0]/heading-needle-deflection-norm", 1); +var gs = props.globals.getNode("/instrumentation/nav[0]/gs-needle-deflection-norm", 1); +var show_hdg = props.globals.getNode("/it-autoflight/custom/show-hdg", 1); +var ap_hdg = props.globals.getNode("/it-autoflight/input/hdg", 1); +var ap_trk_sw = props.globals.getNode("/it-autoflight/custom/trk-fpa", 1); +var ap_ils_mode = props.globals.getNode("/modes/pfd/ILS1", 1); +var ap_ils_mode2 = props.globals.getNode("/modes/pfd/ILS2", 1); +var loc_in_range = props.globals.getNode("/instrumentation/nav[0]/in-range", 1); +var gs_in_range = props.globals.getNode("/instrumentation/nav[0]/gs-in-range", 1); +var nav0_signalq = props.globals.getNode("/instrumentation/nav[0]/signal-quality-norm", 1); +var hasloc = props.globals.getNode("/instrumentation/nav[0]/nav-loc", 1); +var hasgs = props.globals.getNode("/instrumentation/nav[0]/has-gs", 1); +var pfdrate = props.globals.getNode("/systems/acconfig/options/pfd-rate", 1); +var managed_spd = props.globals.getNode("/it-autoflight/input/spd-managed", 1); +var at_tgt_ias = props.globals.getNode("/FMGC/internal/target-ias-pfd", 1); +var ap1 = props.globals.getNode("/it-autoflight/output/ap1", 1); +var ap2 = props.globals.getNode("/it-autoflight/output/ap2", 1); +var fd1 = props.globals.getNode("/it-autoflight/output/fd1", 1); +var fd2 = props.globals.getNode("/it-autoflight/output/fd2", 1); +var athr = props.globals.getNode("/it-autoflight/output/athr", 1); +var gear_agl = props.globals.getNode("/position/gear-agl-ft", 1); +var aileron_input = props.globals.getNode("/controls/flight/aileron-input-fast", 1); +var elevator_input = props.globals.getNode("/controls/flight/elevator-input-fast", 1); +var adirs0_active = props.globals.getNode("/instrumentation/adirs/adr[0]/active", 1); +var adirs1_active = props.globals.getNode("/instrumentation/adirs/adr[1]/active", 1); +var adirs2_active = props.globals.getNode("/instrumentation/adirs/adr[2]/active", 1); +var ir0_aligned = props.globals.getNode("/instrumentation/adirs/ir[0]/aligned", 1); +var ir1_aligned = props.globals.getNode("/instrumentation/adirs/ir[1]/aligned", 1); +var ir2_aligned = props.globals.getNode("/instrumentation/adirs/ir[2]/aligned", 1); +var att_switch = props.globals.getNode("/controls/switching/ATTHDG", 1); +var air_switch = props.globals.getNode("/controls/switching/AIRDATA", 1); + +# Create Nodes: +var vs_needle = props.globals.initNode("/instrumentation/pfd/vs-needle", 0.0, "DOUBLE"); +var vs_needle_trans = props.globals.initNode("/instrumentation/pfd/vs-digit-trans", 0.0, "DOUBLE"); +var alt_diff = props.globals.initNode("/instrumentation/pfd/alt-diff", 0.0, "DOUBLE"); +var heading = props.globals.initNode("/instrumentation/pfd/heading-deg", 0.0, "DOUBLE"); +var horizon_pitch = props.globals.initNode("/instrumentation/pfd/horizon-pitch", 0.0, "DOUBLE"); +var horizon_ground = props.globals.initNode("/instrumentation/pfd/horizon-ground", 0.0, "DOUBLE"); +var hdg_diff = props.globals.initNode("/instrumentation/pfd/hdg-diff", 0.0, "DOUBLE"); +var hdg_scale = props.globals.initNode("/instrumentation/pfd/heading-scale", 0.0, "DOUBLE"); +var track = props.globals.initNode("/instrumentation/pfd/track-deg", 0.0, "DOUBLE"); +var track_diff = props.globals.initNode("/instrumentation/pfd/track-hdg-diff", 0.0, "DOUBLE"); +var speed_pred = props.globals.initNode("/instrumentation/pfd/speed-lookahead", 0.0, "DOUBLE"); +var du1_test = props.globals.initNode("/instrumentation/du/du1-test", 0, "BOOL"); +var du1_test_time = props.globals.initNode("/instrumentation/du/du1-test-time", 0.0, "DOUBLE"); +var du1_test_amount = props.globals.initNode("/instrumentation/du/du1-test-amount", 0.0, "DOUBLE"); +var du2_test = props.globals.initNode("/instrumentation/du/du2-test", 0, "BOOL"); +var du2_test_time = props.globals.initNode("/instrumentation/du/du2-test-time", 0.0, "DOUBLE"); +var du2_test_amount = props.globals.initNode("/instrumentation/du/du2-test-amount", 0.0, "DOUBLE"); +var du5_test = props.globals.initNode("/instrumentation/du/du5-test", 0, "BOOL"); +var du5_test_time = props.globals.initNode("/instrumentation/du/du5-test-time", 0.0, "DOUBLE"); +var du5_test_amount = props.globals.initNode("/instrumentation/du/du5-test-amount", 0.0, "DOUBLE"); +var du6_test = props.globals.initNode("/instrumentation/du/du6-test", 0, "BOOL"); +var du6_test_time = props.globals.initNode("/instrumentation/du/du6-test-time", 0.0, "DOUBLE"); +var du6_test_amount = props.globals.initNode("/instrumentation/du/du6-test-amount", 0.0, "DOUBLE"); var canvas_PFD_base = { init: func(canvas_group, file) { var font_mapper = func(family, weight) { @@ -131,44 +200,45 @@ var canvas_PFD_base = { "TRK_pointer"]; }, update: func() { - elapsedtime = getprop("/sim/time/elapsed-sec"); - if (getprop("/systems/electrical/bus/ac-ess") >= 110) { - if (getprop("/systems/acconfig/autoconfig-running") != 1 and getprop("/instrumentation/du/du1-test") != 1) { - setprop("/instrumentation/du/du1-test", 1); - setprop("/instrumentation/du/du1-test-amount", math.round((rand() * 5 ) + 35, 0.1)); - setprop("/instrumentation/du/du1-test-time", getprop("/sim/time/elapsed-sec")); - } else if (getprop("/systems/acconfig/autoconfig-running") == 1 and getprop("/instrumentation/du/du1-test") != 1) { - setprop("/instrumentation/du/du1-test", 1); - setprop("/instrumentation/du/du1-test-amount", math.round((rand() * 5 ) + 35, 0.1)); - setprop("/instrumentation/du/du1-test-time", getprop("/sim/time/elapsed-sec") - 30); + elapsedtime_act = elapsedtime.getValue(); + if (acess.getValue() >= 110) { + if (acconfig.getValue() != 1 and du1_test.getValue() != 1) { + du1_test.setValue(1); + du1_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); + du1_test_time.setValue(elapsedtime_act); + } else if (acconfig.getValue() == 1 and du1_test.getValue() != 1) { + du1_test.setValue(1); + du1_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); + du1_test_time.setValue(elapsedtime_act - 30); } } else { - setprop("/instrumentation/du/du1-test", 0); - } - if (getprop("/systems/electrical/bus/ac2") >= 110) { - if (getprop("/systems/acconfig/autoconfig-running") != 1 and getprop("/instrumentation/du/du6-test") != 1) { - setprop("/instrumentation/du/du6-test", 1); - setprop("/instrumentation/du/du6-test-amount", math.round((rand() * 5 ) + 35, 0.1)); - setprop("/instrumentation/du/du6-test-time", getprop("/sim/time/elapsed-sec")); - } else if (getprop("/systems/acconfig/autoconfig-running") == 1 and getprop("/instrumentation/du/du6-test") != 1) { - setprop("/instrumentation/du/du6-test", 1); - setprop("/instrumentation/du/du6-test-amount", math.round((rand() * 5 ) + 35, 0.1)); - setprop("/instrumentation/du/du6-test-time", getprop("/sim/time/elapsed-sec") - 30); - } - } else { - setprop("/instrumentation/du/du6-test", 0); + du1_test.setValue(0); } - if (getprop("/systems/acconfig/mismatch-code") == "0x000") { + if (ac2.getValue() >= 110) { + if (acconfig.getValue != 1 and du6_test.getValue() != 1) { + du6_test.setValue(1); + du6_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); + du6_test_time.setValue(elapsedtime_act); + } else if (acconfig.getValue() == 1 and du6_test.getValue() != 1) { + du6_test.setValue(1); + du6_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); + du6_test_time.setValue(elapsedtime_act - 30); + } + } else { + du6_test.setValue(0); + } + + if (acconfig_mismatch.getValue() == "0x000") { PFD_1_mismatch.page.hide(); PFD_2_mismatch.page.hide(); - if (getprop("/systems/electrical/bus/ac-ess") >= 110 and getprop("/controls/lighting/DU/du1") > 0) { - if (getprop("/instrumentation/du/du1-test-time") + getprop("/instrumentation/du/du1-test-amount") >= elapsedtime and getprop("/modes/cpt-du-xfr") != 1) { + if (acess.getValue() >= 110 and du1_lgt.getValue() > 0) { + if (du1_test_time.getValue() + du1_test_amount.getValue() >= elapsedtime_act and cpt_du_xfr.getValue() != 1) { PFD_1_test.update(); updateL = 0; PFD_1.page.hide(); PFD_1_test.page.show(); - } else if (getprop("/instrumentation/du/du2-test-time") + getprop("/instrumentation/du/du2-test-amount") >= elapsedtime and getprop("/modes/cpt-du-xfr") == 1) { + } else if (du2_test_time.getValue() + du2_test_amount.getValue() >= elapsedtime_act and cpt_du_xfr.getValue() == 1) { PFD_1_test.update(); updateL = 0; PFD_1.page.hide(); @@ -185,13 +255,13 @@ var canvas_PFD_base = { PFD_1_test.page.hide(); PFD_1.page.hide(); } - if (getprop("/systems/electrical/bus/ac2") >= 110 and getprop("/controls/lighting/DU/du6") > 0) { - if (getprop("/instrumentation/du/du6-test-time") + getprop("/instrumentation/du/du6-test-amount") >= elapsedtime and getprop("/modes/fo-du-xfr") != 1) { + if (ac2.getValue() >= 110 and du6_lgt.getValue() > 0) { + if (du6_test_time.getValue() + du6_test_amount.getValue() >= elapsedtime_act and fo_du_xfr.getValue() != 1) { PFD_2_test.update(); updateR = 0; PFD_2.page.hide(); PFD_2_test.page.show(); - } else if (getprop("/instrumentation/du/du5-test-time") + getprop("/instrumentation/du/du5-test-amount") >= elapsedtime and getprop("/modes/fo-du-xfr") == 1) { + } else if (du5_test_time.getValue() + du5_test_amount.getValue() >= elapsedtime_act and fo_du_xfr.getValue() == 1) { PFD_2_test.update(); updateR = 0; PFD_2.page.hide(); @@ -230,81 +300,69 @@ var canvas_PFD_base = { } }, updateCommon: func () { - state1 = getprop("/systems/thrust/state1"); - state2 = getprop("/systems/thrust/state2"); - ap1 = getprop("/it-autoflight/output/ap1"); - ap2 = getprop("/it-autoflight/output/ap2"); - fd1 = getprop("/it-autoflight/output/fd1"); - fd2 = getprop("/it-autoflight/output/fd2"); - athr = getprop("/it-autoflight/output/athr"); - throttle_mode = getprop("/modes/pfd/fma/throttle-mode"); - pitch_mode = getprop("/modes/pfd/fma/pitch-mode"); - pitch_mode_armed = getprop("/modes/pfd/fma/pitch-mode-armed"); - pitch_mode2_armed = getprop("/modes/pfd/fma/pitch-mode2-armed"); - roll_mode = getprop("/modes/pfd/fma/roll-mode"); - roll_mode_armed = getprop("/modes/pfd/fma/roll-mode-armed"); - thr1 = getprop("/controls/engines/engine[0]/throttle-pos"); - thr2 = getprop("/controls/engines/engine[1]/throttle-pos"); - pitch = getprop("/orientation/pitch-deg"); - roll = getprop("/orientation/roll-deg"); - wow1 = getprop("/gear/gear[1]/wow"); - wow2 = getprop("/gear/gear[2]/wow"); - # FMA MAN TOGA MCT FLX THR - if (athr == 1 and (state1 == "TOGA" or state1 == "MCT" or state1 == "MAN THR" or state2 == "TOGA" or state2 == "MCT" or state2 == "MAN THR") and getprop("/systems/thrust/eng-out") != 1 and getprop("/systems/thrust/alpha-floor") != 1 and - getprop("/systems/thrust/toga-lk") != 1) { + # Set properties used a lot to a variable to avoid calling getValue() multiple times + state1_act = state1.getValue(); + state2_act = state2.getValue(); + thrust_limit_act = thrust_limit.getValue(); + alpha_floor_act = alpha_floor.getValue(); + toga_lk_act = toga_lk.getValue(); + thr1_act = thr1.getValue(); + thr2_act = thr2.getValue(); + if (athr.getValue() == 1 and (state1_act == "TOGA" or state1_act == "MCT" or state1_act == "MAN THR" or state2_act == "TOGA" or state2_act == "MCT" or state2_act == "MAN THR") and eng_out.getValue() != 1 and alpha_floor_act != 1 and + toga_lk_act != 1) { me["FMA_man"].show(); me["FMA_manmode"].show(); - if (state1 == "TOGA" or state2 == "TOGA") { + if (state1_act == "TOGA" or state2_act == "TOGA") { me["FMA_flx_box"].hide(); me["FMA_flxtemp"].hide(); me["FMA_man_box"].show(); me["FMA_manmode"].setText("TOGA"); me["FMA_man_box"].setColor(0.8078,0.8039,0.8078); - } else if ((state1 == "MAN THR" and thr1 >= 0.83) or (state2 == "MAN THR" and thr2 >= 0.83)) { + } else if ((state1_act == "MAN THR" and thr1_act >= 0.83) or (state2_act == "MAN THR" and thr2_act >= 0.83)) { me["FMA_flx_box"].hide(); me["FMA_flxtemp"].hide(); me["FMA_man_box"].show(); me["FMA_manmode"].setText("THR"); me["FMA_man_box"].setColor(0.7333,0.3803,0); - } else if ((state1 == "MCT" or state2 == "MCT") and getprop("/controls/engines/thrust-limit") != "FLX") { + } else if ((state1_act == "MCT" or state2_act == "MCT") and thrust_limit_act != "FLX") { me["FMA_flx_box"].hide(); me["FMA_flxtemp"].hide(); me["FMA_man_box"].show(); me["FMA_manmode"].setText("MCT"); me["FMA_man_box"].setColor(0.8078,0.8039,0.8078); - } else if ((state1 == "MCT" or state2 == "MCT") and getprop("/controls/engines/thrust-limit") == "FLX") { - me["FMA_flxtemp"].setText(sprintf("%s", "+" ~ getprop("/FMGC/internal/flex"))); + } else if ((state1_act == "MCT" or state2_act == "MCT") and thrust_limit_act == "FLX") { + me["FMA_flxtemp"].setText(sprintf("%s", "+" ~ flex.getValue())); me["FMA_man_box"].hide(); me["FMA_flx_box"].show(); me["FMA_flxtemp"].show(); me["FMA_manmode"].setText("FLX "); me["FMA_man_box"].setColor(0.8078,0.8039,0.8078); - } else if ((state1 == "MAN THR" and thr1 < 0.83) or (state2 == "MAN THR" and thr2 < 0.83)) { + } else if ((state1_act == "MAN THR" and thr1_act < 0.83) or (state2_act == "MAN THR" and thr2_act < 0.83)) { me["FMA_flx_box"].hide(); me["FMA_flxtemp"].hide(); me["FMA_man_box"].show(); me["FMA_manmode"].setText("THR"); me["FMA_man_box"].setColor(0.7333,0.3803,0); } - } else if (athr == 1 and (state1 == "TOGA" or (state1 == "MCT" and getprop("/controls/engines/thrust-limit") == "FLX") or (state1 == "MAN THR" and thr1 >= 0.83) or state2 == "TOGA" or (state2 == "MCT" and - getprop("/controls/engines/thrust-limit") == "FLX") or (state2 == "MAN THR" and thr2 >= 0.83)) and getprop("/systems/thrust/eng-out") == 1 and getprop("/systems/thrust/alpha-floor") != 1 and getprop("/systems/thrust/toga-lk") != 1) { + } else if (athr.getValue() == 1 and (state1_act == "TOGA" or (state1_act == "MCT" and thrust_limit_act == "FLX") or (state1_act == "MAN THR" and thr1_act >= 0.83) or state2_act == "TOGA" or (state2_act == "MCT" and + thrust_limit_act == "FLX") or (state2_act == "MAN THR" and thr2_act >= 0.83)) and eng_out.getValue() == 1 and alpha_floor_act != 1 and toga_lk_act != 1) { me["FMA_man"].show(); me["FMA_manmode"].show(); - if (state1 == "TOGA" or state2 == "TOGA") { + if (state1_act == "TOGA" or state2_act == "TOGA") { me["FMA_flx_box"].hide(); me["FMA_flxtemp"].hide(); me["FMA_man_box"].show(); me["FMA_manmode"].setText("TOGA"); me["FMA_man_box"].setColor(0.8078,0.8039,0.8078); - } else if ((state1 == "MAN THR" and thr1 >= 0.83) or (state2 == "MAN THR" and thr2 >= 0.83)) { + } else if ((state1_act == "MAN THR" and thr1_act >= 0.83) or (state2_act == "MAN THR" and thr2_act >= 0.83)) { me["FMA_flx_box"].hide(); me["FMA_flxtemp"].hide(); me["FMA_man_box"].show(); me["FMA_manmode"].setText("THR"); me["FMA_man_box"].setColor(0.7333,0.3803,0); - } else if ((state1 == "MCT" or state2 == "MCT") and getprop("/controls/engines/thrust-limit") == "FLX") { - me["FMA_flxtemp"].setText(sprintf("%s", "+" ~ getprop("/FMGC/internal/flex"))); + } else if ((state1_act == "MCT" or state2_act == "MCT") and thrust_limit_act == "FLX") { + me["FMA_flxtemp"].setText(sprintf("%s", "+" ~ flex.getValue())); me["FMA_man_box"].hide(); me["FMA_flx_box"].show(); me["FMA_flxtemp"].show(); @@ -319,35 +377,35 @@ var canvas_PFD_base = { me["FMA_flxtemp"].hide(); } - if ((state1 == "CL" and state2 != "CL") or (state1 != "CL" and state2 == "CL") and getprop("/systems/thrust/eng-out") != 1) { + if ((state1_act == "CL" and state2_act != "CL") or (state1_act != "CL" and state2_act == "CL") and eng_out.getValue() != 1) { me["FMA_lvrclb"].setText("LVR ASYM"); } else { - if (getprop("/systems/thrust/eng-out") == 1) { + if (eng_out.getValue() == 1) { me["FMA_lvrclb"].setText("LVR MCT"); } else { me["FMA_lvrclb"].setText("LVR CLB"); } } - if (athr == 1 and getprop("/systems/thrust/lvrclb") == 1) { + if (athr.getValue() == 1 and lvr_clb.getValue() == 1) { me["FMA_lvrclb"].show(); } else { me["FMA_lvrclb"].hide(); } # FMA A/THR - if (getprop("/systems/thrust/alpha-floor") != 1 and getprop("/systems/thrust/toga-lk") != 1) { - if (athr == 1 and getprop("/systems/thrust/eng-out") != 1 and (state1 == "MAN" or state1 == "CL") and (state2 == "MAN" or state2 == "CL")) { + if (alpha_floor_act != 1 and toga_lk_act != 1) { + if (athr.getValue() == 1 and eng_out.getValue() != 1 and (state1_act == "MAN" or state1_act == "CL") and (state2_act == "MAN" or state2_act == "CL")) { me["FMA_thrust"].show(); - if (getprop("/modes/pfd/fma/throttle-mode-box") == 1 and throttle_mode != " ") { + if (throt_box.getValue() == 1 and throttle_mode.getValue() != " ") { me["FMA_thrust_box"].show(); } else { me["FMA_thrust_box"].hide(); } - } else if (athr == 1 and getprop("/systems/thrust/eng-out") == 1 and (state1 == "MAN" or state1 == "CL" or (state1 == "MAN THR" and thr1 < 0.83) or (state1 == "MCT" and getprop("/controls/engines/thrust-limit") != "FLX")) and - (state2 == "MAN" or state2 == "CL" or (state2 == "MAN THR" and thr2 < 0.83) or (state2 == "MCT" and getprop("/controls/engines/thrust-limit") != "FLX"))) { + } else if (athr.getValue() == 1 and eng_out.getValue() == 1 and (state1_act == "MAN" or state1_act == "CL" or (state1_act == "MAN THR" and thr1_act < 0.83) or (state1_act == "MCT" and thrust_limit_act != "FLX")) and + (state2_act == "MAN" or state2_act == "CL" or (state2_act == "MAN THR" and thr2_act < 0.83) or (state2_act == "MCT" and thrust_limit_act != "FLX"))) { me["FMA_thrust"].show(); - if (getprop("/modes/pfd/fma/throttle-mode-box") == 1 and throttle_mode != " ") { + if (throt_box.getValue() == 1 and throttle_mode.getValue() != " ") { me["FMA_thrust_box"].show(); } else { me["FMA_thrust_box"].hide(); @@ -361,21 +419,28 @@ var canvas_PFD_base = { me["FMA_thrust_box"].show(); } - if (getprop("/systems/thrust/alpha-floor") == 1) { + if (alpha_floor_act == 1) { me["FMA_thrust"].setText("A.FLOOR"); me["FMA_thrust_box"].setColor(0.7333,0.3803,0); - } else if (getprop("/systems/thrust/toga-lk") == 1) { + } else if (toga_lk_act == 1) { me["FMA_thrust"].setText("TOGA LK"); me["FMA_thrust_box"].setColor(0.7333,0.3803,0); } else { - me["FMA_thrust"].setText(sprintf("%s", throttle_mode)); + me["FMA_thrust"].setText(sprintf("%s", throttle_mode.getValue())); me["FMA_thrust_box"].setColor(0.8078,0.8039,0.8078); } # FMA Pitch Roll Common - me["FMA_combined"].setText(sprintf("%s", pitch_mode)); + pitch_mode_act = pitch_mode.getValue(); # only call getValue once per loop, not multiple times + pitch_mode_armed_act = pitch_mode_armed.getValue(); + pitch_mode2_armed_act = pitch_mode2_armed.getValue(); + roll_mode_act = roll_mode.getValue(); + roll_mode_armed_act = roll_mode_armed.getValue(); + fbw_curlaw = fbw_law.getValue(); + me["FMA_combined"].setText(sprintf("%s", pitch_mode_act)); - if (pitch_mode == "LAND" or pitch_mode == "FLARE" or pitch_mode == "ROLL OUT") { + + if (pitch_mode_act == "LAND" or pitch_mode_act == "FLARE" or pitch_mode_act == "ROLL OUT") { me["FMA_pitch"].hide(); me["FMA_roll"].hide(); me["FMA_pitch_box"].hide(); @@ -384,11 +449,11 @@ var canvas_PFD_base = { me["FMA_rollarm_box"].hide(); me["FMA_Middle1"].hide(); me["FMA_Middle2"].hide(); - if (getprop("/it-fbw/law") == 2) { + if (fbw_curlaw == 2) { me["FMA_ctr_msg"].setText("USE MAN PITCH TRIM"); me["FMA_ctr_msg"].setColor(0.7333,0.3803,0); me["FMA_ctr_msg"].show(); - } else if (getprop("/it-fbw/law") == 3) { + } else if (fbw_curlaw == 3) { me["FMA_ctr_msg"].setText("MAN PITCH TRIM ONLY"); me["FMA_ctr_msg"].setColor(1,0,0); me["FMA_ctr_msg"].show(); @@ -396,7 +461,7 @@ var canvas_PFD_base = { me["FMA_ctr_msg"].hide(); } me["FMA_combined"].show(); - if (getprop("/modes/pfd/fma/pitch-mode-box") == 1 and pitch_mode != " ") { + if (pitch_box.getValue() == 1 and pitch_mode_act != " ") { me["FMA_combined_box"].show(); } else { me["FMA_combined_box"].hide(); @@ -404,13 +469,13 @@ var canvas_PFD_base = { } else { me["FMA_combined"].hide(); me["FMA_combined_box"].hide(); - if (getprop("/it-fbw/law") == 2) { + if (fbw_curlaw == 2) { me["FMA_ctr_msg"].setText("USE MAN PITCH TRIM"); me["FMA_ctr_msg"].setColor(0.7333,0.3803,0); me["FMA_Middle1"].hide(); me["FMA_Middle2"].show(); me["FMA_ctr_msg"].show(); - } else if (getprop("/it-fbw/law") == 3) { + } else if (fbw_curlaw == 3) { me["FMA_ctr_msg"].setText("MAN PITCH TRIM ONLY"); me["FMA_ctr_msg"].setColor(1,0,0); me["FMA_Middle1"].hide(); @@ -422,40 +487,40 @@ var canvas_PFD_base = { me["FMA_Middle2"].hide(); } - if (ap1 or ap2 or fd1 or fd2) { + if (ap1.getValue() == 1 or ap2.getValue() == 1 or fd1.getValue() == 1 or fd2.getValue() == 1) { me["FMA_pitch"].show(); me["FMA_roll"].show(); } else { me["FMA_pitch"].hide(); me["FMA_roll"].hide(); } - if (getprop("/modes/pfd/fma/pitch-mode-box") == 1 and pitch_mode != " " and (ap1 or ap2 or fd1 or fd2)) { + if (pitch_box.getValue() == 1 and pitch_mode_act != " " and (ap1.getValue() == 1 or ap2.getValue() == 1 or fd1.getValue() == 1 or fd2.getValue() == 1)) { me["FMA_pitch_box"].show(); } else { me["FMA_pitch_box"].hide(); } - if (pitch_mode_armed == " " and pitch_mode2_armed == " ") { + if (pitch_mode_armed_act == " " and pitch_mode2_armed_act == " ") { me["FMA_pitcharm_box"].hide(); } else { - if ((getprop("/modes/pfd/fma/pitch-mode-armed-box") == 1 or getprop("/modes/pfd/fma/pitch-mode2-armed-box") == 1) and (ap1 or ap2 or fd1 or fd2)) { + if ((pitch_mode_armed_box.getValue() == 1 or pitch_mode2_armed_box.getValue() == 1) and (ap1.getValue() == 1 or ap2.getValue() == 1 or fd1.getValue() == 1 or fd2.getValue() == 1)) { me["FMA_pitcharm_box"].show(); } else { me["FMA_pitcharm_box"].hide(); } } - if (getprop("/modes/pfd/fma/roll-mode-box") == 1 and roll_mode != " " and (ap1 or ap2 or fd1 or fd2)) { + if (roll_mode_box.getValue() == 1 and roll_mode_act != " " and (ap1.getValue() == 1 or ap2.getValue() == 1 or fd1.getValue() == 1 or fd2.getValue() == 1)) { me["FMA_roll_box"].show(); } else { me["FMA_roll_box"].hide(); } - if (getprop("/modes/pfd/fma/roll-mode-armed-box") == 1 and roll_mode_armed != " " and (ap1 or ap2 or fd1 or fd2)) { + if (roll_mode_armed_box.getValue() == 1 and roll_mode_armed_act != " " and (ap1.getValue() == 1 or ap2.getValue() == 1 or fd1.getValue() == 1 or fd2.getValue() == 1)) { me["FMA_rollarm_box"].show(); } else { me["FMA_rollarm_box"].hide(); } } - if (ap1 or ap2 or fd1 or fd2) { + if (ap1.getValue() == 1 or ap2.getValue() == 1 or fd1.getValue() == 1 or fd2.getValue() == 1) { me["FMA_pitcharm"].show(); me["FMA_pitcharm2"].show(); me["FMA_rollarm"].show(); @@ -466,13 +531,13 @@ var canvas_PFD_base = { } # FMA Pitch - me["FMA_pitch"].setText(sprintf("%s", pitch_mode)); - me["FMA_pitcharm"].setText(sprintf("%s", pitch_mode_armed)); - me["FMA_pitcharm2"].setText(sprintf("%s", pitch_mode2_armed)); + me["FMA_pitch"].setText(sprintf("%s", pitch_mode_act)); + me["FMA_pitcharm"].setText(sprintf("%s", pitch_mode_armed_act)); + me["FMA_pitcharm2"].setText(sprintf("%s", pitch_mode2_armed_act)); # FMA Roll - me["FMA_roll"].setText(sprintf("%s", roll_mode)); - me["FMA_rollarm"].setText(sprintf("%s", roll_mode_armed)); + me["FMA_roll"].setText(sprintf("%s", roll_mode_act)); + me["FMA_rollarm"].setText(sprintf("%s", roll_mode_armed_act)); # FMA CAT DH me["FMA_catmode"].hide(); @@ -484,48 +549,48 @@ var canvas_PFD_base = { me["FMA_dh_box"].hide(); # FMA AP FD ATHR - me["FMA_ap"].setText(sprintf("%s", getprop("/modes/pfd/fma/ap-mode"))); - me["FMA_fd"].setText(sprintf("%s", getprop("/modes/pfd/fma/fd-mode"))); - me["FMA_athr"].setText(sprintf("%s", getprop("/modes/pfd/fma/at-mode"))); + me["FMA_ap"].setText(sprintf("%s", ap_mode.getValue())); + me["FMA_fd"].setText(sprintf("%s", fd_mode.getValue())); + me["FMA_athr"].setText(sprintf("%s", at_mode.getValue())); - if (getprop("/modes/pfd/fma/athr-armed") != 1) { + if (athr_arm.getValue() != 1) { me["FMA_athr"].setColor(0.8078,0.8039,0.8078); } else { me["FMA_athr"].setColor(0.0901,0.6039,0.7176); } - if (getprop("/modes/pfd/fma/ap-mode-box") == 1 and getprop("/modes/pfd/fma/ap-mode") != " ") { + if (ap_box.getValue() == 1 and ap_mode.getValue() != " ") { me["FMA_ap_box"].show(); } else { me["FMA_ap_box"].hide(); } - if (getprop("/modes/pfd/fma/fd-mode-box") == 1 and getprop("/modes/pfd/fma/fd-mode") != " ") { + if (fd_box.getValue() == 1 and fd_mode.getValue() != " ") { me["FMA_fd_box"].show(); } else { me["FMA_fd_box"].hide(); } - if (getprop("/modes/pfd/fma/athr-mode-box") == 1 and getprop("/modes/pfd/fma/at-mode") != " ") { + if (at_box.getValue() == 1 and at_mode.getValue() != " ") { me["FMA_athr_box"].show(); } else { me["FMA_athr_box"].hide(); } # QNH - if (getprop("/modes/altimeter/std") == 1) { + if (alt_std_mode.getValue() == 1) { me["QNH"].hide(); me["QNH_setting"].hide(); me["QNH_std"].show(); me["QNH_box"].show(); - } else if (getprop("/modes/altimeter/inhg") == 0) { - me["QNH_setting"].setText(sprintf("%4.0f", getprop("/instrumentation/altimeter/setting-hpa"))); + } else if (alt_inhg_mode.getValue() == 0) { + me["QNH_setting"].setText(sprintf("%4.0f", alt_hpa.getValue())); me["QNH"].show(); me["QNH_setting"].show(); me["QNH_std"].hide(); me["QNH_box"].hide(); - } else if (getprop("/modes/altimeter/inhg") == 1) { - me["QNH_setting"].setText(sprintf("%2.2f", getprop("/instrumentation/altimeter/setting-inhg"))); + } else if (alt_inhg_mode.getValue() == 1) { + me["QNH_setting"].setText(sprintf("%2.2f", alt_inhg.getValue())); me["QNH"].show(); me["QNH_setting"].show(); me["QNH_std"].hide(); @@ -534,27 +599,30 @@ var canvas_PFD_base = { }, updateCommonFast: func() { # Airspeed + ind_spd = ind_spd_kt.getValue(); # Subtract 30, since the scale starts at 30, but don"t allow less than 0, or more than 420 situations - if (getprop("/instrumentation/airspeed-indicator/indicated-speed-kt") <= 30) { + if (ind_spd <= 30) { ASI = 0; - } else if (getprop("/instrumentation/airspeed-indicator/indicated-speed-kt") >= 420) { + } else if (ind_spd >= 420) { ASI = 390; } else { - ASI = getprop("/instrumentation/airspeed-indicator/indicated-speed-kt") - 30; + ASI = ind_spd - 30; } - if (getprop("/FMGC/internal/maxspeed") <= 30) { + FMGC_max = FMGC_max_spd.getValue(); + if (FMGC_max <= 30) { ASImax = 0 - ASI; - } else if (getprop("/FMGC/internal/maxspeed") >= 420) { + } else if (FMGC_max >= 420) { ASImax = 390 - ASI; } else { - ASImax = getprop("/FMGC/internal/maxspeed") - 30 - ASI; + ASImax = FMGC_max - 30 - ASI; } me["ASI_scale"].setTranslation(0, ASI * 6.6); me["ASI_max"].setTranslation(0, ASImax * -6.6); - if (getprop("/instrumentation/airspeed-indicator/indicated-mach") >= 0.5) { + ind_mach = ind_spd_mach.getValue(); + if (ind_mach >= 0.5) { me["ASI_mach_decimal"].show(); me["ASI_mach"].show(); } else { @@ -562,13 +630,13 @@ var canvas_PFD_base = { me["ASI_mach"].hide(); } - if (getprop("/instrumentation/airspeed-indicator/indicated-mach") >= 0.999) { + if (ind_mach >= 0.999) { me["ASI_mach"].setText("999"); } else { - me["ASI_mach"].setText(sprintf("%3.0f", getprop("/instrumentation/airspeed-indicator/indicated-mach") * 1000)); + me["ASI_mach"].setText(sprintf("%3.0f", ind_mach * 1000)); } - if (getprop("/it-autoflight/input/spd-managed") == 1) { + if (managed_spd.getValue() == 1) { me["ASI_target"].setColor(0.6901,0.3333,0.7450); me["ASI_digit_UP"].setColor(0.6901,0.3333,0.7450); me["ASI_decimal_UP"].setColor(0.6901,0.3333,0.7450); @@ -582,15 +650,16 @@ var canvas_PFD_base = { me["ASI_decimal_DN"].setColor(0.0901,0.6039,0.7176); } - if (getprop("/FMGC/internal/target-ias-pfd") <= 30) { + tgt_ias = at_tgt_ias.getValue(); + if (tgt_ias <= 30) { ASItrgt = 0 - ASI; - } else if (getprop("/FMGC/internal/target-ias-pfd") >= 420) { + } else if (tgt_ias >= 420) { ASItrgt = 390 - ASI; } else { - ASItrgt = getprop("/FMGC/internal/target-ias-pfd") - 30 - ASI; + ASItrgt = tgt_ias - 30 - ASI; } - ASItrgtdiff = getprop("/FMGC/internal/target-ias-pfd") - getprop("/instrumentation/airspeed-indicator/indicated-speed-kt"); + ASItrgtdiff = tgt_ias - ind_spd; if (ASItrgtdiff >= -42 and ASItrgtdiff <= 42) { me["ASI_target"].setTranslation(0, ASItrgt * -6.6); @@ -600,12 +669,12 @@ var canvas_PFD_base = { me["ASI_decimal_DN"].hide(); me["ASI_target"].show(); } else if (ASItrgtdiff < -42) { - if (getprop("/it-autoflight/input/kts-mach") == 1) { - me["ASI_digit_DN"].setText(sprintf("%3.0f", getprop("/it-autoflight/input/spd-mach") * 1000)); + if (at_mach_mode.getValue() == 1) { + me["ASI_digit_DN"].setText(sprintf("%3.0f", at_input_spd_mach.getValue() * 1000)); me["ASI_decimal_UP"].hide(); me["ASI_decimal_DN"].show(); } else { - me["ASI_digit_DN"].setText(sprintf("%3.0f", getprop("/it-autoflight/input/spd-kts"))); + me["ASI_digit_DN"].setText(sprintf("%3.0f", at_input_spd_kts.getValue())); me["ASI_decimal_UP"].hide(); me["ASI_decimal_DN"].hide(); } @@ -613,12 +682,12 @@ var canvas_PFD_base = { me["ASI_digit_UP"].hide(); me["ASI_target"].hide(); } else if (ASItrgtdiff > 42) { - if (getprop("/it-autoflight/input/kts-mach") == 1) { - me["ASI_digit_UP"].setText(sprintf("%3.0f", getprop("/it-autoflight/input/spd-mach") * 1000)); + if (at_mach_mode.getValue() == 1) { + me["ASI_digit_UP"].setText(sprintf("%3.0f", at_input_spd_mach.getValue() * 1000)); me["ASI_decimal_UP"].show(); me["ASI_decimal_DN"].hide(); } else { - me["ASI_digit_UP"].setText(sprintf("%3.0f", getprop("/it-autoflight/input/spd-kts"))); + me["ASI_digit_UP"].setText(sprintf("%3.0f", at_input_spd_kts.getValue())); me["ASI_decimal_UP"].hide(); me["ASI_decimal_DN"].hide(); } @@ -627,7 +696,7 @@ var canvas_PFD_base = { me["ASI_target"].hide(); } - ASItrend = getprop("/instrumentation/pfd/speed-lookahead") - ASI; + ASItrend = speed_pred.getValue() - ASI; me["ASI_trend_up"].setTranslation(0, math.clamp(ASItrend, 0, 50) * -6.6); me["ASI_trend_down"].setTranslation(0, math.clamp(ASItrend, -50, 0) * -6.6); @@ -643,19 +712,19 @@ var canvas_PFD_base = { } # Attitude Indicator - pitch = getprop("/orientation/pitch-deg") or 0; - roll = getprop("/orientation/roll-deg") or 0; + pitch_cur = pitch.getValue(); + roll_cur = roll.getValue(); - me.AI_horizon_trans.setTranslation(0, pitch * 11.825); - me.AI_horizon_rot.setRotation(-roll * D2R, me["AI_center"].getCenter()); - me.AI_horizon_ground_trans.setTranslation(0, getprop("/instrumentation/pfd/horizon-ground") * 11.825); - me.AI_horizon_ground_rot.setRotation(-roll * D2R, me["AI_center"].getCenter()); - me.AI_horizon_sky_rot.setRotation(-roll * D2R, me["AI_center"].getCenter()); + me.AI_horizon_trans.setTranslation(0, pitch_cur * 11.825); + me.AI_horizon_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter()); + me.AI_horizon_ground_trans.setTranslation(0, horizon_ground.getValue() * 11.825); + me.AI_horizon_ground_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter()); + me.AI_horizon_sky_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter()); - me["AI_slipskid"].setTranslation(math.clamp(getprop("/instrumentation/slip-skid-ball/indicated-slip-skid"), -7, 7) * -15, 0); - me["AI_bank"].setRotation(-roll * D2R); + me["AI_slipskid"].setTranslation(math.clamp(skid_slip.getValue(), -7, 7) * -15, 0); + me["AI_bank"].setRotation(-roll_cur * D2R); - if (getprop("/it-fbw/law") == 0) { + if (fbw_law.getValue() == 0) { me["AI_bank_lim"].show(); me["AI_pitch_lim"].show(); me["AI_bank_lim_X"].hide(); @@ -667,33 +736,39 @@ var canvas_PFD_base = { me["AI_pitch_lim_X"].show(); } - if (getprop("/it-autoflight/fd/roll-bar") != nil) { - me["FD_roll"].setTranslation((getprop("/it-autoflight/fd/roll-bar")) * 2.2, 0); + fd_roll_cur = fd_roll.getValue(); + fd_pitch_cur = fd_pitch.getValue(); + if (fd_roll_cur != nil) { + me["FD_roll"].setTranslation((fd_roll_cur) * 2.2, 0); } - if (getprop("/it-autoflight/fd/pitch-bar") != nil) { - me["FD_pitch"].setTranslation(0, -(getprop("/it-autoflight/fd/pitch-bar")) * 3.8); + if (fd_pitch_cur != nil) { + me["FD_pitch"].setTranslation(0, -(fd_pitch_cur) * 3.8); } - me["AI_agl"].setText(sprintf("%s", math.round(getprop("/position/gear-agl-ft")))); + gear_agl_cur = gear_agl.getValue(); - if (getprop("/position/gear-agl-ft") <= getprop("/instrumentation/mk-viii/inputs/arinc429/decision-height")) { + me["AI_agl"].setText(sprintf("%s", math.round(gear_agl_cur))); + + if (gear_agl_cur <= decision.getValue()) { me["AI_agl"].setColor(0.7333,0.3803,0); } else { me["AI_agl"].setColor(0.0509,0.7529,0.2941); } - if (getprop("/position/gear-agl-ft") <= 2500) { + if (gear_agl_cur <= 2500) { me["AI_agl"].show(); } else { me["AI_agl"].hide(); } - me["AI_agl_g"].setRotation(-roll * D2R); + me["AI_agl_g"].setRotation(-roll_cur * D2R); - if ((wow1 or wow2) and getprop("/FMGC/status/phase") != 0 and getprop("/FMGC/status/phase") != 1) { + FMGCphase_act = FMGCphase.getValue(); + if ((wow1.getValue() == 1 or wow2.getValue() == 1) and FMGCphase_act != 0 and FMGCphase_act != 1) { me["AI_stick"].show(); me["AI_stick_pos"].show(); - } else if ((wow1 or wow2) and (getprop("/FMGC/status/phase") == 0 or getprop("/FMGC/status/phase") == 1) and (getprop("/engines/engine[0]/state") == 3 or getprop("/engines/engine[1]/state") == 3)) { + + } else if ((wow1.getValue() == 1 or wow2.getValue() == 1) and (FMGCphase_act == 0 or FMGCphase_act == 1) and (eng0_state.getValue() == 3 or eng1_state.getValue() == 3)) { me["AI_stick"].show(); me["AI_stick_pos"].show(); } else { @@ -701,10 +776,10 @@ var canvas_PFD_base = { me["AI_stick_pos"].hide(); } - me["AI_stick_pos"].setTranslation(getprop("/controls/flight/aileron-input-fast") * 196.8, getprop("/controls/flight/elevator-input-fast") * 151.5); + me["AI_stick_pos"].setTranslation(aileron_input.getValue() * 196.8, elevator_input.getValue() * 151.5); # Altitude - me.altitude = getprop("/instrumentation/altimeter/indicated-altitude-ft"); + me.altitude = altitude.getValue(); me.altOffset = me.altitude / 500 - int(me.altitude / 500); me.middleAltText = roundaboutAlt(me.altitude / 100); me.middleAltOffset = nil; @@ -721,38 +796,40 @@ var canvas_PFD_base = { me["ALT_two"].setText(sprintf("%03d", abs(me.middleAltText-5))); me["ALT_one"].setText(sprintf("%03d", abs(me.middleAltText-10))); - me["ALT_digits"].setText(sprintf("%s", getprop("/instrumentation/altimeter/indicated-altitude-ft-pfd"))); - altTens = num(right(sprintf("%02d", getprop("/instrumentation/altimeter/indicated-altitude-ft")), 2)); + me["ALT_digits"].setText(sprintf("%s", altitude_pfd.getValue())); + altTens = num(right(sprintf("%02d", altitude.getValue()), 2)); me["ALT_tens"].setTranslation(0, altTens * 1.392); - if (getprop("/instrumentation/pfd/alt-diff") >= -565 and getprop("/instrumentation/pfd/alt-diff") <= 565) { - me["ALT_target"].setTranslation(0, (getprop("/instrumentation/pfd/alt-diff") / 100) * -48.66856); - me["ALT_target_digit"].setText(sprintf("%03d", math.round(getprop("/it-autoflight/internal/alt") / 100))); + ap_alt_cur = ap_alt.getValue(); + alt_diff_cur = alt_diff.getValue(); + if (alt_diff_cur >= -565 and alt_diff_cur <= 565) { + me["ALT_target"].setTranslation(0, (alt_diff_cur / 100) * -48.66856); + me["ALT_target_digit"].setText(sprintf("%03d", math.round(ap_alt_cur / 100))); me["ALT_digit_UP"].hide(); me["ALT_digit_DN"].hide(); me["ALT_target"].show(); - } else if (getprop("/instrumentation/pfd/alt-diff") < -565) { - if (getprop("/modes/altimeter/std") == 1) { - if (getprop("/it-autoflight/internal/alt") < 10000) { - me["ALT_digit_DN"].setText(sprintf("%s", "FL " ~ getprop("/it-autoflight/internal/alt") / 100)); + } else if (alt_diff_cur < -565) { + if (alt_std_mode.getValue() == 1) { + if (ap_alt_cur < 10000) { + me["ALT_digit_DN"].setText(sprintf("%s", "FL " ~ ap_alt_cur / 100)); } else { - me["ALT_digit_DN"].setText(sprintf("%s", "FL " ~ getprop("/it-autoflight/internal/alt") / 100)); + me["ALT_digit_DN"].setText(sprintf("%s", "FL " ~ ap_alt_cur / 100)); } } else { - me["ALT_digit_DN"].setText(sprintf("%5.0f", getprop("/it-autoflight/internal/alt"))); + me["ALT_digit_DN"].setText(sprintf("%5.0f", ap_alt_cur)); } me["ALT_digit_DN"].show(); me["ALT_digit_UP"].hide(); me["ALT_target"].hide(); - } else if (getprop("/instrumentation/pfd/alt-diff") > 565) { - if (getprop("/modes/altimeter/std") == 1) { - if (getprop("/it-autoflight/internal/alt") < 10000) { - me["ALT_digit_UP"].setText(sprintf("%s", "FL " ~ getprop("/it-autoflight/internal/alt") / 100)); + } else if (alt_diff_cur > 565) { + if (alt_std_mode.getValue() == 1) { + if (ap_alt_cur < 10000) { + me["ALT_digit_UP"].setText(sprintf("%s", "FL " ~ ap_alt_cur / 100)); } else { - me["ALT_digit_UP"].setText(sprintf("%s", "FL " ~ getprop("/it-autoflight/internal/alt") / 100)); + me["ALT_digit_UP"].setText(sprintf("%s", "FL " ~ ap_alt_cur / 100)); } } else { - me["ALT_digit_UP"].setText(sprintf("%5.0f", getprop("/it-autoflight/internal/alt"))); + me["ALT_digit_UP"].setText(sprintf("%5.0f", ap_alt_cur)); } me["ALT_digit_UP"].show(); me["ALT_digit_DN"].hide(); @@ -760,29 +837,30 @@ var canvas_PFD_base = { } # Vertical Speed - me["VS_pointer"].setRotation(getprop("/instrumentation/pfd/vs-needle") * D2R); + me["VS_pointer"].setRotation(vs_needle.getValue() * D2R); - me["VS_box"].setTranslation(0, getprop("/instrumentation/pfd/vs-digit-trans")); + me["VS_box"].setTranslation(0, vs_digit.getValue()); - if (getprop("/it-autoflight/internal/vert-speed-fpm-pfd") < 2) { + var vs_pfd_cur = ap_vs_pfd.getValue(); + if (vs_pfd_cur < 2) { me["VS_box"].hide(); } else { me["VS_box"].show(); } - if (getprop("/it-autoflight/internal/vert-speed-fpm-pfd") < 10) { - me["VS_digit"].setText(sprintf("%02d", "0" ~ getprop("/it-autoflight/internal/vert-speed-fpm-pfd"))); + if (vs_pfd_cur < 10) { + me["VS_digit"].setText(sprintf("%02d", "0" ~ vs_pfd_cur)); } else { - me["VS_digit"].setText(sprintf("%02d", getprop("/it-autoflight/internal/vert-speed-fpm-pfd"))); + me["VS_digit"].setText(sprintf("%02d", vs_pfd_cur)); } # ILS - me["LOC_pointer"].setTranslation(getprop("/instrumentation/nav[0]/heading-needle-deflection-norm") * 197, 0); + me["LOC_pointer"].setTranslation(loc.getValue() * 197, 0); - me["GS_pointer"].setTranslation(0, getprop("/instrumentation/nav[0]/gs-needle-deflection-norm") * -197); + me["GS_pointer"].setTranslation(0, gs.getValue() * -197); # Heading - me.heading = getprop("/instrumentation/pfd/heading-scale"); + me.heading = hdg_scale.getValue(); me.headOffset = me.heading / 10 - int(me.heading / 10); me.middleText = roundabout(me.heading / 10); me.middleOffset = nil; @@ -818,18 +896,20 @@ var canvas_PFD_base = { me["HDG_seven"].setFontSize(fontSizeHDG(me.rightText3), 1); me["HDG_one"].setFontSize(fontSizeHDG(me.leftText3), 1); - if (getprop("/it-autoflight/custom/show-hdg") == 1 and getprop("/instrumentation/pfd/hdg-diff") >= -23.62 and getprop("/instrumentation/pfd/hdg-diff") <= 23.62) { - me["HDG_target"].setTranslation((getprop("/instrumentation/pfd/hdg-diff") / 10) * 98.5416, 0); + show_hdg_act = show_hdg.getValue(); + hdg_diff_act = hdg_diff.getValue(); + if (show_hdg_act == 1 and hdg_diff_act >= -23.62 and hdg_diff_act <= 23.62) { + me["HDG_target"].setTranslation((hdg_diff_act / 10) * 98.5416, 0); me["HDG_digit_L"].hide(); me["HDG_digit_R"].hide(); me["HDG_target"].show(); - } else if (getprop("/it-autoflight/custom/show-hdg") == 1 and getprop("/instrumentation/pfd/hdg-diff") < -23.62 and getprop("/instrumentation/pfd/hdg-diff") >= -180) { - me["HDG_digit_L"].setText(sprintf("%3.0f", getprop("/it-autoflight/input/hdg"))); + } else if (show_hdg_act == 1 and hdg_diff_act < -23.62 and hdg_diff_act >= -180) { + me["HDG_digit_L"].setText(sprintf("%3.0f", ap_hdg.getValue())); me["HDG_digit_L"].show(); me["HDG_digit_R"].hide(); me["HDG_target"].hide(); - } else if (getprop("/it-autoflight/custom/show-hdg") == 1 and getprop("/instrumentation/pfd/hdg-diff") > 23.62 and getprop("/instrumentation/pfd/hdg-diff") <= 180) { - me["HDG_digit_R"].setText(sprintf("%3.0f", getprop("/it-autoflight/input/hdg"))); + } else if (show_hdg_act == 1 and hdg_diff_act > 23.62 and hdg_diff_act <= 180) { + me["HDG_digit_R"].setText(sprintf("%3.0f", ap_hdg.getValue())); me["HDG_digit_R"].show(); me["HDG_digit_L"].hide(); me["HDG_target"].hide(); @@ -839,13 +919,13 @@ var canvas_PFD_base = { me["HDG_target"].hide(); } - me["TRK_pointer"].setTranslation((getprop("/instrumentation/pfd/track-hdg-diff") / 10) * 98.5416, 0); + me["TRK_pointer"].setTranslation((track_diff.getValue() / 10) * 98.5416, 0); me["CRS_pointer"].hide(); # AI HDG - me.AI_horizon_hdg_trans.setTranslation(me.middleOffset, getprop("/instrumentation/pfd/horizon-pitch") * 11.825); - me.AI_horizon_hdg_rot.setRotation(-roll * D2R, me["AI_center"].getCenter()); + me.AI_horizon_hdg_trans.setTranslation(me.middleOffset, horizon_pitch.getValue() * 11.825); + me.AI_horizon_hdg_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter()); me["AI_heading"].update(); }, }; @@ -858,17 +938,16 @@ var canvas_PFD_1 = { return m; }, update: func() { - fd1 = getprop("/it-autoflight/output/fd1"); - fd2 = getprop("/it-autoflight/output/fd2"); - pitch_mode = getprop("/modes/pfd/fma/pitch-mode"); - roll_mode = getprop("/modes/pfd/fma/roll-mode"); - pitch = getprop("/orientation/pitch-deg"); - roll = getprop("/orientation/roll-deg"); - wow1 = getprop("/gear/gear[1]/wow"); - wow2 = getprop("/gear/gear[2]/wow"); + fd1_act = fd1.getValue(); + pitch_mode_cur = pitch_mode.getValue(); + roll_mode_cur = roll_mode.getValue(); + pitch_cur = pitch.getValue(); + roll_cur = roll.getValue(); + wow1_act = wow1.getValue(); + wow2_act = wow2.getValue(); # Errors - if ((getprop("/instrumentation/adirs/adr[0]/active") == 1) or (getprop("/controls/switching/AIRDATA") == -1 and getprop("/instrumentation/adirs/adr[2]/active") == 1)) { + if ((adirs0_active.getValue() == 1) or (air_switch.getValue() == -1 and adirs2_active.getValue() == 1)) { me["ASI_group"].show(); me["ALT_group"].show(); me["ALT_group2"].show(); @@ -892,7 +971,7 @@ var canvas_PFD_1 = { me["VS_group"].hide(); } - if ((getprop("/instrumentation/adirs/ir[0]/aligned") == 1) or (getprop("/instrumentation/adirs/ir[2]/aligned") == 1 and getprop("/controls/switching/ATTHDG") == -1)) { + if ((ir0_aligned.getValue() == 1) or (ir2_aligned.getValue() == 1 and att_switch.getValue() == -1)) { me["AI_group"].show(); me["HDG_group"].show(); me["AI_error"].hide(); @@ -907,20 +986,20 @@ var canvas_PFD_1 = { } # FD - if (fd1 == 1 and ((!wow1 and !wow2 and roll_mode != " ") or roll_mode != " ") and getprop("/it-autoflight/custom/trk-fpa") == 0 and pitch < 25 and pitch > -13 and roll < 45 and roll > -45) { + if (fd1_act == 1 and ((!wow1_act and !wow2_act and roll_mode_cur != " ") or roll_mode_cur != " ") and ap_trk_sw.getValue() == 0 and pitch_cur < 25 and pitch_cur > -13 and roll_cur < 45 and roll_cur > -45) { me["FD_roll"].show(); } else { me["FD_roll"].hide(); } - if (fd1 == 1 and ((!wow1 and !wow2 and pitch_mode != " ") or pitch_mode != " ") and getprop("/it-autoflight/custom/trk-fpa") == 0 and pitch < 25 and pitch > -13 and roll < 45 and roll > -45) { + if (fd1_act == 1 and ((!wow1_act and !wow2_act and pitch_mode_cur != " ") or pitch_mode_cur != " ") and ap_trk_sw.getValue() == 0 and pitch_cur < 25 and pitch_cur > -13 and roll_cur < 45 and roll_cur > -45) { me["FD_pitch"].show(); } else { me["FD_pitch"].hide(); } # ILS - if (getprop("/modes/pfd/ILS1") == 1) { + if (ap_ils_mode.getValue() == 1) { me["LOC_scale"].show(); me["GS_scale"].show(); } else { @@ -928,12 +1007,12 @@ var canvas_PFD_1 = { me["GS_scale"].hide(); } - if (getprop("/modes/pfd/ILS1") == 1 and getprop("/instrumentation/nav[0]/in-range") == 1 and getprop("/instrumentation/nav[0]/nav-loc") == 1 and getprop("/instrumentation/nav[0]/signal-quality-norm") > 0.99) { + if (ap_ils_mode.getValue() == 1 and loc_in_range.getValue() == 1 and hasloc.getValue() == 1 and nav0_signalq.getValue() > 0.99) { me["LOC_pointer"].show(); } else { me["LOC_pointer"].hide(); } - if (getprop("/modes/pfd/ILS1") == 1 and getprop("/instrumentation/nav[0]/gs-in-range") == 1 and getprop("/instrumentation/nav[0]/has-gs") == 1 and getprop("/instrumentation/nav[0]/signal-quality-norm") > 0.99) { + if (ap_ils_mode.getValue() == 1 and gs_in_range.getValue() == 1 and hasgs.getValue() == 1 and nav0_signalq.getValue() > 0.99) { me["GS_pointer"].show(); } else { me["GS_pointer"].hide(); @@ -954,17 +1033,16 @@ var canvas_PFD_2 = { return m; }, update: func() { - fd1 = getprop("/it-autoflight/output/fd1"); - fd2 = getprop("/it-autoflight/output/fd2"); - pitch_mode = getprop("/modes/pfd/fma/pitch-mode"); - roll_mode = getprop("/modes/pfd/fma/roll-mode"); - pitch = getprop("/orientation/pitch-deg"); - roll = getprop("/orientation/roll-deg"); - wow1 = getprop("/gear/gear[1]/wow"); - wow2 = getprop("/gear/gear[2]/wow"); + fd2_act = fd2.getValue(); + pitch_mode_cur = pitch_mode.getValue(); + roll_mode_cur = roll_mode.getValue(); + pitch_cur = pitch.getValue(); + roll_cur = roll.getValue(); + wow1_act = wow1.getValue(); + wow2_act = wow2.getValue(); # Errors - if ((getprop("/instrumentation/adirs/adr[1]/active") == 1) or (getprop("/controls/switching/AIRDATA") == 1 and getprop("/instrumentation/adirs/adr[2]/active") == 1)) { + if ((adirs1_active.getValue() == 1) or (air_switch.getValue() == 1 and adirs2_active.getValue() == 1)) { me["ASI_group"].show(); me["ALT_group"].show(); me["ALT_group2"].show(); @@ -988,7 +1066,7 @@ var canvas_PFD_2 = { me["VS_group"].hide(); } - if ((getprop("/instrumentation/adirs/ir[1]/aligned") == 1) or (getprop("/instrumentation/adirs/ir[2]/aligned") == 1 and getprop("/controls/switching/ATTHDG") == 1)) { + if ((ir1_aligned.getValue() == 1) or (ir2_aligned.getValue() == 1 and att_switch.getValue() == 1)) { me["AI_group"].show(); me["HDG_group"].show(); me["AI_error"].hide(); @@ -1003,20 +1081,20 @@ var canvas_PFD_2 = { } # FD - if (fd2 == 1 and ((!wow1 and !wow2 and roll_mode != " ") or roll_mode != " ") and getprop("/it-autoflight/custom/trk-fpa") == 0 and pitch < 25 and pitch > -13 and roll < 45 and roll > -45) { + if (fd2_act == 1 and ((!wow1_act and !wow2_act and roll_mode_cur != " ") or roll_mode_cur != " ") and ap_trk_sw.getValue() == 0 and pitch_cur < 25 and pitch_cur > -13 and roll_cur < 45 and roll_cur > -45) { me["FD_roll"].show(); } else { me["FD_roll"].hide(); } - if (fd2 == 1 and ((!wow1 and !wow2 and pitch_mode != " ") or pitch_mode != " ") and getprop("/it-autoflight/custom/trk-fpa") == 0 and pitch < 25 and pitch > -13 and roll < 45 and roll > -45) { + if (fd2_act == 1 and ((!wow1_act and !wow2_act and pitch_mode_cur != " ") or pitch_mode_cur != " ") and ap_trk_sw.getValue() == 0 and pitch_cur < 25 and pitch_cur > -13 and roll_cur < 45 and roll_cur > -45) { me["FD_pitch"].show(); } else { me["FD_pitch"].hide(); } # ILS - if (getprop("/modes/pfd/ILS2") == 1) { + if (ap_ils_mode2.getValue() == 1) { me["LOC_scale"].show(); me["GS_scale"].show(); } else { @@ -1024,12 +1102,12 @@ var canvas_PFD_2 = { me["GS_scale"].hide(); } - if (getprop("/modes/pfd/ILS2") == 1 and getprop("/instrumentation/nav[0]/in-range") == 1 and getprop("/instrumentation/nav[0]/nav-loc") == 1 and getprop("/instrumentation/nav[0]/signal-quality-norm") > 0.99) { + if (ap_ils_mode2.getValue() == 1 and loc_in_range.getValue() == 1 and hasloc.getValue() == 1 and nav0_signalq.getValue() > 0.99) { me["LOC_pointer"].show(); } else { me["LOC_pointer"].hide(); } - if (getprop("/modes/pfd/ILS2") == 1 and getprop("/instrumentation/nav[0]/gs-in-range") == 1 and getprop("/instrumentation/nav[0]/has-gs") == 1 and getprop("/instrumentation/nav[0]/signal-quality-norm") > 0.99) { + if (ap_ils_mode2.getValue() == 1 and gs_in_range.getValue() == 1 and hasgs.getValue() == 1 and nav0_signalq.getValue() > 0.99) { me["GS_pointer"].show(); } else { me["GS_pointer"].hide(); @@ -1069,10 +1147,14 @@ var canvas_PFD_1_test = { return ["Test_white","Test_text"]; }, update: func() { - if (getprop("/instrumentation/du/du1-test-time") + 1 >= elapsedtime and getprop("/modes/cpt-du-xfr") != 1) { + et = elapsedtime.getValue() or 0; + if ((du1_test_time.getValue() + 1 >= et) and cpt_du_xfr.getValue() != 1) { me["Test_white"].show(); me["Test_text"].hide(); - } else if (getprop("/instrumentation/du/du2-test-time") + 1 >= elapsedtime and getprop("/modes/cpt-du-xfr") == 1) { + } else if ((du2_test_time.getValue() + 1 >= et) and cpt_du_xfr.getValue() != 0) { + print(du2_test_time.getValue()); + print(elapsedtime.getValue()); + print(cpt_du_xfr.getValue()); me["Test_white"].show(); me["Test_text"].hide(); } else { @@ -1109,10 +1191,11 @@ var canvas_PFD_2_test = { return ["Test_white","Test_text"]; }, update: func() { - if (getprop("/instrumentation/du/du6-test-time") + 1 >= elapsedtime and getprop("/modes/fo-du-xfr") != 1) { + et = elapsedtime.getValue() or 0; + if ((du6_test_time.getValue() + 1 >= et) and fo_du_xfr.getValue() != 1) { me["Test_white"].show(); me["Test_text"].hide(); - } else if (getprop("/instrumentation/du/du5-test-time") + 1 >= elapsedtime and getprop("/modes/fo-du-xfr") == 1) { + } else if ((du5_test_time.getValue() + 1 >= et) and fo_du_xfr.getValue() != 0) { me["Test_white"].show(); me["Test_text"].hide(); } else { @@ -1149,7 +1232,7 @@ var canvas_PFD_1_mismatch = { return ["ERRCODE"]; }, update: func() { - me["ERRCODE"].setText(getprop("/systems/acconfig/mismatch-code")); + me["ERRCODE"].setText(acconfig_mismatch.getValue()); }, }; @@ -1180,7 +1263,7 @@ var canvas_PFD_2_mismatch = { return ["ERRCODE"]; }, update: func() { - me["ERRCODE"].setText(getprop("/systems/acconfig/mismatch-code")); + me["ERRCODE"].setText(acconfig_mismatch.getValue()); }, }; @@ -1215,14 +1298,15 @@ setlistener("sim/signals/fdm-initialized", func { PFD_update.start(); PFD_update_fast.start(); - if (getprop("/systems/acconfig/options/pfd-rate") > 1) { + + if (pfdrate.getValue() == 1) { rateApply(); } }); var rateApply = func { - PFD_update.restart(0.15 * getprop("/systems/acconfig/options/pfd-rate")); - PFD_update_fast.restart(0.05 * getprop("/systems/acconfig/options/pfd-rate")); + PFD_update.restart(0.15 * pfdrate.getValue()); + PFD_update_fast.restart(0.05 * pfdrate.getValue()); } var PFD_update = maketimer(0.15, func { @@ -1260,4 +1344,4 @@ var fontSizeHDG = func(input) { } else { return 32; } -}; +}; \ No newline at end of file diff --git a/revision.txt b/revision.txt index 3231dc6f..67cb751d 100644 --- a/revision.txt +++ b/revision.txt @@ -1 +1 @@ -4641 \ No newline at end of file +4642 \ No newline at end of file From 1115bb90cc312729f2dd6365e08644a51a71f70b Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Wed, 19 Sep 2018 17:19:54 +0100 Subject: [PATCH 3/5] Upper ECAM: props.nas --- Models/Instruments/Upper-ECAM/Upper-ECAM.nas | 507 ++++++++++++------- revision.txt | 2 +- 2 files changed, 318 insertions(+), 191 deletions(-) diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas index 5dbf1893..1727c006 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas @@ -10,23 +10,90 @@ var upperECAM_iae_eis2 = nil; var upperECAM_test = nil; var upperECAM_display = nil; var elapsedtime = 0; -setprop("/engines/engine[0]/fuel-flow_actual", 0); -setprop("/engines/engine[1]/fuel-flow_actual", 0); -setprop("/ECAM/Upper/EPR[0]", 0); -setprop("/ECAM/Upper/EPR[1]", 0); -setprop("/ECAM/Upper/EPRthr[0]", 0); -setprop("/ECAM/Upper/EPRthr[1]", 0); -setprop("/ECAM/Upper/EPRylim", 0); -setprop("/ECAM/Upper/EGT[0]", 0); -setprop("/ECAM/Upper/EGT[1]", 0); -setprop("/ECAM/Upper/N1[0]", 0); -setprop("/ECAM/Upper/N1[1]", 0); -setprop("/ECAM/Upper/N1thr[0]", 0); -setprop("/ECAM/Upper/N1thr[1]", 0); -setprop("/ECAM/Upper/N1ylim", 0); -setprop("/instrumentation/du/du3-test", 0); -setprop("/instrumentation/du/du3-test-time", 0); -setprop("/instrumentation/du/du3-test-amount", 0); + +# Create Nodes: +var fuel_1 = props.globals.initNode("/engines/engine[0]/fuel-flow_actual", 0); +var fuel_2 = props.globals.initNode("/engines/engine[1]/fuel-flow_actual", 0); +var EPR_1 = props.globals.initNode("/ECAM/Upper/EPR[0]", 0, "DOUBLE"); +var EPR_2 = props.globals.initNode("/ECAM/Upper/EPR[1]", 0, "DOUBLE"); +var EPR_thr_1 = props.globals.initNode("/ECAM/Upper/EPRthr[0]", 0); +var EPR_thr_2 = props.globals.initNode("/ECAM/Upper/EPRthr[1]", 0); +var EPR_lim = props.globals.initNode("/ECAM/Upper/EPRylim", 0, "DOUBLE"); +var EGT_1 = props.globals.initNode("/ECAM/Upper/EGT[0]", 0, "DOUBLE"); +var EGT_2 = props.globals.initNode("/ECAM/Upper/EGT[1]", 0, "DOUBLE"); +var N1_1 = props.globals.initNode("/ECAM/Upper/N1[0]", 0, "DOUBLE"); +var N1_2 = props.globals.initNode("/ECAM/Upper/N1[1]", 0, "DOUBLE"); +var N1_thr_1 = props.globals.initNode("/ECAM/Upper/N1thr[0]", 0, "DOUBLE"); +var N1_thr_2 = props.globals.initNode("/ECAM/Upper/N1thr[1]", 0, "DOUBLE"); +var N1_lim = props.globals.initNode("/ECAM/Upper/N1ylim", 0, "DOUBLE"); +var du3_test = props.globals.initNode("/instrumentation/du/du3-test", 0, "BOOL"); +var du3_test_time = props.globals.initNode("/instrumentation/du/du3-test-time", 0.0, "DOUBLE"); +var du3_test_amount = props.globals.initNode("/instrumentation/du/du3-test-amount", 0.0, "DOUBLE"); + +# Fetch nodes: +var et = props.globals.getNode("/sim/time/elapsed-sec", 1); +var acconfig = props.globals.getNode("/systems/acconfig/autoconfig-running", 1); +var acess = props.globals.getNode("/systems/electrical/bus/ac-ess", 1); +var eng_option = props.globals.getNode("/options/eng", 1); +var du3_lgt = props.globals.getNode("/controls/lighting/DU/du3", 1); +var rev_1 = props.globals.getNode("/engines/engine[0]/reverser-pos-norm", 1); +var rev_2 = props.globals.getNode("/engines/engine[1]/reverser-pos-norm", 1); +var eng1_n1mode = props.globals.getNode("/systems/fadec/eng1/n1", 1); +var eng1_eprmode = props.globals.getNode("/systems/fadec/eng1/epr", 1); +var eng2_n1mode = props.globals.getNode("/systems/fadec/eng2/n1", 1); +var eng2_eprmode = props.globals.getNode("/systems/fadec/eng2/epr", 1); +var eng1_n2mode = props.globals.getNode("/systems/fadec/eng1/n2", 1); +var eng2_n2mode = props.globals.getNode("/systems/fadec/eng2/n2", 1); +var flap_text = props.globals.getNode("/controls/flight/flap-txt", 1); +var flap_pos = props.globals.getNode("/controls/flight/flap-pos", 1); +var fuel = props.globals.getNode("/consumables/fuel/total-fuel-lbs", 1); +var modeautobrake = props.globals.getNode("/controls/autobrake/mode", 1); +var speedbrakearm = props.globals.getNode("/controls/flight/speedbrake-arm", 1); +var ECAMtoconfig = props.globals.getNode("/ECAM/to-config", 1); +var gear = props.globals.getNode("/gear/gear[1]/position-norm", 1); +var smoke = props.globals.getNode("/controls/switches/no-smoking-sign", 1); +var seatbelt = props.globals.getNode("/controls/switches/seatbelt-sign", 1); +var flaps3_ovr = props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override", 1); +var eng1_n1 = props.globals.getNode("/engines/engine[0]/n1-actual", 1); +var eng2_n1 = props.globals.getNode("/engines/engine[1]/n1-actual", 1); +var eng1_n2 = props.globals.getNode("/engines/engine[0]/n2-actual", 1); +var eng2_n2 = props.globals.getNode("/engines/engine[1]/n2-actual", 1); +var eng1_epr = props.globals.getNode("/engines/engine[0]/epr-actual", 1); +var eng2_epr = props.globals.getNode("/engines/engine[1]/epr-actual", 1); +var eng1_n2mode = props.globals.getNode("/systems/fadec/eng1/egt", 1); +var eng2_n2mode = props.globals.getNode("/systems/fadec/eng2/egt", 1); +var eng1_egt = props.globals.getNode("/engines/engine[0]/egt-actual", 1); +var eng2_egt = props.globals.getNode("/engines/engine[1]/egt-actual", 1); +var eng1_egtmode = props.globals.getNode("/systems/fadec/eng1/egt", 1); +var eng2_egtmode = props.globals.getNode("/systems/fadec/eng2/egt", 1); +var eng1_ffmode = props.globals.getNode("/systems/fadec/eng1/ff", 1); +var eng2_ffmode = props.globals.getNode("/systems/fadec/eng2/ff", 1); +var fadecpower_1 = props.globals.getNode("/systems/fadec/powered1", 1); +var fadecpower_2 = props.globals.getNode("/systems/fadec/powered2", 1); +var fadecpowerup = props.globals.getNode("/systems/fadec/powerup", 1); +var thr_limit = props.globals.getNode("/controls/engines/thrust-limit", 1); +var n1_limit = props.globals.getNode("/controls/engines/n1-limit", 1); +var epr_limit = props.globals.getNode("/controls/engines/epr-limit", 1); +var n1mode1 = props.globals.getNode("/systems/fadec/n1mode1", 1); +var n1mode2 = props.globals.getNode("/systems/fadec/n1mode2", 1); +var ECAM_line1 = props.globals.getNode("/ECAM/msg/line1", 1); +var ECAM_line2 = props.globals.getNode("/ECAM/msg/line2", 1); +var ECAM_line3 = props.globals.getNode("/ECAM/msg/line3", 1); +var ECAM_line4 = props.globals.getNode("/ECAM/msg/line4", 1); +var ECAM_line5 = props.globals.getNode("/ECAM/msg/line5", 1); +var ECAM_line6 = props.globals.getNode("/ECAM/msg/line6", 1); +var ECAM_line7 = props.globals.getNode("/ECAM/msg/line7", 1); +var ECAM_line8 = props.globals.getNode("/ECAM/msg/line8", 1); +var ECAM_line1c = props.globals.getNode("/ECAM/msg/line1c", 1); +var ECAM_line2c = props.globals.getNode("/ECAM/msg/line2c", 1); +var ECAM_line3c = props.globals.getNode("/ECAM/msg/line3c", 1); +var ECAM_line4c = props.globals.getNode("/ECAM/msg/line4c", 1); +var ECAM_line5c = props.globals.getNode("/ECAM/msg/line5c", 1); +var ECAM_line6c = props.globals.getNode("/ECAM/msg/line6c", 1); +var ECAM_line7c = props.globals.getNode("/ECAM/msg/line7c", 1); +var ECAM_line8c = props.globals.getNode("/ECAM/msg/line8c", 1); +var ECAMleft = props.globals.getNode("/ECAM/left-msg", 1); +var rate = props.globals.getNode("/systems/acconfig/options/uecam-rate", 1); var canvas_upperECAM_base = { init: func(canvas_group, file) { @@ -49,34 +116,36 @@ var canvas_upperECAM_base = { return []; }, update: func() { - elapsedtime = getprop("/sim/time/elapsed-sec"); - if (getprop("/systems/electrical/bus/ac-ess") >= 110) { - if (getprop("/systems/acconfig/autoconfig-running") != 1 and getprop("/instrumentation/du/du3-test") != 1) { - setprop("/instrumentation/du/du3-test", 1); - setprop("/instrumentation/du/du3-test-amount", math.round((rand() * 5 ) + 35, 0.1)); - setprop("/instrumentation/du/du3-test-time", getprop("/sim/time/elapsed-sec")); - } else if (getprop("/systems/acconfig/autoconfig-running") == 1 and getprop("/instrumentation/du/du3-test") != 1) { - setprop("/instrumentation/du/du3-test", 1); - setprop("/instrumentation/du/du3-test-amount", math.round((rand() * 5 ) + 35, 0.1)); - setprop("/instrumentation/du/du3-test-time", getprop("/sim/time/elapsed-sec") - 30); + elapsedtime = et.getValue(); + + if (acess.getValue() >= 110) { + if (acconfig.getValue() != 1 and du3_test.getValue() != 1) { + du3_test.setValue(1); + du3_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); + du3_test_time.setValue(elapsedtime); + } else if (acconfig.getValue() == 1 and du3_test.getValue() != 1) { + du3_test.setValue(1); + du3_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); + du3_test_time.setValue(elapsedtime - 30); } } else { - setprop("/instrumentation/du/du3-test", 0); + du3_test.setValue(0); } - if (getprop("/systems/electrical/bus/ac-ess") >= 110 and getprop("/controls/lighting/DU/du3") > 0) { - if (getprop("/instrumentation/du/du3-test-time") + getprop("/instrumentation/du/du3-test-amount") >= elapsedtime) { + cur_eng_option = eng_option.getValue(); + if (acess.getValue() >= 110 and du3_lgt.getValue() > 0) { + if (du3_test_time.getValue() + du3_test_amount.getValue() >= elapsedtime) { upperECAM_cfm_eis2.page.hide(); upperECAM_iae_eis2.page.hide(); upperECAM_test.page.show(); upperECAM_test.update(); } else { upperECAM_test.page.hide(); - if (getprop("/options/eng") == "CFM") { + if (cur_eng_option == "CFM") { upperECAM_cfm_eis2.page.show(); upperECAM_iae_eis2.page.hide(); upperECAM_cfm_eis2.update(); - } else if (getprop("/options/eng") == "IAE") { + } else if (cur_eng_option == "IAE") { upperECAM_cfm_eis2.page.hide(); upperECAM_iae_eis2.page.show(); upperECAM_iae_eis2.update(); @@ -90,10 +159,12 @@ var canvas_upperECAM_base = { }, updateBase: func() { # Reversers - if (getprop("/engines/engine[0]/reverser-pos-norm") >= 0.01 and getprop("/systems/fadec/eng1/n1") == 1 and getprop("/options/eng") == "CFM") { + rev_1_cur = rev_1.getValue(); + rev_2_cur = rev_2.getValue(); + if (rev_1_cur >= 0.01 and eng1_n1mode.getValue() == 1 and cur_eng_option == "CFM") { me["REV1"].show(); me["REV1-box"].show(); - } else if (getprop("/engines/engine[0]/reverser-pos-norm") >= 0.01 and getprop("/systems/fadec/eng1/epr") == 1 and getprop("/options/eng") == "IAE") { + } else if (rev_1_cur >= 0.01 and eng1_eprmode.getValue() == 1 and cur_eng_option == "IAE") { me["REV1"].show(); me["REV1-box"].show(); } else { @@ -101,16 +172,16 @@ var canvas_upperECAM_base = { me["REV1-box"].hide(); } - if (getprop("/engines/engine[0]/reverser-pos-norm") >= 0.95) { + if (rev_1_cur >= 0.95) { me["REV1"].setColor(0.0509,0.7529,0.2941); } else { me["REV1"].setColor(0.7333,0.3803,0); } - if (getprop("/engines/engine[1]/reverser-pos-norm") >= 0.01 and getprop("/systems/fadec/eng2/n1") == 1 and getprop("/options/eng") == "CFM") { + if (rev_2_cur >= 0.01 and eng2_n1mode.getValue() == 1 and cur_eng_option == "CFM") { me["REV2"].show(); me["REV2-box"].show(); - } else if (getprop("/engines/engine[1]/reverser-pos-norm") >= 0.01 and getprop("/systems/fadec/eng2/epr") == 1 and getprop("/options/eng") == "IAE") { + } else if (rev_2_cur >= 0.01 and eng2_eprmode.getValue() == 1 and cur_eng_option == "IAE") { me["REV2"].show(); me["REV2-box"].show(); } else { @@ -118,136 +189,148 @@ var canvas_upperECAM_base = { me["REV2-box"].hide(); } - if (getprop("/engines/engine[1]/reverser-pos-norm") >= 0.95) { + if (rev_2_cur >= 0.95) { me["REV2"].setColor(0.0509,0.7529,0.2941); } else { me["REV2"].setColor(0.7333,0.3803,0); } # Flap Indicator - me["FlapTxt"].setText(sprintf("%s", getprop("/controls/flight/flap-txt"))); + me["FlapTxt"].setText(sprintf("%s", flap_text.getValue())); - if (getprop("/controls/flight/flap-pos") > 0) { + if (flap_pos.getValue() > 0) { me["FlapDots"].show(); } else { me["FlapDots"].hide(); } # FOB - me["FOB-LBS"].setText(sprintf("%s", math.round(getprop("/consumables/fuel/total-fuel-lbs"), 10))); + me["FOB-LBS"].setText(sprintf("%s", math.round(fuel.getValue(), 10))); # Left ECAM Messages - if (getprop("/ECAM/left-msg") == "MSG") { - me["ECAML1"].setText(sprintf("%s", getprop("/ECAM/msg/line1"))); - me["ECAML2"].setText(sprintf("%s", getprop("/ECAM/msg/line2"))); - me["ECAML3"].setText(sprintf("%s", getprop("/ECAM/msg/line3"))); - me["ECAML4"].setText(sprintf("%s", getprop("/ECAM/msg/line4"))); - me["ECAML5"].setText(sprintf("%s", getprop("/ECAM/msg/line5"))); - me["ECAML6"].setText(sprintf("%s", getprop("/ECAM/msg/line6"))); - me["ECAML7"].setText(sprintf("%s", getprop("/ECAM/msg/line7"))); - me["ECAML8"].setText(sprintf("%s", getprop("/ECAM/msg/line8"))); + line1c = ECAM_line1c.getValue(); + line2c = ECAM_line2c.getValue(); + line3c = ECAM_line3c.getValue(); + line4c = ECAM_line4c.getValue(); + line5c = ECAM_line5c.getValue(); + line6c = ECAM_line6c.getValue(); + line7c = ECAM_line7c.getValue(); + line8c = ECAM_line8c.getValue(); + leftmsg = ECAMleft.getValue(); + + if (leftmsg == "MSG") { + me["ECAML1"].setText(sprintf("%s", ECAM_line1.getValue())); + me["ECAML2"].setText(sprintf("%s", ECAM_line2.getValue())); + me["ECAML3"].setText(sprintf("%s", ECAM_line3.getValue())); + me["ECAML4"].setText(sprintf("%s", ECAM_line4.getValue())); + me["ECAML5"].setText(sprintf("%s", ECAM_line5.getValue())); + me["ECAML6"].setText(sprintf("%s", ECAM_line6.getValue())); + me["ECAML7"].setText(sprintf("%s", ECAM_line7.getValue())); + me["ECAML8"].setText(sprintf("%s", ECAM_line8.getValue())); - if (getprop("/ECAM/msg/line1c") == "w") { + + if (line1c == "w") { me["ECAML1"].setColor(0.8078,0.8039,0.8078); - } else if (getprop("/ECAM/msg/line1c") == "b") { + } else if (line1c == "b") { me["ECAML1"].setColor(0.0901,0.6039,0.7176); - } else if (getprop("/ECAM/msg/line1c") == "g") { + } else if (line1c == "g") { me["ECAML1"].setColor(0.0509,0.7529,0.2941); - } else if (getprop("/ECAM/msg/line1c") == "a") { + } else if (line1c == "a") { me["ECAML1"].setColor(0.7333,0.3803,0); - } else if (getprop("/ECAM/msg/line1c") == "r") { + } else if (line1c == "r") { me["ECAML1"].setColor(1,0,0); } - if (getprop("/ECAM/msg/line2c") == "w") { + if (line2c == "w") { me["ECAML2"].setColor(0.8078,0.8039,0.8078); - } else if (getprop("/ECAM/msg/line2c") == "b") { + } else if (line2c == "b") { me["ECAML2"].setColor(0.0901,0.6039,0.7176); - } else if (getprop("/ECAM/msg/line2c") == "g") { + } else if (line2c == "g") { me["ECAML2"].setColor(0.0509,0.7529,0.2941); - } else if (getprop("/ECAM/msg/line2c") == "a") { + } else if (line2c == "a") { me["ECAML2"].setColor(0.7333,0.3803,0); - } else if (getprop("/ECAM/msg/line2c") == "r") { + } else if (line2c == "r") { me["ECAML2"].setColor(1,0,0); } - if (getprop("/ECAM/msg/line3c") == "w") { + if (line3c == "w") { me["ECAML3"].setColor(0.8078,0.8039,0.8078); - } else if (getprop("/ECAM/msg/line3c") == "b") { + } else if (line3c == "b") { me["ECAML3"].setColor(0.0901,0.6039,0.7176); - } else if (getprop("/ECAM/msg/line3c") == "g") { + } else if (line3c == "g") { me["ECAML3"].setColor(0.0509,0.7529,0.2941); - } else if (getprop("/ECAM/msg/line3c") == "a") { + } else if (line3c == "a") { me["ECAML3"].setColor(0.7333,0.3803,0); - } else if (getprop("/ECAM/msg/line3c") == "r") { + } else if (line3c == "r") { me["ECAML3"].setColor(1,0,0); } - if (getprop("/ECAM/msg/line4c") == "w") { + if (line4c == "w") { me["ECAML4"].setColor(0.8078,0.8039,0.8078); - } else if (getprop("/ECAM/msg/line4c") == "b") { + } else if (line4c == "b") { me["ECAML4"].setColor(0.0901,0.6039,0.7176); - } else if (getprop("/ECAM/msg/line4c") == "g") { + } else if (line4c == "g") { me["ECAML4"].setColor(0.0509,0.7529,0.2941); - } else if (getprop("/ECAM/msg/line4c") == "a") { + } else if (line4c == "a") { me["ECAML4"].setColor(0.7333,0.3803,0); - } else if (getprop("/ECAM/msg/line4c") == "r") { + } else if (line4c == "r") { me["ECAML4"].setColor(1,0,0); } - if (getprop("/ECAM/msg/line5c") == "w") { + if (line5c == "w") { me["ECAML5"].setColor(0.8078,0.8039,0.8078); - } else if (getprop("/ECAM/msg/line5c") == "b") { + } else if (line5c == "b") { me["ECAML5"].setColor(0.0901,0.6039,0.7176); - } else if (getprop("/ECAM/msg/line5c") == "g") { + } else if (line5c == "g") { me["ECAML5"].setColor(0.0509,0.7529,0.2941); - } else if (getprop("/ECAM/msg/line5c") == "a") { + } else if (line5c == "a") { me["ECAML5"].setColor(0.7333,0.3803,0); - } else if (getprop("/ECAM/msg/line5c") == "r") { + } else if (line5c == "r") { me["ECAML5"].setColor(1,0,0); } - if (getprop("/ECAM/msg/line6c") == "w") { + if (line6c == "w") { me["ECAML6"].setColor(0.8078,0.8039,0.8078); - } else if (getprop("/ECAM/msg/line6c") == "b") { + } else if (line6c == "b") { me["ECAML6"].setColor(0.0901,0.6039,0.7176); - } else if (getprop("/ECAM/msg/line6c") == "g") { + } else if (line6c == "g") { me["ECAML6"].setColor(0.0509,0.7529,0.2941); - } else if (getprop("/ECAM/msg/line6c") == "a") { + } else if (line6c == "a") { me["ECAML6"].setColor(0.7333,0.3803,0); - } else if (getprop("/ECAM/msg/line6c") == "r") { + } else if (line6c == "r") { me["ECAML6"].setColor(1,0,0); } - if (getprop("/ECAM/msg/line7c") == "w") { + if (line7c == "w") { me["ECAML7"].setColor(0.8078,0.8039,0.8078); - } else if (getprop("/ECAM/msg/line7c") == "b") { + } else if (line7c == "b") { me["ECAML7"].setColor(0.0901,0.6039,0.7176); - } else if (getprop("/ECAM/msg/line7c") == "g") { + } else if (line7c == "g") { me["ECAML7"].setColor(0.0509,0.7529,0.2941); - } else if (getprop("/ECAM/msg/line7c") == "a") { + } else if (line7c == "a") { me["ECAML7"].setColor(0.7333,0.3803,0); - } else if (getprop("/ECAM/msg/line7c") == "r") { + } else if (line7c == "r") { me["ECAML7"].setColor(1,0,0); } - if (getprop("/ECAM/msg/line8c") == "w") { + if (line8c == "w") { me["ECAML8"].setColor(0.8078,0.8039,0.8078); - } else if (getprop("/ECAM/msg/line8c") == "b") { + } else if (line8c == "b") { me["ECAML8"].setColor(0.0901,0.6039,0.7176); - } else if (getprop("/ECAM/msg/line8c") == "g") { + } else if (line8c == "g") { me["ECAML8"].setColor(0.0509,0.7529,0.2941); - } else if (getprop("/ECAM/msg/line8c") == "a") { + } else if (line8c == "a") { me["ECAML8"].setColor(0.7333,0.3803,0); - } else if (getprop("/ECAM/msg/line8c") == "r") { + } else if (line8c == "r") { me["ECAML8"].setColor(1,0,0); } me["TO_Memo"].hide(); me["LDG_Memo"].hide(); me["ECAM_Left"].show(); - } else if (getprop("/ECAM/left-msg") == "TO-MEMO") { - if (getprop("/controls/autobrake/mode") == 3) { + } else if (leftmsg == "TO-MEMO") { + modebrk = modeautobrake.getValue(); + if (modebrk == 3) { me["TO_Autobrake"].setText("AUTO BRK MAX"); me["TO_Autobrake_B"].hide(); } else { @@ -255,7 +338,7 @@ var canvas_upperECAM_base = { me["TO_Autobrake_B"].show(); } - if (getprop("/controls/switches/no-smoking-sign") == 1 and getprop("/controls/switches/seatbelt-sign") == 1) { + if (smoke.getValue() == 1 and seatbelt.getValue() == 1) { me["TO_Signs"].setText("SIGNS ON"); me["TO_Signs_B"].hide(); } else { @@ -263,7 +346,7 @@ var canvas_upperECAM_base = { me["TO_Signs_B"].show(); } - if (getprop("/controls/flight/speedbrake-arm") == 1) { + if (speedbrakearm.getValue() == 1) { me["TO_Spoilers"].setText("SPLRS ARM"); me["TO_Spoilers_B"].hide(); } else { @@ -271,7 +354,7 @@ var canvas_upperECAM_base = { me["TO_Spoilers_B"].show(); } - if (getprop("/controls/flight/flap-pos") > 0 and getprop("/controls/flight/flap-pos") < 5) { + if (flap_pos.getValue() > 0 and flap_pos.getValue() < 5) { me["TO_Flaps"].setText("FLAPS T.O"); me["TO_Flaps_B"].hide(); } else { @@ -279,7 +362,7 @@ var canvas_upperECAM_base = { me["TO_Flaps_B"].show(); } - if (getprop("/ECAM/to-config") == 1) { + if (ECAMtoconfig.getValue() == 1) { me["TO_Config"].setText("T.O CONFIG NORMAL"); me["TO_Config_B"].hide(); } else { @@ -290,8 +373,8 @@ var canvas_upperECAM_base = { me["ECAM_Left"].hide(); me["LDG_Memo"].hide(); me["TO_Memo"].show(); - } else if (getprop("/ECAM/left-msg") == "LDG-MEMO") { - if (getprop("/gear/gear[1]/position-norm") == 1) { + } else if (leftmsg == "LDG-MEMO") { + if (gear.getValue() == 1) { me["LDG_Gear"].setText("LDG GEAR DN"); me["LDG_Gear_B"].hide(); } else { @@ -299,7 +382,7 @@ var canvas_upperECAM_base = { me["LDG_Gear_B"].show(); } - if (getprop("/controls/switches/no-smoking-sign") == 1 and getprop("/controls/switches/seatbelt-sign") == 1) { + if (smoke.getValue() == 1 and seatbelt.getValue() == 1) { me["LDG_Signs"].setText("SIGNS ON"); me["LDG_Signs_B"].hide(); } else { @@ -307,7 +390,7 @@ var canvas_upperECAM_base = { me["LDG_Signs_B"].show(); } - if (getprop("/controls/flight/speedbrake-arm") == 1) { + if (speedbrakearm.getValue() == 1) { me["LDG_Spoilers"].setText("SPLRS ARM"); me["LDG_Spoilers_B"].hide(); } else { @@ -315,17 +398,19 @@ var canvas_upperECAM_base = { me["LDG_Spoilers_B"].show(); } - if (getprop("/instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override") != 1 and getprop("/controls/flight/flap-pos") == 5) { + flaps3 = flaps3_ovr.getValue(); + flaps_position = flaps_pos.getValue(); + if (flaps3 != 1 and flaps_position == 5) { me["LDG_Flaps"].setText("FLAPS FULL"); me["LDG_Flaps_B"].hide(); me["LDG_Flaps_B3"].hide(); - } else if (getprop("/instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override") == 1 and getprop("/controls/flight/flap-pos") >= 4) { + } else if (flaps3 == 1 and flaps_position >= 4) { me["LDG_Flaps"].setText("FLAPS 3"); me["LDG_Flaps_B"].hide(); me["LDG_Flaps_B3"].hide(); } else { me["LDG_Flaps"].setText("FLAPS"); - if (getprop("/instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override") == 1) { + if (flaps3 == 1) { me["LDG_Flaps_B"].hide(); me["LDG_Flaps_B3"].show(); } else { @@ -361,21 +446,39 @@ var canvas_upperECAM_cfm_eis2 = { }, update: func() { # N1 - me["N11"].setText(sprintf("%s", math.floor(getprop("/engines/engine[0]/n1-actual") + 0.05))); - me["N11-decimal"].setText(sprintf("%s", int(10 * math.mod(getprop("/engines/engine[0]/n1-actual") + 0.05, 1)))); + N1_1_cur = N1_1.getValue(); + N1_2_cur = N1_2.getValue(); + N1_1_act = eng1_n1.getValue(); + N1_2_act = eng2_n1.getValue(); + N1_lim_cur = N1_lim.getValue(); + N1_thr_1_act = N1_thr_1.getValue(); + N1_thr_2_act = N1_thr_2.getValue(); + n1mode_1 = eng1_n1mode.getValue(); + n1mode_2 = eng2_n1mode.getValue(); + rev_1_act = rev_1.getValue(); + rev_2_act = rev_2.getValue(); + ff_1 = eng1_ffmode.getValue(); + ff_2 = eng2_ffmode.getValue(); + EGT_1_cur = EGT_1.getValue(); + EGT_2_cur = EGT_2.getValue(); + n2cur_1 = eng1_n2.getValue(); + n2cur_2 = eng2_n2.getValue(); - me["N12"].setText(sprintf("%s", math.floor(getprop("/engines/engine[1]/n1-actual") + 0.05))); - me["N12-decimal"].setText(sprintf("%s", int(10 * math.mod(getprop("/engines/engine[1]/n1-actual") + 0.05, 1)))); + me["N11"].setText(sprintf("%s", math.floor(N1_1_act + 0.05))); + me["N11-decimal"].setText(sprintf("%s", int(10 * math.mod(N1_1_act + 0.05, 1)))); - me["N11-needle"].setRotation((getprop("/ECAM/Upper/N1[0]") + 90) * D2R); - me["N11-thr"].setRotation((getprop("/ECAM/Upper/N1thr[0]") + 90) * D2R); - me["N11-ylim"].setRotation((getprop("/ECAM/Upper/N1ylim") + 90) * D2R); + me["N12"].setText(sprintf("%s", math.floor(N1_2_act + 0.05))); + me["N12-decimal"].setText(sprintf("%s", int(10 * math.mod(N1_2_act + 0.05, 1)))); - me["N12-needle"].setRotation((getprop("/ECAM/Upper/N1[1]") + 90) * D2R); - me["N12-thr"].setRotation((getprop("/ECAM/Upper/N1thr[1]") + 90) * D2R); - me["N12-ylim"].setRotation((getprop("/ECAM/Upper/N1ylim") + 90) * D2R); + me["N11-needle"].setRotation((N1_1_cur + 90) * D2R); + me["N11-thr"].setRotation((N1_thr_1_act + 90) * D2R); + me["N11-ylim"].setRotation((N1_lim_cur + 90) * D2R); - if (getprop("/systems/fadec/eng1/n1") == 1) { + me["N12-needle"].setRotation((N1_2_cur + 90) * D2R); + me["N12-thr"].setRotation((N1_thr_2_act + 90) * D2R); + me["N12-ylim"].setRotation((N1_lim_cur + 90) * D2R); + + if (n1mode_1 == 1) { me["N11-scale"].setColor(0.8078,0.8039,0.8078); me["N11-scale2"].setColor(1,0,0); me["N11"].show(); @@ -405,13 +508,13 @@ var canvas_upperECAM_cfm_eis2 = { me["N11-XX-box"].show(); } - if (getprop("/engines/engine[0]/reverser-pos-norm") < 0.01 and getprop("/systems/fadec/eng1/n1") == 1) { + if (rev_1_act < 0.01 and n1mode_1 == 1) { me["N11-thr"].show(); } else { me["N11-thr"].hide(); } - if (getprop("/systems/fadec/eng2/n1") == 1) { + if (n1mode_2 == 1) { me["N12-scale"].setColor(0.8078,0.8039,0.8078); me["N12-scale2"].setColor(1,0,0); me["N12"].show(); @@ -441,20 +544,20 @@ var canvas_upperECAM_cfm_eis2 = { me["N12-XX-box"].show(); } - if (getprop("/engines/engine[1]/reverser-pos-norm") < 0.01 and getprop("/systems/fadec/eng2/n1") == 1) { + if (rev_2_act < 0.01 and n1mode_2 == 1) { me["N12-thr"].show(); } else { me["N12-thr"].hide(); } # EGT - me["EGT1"].setText(sprintf("%s", math.round(getprop("/engines/engine[0]/egt-actual")))); - me["EGT2"].setText(sprintf("%s", math.round(getprop("/engines/engine[1]/egt-actual")))); + me["EGT1"].setText(sprintf("%s", math.round(eng1_egt.getValue()))); + me["EGT2"].setText(sprintf("%s", math.round(eng2_egt.getValue()))); - me["EGT1-needle"].setRotation((getprop("/ECAM/Upper/EGT[0]") + 90) * D2R); - me["EGT2-needle"].setRotation((getprop("/ECAM/Upper/EGT[1]") + 90) * D2R); + me["EGT1-needle"].setRotation((EGT_1_cur + 90) * D2R); + me["EGT2-needle"].setRotation((EGT_2_cur + 90) * D2R); - if (getprop("/systems/fadec/eng1/egt") == 1) { + if (eng1_egtmode.getValue() == 1) { me["EGT1-scale"].setColor(0.8078,0.8039,0.8078); me["EGT1-scale2"].setColor(1,0,0); me["EGT1"].show(); @@ -472,7 +575,7 @@ var canvas_upperECAM_cfm_eis2 = { me["EGT1-XX"].show(); } - if (getprop("/systems/fadec/eng2/egt") == 1) { + if (eng2_egtmode.getValue() == 1) { me["EGT2-scale"].setColor(0.8078,0.8039,0.8078); me["EGT2-scale2"].setColor(1,0,0); me["EGT2"].show(); @@ -491,12 +594,13 @@ var canvas_upperECAM_cfm_eis2 = { } # N2 - me["N21"].setText(sprintf("%s", math.floor(getprop("/engines/engine[0]/n2-actual") + 0.05))); - me["N21-decimal"].setText(sprintf("%s", int(10 * math.mod(getprop("/engines/engine[0]/n2-actual") + 0.05, 1)))); - me["N22"].setText(sprintf("%s", math.floor(getprop("/engines/engine[1]/n2-actual") + 0.05))); - me["N22-decimal"].setText(sprintf("%s", int(10 * math.mod(getprop("/engines/engine[1]/n2-actual") + 0.05, 1)))); - if (getprop("/systems/fadec/eng1/n2") == 1) { + me["N21"].setText(sprintf("%s", math.floor(n2cur_1 + 0.05))); + me["N21-decimal"].setText(sprintf("%s", int(10 * math.mod(n2cur_1 + 0.05, 1)))); + me["N22"].setText(sprintf("%s", math.floor(n2cur_2 + 0.05))); + me["N22-decimal"].setText(sprintf("%s", int(10 * math.mod(n2cur_2 + 0.05, 1)))); + + if (eng1_n2mode.getValue() == 1) { me["N21"].show(); me["N21-decimal"].show(); me["N21-decpnt"].show(); @@ -508,7 +612,7 @@ var canvas_upperECAM_cfm_eis2 = { me["N21-XX"].show(); } - if (getprop("/systems/fadec/eng2/n2") == 1) { + if (eng2_n2mode.getValue() == 1) { me["N22"].show(); me["N22-decimal"].show(); me["N22-decpnt"].show(); @@ -521,10 +625,10 @@ var canvas_upperECAM_cfm_eis2 = { } # FF - me["FF1"].setText(sprintf("%s", math.round(getprop("/engines/engine[0]/fuel-flow_actual"), 10))); - me["FF2"].setText(sprintf("%s", math.round(getprop("/engines/engine[1]/fuel-flow_actual"), 10))); + me["FF1"].setText(sprintf("%s", math.round(fuel_1.getValue(), 10))); + me["FF2"].setText(sprintf("%s", math.round(fuel_2.getValue(), 10))); - if (getprop("/systems/fadec/eng1/ff") == 1) { + if (ff_1 == 1) { me["FF1"].show(); me["FF1-XX"].hide(); } else { @@ -532,7 +636,7 @@ var canvas_upperECAM_cfm_eis2 = { me["FF1-XX"].show(); } - if (getprop("/systems/fadec/eng2/ff") == 1) { + if (ff_2 == 1) { me["FF2"].show(); me["FF2-XX"].hide(); } else { @@ -541,11 +645,11 @@ var canvas_upperECAM_cfm_eis2 = { } # N1 Limit - me["N1Lim-mode"].setText(sprintf("%s", getprop("/controls/engines/thrust-limit"))); - me["N1Lim"].setText(sprintf("%s", math.floor(getprop("/controls/engines/n1-limit") + 0.05))); - me["N1Lim-decimal"].setText(sprintf("%s", int(10 * math.mod(getprop("/controls/engines/n1-limit") + 0.05, 1)))); + me["N1Lim-mode"].setText(sprintf("%s", thr_limit.getValue())); + me["N1Lim"].setText(sprintf("%s", math.floor(n1_limit.getValue() + 0.05))); + me["N1Lim-decimal"].setText(sprintf("%s", int(10 * math.mod(n1_limit.getValue() + 0.05, 1)))); - if (getprop("/systems/fadec/powered1") == 1 or getprop("/systems/fadec/powered2") == 1 or getprop("/systems/fadec/powerup")) { + if (fadecpower_1.getValue() == 1 or fadecpower_2.getValue() == 1 or fadecpowerup.getValue()) { me["N1Lim-mode"].show(); me["N1Lim-XX"].hide(); me["N1Lim-XX2"].hide(); @@ -555,7 +659,7 @@ var canvas_upperECAM_cfm_eis2 = { me["N1Lim-XX2"].show(); } - if ((getprop("/systems/fadec/powered1") == 1 or getprop("/systems/fadec/powered2") == 1 or getprop("/systems/fadec/powerup")) and getprop("/controls/engines/thrust-limit") != "MREV") { + if ((fadecpower_1.getValue() == 1 or fadecpower_2.getValue() == 1 or fadecpowerup.getValue()) and thr_limit.getValue() != "MREV") { me["N1Lim"].show(); me["N1Lim-decpnt"].show(); me["N1Lim-decimal"].show(); @@ -587,20 +691,43 @@ var canvas_upperECAM_iae_eis2 = { "LDG_Memo","LDG_Gear","LDG_Signs","LDG_Spoilers","LDG_Flaps","LDG_Gear_B","LDG_Signs_B","LDG_Spoilers_B","LDG_Flaps_B","LDG_Flaps_B3"]; }, update: func() { + N1_1_cur = N1_1.getValue(); + N1_2_cur = N1_2.getValue(); + N1_1_act = eng1_n1.getValue(); + N1_2_act = eng2_n1.getValue(); + N1_lim_cur = N1_lim.getValue(); + EPR_1_cur = EPR_1.getValue(); + EPR_2_cur = EPR_2.getValue(); + EPR_1_act = eng1_epr.getValue(); + EPR_2_act = eng2_epr.getValue(); + EPR_lim_cur = EPR_lim.getValue(); + EPR_thr_1_act = EPR_thr_1.getValue(); + EPR_thr_2_act = EPR_thr_2.getValue(); + eprmode1 = eng1_eprmode.getValue(); + eprmode2 = eng2_eprmode.getValue(); + rev_1_act = rev_1.getValue(); + rev_2_act = rev_2.getValue(); + ff_1 = eng1_ffmode.getValue(); + ff_2 = eng2_ffmode.getValue(); + EGT_1_cur = EGT_1.getValue(); + EGT_2_cur = EGT_2.getValue(); + n2cur_1 = eng1_n2.getValue(); + n2cur_2 = eng2_n2.getValue(); + # EPR - me["EPR1"].setText(sprintf("%1.0f", math.floor(getprop("/engines/engine[0]/epr-actual")))); - me["EPR1-decimal"].setText(sprintf("%03d", (getprop("/engines/engine[0]/epr-actual") - int(getprop("/engines/engine[0]/epr-actual"))) * 1000)); - me["EPR2"].setText(sprintf("%1.0f", math.floor(getprop("/engines/engine[1]/epr-actual")))); - me["EPR2-decimal"].setText(sprintf("%03d", (getprop("/engines/engine[1]/epr-actual") - int(getprop("/engines/engine[1]/epr-actual"))) * 1000)); + me["EPR1"].setText(sprintf("%1.0f", math.floor(EPR_1_act))); + me["EPR1-decimal"].setText(sprintf("%03d", (EPR_1_act - int(EPR_1_act)) * 1000)); + me["EPR2"].setText(sprintf("%1.0f", math.floor(EPR_2_act))); + me["EPR2-decimal"].setText(sprintf("%03d", (EPR_2_act - int(EPR_2_act)) * 1000)); - me["EPR1-needle"].setRotation((getprop("/ECAM/Upper/EPR[0]") + 90) * D2R); - me["EPR1-thr"].setRotation((getprop("/ECAM/Upper/EPRthr[0]") + 90) * D2R); - me["EPR1-ylim"].setRotation((getprop("/ECAM/Upper/EPRylim") + 90) * D2R); - me["EPR2-needle"].setRotation((getprop("/ECAM/Upper/EPR[1]") + 90) * D2R); - me["EPR2-thr"].setRotation((getprop("/ECAM/Upper/EPRthr[1]") + 90) * D2R); - me["EPR2-ylim"].setRotation((getprop("/ECAM/Upper/EPRylim") + 90) * D2R); + me["EPR1-needle"].setRotation((EPR_1_cur + 90) * D2R); + me["EPR1-thr"].setRotation((EPR_thr_1_act + 90) * D2R); + me["EPR1-ylim"].setRotation((EPR_lim_cur + 90) * D2R); + me["EPR2-needle"].setRotation((EPR_2_cur + 90) * D2R); + me["EPR2-thr"].setRotation((EPR_thr_2_act + 90) * D2R); + me["EPR2-ylim"].setRotation((EPR_lim_cur + 90) * D2R); - if (getprop("/systems/fadec/eng1/epr") == 1) { + if (eprmode1 == 1) { me["EPR1-scale"].setColor(0.8078,0.8039,0.8078); me["EPR1"].show(); me["EPR1-decpnt"].show(); @@ -626,13 +753,13 @@ var canvas_upperECAM_iae_eis2 = { me["EPR1-XX2"].show(); } - if (getprop("/engines/engine[0]/reverser-pos-norm") < 0.01 and getprop("/systems/fadec/eng1/epr") == 1) { + if (rev_1_act < 0.01 and eprmode1 == 1) { me["EPR1-thr"].show(); } else { me["EPR1-thr"].hide(); } - if (getprop("/systems/fadec/eng2/epr") == 1) { + if (eprmode2 == 1) { me["EPR2-scale"].setColor(0.8078,0.8039,0.8078); me["EPR2"].show(); me["EPR2-decpnt"].show(); @@ -658,20 +785,20 @@ var canvas_upperECAM_iae_eis2 = { me["EPR2-XX2"].show(); } - if (getprop("/engines/engine[1]/reverser-pos-norm") < 0.01 and getprop("/systems/fadec/eng2/epr") == 1) { + if (rev_2_act < 0.01 and eprmode2 == 1) { me["EPR2-thr"].show(); } else { me["EPR2-thr"].hide(); } # EGT - me["EGT1"].setText(sprintf("%s", math.round(getprop("/engines/engine[0]/egt-actual")))); - me["EGT2"].setText(sprintf("%s", math.round(getprop("/engines/engine[1]/egt-actual")))); + me["EGT1"].setText(sprintf("%s", math.round(eng1_egt.getValue()))); + me["EGT2"].setText(sprintf("%s", math.round(eng2_egt.getValue()))); - me["EGT1-needle"].setRotation((getprop("/ECAM/Upper/EGT[0]") + 90) * D2R); - me["EGT2-needle"].setRotation((getprop("/ECAM/Upper/EGT[1]") + 90) * D2R); + me["EGT1-needle"].setRotation((EGT_1_cur + 90) * D2R); + me["EGT2-needle"].setRotation((EGT_2_cur + 90) * D2R); - if (getprop("/systems/fadec/eng1/egt") == 1) { + if (eng1_egtmode.getValue() == 1) { me["EGT1-scale"].setColor(0.8078,0.8039,0.8078); me["EGT1-scale2"].setColor(1,0,0); me["EGT1"].show(); @@ -689,7 +816,7 @@ var canvas_upperECAM_iae_eis2 = { me["EGT1-XX"].show(); } - if (getprop("/systems/fadec/eng2/egt") == 1) { + if (eng2_egtmode.getValue() == 1) { me["EGT2-scale"].setColor(0.8078,0.8039,0.8078); me["EGT2-scale2"].setColor(1,0,0); me["EGT2"].show(); @@ -708,21 +835,21 @@ var canvas_upperECAM_iae_eis2 = { } # N1 - me["N11"].setText(sprintf("%s", math.floor(getprop("/engines/engine[0]/n1-actual") + 0.05))); - me["N11-decimal"].setText(sprintf("%s", int(10 * math.mod(getprop("/engines/engine[0]/n1-actual") + 0.05, 1)))); + me["N11"].setText(sprintf("%s", math.floor(eng1_n1.getValue() + 0.05))); + me["N11-decimal"].setText(sprintf("%s", int(10 * math.mod(eng1_n1.getValue() + 0.05, 1)))); - me["N12"].setText(sprintf("%s", math.floor(getprop("/engines/engine[1]/n1-actual") + 0.05))); - me["N12-decimal"].setText(sprintf("%s", int(10 * math.mod(getprop("/engines/engine[1]/n1-actual") + 0.05, 1)))); + me["N12"].setText(sprintf("%s", math.floor(eng2_n1.getValue() + 0.05))); + me["N12-decimal"].setText(sprintf("%s", int(10 * math.mod(eng2_n1.getValue() + 0.05, 1)))); - me["N11-needle"].setRotation((getprop("/ECAM/Upper/N1[0]") + 90) * D2R); - me["N11-thr"].setRotation((getprop("/ECAM/Upper/N1thr[0]") + 90) * D2R); - me["N11-ylim"].setRotation((getprop("/ECAM/Upper/N1ylim") + 90) * D2R); + me["N11-needle"].setRotation((N1_1_cur + 90) * D2R); + me["N11-thr"].setRotation((N1_thr_1.getValue() + 90) * D2R); + me["N11-ylim"].setRotation((N1_lim_cur + 90) * D2R); - me["N12-needle"].setRotation((getprop("/ECAM/Upper/N1[1]") + 90) * D2R); - me["N12-thr"].setRotation((getprop("/ECAM/Upper/N1thr[1]") + 90) * D2R); - me["N12-ylim"].setRotation((getprop("/ECAM/Upper/N1ylim") + 90) * D2R); + me["N12-needle"].setRotation((N1_2_cur + 90) * D2R); + me["N12-thr"].setRotation((N1_thr_2.getValue() + 90) * D2R); + me["N12-ylim"].setRotation((N1_lim_cur + 90) * D2R); - if (getprop("/systems/fadec/eng1/n1") == 1) { + if (eng1_n1mode.getValue() == 1) { me["N11-scale"].setColor(0.8078,0.8039,0.8078); me["N11-scale2"].setColor(1,0,0); me["N11"].show(); @@ -744,7 +871,7 @@ var canvas_upperECAM_iae_eis2 = { me["N11-XX"].show(); } - if (getprop("/systems/fadec/eng2/n1") == 1) { + if (eng2_n1mode.getValue() == 1) { me["N12-scale"].setColor(0.8078,0.8039,0.8078); me["N12-scale2"].setColor(1,0,0); me["N12"].show(); @@ -766,7 +893,7 @@ var canvas_upperECAM_iae_eis2 = { me["N12-XX"].show(); } - if (getprop("/systems/fadec/eng1/n1") == 1 and getprop("/systems/fadec/n1mode1") == 1) { + if (eng1_n1mode.getValue() == 1 and n1mode1.getValue() == 1) { me["N11-thr"].show(); me["N11-ylim"].hide(); # Keep it hidden, since N1 mode limit calculation is not done yet } else { @@ -774,7 +901,7 @@ var canvas_upperECAM_iae_eis2 = { me["N11-ylim"].hide(); } - if (getprop("/systems/fadec/eng1/n2") == 1 and getprop("/systems/fadec/n1mode2") == 1) { + if (eng2_n1mode.getValue() == 1 and n1mode2.getValue() == 1) { me["N12-thr"].show(); me["N12-ylim"].hide(); # Keep it hidden, since N1 mode limit calculation is not done yet } else { @@ -783,12 +910,12 @@ var canvas_upperECAM_iae_eis2 = { } # N2 - me["N21"].setText(sprintf("%s", math.floor(getprop("/engines/engine[0]/n2-actual") + 0.05))); - me["N21-decimal"].setText(sprintf("%s", int(10 * math.mod(getprop("/engines/engine[0]/n2-actual") + 0.05, 1)))); - me["N22"].setText(sprintf("%s", math.floor(getprop("/engines/engine[1]/n2-actual") + 0.05))); - me["N22-decimal"].setText(sprintf("%s", int(10 * math.mod(getprop("/engines/engine[1]/n2-actual") + 0.05, 1)))); + me["N21"].setText(sprintf("%s", math.floor(eng1_n2.getValue() + 0.05))); + me["N21-decimal"].setText(sprintf("%s", int(10 * math.mod(eng1_n2.getValue() + 0.05, 1)))); + me["N22"].setText(sprintf("%s", math.floor(eng2_n2.getValue() + 0.05))); + me["N22-decimal"].setText(sprintf("%s", int(10 * math.mod(eng2_n2.getValue() + 0.05, 1)))); - if (getprop("/systems/fadec/eng1/n2") == 1) { + if (eng1_n2mode.getValue() == 1) { me["N21"].show(); me["N21-decimal"].show(); me["N21-decpnt"].show(); @@ -800,7 +927,7 @@ var canvas_upperECAM_iae_eis2 = { me["N21-XX"].show(); } - if (getprop("/systems/fadec/eng2/n2") == 1) { + if (eng2_n2mode.getValue() == 1) { me["N22"].show(); me["N22-decimal"].show(); me["N22-decpnt"].show(); @@ -813,10 +940,10 @@ var canvas_upperECAM_iae_eis2 = { } # FF - me["FF1"].setText(sprintf("%s", math.round(getprop("/engines/engine[0]/fuel-flow_actual"), 10))); - me["FF2"].setText(sprintf("%s", math.round(getprop("/engines/engine[1]/fuel-flow_actual"), 10))); + me["FF1"].setText(sprintf("%s", math.round(fuel_1.getValue(), 10))); + me["FF2"].setText(sprintf("%s", math.round(fuel_2.getValue(), 10))); - if (getprop("/systems/fadec/eng1/ff") == 1) { + if (ff_1 == 1) { me["FF1"].show(); me["FF1-XX"].hide(); } else { @@ -824,7 +951,7 @@ var canvas_upperECAM_iae_eis2 = { me["FF1-XX"].show(); } - if (getprop("/systems/fadec/eng2/ff") == 1) { + if (ff_2 == 1) { me["FF2"].show(); me["FF2-XX"].hide(); } else { @@ -833,11 +960,11 @@ var canvas_upperECAM_iae_eis2 = { } # EPR Limit - me["EPRLim-mode"].setText(sprintf("%s", getprop("/controls/engines/thrust-limit"))); - me["EPRLim"].setText(sprintf("%1.0f", math.floor(getprop("/controls/engines/epr-limit")))); - me["EPRLim-decimal"].setText(sprintf("%03d", (getprop("/controls/engines/epr-limit") - int(getprop("/controls/engines/epr-limit"))) * 1000)); + me["EPRLim-mode"].setText(sprintf("%s", thr_limit.getValue())); + me["EPRLim"].setText(sprintf("%1.0f", math.floor(epr_limit.getValue()))); + me["EPRLim-decimal"].setText(sprintf("%03d", (epr_limit.getValue() - int(epr_limit.getValue())) * 1000)); - if (getprop("/systems/fadec/powered1") == 1 or getprop("/systems/fadec/powered2") == 1 or getprop("/systems/fadec/powerup")) { + if (fadecpower_1.getValue() == 1 or fadecpower_2.getValue() == 1 or fadecpowerup.getValue()) { me["EPRLim-mode"].show(); me["EPRLim-XX"].hide(); me["EPRLim-XX2"].hide(); @@ -847,7 +974,7 @@ var canvas_upperECAM_iae_eis2 = { me["EPRLim-XX2"].show(); } - if ((getprop("/systems/fadec/powered1") == 1 or getprop("/systems/fadec/powered2") == 1 or getprop("/systems/fadec/powerup")) and getprop("/controls/engines/thrust-limit") != "MREV") { + if ((fadecpower_1.getValue() == 1 or fadecpower_2.getValue() == 1 or fadecpowerup.getValue()) and thr_limit.getValue() != "MREV") { me["EPRLim"].show(); me["EPRLim-decpnt"].show(); me["EPRLim-decimal"].show(); @@ -888,7 +1015,7 @@ var canvas_upperECAM_test = { return ["Test_white","Test_text"]; }, update: func() { - if (getprop("/instrumentation/du/du3-test-time") + 1 >= elapsedtime) { + if (du3_test_time.getValue() + 1 >= elapsedtime) { me["Test_white"].show(); me["Test_text"].hide(); } else { @@ -915,13 +1042,13 @@ setlistener("sim/signals/fdm-initialized", func { upperECAM_test = canvas_upperECAM_test.new(group_test, "Aircraft/IDG-A32X/Models/Instruments/Common/res/du-test.svg"); upperECAM_update.start(); - if (getprop("/systems/acconfig/options/uecam-rate") > 1) { + if (rate.getValue() > 1) { u_rateApply(); } }); var u_rateApply = func { - upperECAM_update.restart(0.05 * getprop("/systems/acconfig/options/uecam-rate")); + upperECAM_update.restart(0.05 * rate.getValue()); } var upperECAM_update = maketimer(0.05, func { diff --git a/revision.txt b/revision.txt index 67cb751d..e17d7a4a 100644 --- a/revision.txt +++ b/revision.txt @@ -1 +1 @@ -4642 \ No newline at end of file +4643 \ No newline at end of file From 048e5fad4b94cd23e839f257b267e08775bb28f1 Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Thu, 20 Sep 2018 13:50:33 -0400 Subject: [PATCH 4/5] DU: Add back the refactored ND.nas --- Models/Instruments/ND/canvas/ND.nas | 89 +++++++++++++++++------------ Models/Instruments/PFD/PFD.nas | 1 + 2 files changed, 53 insertions(+), 37 deletions(-) diff --git a/Models/Instruments/ND/canvas/ND.nas b/Models/Instruments/ND/canvas/ND.nas index 2dd1149d..a44e8ab9 100644 --- a/Models/Instruments/ND/canvas/ND.nas +++ b/Models/Instruments/ND/canvas/ND.nas @@ -15,12 +15,20 @@ var ND_2 = nil; var ND_1_test = nil; var ND_2_test = nil; var elapsedtime = 0; -setprop("/instrumentation/du/du2-test", 0); -setprop("/instrumentation/du/du2-test-time", 0); -setprop("/instrumentation/du/du2-test-amount", 0); -setprop("/instrumentation/du/du5-test", 0); -setprop("/instrumentation/du/du5-test-time", 0); -setprop("/instrumentation/du/du5-test-amount", 0); +var du1_test = props.globals.getNode("/instrumentation/du/du1-test", 1); +var du1_test_time = props.globals.getNode("/instrumentation/du/du1-test-time", 1); +var du1_test_amount = props.globals.getNode("/instrumentation/du/du1-test-amount", 1); +var du2_test = props.globals.getNode("/instrumentation/du/du2-test", 1); +var du2_test_time = props.globals.getNode("/instrumentation/du/du2-test-time", 1); +var du2_test_amount = props.globals.getNode("/instrumentation/du/du2-test-amount", 1); +var du5_test = props.globals.getNode("/instrumentation/du/du5-test", 1); +var du5_test_time = props.globals.getNode("/instrumentation/du/du5-test-time", 1); +var du5_test_amount = props.globals.getNode("/instrumentation/du/du5-test-amount", 1); +var du6_test = props.globals.getNode("/instrumentation/du/du6-test", 1); +var du6_test_time = props.globals.getNode("/instrumentation/du/du6-test-time", 1); +var du6_test_amount = props.globals.getNode("/instrumentation/du/du6-test-amount", 1); +var cpt_du_xfr = props.globals.getNode("/modes/cpt-du-xfr"); +var fo_du_xfr = props.globals.getNode("/modes/fo-du-xfr"); var nd_display = {}; @@ -79,38 +87,38 @@ var canvas_nd_base = { update: func() { elapsedtime = getprop("/sim/time/elapsed-sec"); if (getprop("/systems/electrical/bus/ac-ess-shed") >= 110) { - if (getprop("/systems/acconfig/autoconfig-running") != 1 and getprop("/instrumentation/du/du2-test") != 1) { - setprop("/instrumentation/du/du2-test", 1); - setprop("/instrumentation/du/du2-test-amount", math.round((rand() * 5 ) + 35, 0.1)); - setprop("/instrumentation/du/du2-test-time", getprop("/sim/time/elapsed-sec")); - } else if (getprop("/systems/acconfig/autoconfig-running") == 1 and getprop("/instrumentation/du/du2-test") != 1) { - setprop("/instrumentation/du/du2-test", 1); - setprop("/instrumentation/du/du2-test-amount", math.round((rand() * 5 ) + 35, 0.1)); - setprop("/instrumentation/du/du2-test-time", getprop("/sim/time/elapsed-sec") - 30); + if (getprop("/systems/acconfig/autoconfig-running") != 1 and du2_test.getValue() != 1) { + du2_test.setValue(1); + du2_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); + du2_test_time.setValue(getprop("/sim/time/elapsed-sec")); + } else if (getprop("/systems/acconfig/autoconfig-running") == 1 and du2_test.getValue() != 1) { + du2_test.setValue(1); + du2_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); + du2_test_time.setValue(getprop("/sim/time/elapsed-sec") - 30); } } else { - setprop("/instrumentation/du/du2-test", 0); + du2_test.setValue(0); } if (getprop("/systems/electrical/bus/ac2") >= 110) { - if (getprop("/systems/acconfig/autoconfig-running") != 1 and getprop("/instrumentation/du/du5-test") != 1) { - setprop("/instrumentation/du/du5-test", 1); - setprop("/instrumentation/du/du5-test-amount", math.round((rand() * 5 ) + 35, 0.1)); - setprop("/instrumentation/du/du5-test-time", getprop("/sim/time/elapsed-sec")); - } else if (getprop("/systems/acconfig/autoconfig-running") == 1 and getprop("/instrumentation/du/du5-test") != 1) { - setprop("/instrumentation/du/du5-test", 1); - setprop("/instrumentation/du/du5-test-amount", math.round((rand() * 5 ) + 35, 0.1)); - setprop("/instrumentation/du/du5-test-time", getprop("/sim/time/elapsed-sec") - 30); + if (getprop("/systems/acconfig/autoconfig-running") != 1 and du5_test.getValue() != 1) { + du5_test.setValue(1); + du5_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); + du5_test_time.setValue(getprop("/sim/time/elapsed-sec")); + } else if (getprop("/systems/acconfig/autoconfig-running") == 1 and du5_test.getValue() != 1) { + du5_test.setValue(1); + du5_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); + du5_test_time.setValue(getprop("/sim/time/elapsed-sec") - 30); } } else { - setprop("/instrumentation/du/du5-test", 0); + du5_test.setValue(0); } if (getprop("/systems/electrical/bus/ac-ess-shed") >= 110 and getprop("/controls/lighting/DU/du2") > 0) { - if (getprop("/instrumentation/du/du2-test-time") + getprop("/instrumentation/du/du2-test-amount") >= elapsedtime and getprop("/modes/cpt-du-xfr") != 1) { + if (du2_test_time.getValue() + du2_test_amount.getValue() >= elapsedtime and cpt_du_xfr.getValue() != 1) { ND_1.page.hide(); ND_1_test.page.show(); ND_1_test.update(); - } else if (getprop("/instrumentation/du/du1-test-time") + getprop("/instrumentation/du/du1-test-amount") >= elapsedtime and getprop("/modes/cpt-du-xfr") == 1) { + } else if (du1_test_time.getValue() + du1_test_amount.getValue() >= elapsedtime and cpt_du_xfr.getValue() == 1) { ND_1.page.hide(); ND_1_test.page.show(); ND_1_test.update(); @@ -124,11 +132,11 @@ var canvas_nd_base = { ND_1.page.hide(); } if (getprop("/systems/electrical/bus/ac2") >= 110 and getprop("/controls/lighting/DU/du5") > 0) { - if (getprop("/instrumentation/du/du5-test-time") + getprop("/instrumentation/du/du6-test-amount") >= elapsedtime and getprop("/modes/fo-du-xfr") != 1) { + if (du5_test_time.getValue() + du5_test_amount.getValue() >= elapsedtime and fo_du_xfr.getValue() != 1) { ND_2.page.hide(); ND_2_test.page.show(); ND_2_test.update(); - } else if (getprop("/instrumentation/du/du6-test-time") + getprop("/instrumentation/du/du5-test-amount") >= elapsedtime and getprop("/modes/fo-du-xfr") == 1) { + } else if (du6_test_time.getValue() + du6_test_amount.getValue() >= elapsedtime and fo_du_xfr.getValue() == 1) { ND_2.page.hide(); ND_2_test.page.show(); ND_2_test.update(); @@ -211,10 +219,12 @@ var canvas_ND_1_test = { return ["Test_white","Test_text"]; }, update: func() { - if (getprop("/instrumentation/du/du2-test-time") + 1 >= elapsedtime and getprop("/modes/cpt-du-xfr") != 1) { + elapsedtime = getprop("/sim/time/elapsed-sec") or 0; + if ((du2_test_time.getValue() + 1 >= elapsedtime) and getprop("/modes/cpt-du-xfr") != 1) { me["Test_white"].show(); me["Test_text"].hide(); - } else if (getprop("/instrumentation/du/du1-test-time") + 1 >= elapsedtime and getprop("/modes/cpt-du-xfr") == 1) { + } else if ((du1_test_time.getValue() + 1 >= elapsedtime) and getprop("/modes/cpt-du-xfr") != 0) { + print(getprop("/modes/cpt-du-xfr")); me["Test_white"].show(); me["Test_text"].hide(); } else { @@ -251,10 +261,11 @@ var canvas_ND_2_test = { return ["Test_white","Test_text"]; }, update: func() { - if (getprop("/instrumentation/du/du5-test-time") + 1 >= elapsedtime and getprop("/modes/cpt-du-xfr") != 1) { + elapsedtime = getprop("/sim/time/elapsed-sec") or 0; + if ((du5_test_time.getValue() + 1 >= elapsedtime) and getprop("/modes/cpt-du-xfr") != 1) { me["Test_white"].show(); me["Test_text"].hide(); - } else if (getprop("/instrumentation/du/du6-test-time") + 1 >= elapsedtime and getprop("/modes/cpt-du-xfr") == 1) { + } else if ((du6_test_time.getValue() + 1 >= elapsedtime) and getprop("/modes/cpt-du-xfr") != 0) { me["Test_white"].show(); me["Test_text"].hide(); } else { @@ -308,7 +319,7 @@ var nd_update = maketimer(0.05, func { canvas_nd_base.update(); }); -for (i = 0; i < 2; i = i + 1) { +for (i = 0; i < 2; i = i + 1 ) { setlistener("/instrumentation/efis["~i~"]/nd/display-mode", func(node) { var par = node.getParent().getParent(); var idx = par.getIndex(); @@ -319,14 +330,18 @@ for (i = 0; i < 2; i = i + 1) { var centered = 1; if (mode == "ILS") { cvs_mode = "APP"; - } else if (mode == "VOR") { + } + else if (mode == "VOR") { cvs_mode = "VOR"; - } else if (mode == "NAV") { + } + else if (mode == "NAV"){ cvs_mode = "MAP"; - } else if (mode == "ARC") { + } + else if (mode == "ARC"){ cvs_mode = "MAP"; centered = 0; - } else if (mode == "PLAN") { + } + else if (mode == "PLAN"){ cvs_mode = "PLAN"; } setprop(canvas_mode, cvs_mode); diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index c4827781..3b72a22e 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -147,6 +147,7 @@ var du5_test_amount = props.globals.initNode("/instrumentation/du/du5-test-amoun var du6_test = props.globals.initNode("/instrumentation/du/du6-test", 0, "BOOL"); var du6_test_time = props.globals.initNode("/instrumentation/du/du6-test-time", 0.0, "DOUBLE"); var du6_test_amount = props.globals.initNode("/instrumentation/du/du6-test-amount", 0.0, "DOUBLE"); + var canvas_PFD_base = { init: func(canvas_group, file) { var font_mapper = func(family, weight) { From 4b87a65af4fdd78b660ff2a4686f88694d43674e Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Thu, 20 Sep 2018 13:54:43 -0400 Subject: [PATCH 5/5] GIT: Formatting --- Models/Instruments/Upper-ECAM/Upper-ECAM.nas | 1 - 1 file changed, 1 deletion(-) diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas index 1727c006..91515f4d 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas @@ -228,7 +228,6 @@ var canvas_upperECAM_base = { me["ECAML7"].setText(sprintf("%s", ECAM_line7.getValue())); me["ECAML8"].setText(sprintf("%s", ECAM_line8.getValue())); - if (line1c == "w") { me["ECAML1"].setColor(0.8078,0.8039,0.8078); } else if (line1c == "b") {