From 8edf5bb5cb57d863f4ee50015f6b7f844fd798df Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sat, 28 Dec 2019 15:53:17 +0000 Subject: [PATCH] Fix transponder, self-test now only occurs when power lost > 3 seconds, fix ECAM warnings going off sometimes when they shouldn't --- Models/Instruments/Lower-ECAM/Lower-ECAM.nas | 43 +++++++---- Models/Instruments/ND/canvas/ND.nas | 75 ++++++++++++------- Models/Instruments/PFD/PFD.nas | 77 +++++++++++++------- Models/Instruments/Upper-ECAM/Upper-ECAM.nas | 40 ++++++---- Nasal/ECAM/ECAM-controller.nas | 6 +- Nasal/FMGC/FCU.nas | 6 +- Systems/a320-adr.xml | 20 ++++- Systems/instrumentation.xml | 2 - 8 files changed, 175 insertions(+), 94 deletions(-) diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas index 1cdede16..2c47f1a8 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas @@ -253,6 +253,7 @@ var gen2_load = props.globals.initNode("/systems/electrical/extra/gen2-load", 0, var du4_test = props.globals.initNode("/instrumentation/du/du4-test", 0, "BOOL"); var du4_test_time = props.globals.initNode("/instrumentation/du/du4-test-time", 0, "DOUBLE"); var du4_test_amount = props.globals.initNode("/instrumentation/du/du4-test-amount", 0, "DOUBLE"); +var du4_offtime = props.globals.initNode("/instrumentation/du/du4-off-time", 0.0, "DOUBLE"); var canvas_lowerECAM_base = { init: func(canvas_group, file) { @@ -274,27 +275,34 @@ var canvas_lowerECAM_base = { getKeys: func() { return []; }, - update: func() { - elapsedtime = elapsed_sec.getValue(); + updateDu4: func() { + var elapsedtime = elapsed_sec.getValue(); + if (ac2.getValue() >= 110) { - if (gear0_wow.getValue() == 1) { - if (autoconfig_running.getValue() != 1 and du4_test.getValue() != 1) { + if (du4_offtime.getValue() + 3 < elapsedtime) { + if (gear0_wow.getValue() == 1) { + if (autoconfig_running.getValue() != 1 and du4_test.getValue() != 1) { + du4_test.setValue(1); + du4_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); + du4_test_time.setValue(elapsedtime); + } else if (autoconfig_running.getValue() == 1 and du4_test.getValue() != 1) { + du4_test.setValue(1); + du4_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); + du4_test_time.setValue(elapsedtime - 30); + } + } else { du4_test.setValue(1); - du4_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); - du4_test_time.setValue(elapsedtime); - } else if (autoconfig_running.getValue() == 1 and du4_test.getValue() != 1) { - du4_test.setValue(1); - du4_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); - du4_test_time.setValue(elapsedtime - 30); + du4_test_amount.setValue(0); + du4_test_time.setValue(-100); } - } else { - du4_test.setValue(1); - du4_test_amount.setValue(0); - du4_test_time.setValue(-100); } - } else if (ac1_src.getValue() == "XX" or ac2_src.getValue() == "XX") { + } else { du4_test.setValue(0); + du4_offtime.setValue(elapsedtime); } + }, + update: func() { + var elapsedtime = elapsed_sec.getValue(); if (ac2.getValue() >= 110 and lighting_du4.getValue() > 0.01) { if (du4_test_time.getValue() + du4_test_amount.getValue() >= elapsedtime) { @@ -3244,6 +3252,7 @@ var canvas_lowerECAM_test = { return ["Test_white","Test_text"]; }, update: func() { + var elapsedtime = elapsed_sec.getValue(); if (du4_test_time.getValue() + 1 >= elapsedtime) { me["Test_white"].show(); me["Test_text"].hide(); @@ -3310,3 +3319,7 @@ var showLowerECAM = func { var dlg = canvas.Window.new([512, 512], "dialog").set("resize", 1); dlg.setCanvas(lowerECAM_display); } + +setlistener("/systems/electrical/bus/ac-2", func() { + canvas_lowerECAM_base.updateDu4(); +}, 0, 0); \ No newline at end of file diff --git a/Models/Instruments/ND/canvas/ND.nas b/Models/Instruments/ND/canvas/ND.nas index 7b967524..ff78c1aa 100644 --- a/Models/Instruments/ND/canvas/ND.nas +++ b/Models/Instruments/ND/canvas/ND.nas @@ -20,8 +20,10 @@ var du1_test_amount = props.globals.getNode("/instrumentation/du/du1-test-amount var du2_test = props.globals.getNode("/instrumentation/du/du2-test"); var du2_test_time = props.globals.getNode("/instrumentation/du/du2-test-time"); var du2_test_amount = props.globals.getNode("/instrumentation/du/du2-test-amount"); +var du2_offtime = props.globals.initNode("/instrumentation/du/du2-off-time", 0.0, "DOUBLE"); var du5_test = props.globals.getNode("/instrumentation/du/du5-test"); var du5_test_time = props.globals.getNode("/instrumentation/du/du5-test-time"); +var du5_offtime = props.globals.initNode("/instrumentation/du/du5-off-time", 0.0, "DOUBLE"); var du5_test_amount = props.globals.getNode("/instrumentation/du/du5-test-amount"); var du6_test = props.globals.getNode("/instrumentation/du/du6-test"); var du6_test_time = props.globals.getNode("/instrumentation/du/du6-test-time"); @@ -84,47 +86,60 @@ var canvas_nd_base = { getKeys: func() { return []; }, - update: func() { - elapsedtime = getprop("/sim/time/elapsed-sec"); + updateDu2: func() { + var elapsedtime = getprop("/sim/time/elapsed-sec"); if (getprop("/systems/electrical/bus/ac-ess-shed") >= 110) { - if (wow0.getValue() == 1) { - if (getprop("/systems/acconfig/autoconfig-running") != 1 and du2_test.getValue() != 1) { + if (du2_offtime.getValue() + 3 < elapsedtime) { + if (wow0.getValue() == 1) { + 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 { 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); + du2_test_amount.setValue(0); + du2_test_time.setValue(-100); } - } else { - du2_test.setValue(1); - du2_test_amount.setValue(0); - du2_test_time.setValue(-100); } } else { du2_test.setValue(0); + du2_offtime.setValue(elapsedtime); } + }, + updateDu5: func() { + var elapsedtime = getprop("/sim/time/elapsed-sec"); if (getprop("/systems/electrical/bus/ac-2") >= 110) { - if (wow0.getValue() == 1) { - if (getprop("/systems/acconfig/autoconfig-running") != 1 and du5_test.getValue() != 1) { + if (du5_offtime.getValue() + 3 < elapsedtime) { + if (wow0.getValue() == 1) { + 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 { 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); + du5_test_amount.setValue(0); + du5_test_time.setValue(-100); } - } else { - du5_test.setValue(1); - du5_test_amount.setValue(0); - du5_test_time.setValue(-100); } } else { du5_test.setValue(0); + du5_offtime.setValue(elapsedtime); } + }, + update: func() { + var elapsedtime = getprop("/sim/time/elapsed-sec"); + 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) { ND_1.page.hide(); @@ -383,3 +398,11 @@ var showNd = func(nd = nil) { var dlg = canvas.Window.new([512, 512], "dialog").set("resize", 1); dlg.setCanvas(nd_display[nd]); } + +setlistener("/systems/electrical/bus/ac-ess-shed", func() { + canvas_nd_base.updateDu2(); +}, 0, 0); + +setlistener("/systems/electrical/bus/ac-2", func() { + canvas_nd_base.updateDu5(); +}, 0, 0); diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 2b86ba09..44c79462 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -124,6 +124,7 @@ var track = props.globals.initNode("/instrumentation/pfd/track-deg", 0.0, "DOUBL var track_diff = props.globals.initNode("/instrumentation/pfd/track-hdg-diff", 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_offtime = props.globals.initNode("/instrumentation/du/du1-off-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"); @@ -134,6 +135,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 du6_offtime = props.globals.initNode("/instrumentation/du/du6-off-time", 0.0, "DOUBLE"); var canvas_PFD_base = { init: func(canvas_group, file) { @@ -187,47 +189,58 @@ var canvas_PFD_base = { "QNH_std","QNH_box","LOC_pointer","LOC_scale","GS_scale","GS_pointer","CRS_pointer","HDG_target","HDG_scale","HDG_one","HDG_two","HDG_three","HDG_four","HDG_five","HDG_six","HDG_seven","HDG_digit_L","HDG_digit_R","HDG_error","HDG_group","HDG_frame", "TRK_pointer","machError"]; }, - update: func() { - elapsedtime_act = elapsedtime.getValue(); + updateDu1: func() { + var elapsedtime_act = elapsedtime.getValue(); if (acess.getValue() >= 110) { - if (wow0.getValue() == 1) { - if (acconfig.getValue() != 1 and du1_test.getValue() != 1) { + if (du1_offtime.getValue() + 3 < elapsedtime_act) { + if (wow0.getValue() == 1) { + 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 { 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); + du1_test_amount.setValue(0); + du1_test_time.setValue(-100); } - } else { - du1_test.setValue(1); - du1_test_amount.setValue(0); - du1_test_time.setValue(-100); } } else { du1_test.setValue(0); + du1_offtime.setValue(elapsedtime_act); } - + }, + updateDu6: func() { + var elapsedtime_act = elapsedtime.getValue(); if (ac2.getValue() >= 110) { - if (wow0.getValue() == 1) { - if (acconfig.getValue() != 1 and du6_test.getValue() != 1) { + if (du6_offtime.getValue() + 3 < elapsedtime_act) { + if (wow0.getValue() == 1) { + 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(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); + du6_test_amount.setValue(0); + du6_test_time.setValue(-100); } - } else { - du6_test.setValue(1); - du6_test_amount.setValue(0); - du6_test_time.setValue(-100); } } else { du6_test.setValue(0); + du6_offtime.setValue(elapsedtime_act); } + }, + update: func() { + var elapsedtime_act = elapsedtime.getValue(); if (acconfig_mismatch.getValue() == "0x000") { PFD_1_mismatch.page.hide(); @@ -1556,4 +1569,12 @@ var fontSizeHDG = func(input) { } else { return 32; } -}; \ No newline at end of file +}; + +setlistener("/systems/electrical/bus/ac-ess", func() { + canvas_PFD_base.updateDu1(); +}, 0, 0); + +setlistener("/systems/electrical/bus/ac-2", func() { + canvas_PFD_base.updateDu6(); +}, 0, 0); \ No newline at end of file diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas index 8f1602c0..a72fa686 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas @@ -28,6 +28,7 @@ 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"); +var du3_offtime = props.globals.initNode("/instrumentation/du/du3-off-time", 0.0, "DOUBLE"); # Fetch nodes: var et = props.globals.getNode("/sim/time/elapsed-sec", 1); @@ -133,28 +134,34 @@ var canvas_upperECAM_base = { getKeys: func() { return []; }, - update: func() { - elapsedtime = et.getValue(); + updateDu3: func() { + var elapsedtime = et.getValue(); if (acess.getValue() >= 110) { - if (wow0.getValue() == 1) { - if (acconfig.getValue() != 1 and du3_test.getValue() != 1) { + if (du3_offtime.getValue() + 3 < elapsedtime) { + if (wow0.getValue() == 1) { + 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 { 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); + du3_test_amount.setValue(0); + du3_test_time.setValue(-100); } - } else { - du3_test.setValue(1); - du3_test_amount.setValue(0); - du3_test_time.setValue(-100); } } else { du3_test.setValue(0); + du3_offtime.setValue(elapsedtime); } + }, + update: func() { + var elapsedtime = et.getValue(); cur_eng_option = eng_option.getValue(); if (acess.getValue() >= 110 and du3_lgt.getValue() > 0.01) { @@ -1168,6 +1175,7 @@ var canvas_upperECAM_test = { return ["Test_white","Test_text"]; }, update: func() { + var elapsedtime = et.getValue(); if (du3_test_time.getValue() + 1 >= elapsedtime) { me["Test_white"].show(); me["Test_text"].hide(); @@ -1212,3 +1220,7 @@ var showUpperECAM = func { var dlg = canvas.Window.new([512, 512], "dialog").set("resize", 1); dlg.setCanvas(upperECAM_display); } + +setlistener("/systems/electrical/bus/ac-ess", func() { + canvas_upperECAM_base.updateDu3(); +}, 0, 0); diff --git a/Nasal/ECAM/ECAM-controller.nas b/Nasal/ECAM/ECAM-controller.nas index 3b9c2ca4..dd0b868b 100644 --- a/Nasal/ECAM/ECAM-controller.nas +++ b/Nasal/ECAM/ECAM-controller.nas @@ -341,12 +341,12 @@ var ECAM_controller = { } }, warningReset: func(warning) { + if (warning.aural != 9 and warning.active == 1) { + aural[warning.aural].setBoolValue(0); + } warning.active = 0; warning.noRepeat = 0; warning.noRepeat2 = 0; - if (warning.aural == 2) { - aural[2].setValue(0); - } }, }; diff --git a/Nasal/FMGC/FCU.nas b/Nasal/FMGC/FCU.nas index 6f3b8585..ca4270d6 100644 --- a/Nasal/FMGC/FCU.nas +++ b/Nasal/FMGC/FCU.nas @@ -151,8 +151,10 @@ var FCUController = { setprop("/it-autoflight/sound/apoffsound", 0); setprop("/it-autoflight/sound/apoffsound2", 0); } - setprop("/it-autoflight/output/ap-warning", 0); - setprop("/ECAM/warnings/master-warning-light", 0); + if (getprop("/it-autoflight/output/ap-warning") != 0) { + setprop("/it-autoflight/output/ap-warning", 0); + setprop("/ECAM/warnings/master-warning-light", 0); + } } } }, diff --git a/Systems/a320-adr.xml b/Systems/a320-adr.xml index b929a839..9aa3ac8f 100644 --- a/Systems/a320-adr.xml +++ b/Systems/a320-adr.xml @@ -955,14 +955,26 @@ - - + + /instrumentation/transponder/altimeter-input-src eq 1 - + /instrumentation/transponder/altimeter-input-src eq 2 - + + /instrumentation/transponder/altimeter-input-src eq 3 + + + + + + /instrumentation/transponder/altimeter-input-src eq 1 + + + /instrumentation/transponder/altimeter-input-src eq 2 + + /instrumentation/transponder/altimeter-input-src eq 3 diff --git a/Systems/instrumentation.xml b/Systems/instrumentation.xml index 3439f4cb..0f0edc75 100644 --- a/Systems/instrumentation.xml +++ b/Systems/instrumentation.xml @@ -226,8 +226,6 @@ 2 /instrumentation/transponder/altimeter-input /instrumentation/transponder/airspeed-input - /instrumentation/encoder/mode-c-alt-ft - /instrumentation/encoder/mode-s-alt-ft