From 2d3159e3dc9aae8f4732ae657623642fd1fdd48f Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Tue, 12 Feb 2019 10:49:28 -0500 Subject: [PATCH] Sim: Attempt to fix error on first FG loadup --- A320-main.xml | 7 ++++-- Models/Instruments/IESI/IESI.nas | 2 +- Models/Instruments/Lower-ECAM/Lower-ECAM.nas | 2 +- Models/Instruments/MCDU/MCDU.nas | 2 +- Models/Instruments/ND/canvas/ND.nas | 2 +- Models/Instruments/PFD/PFD.nas | 2 +- Models/Instruments/Upper-ECAM/Upper-ECAM.nas | 2 +- Nasal/libraries.nas | 25 ++++++++++++++++++++ revision.txt | 2 +- 9 files changed, 37 insertions(+), 9 deletions(-) diff --git a/A320-main.xml b/A320-main.xml index e0a5dceb..daff6607 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -5,7 +5,6 @@ - it0uchpods Design Group: Joshua Davidson (it0uchpods), Jonathan Redpath (legoboyvdlp), Thorsten Herrmann (TH-555) Pre V1.0 @@ -403,7 +402,11 @@ 300.0 - 2018.1.0 + 2018.1.0 + + + 0 + diff --git a/Models/Instruments/IESI/IESI.nas b/Models/Instruments/IESI/IESI.nas index 182fe5e0..95ed6fa8 100644 --- a/Models/Instruments/IESI/IESI.nas +++ b/Models/Instruments/IESI/IESI.nas @@ -192,7 +192,7 @@ var canvas_IESI = { }, }; -setlistener("sim/signals/fdm-initialized", func { +setlistener("/sim/signals/hack-canvas", func { IESI_display = canvas.new({ "name": "IESI", "size": [1024, 1024], diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas index c3ee50e1..6e1926b6 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas @@ -3072,7 +3072,7 @@ var canvas_lowerECAM_test = { }, }; -setlistener("sim/signals/fdm-initialized", func { +setlistener("/sim/signals/hack-canvas", func { lowerECAM_display = canvas.new({ "name": "lowerECAM", "size": [1024, 1024], diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index e62c69f7..9abb0e8f 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -1742,7 +1742,7 @@ var canvas_MCDU_2 = { }, }; -setlistener("sim/signals/fdm-initialized", func { +setlistener("/sim/signals/hack-canvas", func { MCDU1_display = canvas.new({ "name": "MCDU1", "size": [1024, 864], diff --git a/Models/Instruments/ND/canvas/ND.nas b/Models/Instruments/ND/canvas/ND.nas index cfaca568..2a2a8906 100644 --- a/Models/Instruments/ND/canvas/ND.nas +++ b/Models/Instruments/ND/canvas/ND.nas @@ -287,7 +287,7 @@ var canvas_ND_2_test = { }, }; -setlistener("sim/signals/fdm-initialized", func { +setlistener("/sim/signals/hack-canvas", func { setprop("instrumentation/efis[0]/inputs/plan-wpt-index", -1); setprop("instrumentation/efis[1]/inputs/plan-wpt-index", -1); diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index f9c39a96..85318ab2 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -1283,7 +1283,7 @@ var canvas_PFD_2_mismatch = { }, }; -setlistener("sim/signals/fdm-initialized", func { +setlistener("/sim/signals/hack-canvas", func { PFD1_display = canvas.new({ "name": "PFD1", "size": [1024, 1024], diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas index 30590b6b..af39a89b 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas @@ -1159,7 +1159,7 @@ var canvas_upperECAM_test = { }, }; -setlistener("sim/signals/fdm-initialized", func { +setlistener("/sim/signals/hack-canvas", func { upperECAM_display = canvas.new({ "name": "upperECAM", "size": [1024, 1024], diff --git a/Nasal/libraries.nas b/Nasal/libraries.nas index f4de37fc..52c7ebcb 100644 --- a/Nasal/libraries.nas +++ b/Nasal/libraries.nas @@ -206,6 +206,31 @@ var systemsInit = func { setlistener("/sim/signals/fdm-initialized", func { systemsInit(); + + canvas.Text._lastText = canvas.Text["_lastText"]; + canvas.Text.setText = func(text) { + if (text == me._lastText and text != nil and size(text) == size(me._lastText)) {return me;} + me._lastText = text; + me.set("text", typeof(text) == 'scalar' ? text : ""); + }; + canvas.Element._lastVisible = nil; + canvas.Element.show = func { + if (1 == me._lastVisible) {return me;} + me._lastVisible = 1; + me.setBool("visible", 1); + }; + canvas.Element.hide = func { + if (0 == me._lastVisible) {return me;} + me._lastVisible = 0; + me.setBool("visible", 0); + }; + canvas.Element.setVisible = func(vis) { + if (vis == me._lastVisible) {return me;} + me._lastVisible = vis; + me.setBool("visible", vis); + }; + + setprop("/sim/signals/hack-canvas", 1); }); var systemsLoop = maketimer(0.1, func { diff --git a/revision.txt b/revision.txt index 9a9b8aca..fad0b619 100644 --- a/revision.txt +++ b/revision.txt @@ -1 +1 @@ -4760 \ No newline at end of file +4761 \ No newline at end of file