From 9c56c0a7644225cb339c098d17b03d813eb8ad9f Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Sun, 31 Dec 2017 09:06:20 -0500 Subject: [PATCH 1/2] A32X: Randomize DU Test times --- Models/Instruments/Lower-ECAM/Lower-ECAM.nas | 7 +++++-- Models/Instruments/ND/canvas/ND.nas | 18 ++++++++++++------ Models/Instruments/PFD/PFD.nas | 19 ++++++++++++------- Models/Instruments/Upper-ECAM/Upper-ECAM.nas | 7 +++++-- revision.txt | 2 +- 5 files changed, 35 insertions(+), 18 deletions(-) diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas index 0e66cbfb..ae38b4a8 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas @@ -65,6 +65,7 @@ setprop("/controls/flight/spoiler-r4-failed", 0); setprop("/controls/flight/spoiler-r5-failed", 0); setprop("/instrumentation/du/du4-test", 0); setprop("/instrumentation/du/du4-test-time", 0); +setprop("/instrumentation/du/du4-test-amount", 0); var canvas_lowerECAM_base = { init: func(canvas_group, file) { @@ -91,17 +92,19 @@ var canvas_lowerECAM_base = { if (getprop("/systems/electrical/bus/ac2") >= 110) { if (getprop("/systems/acconfig/autoconfig-running") != 1 and getprop("/instrumentation/du/du4-test") != 1) { setprop("/instrumentation/du/du4-test", 1); + setprop("/instrumentation/du/du4-test-amount", math.round((rand() * 5 ) + 35, 0.1)); setprop("/instrumentation/du/du4-test-time", getprop("/sim/time/elapsed-sec")); } else if (getprop("/systems/acconfig/autoconfig-running") == 1 and getprop("/instrumentation/du/du4-test") != 1) { setprop("/instrumentation/du/du4-test", 1); - setprop("/instrumentation/du/du4-test-time", getprop("/sim/time/elapsed-sec") - 35); + setprop("/instrumentation/du/du4-test-amount", math.round((rand() * 5 ) + 35, 0.1)); + setprop("/instrumentation/du/du4-test-time", getprop("/sim/time/elapsed-sec") - 30); } } else if (getprop("/systems/electrical/ac1-src") == "XX" or getprop("/systems/electrical/ac2-src") == "XX") { setprop("/instrumentation/du/du4-test", 0); } if (getprop("/systems/electrical/bus/ac2") >= 110 and getprop("/controls/lighting/DU/du4") > 0) { - if (getprop("/instrumentation/du/du4-test-time") + 40 >= elapsedtime) { + if (getprop("/instrumentation/du/du4-test-time") + getprop("/instrumentation/du/du4-test-amount") >= elapsedtime) { lowerECAM_apu.page.hide(); lowerECAM_eng.page.hide(); lowerECAM_fctl.page.hide(); diff --git a/Models/Instruments/ND/canvas/ND.nas b/Models/Instruments/ND/canvas/ND.nas index 31bcd00f..f23feb85 100644 --- a/Models/Instruments/ND/canvas/ND.nas +++ b/Models/Instruments/ND/canvas/ND.nas @@ -17,8 +17,10 @@ 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 nd_display = {}; @@ -79,10 +81,12 @@ var canvas_nd_base = { 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-time", getprop("/sim/time/elapsed-sec") - 35); + 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 { setprop("/instrumentation/du/du2-test", 0); @@ -90,20 +94,22 @@ var canvas_nd_base = { 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-time", getprop("/sim/time/elapsed-sec") - 35); + 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 { setprop("/instrumentation/du/du5-test", 0); } if (getprop("/systems/electrical/bus/ac-ess-shed") >= 110 and getprop("/controls/lighting/DU/du2") > 0) { - if (getprop("/instrumentation/du/du2-test-time") + 38.5 >= elapsedtime and getprop("/modes/cpt-du-xfr") != 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(); - } else if (getprop("/instrumentation/du/du1-test-time") + 39.5 >= elapsedtime and getprop("/modes/cpt-du-xfr") == 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(); } else { @@ -116,10 +122,10 @@ 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") + 38.5 >= elapsedtime and getprop("/modes/fo-du-xfr") != 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(); - } else if (getprop("/instrumentation/du/du6-test-time") + 39.5 >= elapsedtime and getprop("/modes/fo-du-xfr") == 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(); } else { diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index d8b28561..ce51e7dd 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -59,8 +59,10 @@ 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); @@ -73,7 +75,6 @@ setprop("/instrumentation/adirs/ir[1]/aligned", 0); setprop("/instrumentation/adirs/ir[2]/aligned", 0); setprop("/controls/switching/ATTHDG", 0); setprop("/controls/switching/AIRDATA", 0); -setprop("/testing", 0); var canvas_PFD_base = { init: func(canvas_group, file) { @@ -136,10 +137,12 @@ var canvas_PFD_base = { 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-time", getprop("/sim/time/elapsed-sec") - 35); + 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 { setprop("/instrumentation/du/du1-test", 0); @@ -147,20 +150,22 @@ var canvas_PFD_base = { 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-time", getprop("/sim/time/elapsed-sec") - 35); + 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); } if (getprop("/systems/electrical/bus/ac-ess") >= 110 and getprop("/controls/lighting/DU/du1") > 0) { - if (getprop("/instrumentation/du/du1-test-time") + 39.5 >= elapsedtime and getprop("/modes/cpt-du-xfr") != 1) { + if (getprop("/instrumentation/du/du1-test-time") + getprop("/instrumentation/du/du1-test-amount") >= elapsedtime and getprop("/modes/cpt-du-xfr") != 1) { PFD_1.page.hide(); PFD_1_test.page.show(); - } else if (getprop("/instrumentation/du/du2-test-time") + 38.5 >= elapsedtime and getprop("/modes/cpt-du-xfr") == 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.page.hide(); PFD_1_test.page.show(); } else { @@ -173,10 +178,10 @@ var canvas_PFD_base = { 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") + 39.5 >= elapsedtime and getprop("/modes/fo-du-xfr") != 1) { + if (getprop("/instrumentation/du/du6-test-time") + getprop("/instrumentation/du/du6-test-amount") >= elapsedtime and getprop("/modes/fo-du-xfr") != 1) { PFD_2.page.hide(); PFD_2_test.page.show(); - } else if (getprop("/instrumentation/du/du5-test-time") + 38.5 >= elapsedtime and getprop("/modes/fo-du-xfr") == 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.page.hide(); PFD_2_test.page.show(); } else { diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas index 577cbf84..8282f3a6 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas @@ -26,6 +26,7 @@ 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); var canvas_upperECAM_base = { init: func(canvas_group, file) { @@ -52,17 +53,19 @@ var canvas_upperECAM_base = { 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-time", getprop("/sim/time/elapsed-sec") - 35); + 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); } } else { setprop("/instrumentation/du/du3-test", 0); } if (getprop("/systems/electrical/bus/ac-ess") >= 110 and getprop("/controls/lighting/DU/du3") > 0) { - if (getprop("/instrumentation/du/du3-test-time") + 39 >= elapsedtime) { + if (getprop("/instrumentation/du/du3-test-time") + getprop("/instrumentation/du/du3-test-amount") >= elapsedtime) { upperECAM_cfm_eis2.page.hide(); upperECAM_iae_eis2.page.hide(); upperECAM_test.page.show(); diff --git a/revision.txt b/revision.txt index a266a87e..35d9e748 100644 --- a/revision.txt +++ b/revision.txt @@ -1 +1 @@ -4213 \ No newline at end of file +4214 \ No newline at end of file From 920bb9b298d0ba4a192eefb6c659c05df4f677ae Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Sun, 31 Dec 2017 09:33:53 -0500 Subject: [PATCH 2/2] A3XX: Add white screen before DU test --- Models/Instruments/Common/res/du-test.svg | 19 +++-- Models/Instruments/Lower-ECAM/Lower-ECAM.nas | 18 +++++ Models/Instruments/ND/canvas/ND.nas | 44 ++++++++++++ Models/Instruments/PFD/PFD.nas | 73 +++++++++++++++----- Models/Instruments/Upper-ECAM/Upper-ECAM.nas | 18 +++++ 5 files changed, 150 insertions(+), 22 deletions(-) diff --git a/Models/Instruments/Common/res/du-test.svg b/Models/Instruments/Common/res/du-test.svg index 79a4b661..d0a9b4c6 100644 --- a/Models/Instruments/Common/res/du-test.svg +++ b/Models/Instruments/Common/res/du-test.svg @@ -41,9 +41,9 @@ inkscape:window-height="1030" id="namedview371" showgrid="true" - inkscape:zoom="0.25" - inkscape:cx="1402.5446" - inkscape:cy="508.4561" + inkscape:zoom="0.70710678" + inkscape:cx="927.599" + inkscape:cy="590.48297" inkscape:window-x="1592" inkscape:window-y="-8" inkscape:window-maximized="1" @@ -55,13 +55,22 @@ type="xygrid" id="grid5153" /> + = elapsedtime) { + me["Test_white"].show(); + me["Test_text"].hide(); + } else { + me["Test_white"].hide(); + me["Test_text"].show(); + } + }, }; setlistener("sim/signals/fdm-initialized", func { diff --git a/Models/Instruments/ND/canvas/ND.nas b/Models/Instruments/ND/canvas/ND.nas index f23feb85..b9d42a43 100644 --- a/Models/Instruments/ND/canvas/ND.nas +++ b/Models/Instruments/ND/canvas/ND.nas @@ -109,9 +109,11 @@ var canvas_nd_base = { 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 (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(); } else { ND_1_test.page.hide(); ND_1.page.show(); @@ -125,9 +127,11 @@ var canvas_nd_base = { 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 (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(); } else { ND_2_test.page.hide(); ND_2.page.show(); @@ -187,6 +191,11 @@ var canvas_ND_1_test = { }; canvas.parsesvg(canvas_group, file, {"font-mapper": font_mapper}); + + var svg_keys = me.getKeys(); + foreach(var key; svg_keys) { + me[key] = canvas_group.getElementById(key); + } me.page = canvas_group; @@ -198,6 +207,21 @@ var canvas_ND_1_test = { return m; }, + getKeys: func() { + return ["Test_white","Test_text"]; + }, + update: func() { + 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 (getprop("/instrumentation/du/du1-test-time") + 1 >= elapsedtime and getprop("/modes/cpt-du-xfr") == 1) { + me["Test_white"].show(); + me["Test_text"].hide(); + } else { + me["Test_white"].hide(); + me["Test_text"].show(); + } + }, }; var canvas_ND_2_test = { @@ -207,6 +231,11 @@ var canvas_ND_2_test = { }; canvas.parsesvg(canvas_group, file, {"font-mapper": font_mapper}); + + var svg_keys = me.getKeys(); + foreach(var key; svg_keys) { + me[key] = canvas_group.getElementById(key); + } me.page = canvas_group; @@ -218,6 +247,21 @@ var canvas_ND_2_test = { return m; }, + getKeys: func() { + return ["Test_white","Test_text"]; + }, + update: func() { + 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 (getprop("/instrumentation/du/du6-test-time") + 1 >= elapsedtime and getprop("/modes/cpt-du-xfr") == 1) { + me["Test_white"].show(); + me["Test_text"].hide(); + } else { + me["Test_white"].hide(); + me["Test_text"].show(); + } + }, }; setlistener("sim/signals/fdm-initialized", func { diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index ce51e7dd..4e162e55 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -87,25 +87,20 @@ var canvas_PFD_base = { var svg_keys = me.getKeys(); foreach(var key; svg_keys) { me[key] = canvas_group.getElementById(key); - var svg_keys = me.getKeys(); - foreach (var key; svg_keys) { - me[key] = canvas_group.getElementById(key); + var clip_el = canvas_group.getElementById(key ~ "_clip"); + if (clip_el != nil) { + clip_el.setVisible(0); + var tran_rect = clip_el.getTransformedBounds(); - var clip_el = canvas_group.getElementById(key ~ "_clip"); - if (clip_el != nil) { - clip_el.setVisible(0); - var tran_rect = clip_el.getTransformedBounds(); - - var clip_rect = sprintf("rect(%d,%d, %d,%d)", - tran_rect[1], # 0 ys - tran_rect[2], # 1 xe - tran_rect[3], # 2 ye - tran_rect[0]); #3 xs - # coordinates are top,right,bottom,left (ys, xe, ye, xs) ref: l621 of simgear/canvas/CanvasElement.cxx - me[key].set("clip", clip_rect); - me[key].set("clip-frame", canvas.Element.PARENT); - } + var clip_rect = sprintf("rect(%d,%d, %d,%d)", + tran_rect[1], # 0 ys + tran_rect[2], # 1 xe + tran_rect[3], # 2 ye + tran_rect[0]); #3 xs + # coordinates are top,right,bottom,left (ys, xe, ye, xs) ref: l621 of simgear/canvas/CanvasElement.cxx + me[key].set("clip", clip_rect); + me[key].set("clip-frame", canvas.Element.PARENT); } } @@ -165,9 +160,11 @@ var canvas_PFD_base = { if (getprop("/instrumentation/du/du1-test-time") + getprop("/instrumentation/du/du1-test-amount") >= elapsedtime and getprop("/modes/cpt-du-xfr") != 1) { PFD_1.page.hide(); PFD_1_test.page.show(); + PFD_1_test.update(); } else if (getprop("/instrumentation/du/du2-test-time") + getprop("/instrumentation/du/du2-test-amount") >= elapsedtime and getprop("/modes/cpt-du-xfr") == 1) { PFD_1.page.hide(); PFD_1_test.page.show(); + PFD_1_test.update(); } else { PFD_1_test.page.hide(); PFD_1.page.show(); @@ -181,9 +178,11 @@ var canvas_PFD_base = { if (getprop("/instrumentation/du/du6-test-time") + getprop("/instrumentation/du/du6-test-amount") >= elapsedtime and getprop("/modes/fo-du-xfr") != 1) { PFD_2.page.hide(); PFD_2_test.page.show(); + PFD_2_test.update(); } else if (getprop("/instrumentation/du/du5-test-time") + getprop("/instrumentation/du/du5-test-amount") >= elapsedtime and getprop("/modes/fo-du-xfr") == 1) { PFD_2.page.hide(); PFD_2_test.page.show(); + PFD_2_test.update(); } else { PFD_2_test.page.hide(); PFD_2.page.show(); @@ -1001,6 +1000,11 @@ var canvas_PFD_1_test = { }; canvas.parsesvg(canvas_group, file, {"font-mapper": font_mapper}); + + var svg_keys = me.getKeys(); + foreach(var key; svg_keys) { + me[key] = canvas_group.getElementById(key); + } me.page = canvas_group; @@ -1012,6 +1016,21 @@ var canvas_PFD_1_test = { return m; }, + getKeys: func() { + return ["Test_white","Test_text"]; + }, + update: func() { + 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 (getprop("/instrumentation/du/du2-test-time") + 1 >= elapsedtime and getprop("/modes/cpt-du-xfr") == 1) { + me["Test_white"].show(); + me["Test_text"].hide(); + } else { + me["Test_white"].hide(); + me["Test_text"].show(); + } + }, }; var canvas_PFD_2_test = { @@ -1021,6 +1040,11 @@ var canvas_PFD_2_test = { }; canvas.parsesvg(canvas_group, file, {"font-mapper": font_mapper}); + + var svg_keys = me.getKeys(); + foreach(var key; svg_keys) { + me[key] = canvas_group.getElementById(key); + } me.page = canvas_group; @@ -1032,6 +1056,21 @@ var canvas_PFD_2_test = { return m; }, + getKeys: func() { + return ["Test_white","Test_text"]; + }, + update: func() { + 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 (getprop("/instrumentation/du/du5-test-time") + 1 >= elapsedtime and getprop("/modes/fo-du-xfr") == 1) { + me["Test_white"].show(); + me["Test_text"].hide(); + } else { + me["Test_white"].hide(); + me["Test_text"].show(); + } + }, }; setlistener("sim/signals/fdm-initialized", func { diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas index 8282f3a6..f5fb3c71 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas @@ -69,6 +69,7 @@ var canvas_upperECAM_base = { 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") { @@ -816,6 +817,11 @@ var canvas_upperECAM_test = { }; canvas.parsesvg(canvas_group, file, {"font-mapper": font_mapper}); + + var svg_keys = me.getKeys(); + foreach(var key; svg_keys) { + me[key] = canvas_group.getElementById(key); + } me.page = canvas_group; @@ -827,6 +833,18 @@ var canvas_upperECAM_test = { return m; }, + getKeys: func() { + return ["Test_white","Test_text"]; + }, + update: func() { + if (getprop("/instrumentation/du/du3-test-time") + 1 >= elapsedtime) { + me["Test_white"].show(); + me["Test_text"].hide(); + } else { + me["Test_white"].hide(); + me["Test_text"].show(); + } + }, }; setlistener("sim/signals/fdm-initialized", func {