From 074fe62767deb9bbb33bfe27bb53f49e440d1a35 Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Mon, 20 Nov 2017 17:03:07 -0500 Subject: [PATCH] A3XX: Add DU Test --- A320-main.xml | 2 + AircraftConfig/acconfig.nas | 11 + Models/Instruments/Common/res/du-test.svg | 75 ++ Models/Instruments/Lower-ECAM/Lower-ECAM.nas | 124 ++- Models/Instruments/ND/canvas/A3XX_ND.nas | 22 +- .../Instruments/ND/canvas/A3XX_ND_drivers.nas | 14 +- Models/Instruments/ND/canvas/ND.nas | 184 ++-- Models/Instruments/ND/canvas/ND_config.nas | 14 +- .../ND/canvas/framework/MapDrivers.nas | 16 +- .../ND/canvas/framework/canvas.nas | 66 +- .../ND/canvas/framework/navdisplay.nas | 140 +-- Models/Instruments/ND/canvas/helpers.nas | 26 +- Models/Instruments/ND/canvas/loaders.nas | 10 +- Models/Instruments/ND/canvas/style.nas | 798 +++++++++--------- Models/Instruments/PFD/PFD.nas | 158 +++- Models/Instruments/Upper-ECAM/Upper-ECAM.nas | 64 +- revision.txt | 2 +- 17 files changed, 1039 insertions(+), 687 deletions(-) create mode 100644 Models/Instruments/Common/res/du-test.svg diff --git a/A320-main.xml b/A320-main.xml index bc2ff4ad..4d865009 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -904,6 +904,8 @@ 0 29.92 + 0 + 0 0 0 diff --git a/AircraftConfig/acconfig.nas b/AircraftConfig/acconfig.nas index 2ecca8f0..0da98aac 100644 --- a/AircraftConfig/acconfig.nas +++ b/AircraftConfig/acconfig.nas @@ -169,6 +169,15 @@ var systemsReset = func { libraries.variousReset(); } +var skipDUTest = func { + setprop("/instrumentation/du/du1-test-time", getprop("/instrumentation/du/du1-test-time") - 35); + setprop("/instrumentation/du/du2-test-time", getprop("/instrumentation/du/du2-test-time") - 35); + setprop("/instrumentation/du/du3-test-time", getprop("/instrumentation/du/du3-test-time") - 35); + setprop("/instrumentation/du/du4-test-time", getprop("/instrumentation/du/du4-test-time") - 35); + setprop("/instrumentation/du/du5-test-time", getprop("/instrumentation/du/du5-test-time") - 35); + setprop("/instrumentation/du/du6-test-time", getprop("/instrumentation/du/du6-test-time") - 35); +} + ################ # Panel States # ################ @@ -290,6 +299,7 @@ var beforestart_b = func { setprop("/controls/adirs/mcducbtn", 1); setprop("/controls/lighting/beacon", 1); setprop("/controls/lighting/nav-lights-switch", 1); + skipDUTest(); setprop("/controls/gear/brake-left", 0); setprop("/controls/gear/brake-right", 0); setprop("/systems/acconfig/autoconfig-running", 0); @@ -366,6 +376,7 @@ var taxi_b = func { setprop("/controls/adirs/mcducbtn", 1); setprop("/controls/lighting/beacon", 1); setprop("/controls/lighting/nav-lights-switch", 1); + skipDUTest(); settimer(taxi_c, 2); } var taxi_c = func { diff --git a/Models/Instruments/Common/res/du-test.svg b/Models/Instruments/Common/res/du-test.svg new file mode 100644 index 00000000..79a4b661 --- /dev/null +++ b/Models/Instruments/Common/res/du-test.svg @@ -0,0 +1,75 @@ + + + + + + image/svg+xml + + + + + + + + + + SELF TEST IN PROGRESS(MAX 40 SECONDS) + diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas index 63ad93b8..371f473c 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas @@ -10,6 +10,7 @@ var lowerECAM_eng = nil; var lowerECAM_fctl = nil; var lowerECAM_wheel = nil; var lowerECAM_door = nil; +var lowerECAM_test = nil; var lowerECAM_display = nil; var page = "eng"; var oat = getprop("/environment/temperature-degc"); @@ -27,7 +28,7 @@ var gearlvr = 0; var askidsw = 0; var brakemode = 0; var accum = 0; - +var elapsedtime = 0; setprop("/systems/electrical/extra/apu-load", 0); setprop("/systems/electrical/extra/apu-volts", 0); setprop("/systems/electrical/extra/apu-hz", 0); @@ -62,6 +63,8 @@ setprop("/controls/flight/spoiler-r2-failed", 0); setprop("/controls/flight/spoiler-r3-failed", 0); 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); var canvas_lowerECAM_base = { init: func(canvas_group, file) { @@ -69,7 +72,7 @@ var canvas_lowerECAM_base = { return "LiberationFonts/LiberationSans-Regular.ttf"; }; - canvas.parsesvg(canvas_group, file, {'font-mapper': font_mapper}); + canvas.parsesvg(canvas_group, file, {"font-mapper": font_mapper}); var svg_keys = me.getKeys(); foreach(var key; svg_keys) { @@ -84,51 +87,72 @@ var canvas_lowerECAM_base = { return []; }, update: func() { + elapsedtime = getprop("/sim/time/elapsed-sec"); + if (getprop("/systems/electrical/bus/ac1") >= 110 and getprop("/systems/electrical/bus/ac2") >= 110) { + if (getprop("/instrumentation/du/du4-test") != 1) { + setprop("/instrumentation/du/du4-test", 1); + setprop("/instrumentation/du/du4-test-time", getprop("/sim/time/elapsed-sec")); + } + } 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/ac1") >= 110 and getprop("/systems/electrical/ac1-src") != "RAT" and getprop("/systems/electrical/bus/ac2") >= 110 and getprop("/systems/electrical/ac2-src") != "RAT" and getprop("/controls/lighting/DU/du4") > 0) { - page = getprop("/ECAM/Lower/page"); - if (page == "apu") { - lowerECAM_apu.page.show(); - lowerECAM_eng.page.hide(); - lowerECAM_fctl.page.hide(); - lowerECAM_wheel.page.hide(); - lowerECAM_door.page.hide(); - lowerECAM_apu.update(); - } else if (page == "eng") { - lowerECAM_apu.page.hide(); - lowerECAM_eng.page.show(); - lowerECAM_fctl.page.hide(); - lowerECAM_wheel.page.hide(); - lowerECAM_door.page.hide(); - lowerECAM_eng.update(); - } else if (page == "fctl") { - lowerECAM_apu.page.hide(); - lowerECAM_eng.page.hide(); - lowerECAM_fctl.page.show(); - lowerECAM_wheel.page.hide(); - lowerECAM_door.page.hide(); - lowerECAM_fctl.update(); - } else if (page == "wheel") { - lowerECAM_apu.page.hide(); - lowerECAM_eng.page.hide(); - lowerECAM_fctl.page.hide(); - lowerECAM_wheel.page.show(); - lowerECAM_door.page.hide(); - lowerECAM_wheel.update(); - } else if (page == "door") { + if (getprop("/instrumentation/du/du4-test-time") + 40 >= elapsedtime) { lowerECAM_apu.page.hide(); lowerECAM_eng.page.hide(); lowerECAM_fctl.page.hide(); lowerECAM_wheel.page.hide(); - lowerECAM_door.page.show(); - lowerECAM_door.update(); + lowerECAM_door.page.hide(); + lowerECAM_test.page.show(); } else { - lowerECAM_apu.page.hide(); - lowerECAM_eng.page.hide(); - lowerECAM_fctl.page.hide(); - lowerECAM_wheel.page.hide(); - lowerECAM_door.page.hide(); + lowerECAM_test.page.hide(); + page = getprop("/ECAM/Lower/page"); + if (page == "apu") { + lowerECAM_apu.page.show(); + lowerECAM_eng.page.hide(); + lowerECAM_fctl.page.hide(); + lowerECAM_wheel.page.hide(); + lowerECAM_door.page.hide(); + lowerECAM_apu.update(); + } else if (page == "eng") { + lowerECAM_apu.page.hide(); + lowerECAM_eng.page.show(); + lowerECAM_fctl.page.hide(); + lowerECAM_wheel.page.hide(); + lowerECAM_door.page.hide(); + lowerECAM_eng.update(); + } else if (page == "fctl") { + lowerECAM_apu.page.hide(); + lowerECAM_eng.page.hide(); + lowerECAM_fctl.page.show(); + lowerECAM_wheel.page.hide(); + lowerECAM_door.page.hide(); + lowerECAM_fctl.update(); + } else if (page == "wheel") { + lowerECAM_apu.page.hide(); + lowerECAM_eng.page.hide(); + lowerECAM_fctl.page.hide(); + lowerECAM_wheel.page.show(); + lowerECAM_door.page.hide(); + lowerECAM_wheel.update(); + } else if (page == "door") { + lowerECAM_apu.page.hide(); + lowerECAM_eng.page.hide(); + lowerECAM_fctl.page.hide(); + lowerECAM_wheel.page.hide(); + lowerECAM_door.page.show(); + lowerECAM_door.update(); + } else { + lowerECAM_apu.page.hide(); + lowerECAM_eng.page.hide(); + lowerECAM_fctl.page.hide(); + lowerECAM_wheel.page.hide(); + lowerECAM_door.page.hide(); + } } } else { + lowerECAM_test.page.hide(); lowerECAM_apu.page.hide(); lowerECAM_eng.page.hide(); lowerECAM_fctl.page.hide(); @@ -1290,6 +1314,26 @@ var canvas_lowerECAM_wheel = { }, }; +var canvas_lowerECAM_test = { + init: func(canvas_group, file) { + var font_mapper = func(family, weight) { + return "LiberationFonts/LiberationSans-Regular.ttf"; + }; + + canvas.parsesvg(canvas_group, file, {"font-mapper": font_mapper}); + + me.page = canvas_group; + + return me; + }, + new: func(canvas_group, file) { + var m = {parents: [canvas_lowerECAM_test]}; + m.init(canvas_group, file); + + return m; + }, +}; + setlistener("sim/signals/fdm-initialized", func { lowerECAM_display = canvas.new({ "name": "lowerECAM", @@ -1303,12 +1347,14 @@ setlistener("sim/signals/fdm-initialized", func { var groupFctl = lowerECAM_display.createGroup(); var groupWheel = lowerECAM_display.createGroup(); var groupDoor = lowerECAM_display.createGroup(); + var group_test = lowerECAM_display.createGroup(); lowerECAM_apu = canvas_lowerECAM_apu.new(groupApu, "Aircraft/IDG-A32X/Models/Instruments/Lower-ECAM/res/apu.svg"); lowerECAM_eng = canvas_lowerECAM_eng.new(groupEng, "Aircraft/IDG-A32X/Models/Instruments/Lower-ECAM/res/eng-eis2.svg"); lowerECAM_fctl = canvas_lowerECAM_fctl.new(groupFctl, "Aircraft/IDG-A32X/Models/Instruments/Lower-ECAM/res/fctl.svg"); lowerECAM_wheel = canvas_lowerECAM_wheel.new(groupWheel, "Aircraft/IDG-A32X/Models/Instruments/Lower-ECAM/res/wheel.svg"); lowerECAM_door = canvas_lowerECAM_door.new(groupDoor, "Aircraft/IDG-A32X/Models/Instruments/Lower-ECAM/res/door.svg"); + lowerECAM_test = canvas_lowerECAM_test.new(group_test, "Aircraft/IDG-A32X/Models/Instruments/Common/res/du-test.svg"); lowerECAM_update.start(); }); diff --git a/Models/Instruments/ND/canvas/A3XX_ND.nas b/Models/Instruments/ND/canvas/A3XX_ND.nas index c874b42e..c4725e03 100644 --- a/Models/Instruments/ND/canvas/A3XX_ND.nas +++ b/Models/Instruments/ND/canvas/A3XX_ND.nas @@ -1,13 +1,13 @@ # A3XX ND Implementation var get_local_path = func(file){ - var aircraft_dir = split('/', getprop("/sim/aircraft-dir"))[-1]; + var aircraft_dir = split("/", getprop("/sim/aircraft-dir"))[-1]; return "Aircraft/" ~ aircraft_dir ~ "/Models/Instruments/ND/canvas/"~ file; }; -var version = getprop('sim/version/flightgear'); -var v = split('.', version); -version = num(v[0]~'.'~v[1]); +var version = getprop("sim/version/flightgear"); +var v = split(".", version); +version = num(v[0]~"."~v[1]); var SymbolLayer = canvas.SymbolLayer; var SingleSymbolLayer = canvas.SingleSymbolLayer; @@ -25,10 +25,10 @@ var SymbolCache32x32 = canvas.SymbolCache32x32; var SymbolCache = canvas.SymbolCache; var Text = canvas.Text; -io.include('ND_config.nas'); -io.include('framework/canvas.nas'); -io.include('framework/navdisplay.nas'); -io.include('framework/MapDrivers.nas'); -io.include('loaders.nas'); -io.include('helpers.nas'); -io.include('style.nas'); +io.include("ND_config.nas"); +io.include("framework/canvas.nas"); +io.include("framework/navdisplay.nas"); +io.include("framework/MapDrivers.nas"); +io.include("loaders.nas"); +io.include("helpers.nas"); +io.include("style.nas"); diff --git a/Models/Instruments/ND/canvas/A3XX_ND_drivers.nas b/Models/Instruments/ND/canvas/A3XX_ND_drivers.nas index 254c3a49..60aea759 100644 --- a/Models/Instruments/ND/canvas/A3XX_ND_drivers.nas +++ b/Models/Instruments/ND/canvas/A3XX_ND_drivers.nas @@ -13,7 +13,7 @@ var A3XXRouteDriver = { me.flightplan = flightplan(); }, getNumberOfFlightPlans: func(){1}, - getFlightPlanType: func(fpNum){'current'}, + getFlightPlanType: func(fpNum){"current"}, getFlightPlan: func(fpNum){me.flightplan}, getPlanSize: func(fpNum){me.flightplan.getPlanSize()}, getWP: func(fpNum, idx){me.flightplan.getWP(idx)}, @@ -55,16 +55,16 @@ var MultiA3XXRouteDriver = { me._flightplans = subv_l ~ subv_r; } } - me.triggerSignal('fp-added'); + me.triggerSignal("fp-added"); }, removeFlightPlanOfType: func(type){ var new_vec = []; foreach(var fp; me._flightplans){ - if(fp['type'] != type) + if(fp["type"] != type) append(new_vec, fp); } me._flightplans = new_vec; - me.triggerSignal('fp-removed'); + me.triggerSignal("fp-removed"); }, getNumberOfFlightPlans: func(){ size(me._flightplans); @@ -96,10 +96,10 @@ var MultiA3XXRouteDriver = { setprop(me.signalPath(signal)); }, signalPath: func(signal){ - 'autopilot/route-manager/signals/rd-'~ signal; + "autopilot/route-manager/signals/rd-"~ signal; }, getListeners: func(){[ - me.getSignal('fp-added'), - me.getSignal('fp-removed') + me.getSignal("fp-added"), + me.getSignal("fp-removed") ]} }; diff --git a/Models/Instruments/ND/canvas/ND.nas b/Models/Instruments/ND/canvas/ND.nas index be385991..d48b2d56 100644 --- a/Models/Instruments/ND/canvas/ND.nas +++ b/Models/Instruments/ND/canvas/ND.nas @@ -5,45 +5,52 @@ # Copyright (c) Joshua Davidson (it0uchpods) # ############################################## -io.include('A3XX_ND.nas'); +io.include("A3XX_ND.nas"); -io.include('A3XX_ND_drivers.nas'); -canvas.NDStyles['Airbus'].options.defaults.route_driver = A3XXRouteDriver.new(); +io.include("A3XX_ND_drivers.nas"); +canvas.NDStyles["Airbus"].options.defaults.route_driver = A3XXRouteDriver.new(); -var nd_nd = nil; -var nd_nd2 = nil; +var ND_1 = nil; +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/du5-test", 0); +setprop("/instrumentation/du/du5-test-time", 0); var nd_display = {}; var ND = canvas.NavDisplay; var myCockpit_switches = { - 'toggle_range': {path: '/inputs/range-nm', value:40, type:'INT'}, - 'toggle_weather': {path: '/inputs/wxr', value:0, type:'BOOL'}, - 'toggle_airports': {path: '/inputs/arpt', value:0, type:'BOOL'}, - 'toggle_ndb': {path: '/inputs/NDB', value:0, type:'BOOL'}, - 'toggle_stations': {path: '/inputs/sta', value:0, type:'BOOL'}, - 'toggle_vor': {path: '/inputs/VORD', value:0, type:'BOOL'}, - 'toggle_dme': {path: '/inputs/DME', value:0, type:'BOOL'}, - 'toggle_cstr': {path: '/inputs/CSTR', value:0, type:'BOOL'}, - 'toggle_waypoints': {path: '/inputs/wpt', value:0, type:'BOOL'}, - 'toggle_position': {path: '/inputs/pos', value:0, type:'BOOL'}, - 'toggle_data': {path: '/inputs/data',value:0, type:'BOOL'}, - 'toggle_terrain': {path: '/inputs/terr',value:0, type:'BOOL'}, - 'toggle_traffic': {path: '/inputs/tfc',value:0, type:'BOOL'}, - 'toggle_centered': {path: '/inputs/nd-centered',value:0, type:'BOOL'}, - 'toggle_lh_vor_adf': {path: '/input/lh-vor-adf',value:0, type:'INT'}, - 'toggle_rh_vor_adf': {path: '/input/rh-vor-adf',value:0, type:'INT'}, - 'toggle_display_mode': {path: '/nd/canvas-display-mode', value:'NAV', type:'STRING'}, - 'toggle_display_type': {path: '/nd/display-type', value:'LCD', type:'STRING'}, - 'toggle_true_north': {path: '/nd/true-north', value:0, type:'BOOL'}, - 'toggle_track_heading': {path: '/trk-selected', value:0, type:'BOOL'}, - 'toggle_wpt_idx': {path: '/inputs/plan-wpt-index', value: -1, type: 'INT'}, - 'toggle_plan_loop': {path: '/nd/plan-mode-loop', value: 0, type: 'INT'}, - 'toggle_weather_live': {path: '/nd/wxr-live-enabled', value: 0, type: 'BOOL'}, - 'toggle_chrono': {path: '/inputs/CHRONO', value: 0, type: 'INT'}, - 'toggle_xtrk_error': {path: '/nd/xtrk-error', value: 0, type: 'BOOL'}, - 'toggle_trk_line': {path: '/nd/trk-line', value: 0, type: 'BOOL'}, + "toggle_range": {path: "/inputs/range-nm", value:40, type:"INT"}, + "toggle_weather": {path: "/inputs/wxr", value:0, type:"BOOL"}, + "toggle_airports": {path: "/inputs/arpt", value:0, type:"BOOL"}, + "toggle_ndb": {path: "/inputs/NDB", value:0, type:"BOOL"}, + "toggle_stations": {path: "/inputs/sta", value:0, type:"BOOL"}, + "toggle_vor": {path: "/inputs/VORD", value:0, type:"BOOL"}, + "toggle_dme": {path: "/inputs/DME", value:0, type:"BOOL"}, + "toggle_cstr": {path: "/inputs/CSTR", value:0, type:"BOOL"}, + "toggle_waypoints": {path: "/inputs/wpt", value:0, type:"BOOL"}, + "toggle_position": {path: "/inputs/pos", value:0, type:"BOOL"}, + "toggle_data": {path: "/inputs/data",value:0, type:"BOOL"}, + "toggle_terrain": {path: "/inputs/terr",value:0, type:"BOOL"}, + "toggle_traffic": {path: "/inputs/tfc",value:0, type:"BOOL"}, + "toggle_centered": {path: "/inputs/nd-centered",value:0, type:"BOOL"}, + "toggle_lh_vor_adf": {path: "/input/lh-vor-adf",value:0, type:"INT"}, + "toggle_rh_vor_adf": {path: "/input/rh-vor-adf",value:0, type:"INT"}, + "toggle_display_mode": {path: "/nd/canvas-display-mode", value:"NAV", type:"STRING"}, + "toggle_display_type": {path: "/nd/display-type", value:"LCD", type:"STRING"}, + "toggle_true_north": {path: "/nd/true-north", value:0, type:"BOOL"}, + "toggle_track_heading": {path: "/trk-selected", value:0, type:"BOOL"}, + "toggle_wpt_idx": {path: "/inputs/plan-wpt-index", value: -1, type: "INT"}, + "toggle_plan_loop": {path: "/nd/plan-mode-loop", value: 0, type: "INT"}, + "toggle_weather_live": {path: "/nd/wxr-live-enabled", value: 0, type: "BOOL"}, + "toggle_chrono": {path: "/inputs/CHRONO", value: 0, type: "INT"}, + "toggle_xtrk_error": {path: "/nd/xtrk-error", value: 0, type: "BOOL"}, + "toggle_trk_line": {path: "/nd/trk-line", value: 0, type: "BOOL"}, }; var canvas_nd_base = { @@ -53,7 +60,7 @@ var canvas_nd_base = { }; if (file != nil) { - canvas.parsesvg(canvas_group, file, {'font-mapper': font_mapper}); + canvas.parsesvg(canvas_group, file, {"font-mapper": font_mapper}); var svg_keys = me.getKeys(); foreach(var key; svg_keys) { @@ -68,28 +75,63 @@ var canvas_nd_base = { return []; }, update: func() { - if (getprop("/systems/electrical/bus/ac1") >= 110 and getprop("/systems/electrical/ac1-src") != "RAT" and getprop("/systems/electrical/bus/ac2") >= 110 and getprop("/systems/electrical/ac2-src") != "RAT" and getprop("/controls/lighting/DU/du2") > 0) { - nd_nd.page.show(); - nd_nd.NDCpt.update(); + elapsedtime = getprop("/sim/time/elapsed-sec"); + if (getprop("/systems/electrical/bus/ac1") >= 110 and getprop("/systems/electrical/bus/ac2") >= 110) { + if (getprop("/instrumentation/du/du2-test") != 1) { + setprop("/instrumentation/du/du2-test", 1); + setprop("/instrumentation/du/du2-test-time", getprop("/sim/time/elapsed-sec")); + } + if (getprop("/instrumentation/du/du5-test") != 1) { + setprop("/instrumentation/du/du5-test", 1); + setprop("/instrumentation/du/du5-test-time", getprop("/sim/time/elapsed-sec")); + } } else { - nd_nd.page.hide(); + setprop("/instrumentation/du/du2-test", 0); + setprop("/instrumentation/du/du5-test", 0); + } + + if (getprop("/systems/electrical/bus/ac1") >= 110 and getprop("/systems/electrical/ac1-src") != "RAT" and getprop("/systems/electrical/bus/ac2") >= 110 and getprop("/systems/electrical/ac2-src") != "RAT" and getprop("/controls/lighting/DU/du2") > 0) { + if (getprop("/instrumentation/du/du2-test-time") + 38.5 >= 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) { + ND_1.page.hide(); + ND_1_test.page.show(); + } else { + ND_1_test.page.hide(); + ND_1.page.show(); + ND_1.NDCpt.update(); + } + } else { + ND_1_test.page.hide(); + ND_1.page.hide(); } if (getprop("/systems/electrical/bus/ac1") >= 110 and getprop("/systems/electrical/ac1-src") != "RAT" and getprop("/systems/electrical/bus/ac2") >= 110 and getprop("/systems/electrical/ac2-src") != "RAT" and getprop("/controls/lighting/DU/du5") > 0) { - nd_nd2.page.show(); - nd_nd2.NDFo.update(); + if (getprop("/instrumentation/du/du5-test-time") + 38.5 >= 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) { + ND_2.page.hide(); + ND_2_test.page.show(); + } else { + ND_2_test.page.hide(); + ND_2.page.show(); + ND_2.NDFo.update(); + } } else { - nd_nd2.page.hide(); + ND_2_test.page.hide(); + ND_2.page.hide(); } }, }; -var canvas_nd_nd = { +var canvas_ND_1 = { new: func(canvas_group) { - var m = {parents: [canvas_nd_nd, canvas_nd_base]}; + var m = {parents: [canvas_ND_1, canvas_nd_base]}; m.init(canvas_group); # here we make the ND: - me.NDCpt = ND.new("instrumentation/efis", myCockpit_switches, 'Airbus'); + me.NDCpt = ND.new("instrumentation/efis", myCockpit_switches, "Airbus"); me.NDCpt.newMFD(canvas_group); me.NDCpt.update(); @@ -103,13 +145,13 @@ var canvas_nd_nd = { }, }; -var canvas_nd_nd_r = { +var canvas_ND_2 = { new: func(canvas_group) { - var m = {parents: [canvas_nd_nd_r, canvas_nd_base]}; + var m = {parents: [canvas_ND_2, canvas_nd_base]}; m.init(canvas_group); # here we make the ND: - me.NDFo = ND.new("instrumentation/efis[1]", myCockpit_switches, 'Airbus'); + me.NDFo = ND.new("instrumentation/efis[1]", myCockpit_switches, "Airbus"); me.NDFo.newMFD(canvas_group); me.NDFo.update(); @@ -123,6 +165,46 @@ var canvas_nd_nd_r = { }, }; +var canvas_ND_1_test = { + init: func(canvas_group, file) { + var font_mapper = func(family, weight) { + return "LiberationFonts/LiberationSans-Regular.ttf"; + }; + + canvas.parsesvg(canvas_group, file, {"font-mapper": font_mapper}); + + me.page = canvas_group; + + return me; + }, + new: func(canvas_group, file) { + var m = {parents: [canvas_ND_1_test]}; + m.init(canvas_group, file); + + return m; + }, +}; + +var canvas_ND_2_test = { + init: func(canvas_group, file) { + var font_mapper = func(family, weight) { + return "LiberationFonts/LiberationSans-Regular.ttf"; + }; + + canvas.parsesvg(canvas_group, file, {"font-mapper": font_mapper}); + + me.page = canvas_group; + + return me; + }, + new: func(canvas_group, file) { + var m = {parents: [canvas_ND_2_test]}; + m.init(canvas_group, file); + + return m; + }, +}; + setlistener("sim/signals/fdm-initialized", func { setprop("instrumentation/efis[0]/inputs/plan-wpt-index", -1); setprop("instrumentation/efis[1]/inputs/plan-wpt-index", -1); @@ -143,11 +225,15 @@ setlistener("sim/signals/fdm-initialized", func { nd_display.main.addPlacement({"node": "ND.screen"}); nd_display.right.addPlacement({"node": "ND_R.screen"}); - var group_nd = nd_display.main.createGroup(); + var group_nd1 = nd_display.main.createGroup(); + var group_nd1_test = nd_display.main.createGroup(); var group_nd2 = nd_display.right.createGroup(); + var group_nd2_test = nd_display.right.createGroup(); - nd_nd = canvas_nd_nd.new(group_nd); - nd_nd2 = canvas_nd_nd_r.new(group_nd2); + ND_1 = canvas_ND_1.new(group_nd1); + ND_1_test = canvas_ND_1_test.new(group_nd1_test, "Aircraft/IDG-A32X/Models/Instruments/Common/res/du-test.svg"); + ND_2 = canvas_ND_2.new(group_nd2); + ND_2_test = canvas_ND_2_test.new(group_nd2_test, "Aircraft/IDG-A32X/Models/Instruments/Common/res/du-test.svg"); nd_update.start(); }); @@ -204,7 +290,7 @@ setlistener("/flight-management/control/capture-leg", func(n) { }, 0, 0); var showNd = func(nd = nil) { - if(nd == nil) nd = 'main'; + if(nd == nil) nd = "main"; var dlg = canvas.Window.new([512, 512], "dialog"); dlg.setCanvas(nd_display[nd]); } diff --git a/Models/Instruments/ND/canvas/ND_config.nas b/Models/Instruments/ND/canvas/ND_config.nas index c857ead0..79c20cb9 100644 --- a/Models/Instruments/ND/canvas/ND_config.nas +++ b/Models/Instruments/ND/canvas/ND_config.nas @@ -4,18 +4,18 @@ canvas.NDConfig = { dep_apt: "/autopilot/route-manager/departure/airport", des_rwy: "/autopilot/route-manager/destination/runway", dep_rwy: "/autopilot/route-manager/departure/runway", - fplan_active: 'autopilot/route-manager/active', - athr: '/it-autoflight/output/athr', + fplan_active: "autopilot/route-manager/active", + athr: "/it-autoflight/output/athr", cur_wp: "/autopilot/route-manager/current-wp", vnav_node: "/autopilot/route-manager/vnav/", spd_node: "/autopilot/route-manager/spd/", holding: "/flight-management/hold", holding_points: "/flight-management/hold/points", - adf1_frq: 'instrumentation/adf/frequencies/selected-khz', - adf2_frq: 'instrumentation/adf[1]/frequencies/selected-khz', - nav1_frq: 'instrumentation/nav/frequencies/selected-mhz', - nav2_frq: 'instrumentation/nav[1]/frequencies/selected-mhz', - lat_ctrl: 'flight-management/control/lat-ctrl', + adf1_frq: "instrumentation/adf/frequencies/selected-khz", + adf2_frq: "instrumentation/adf[1]/frequencies/selected-khz", + nav1_frq: "instrumentation/nav/frequencies/selected-mhz", + nav2_frq: "instrumentation/nav[1]/frequencies/selected-mhz", + lat_ctrl: "flight-management/control/lat-ctrl", ver_ctrl: "flight-management/control/ver-ctrl", } }; diff --git a/Models/Instruments/ND/canvas/framework/MapDrivers.nas b/Models/Instruments/ND/canvas/framework/MapDrivers.nas index 9b77a678..514d513c 100644 --- a/Models/Instruments/ND/canvas/framework/MapDrivers.nas +++ b/Models/Instruments/ND/canvas/framework/MapDrivers.nas @@ -13,7 +13,7 @@ canvas.RouteDriver = { me.flightplan = flightplan(); }, getNumberOfFlightPlans: func(){1}, - getFlightPlanType: func(fpNum){'active'}, + getFlightPlanType: func(fpNum){"active"}, getFlightPlan: func(fpNum){me.flightplan}, getPlanSize: func(fpNum){me.flightplan.getPlanSize()}, getWP: func(fpNum, idx){me.flightplan.getWP(idx)}, @@ -24,7 +24,7 @@ canvas.RouteDriver = { getHoldPatterns: func(fpNum){[]}, shouldUpdate: func 1, shouldDisplayWP: func(fpNum, idx) 1, - getCurrentWPIdx: func(fpNum) getprop('autopilot/route-manager/current-wp'), + getCurrentWPIdx: func(fpNum) getprop("autopilot/route-manager/current-wp"), getTimeConstraint: func (fpNum, wp_idx) {nil} }; @@ -60,16 +60,16 @@ canvas.MultiRouteDriver = { me._flightplans = subv_l ~ subv_r; } } - me.triggerSignal('fp-added'); + me.triggerSignal("fp-added"); }, removeFlightPlanOfType: func(type){ var new_vec = []; foreach(var fp; me._flightplans){ - if(fp['type'] != type) + if(fp["type"] != type) append(new_vec, fp); } me._flightplans = new_vec; - me.triggerSignal('fp-removed'); + me.triggerSignal("fp-removed"); }, getNumberOfFlightPlans: func(){ size(me._flightplans); @@ -101,11 +101,11 @@ canvas.MultiRouteDriver = { setprop(me.signalPath(signal)); }, signalPath: func(signal){ - 'autopilot/route-manager/signals/rd-'~ signal; + "autopilot/route-manager/signals/rd-"~ signal; }, getListeners: func(){[ - me.getSignal('fp-added'), - me.getSignal('fp-removed') + me.getSignal("fp-added"), + me.getSignal("fp-removed") ]}, getCurrentWPIdx: func(fpNum) { var fp = me.getFlightPlan(fpNum); diff --git a/Models/Instruments/ND/canvas/framework/canvas.nas b/Models/Instruments/ND/canvas/framework/canvas.nas index 0a7924bf..8aafbbdd 100644 --- a/Models/Instruments/ND/canvas/framework/canvas.nas +++ b/Models/Instruments/ND/canvas/framework/canvas.nas @@ -10,7 +10,7 @@ canvas.Group.getChildrenOfType = func(type, array = nil){ if(children == nil) children = []; var my_children = me.getChildren(); - if(typeof(type) != 'vector') + if(typeof(type) != "vector") type = [type]; foreach(var c; my_children){ foreach(var t; type){ @@ -32,14 +32,14 @@ canvas.Group.setColor = func(){ var color = arg; var types = [Path, Text]; var arg_c = size(color); - if(arg_c > 1 and typeof(color[-1]) == 'vector'){ + if(arg_c > 1 and typeof(color[-1]) == "vector"){ types = color[-1]; color = subvec(color, 0, arg_c - 1); } var children = me.getChildrenOfType(types); - if(typeof(color) == 'vector'){ + if(typeof(color) == "vector"){ var first = color[0]; - if(typeof(first) == 'vector') + if(typeof(first) == "vector") color = first; } foreach(var c; children) @@ -97,8 +97,8 @@ canvas.Symbol.formattedString = func(frmt, model_props){ if(contains(me.model, prop)){ var val = me.model[prop]; var tp = typeof(val); - if(tp != 'scalar'){ - val = ''; + if(tp != "scalar"){ + val = ""; #printlog("warn", "formattedString: invalid type for "~prop~" (" ~ tp ~ ")"); } else { append(args, val); @@ -124,7 +124,7 @@ canvas.Symbol.getStyle = func(name, default = nil){ st = me.layer.style; if(st == nil) return default; var val = opt_member(st, name); - if(typeof(val) == 'func'){ + if(typeof(val) == "func"){ val = (call(val,[],me)); } if(val == nil) return default; @@ -133,14 +133,14 @@ canvas.Symbol.getStyle = func(name, default = nil){ canvas.Symbol.getLabelFromModel = func(default_val = nil){ if(me.model == nil) return default_val; - if(default_val == nil and contains(me.model, 'id')) + if(default_val == nil and contains(me.model, "id")) default_val = me.model.id; - var label_content = me.getOption('label_content'); + var label_content = me.getOption("label_content"); if(label_content == nil) return default_val; - if(typeof(label_content) == 'scalar') + if(typeof(label_content) == "scalar") label_content = [label_content]; - var format_s = me.getOption('label_format'); - var label = ''; + var format_s = me.getOption("label_format"); + var label = ""; if(format_s == nil){ format_s = "%s"; } @@ -148,9 +148,9 @@ canvas.Symbol.getLabelFromModel = func(default_val = nil){ }; canvas.Symbol.callback = func(name, args...){ - name = name ~'_callback'; + name = name ~"_callback"; var f = me.getOption(name); - if(typeof(f) == 'func'){ + if(typeof(f) == "func"){ return call(f, args, me); } }; @@ -167,7 +167,7 @@ canvas.DotSym.update = func() { } else me.element.show(); me.draw(); - if(me.getOption('disable_position', 0)) return; # << CHECK FOR OPTION 'disable_position' + if(me.getOption("disable_position", 0)) return; # << CHECK FOR OPTION "disable_position" var pos = me.controller.getpos(me.model); if (size(pos) == 2) pos~=[nil]; # fall through @@ -183,27 +183,27 @@ canvas.DotSym.update = func() { # SVGSymbol canvas.SVGSymbol.init = func() { - me.callback('init_before'); - var opt_path = me.getStyle('svg_path'); + me.callback("init_before"); + var opt_path = me.getStyle("svg_path"); if(opt_path != nil) me.svg_path = opt_path; if (!me.cacheable) { - if(me.svg_path != nil and me.svg_path != '') + if(me.svg_path != nil and me.svg_path != "") canvas.parsesvg(me.element, me.svg_path); # hack: - if (var scale = me.layer.style['scale_factor']) + if (var scale = me.layer.style["scale_factor"]) me.element.setScale(scale); - if ((var transl = me.layer.style['translate']) != nil) + if ((var transl = me.layer.style["translate"]) != nil) me.element.setTranslation(transl); } else { __die("cacheable not implemented yet!"); } - me.callback('init_after'); + me.callback("init_after"); me.draw(); }; canvas.SVGSymbol.draw = func{ - me.callback('draw'); + me.callback("draw"); }; # SymbolLayer @@ -223,13 +223,13 @@ canvas.SymbolLayer._new = func(m, style, controller, options) { if (controller.parents[0].parents[0] != SymbolLayer.Controller) __die("MultiSymbolLayer: OOP error"); if(options != nil){ # << CHECK FOR CONFIGURABLE LISTENERS - var listeners = opt_member(controller, 'listeners'); - var listen = opt_member(options, 'listen'); + var listeners = opt_member(controller, "listeners"); + var listen = opt_member(options, "listen"); if (listen != nil and listeners != nil){ var listen_tp = typeof(listen); - if(listen_tp != 'vector' and listen_tp != 'scalar') + if(listen_tp != "vector" and listen_tp != "scalar") __die("Options 'listen' cannot be a "~ listen_tp); - if(typeof(listen) == 'scalar') + if(typeof(listen) == "scalar") listen = [listen]; foreach(var node_name; listen){ var node = opt_member(options, node_name); @@ -247,9 +247,9 @@ canvas.SymbolLayer._new = func(m, style, controller, options) { canvas.LineSymbol.new = func(group, layer, model, controller=nil) { if (me == nil) __die("Need me reference for LineSymbol.new()"); - if (typeof(model) != 'vector') { - if(typeof(model) == 'hash'){ - if(!contains(model, 'path')) + if (typeof(model) != "vector") { + if(typeof(model) == "hash"){ + if(!contains(model, "path")) canvas.__die("LineSymbol.new(): model hash requires path"); } else canvas.__die("LineSymbol.new(): need a vector of points or a hash"); @@ -272,7 +272,7 @@ canvas.LineSymbol.new = func(group, layer, model, controller=nil) { }; # Non-static: canvas.LineSymbol.draw = func() { - me.callback('draw_before'); + me.callback("draw_before"); if (!me.needs_update) return; #printlog(_MP_dbg_lvl, "redrawing a LineSymbol "~me.layer.type); me.element.reset(); @@ -280,7 +280,7 @@ canvas.LineSymbol.draw = func() { var coords = []; var cmd = canvas.Path.VG_MOVE_TO; var path = me.model; - if(typeof(path) == 'hash'){ + if(typeof(path) == "hash"){ path = me.model.path; if(path == nil) canvas.__die("LineSymbol model requires a 'path' member (vector)"); @@ -297,7 +297,7 @@ canvas.LineSymbol.draw = func() { } } me.element.setDataGeo(cmds, coords); - me.element.update(); # this doesn't help with flickering, it seems - me.callback('draw_after'); + me.element.update(); # this doesn"t help with flickering, it seems + me.callback("draw_after"); }; diff --git a/Models/Instruments/ND/canvas/framework/navdisplay.nas b/Models/Instruments/ND/canvas/framework/navdisplay.nas index b486f752..9c232cf5 100644 --- a/Models/Instruments/ND/canvas/framework/navdisplay.nas +++ b/Models/Instruments/ND/canvas/framework/navdisplay.nas @@ -16,8 +16,8 @@ canvas.NavDisplay.set_switch = func(s, v) { }; canvas.NavDisplay.get_nav_path = func (type, idx) { - var name = (type == 'dme' ? type : 'nav'); - var path = 'instrumentation/%s[%d]/'; + var name = (type == "dme" ? type : "nav"); + var path = "instrumentation/%s[%d]/"; var indexes = me.radio_cfg[type]; if (indexes != nil) { idx = indexes[idx]; @@ -34,32 +34,32 @@ canvas.NavDisplay.newMFD = func(canvas_group, parent=nil, nd_options=nil, update me.nd = canvas_group; me.canvas_handle = parent; me.df_options = nil; - if(contains(me.nd_style, 'options')) + if(contains(me.nd_style, "options")) me.df_options = me.nd_style.options; nd_options = default_hash(nd_options, me.df_options); me.options = nd_options; me.route_driver = nil; - if(contains(me.options, 'route_driver')){ + if(contains(me.options, "route_driver")){ me.route_driver = me.options.route_driver; } - elsif(contains(me.options, 'defaults')){ - if(contains(me.options.defaults, 'route_driver')) + elsif(contains(me.options, "defaults")){ + if(contains(me.options.defaults, "route_driver")) me.route_driver = me.options.defaults.route_driver; } - me.radio_cfg = me.options['radio']; + me.radio_cfg = me.options["radio"]; if (me.radio_cfg == nil) me.radio_cfg = {}; # load the specified SVG file into the me.nd group and populate all sub groups - canvas.parsesvg(me.nd, me.nd_style.svg_filename, {'font-mapper': me.nd_style.font_mapper}); + canvas.parsesvg(me.nd, me.nd_style.svg_filename, {"font-mapper": me.nd_style.font_mapper}); me.symbols = {}; # storage for SVG elements, to avoid namespace pollution (all SVG elements end up here) foreach(var feature; me.nd_style.features ) { me.symbols[feature.id] = me.nd.getElementById(feature.id).updateCenter(); - if(contains(feature.impl,'init')) feature.impl.init(me.nd, feature); # call The element's init code (i.e. updateCenter) + if(contains(feature.impl,"init")) feature.impl.init(me.nd, feature); # call The element"s init code (i.e. updateCenter) } - ### this is the "old" method that's less flexible, we want to use the style hash instead (see above) + ### this is the "old" method that"s less flexible, we want to use the style hash instead (see above) # because things are much better configurable that way # now look up all required SVG elements and initialize member fields using the same name to have a convenient handle foreach(var element; ["dmeLDist","dmeRDist","dmeL","dmeR","vorL","vorR","vorLId","vorRId", @@ -78,7 +78,7 @@ canvas.NavDisplay.newMFD = func(canvas_group, parent=nil, nd_options=nil, update me.map = me.nd.createChild("map","map") .set("clip", "rect(124, 1024, 1024, 0)") .set("screen-range", 700) - .set('z-index',-1); + .set("z-index",-1); me.update_sub(); # init some map properties based on switches @@ -108,7 +108,7 @@ canvas.NavDisplay.newMFD = func(canvas_group, parent=nil, nd_options=nil, update } # a hash with controller callbacks, will be passed onto draw routines to customize behavior/appearance - # the point being that draw routines don't know anything about their frontends (instrument or GUI dialog) + # the point being that draw routines don"t know anything about their frontends (instrument or GUI dialog) # so we need some simple way to communicate between frontend<->backend until we have real controllers # for now, a single controller hash is shared by most layers - unsupported callbacks are simply ignored by the draw files # @@ -148,32 +148,32 @@ canvas.NavDisplay.newMFD = func(canvas_group, parent=nil, nd_options=nil, update ### # set up various layers, controlled via callbacks in the controller hash - # revisit this code once Philosopher's "Smart MVC Symbols/Layers" work is committed and integrated + # revisit this code once Philosopher"s "Smart MVC Symbols/Layers" work is committed and integrated # helper / closure generator var make_event_handler = func(predicate, layer) func predicate(me, layer); me.layers={}; # storage container for all ND specific layers # look up all required layers as specified per the NDStyle hash and do the initial setup for event handling - var default_opts = me.options != nil and contains(me.options, 'defaults') ? me.options.defaults : nil; + var default_opts = me.options != nil and contains(me.options, "defaults") ? me.options.defaults : nil; foreach(var layer; me.nd_style.layers) { - if(layer['disabled']) continue; # skip this layer + if(layer["disabled"]) continue; # skip this layer #print("newMFD(): Setting up ND layer:", layer.name); var the_layer = nil; - if(!layer['isMapStructure']) # set up an old INEFFICIENT and SLOW layer + if(!layer["isMapStructure"]) # set up an old INEFFICIENT and SLOW layer the_layer = me.layers[layer.name] = canvas.MAP_LAYERS[layer.name].new( me.map, layer.name, controller ); else { printlog(_MP_dbg_lvl, "Setting up MapStructure-based layer for ND, name:", layer.name); var opt = me.options != nil and me.options[layer.name] != nil ? me.options[layer.name] :nil; - if(opt == nil and contains(layer, 'options')) + if(opt == nil and contains(layer, "options")) opt = layer.options; if(opt != nil and default_opts != nil) opt = default_hash(opt, default_opts); #elsif(default_opts != nil) # opt = default_opts; var style = nil; - if(contains(layer, 'style')) + if(contains(layer, "style")) style = layer.style; #print("Options is: ", opt!=nil?"enabled":"disabled"); #debug.dump(opt); @@ -183,15 +183,15 @@ canvas.NavDisplay.newMFD = func(canvas_group, parent=nil, nd_options=nil, update opts: opt, visible:0, style: style, - priority: layer['z-index'] + priority: layer["z-index"] ); - #me.map.addLayer(canvas.SymbolLayer, layer.name, layer['z-index'], style, opt, 0); + #me.map.addLayer(canvas.SymbolLayer, layer.name, layer["z-index"], style, opt, 0); the_layer = me.layers[layer.name] = me.map.getLayer(layer.name); - if(opt != nil and contains(opt, 'range_dependant')){ + if(opt != nil and contains(opt, "range_dependant")){ if(opt.range_dependant) append(me.range_dependant_layers, the_layer); } - if(contains(layer, 'always_update')) + if(contains(layer, "always_update")) me.always_update_layers[layer.name] = layer.always_update; if (1) (func { var l = layer; @@ -206,11 +206,11 @@ canvas.NavDisplay.newMFD = func(canvas_group, parent=nil, nd_options=nil, update # now register all layer specific notification listeners and their corresponding update predicate/callback # pass the ND instance and the layer handle to the predicate when it is called - # so that it can directly access the ND instance and its own layer (without having to know the layer's name) + # so that it can directly access the ND instance and its own layer (without having to know the layer"s name) var event_handler = make_event_handler(layer.predicate, the_layer); foreach(var event; layer.update_on) { # this handles timers - if (typeof(event)=='hash' and contains(event, 'rate_hz')) { + if (typeof(event)=="hash" and contains(event, "rate_hz")) { #print("FIXME: navdisplay.mfd timer handling is broken ATM"); var job=me.addtimer(1/event.rate_hz, event_handler); job.start(); @@ -239,14 +239,14 @@ canvas.NavDisplay.update_sub = func(){ var userLon = me.aircraft_source.get_lon(); var userGndSpd = me.aircraft_source.get_gnd_spd(); var userVSpd = me.aircraft_source.get_vspd(); - var dispLCD = me.get_switch('toggle_display_type') == "LCD"; + var dispLCD = me.get_switch("toggle_display_type") == "LCD"; # Heading update var userHdgMag = me.aircraft_source.get_hdg_mag(); var userHdgTru = me.aircraft_source.get_hdg_tru(); var userTrkMag = me.aircraft_source.get_trk_mag(); var userTrkTru = me.aircraft_source.get_trk_tru(); - if(me.get_switch('toggle_true_north')) { + if(me.get_switch("toggle_true_north")) { var userHdg=userHdgTru; me.userHdg=userHdgTru; var userTrk=userTrkTru; @@ -268,8 +268,8 @@ canvas.NavDisplay.update_sub = func(){ me.userTrk=userHdg; } - if((me.in_mode('toggle_display_mode', ['MAP']) and me.get_switch('toggle_display_type') == "CRT") - or (me.get_switch('toggle_track_heading') and me.get_switch('toggle_display_type') == "LCD")) + if((me.in_mode("toggle_display_mode", ["MAP"]) and me.get_switch("toggle_display_type") == "CRT") + or (me.get_switch("toggle_track_heading") and me.get_switch("toggle_display_type") == "LCD")) { userHdgTrk = userTrk; me.userHdgTrk = userTrk; @@ -291,7 +291,7 @@ canvas.NavDisplay.update_sub = func(){ }; # reposition the map, change heading & range: var pln_wpt_idx = getprop(me.efis_path ~ "/inputs/plan-wpt-index"); - if(me.in_mode('toggle_display_mode', ['PLAN']) and pln_wpt_idx >= 0) { + if(me.in_mode("toggle_display_mode", ["PLAN"]) and pln_wpt_idx >= 0) { if(me.route_driver != nil){ var wp = me.route_driver.getPlanModeWP(pln_wpt_idx); if(wp != nil){ @@ -309,14 +309,14 @@ canvas.NavDisplay.update_sub = func(){ pos.lat = userLat; pos.lon = userLon; } - if(me.in_mode('toggle_display_mode', ['PLAN'])) { + if(me.in_mode("toggle_display_mode", ["PLAN"])) { pos.hdg = 0; pos.range = me.rangeNm()*2 } else { pos.range = me.rangeNm(); # avoid this here, use a listener instead pos.hdg = userHdgTrkTru; } - if(me.options != nil and (var pos_callback = me.options['position_callback']) != nil) + if(me.options != nil and (var pos_callback = me.options["position_callback"]) != nil) pos_callback(me, pos); call(me.map.setPos, [pos.lat, pos.lon], me.map, pos); if(pos.range != oldRange){ @@ -329,12 +329,12 @@ canvas.NavDisplay.update_sub = func(){ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft specific, cannot easily be reused by other aircraft { var _time = systime(); - # Disables WXR Live if it's not enabled. The toggle_weather_live should be common to all + # Disables WXR Live if it"s not enabled. The toggle_weather_live should be common to all # ND instances. - var wxr_live_enabled = getprop(wxr_live_tree~'/enabled'); - if(wxr_live_enabled == nil or wxr_live_enabled == '') + var wxr_live_enabled = getprop(wxr_live_tree~"/enabled"); + if(wxr_live_enabled == nil or wxr_live_enabled == "") wxr_live_enabled = 0; - me.set_switch('toggle_weather_live', wxr_live_enabled); + me.set_switch("toggle_weather_live", wxr_live_enabled); call(me.update_sub, nil, nil, caller(0)[0]); # call this in the same namespace to "steal" its variables # MapStructure update! @@ -351,14 +351,14 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec # TODO: should be refactored! var translation_callback = nil; if(me.options != nil) - translation_callback = me.options['translation_callback']; - if(typeof(translation_callback) == 'func'){ + translation_callback = me.options["translation_callback"]; + if(typeof(translation_callback) == "func"){ var trsl = translation_callback(me); me.map.setTranslation(trsl.x, trsl.y); } else { - if(me.in_mode('toggle_display_mode', ['PLAN'])) + if(me.in_mode("toggle_display_mode", ["PLAN"])) me.map.setTranslation(512,512); - elsif(me.get_switch('toggle_centered')) + elsif(me.get_switch("toggle_centered")) me.map.setTranslation(512,565); else me.map.setTranslation(512,824); @@ -368,7 +368,7 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec var dme1_path = "/instrumentation/dme[2]"; var dme2_path = "/instrumentation/dme[3]"; - if(me.get_switch('toggle_rh_vor_adf') == 1) { + if(me.get_switch("toggle_rh_vor_adf") == 1) { me.symbols.vorR.setText("VOR R"); me.symbols.vorR.setColor(0.195,0.96,0.097); me.symbols.dmeR.setText("DME"); @@ -382,7 +382,7 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec me.symbols.dmeRDist.setText(sprintf("%3.1f",getprop(dme2_path~ "indicated-distance-nm"))); else me.symbols.dmeRDist.setText(" ---"); me.symbols.dmeRDist.setColor(0.195,0.96,0.097); - } elsif(me.get_switch('toggle_rh_vor_adf') == -1) { + } elsif(me.get_switch("toggle_rh_vor_adf") == -1) { me.symbols.vorR.setText("ADF R"); me.symbols.vorR.setColor(0,0.6,0.85); me.symbols.dmeR.setText(""); @@ -406,8 +406,8 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec if (hdg_bug_active == nil) hdg_bug_active = 1; - if((me.in_mode('toggle_display_mode', ['MAP']) and me.get_switch('toggle_display_type') == "CRT") - or (me.get_switch('toggle_track_heading') and me.get_switch('toggle_display_type') == "LCD")) + if((me.in_mode("toggle_display_mode", ["MAP"]) and me.get_switch("toggle_display_type") == "CRT") + or (me.get_switch("toggle_track_heading") and me.get_switch("toggle_display_type") == "LCD")) { me.symbols.trkInd.setRotation(0); me.symbols.curHdgPtr.setRotation((userHdg-userTrk)*D2R); @@ -419,7 +419,7 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec me.symbols.curHdgPtr.setRotation(0); me.symbols.curHdgPtr2.setRotation(0); } - if(!me.in_mode('toggle_display_mode', ['PLAN'])) + if(!me.in_mode("toggle_display_mode", ["PLAN"])) { var hdgBugRot = (vhdg_bug-userHdgTrk)*D2R; me.symbols.selHdgLine.setRotation(hdgBugRot); @@ -428,9 +428,9 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec me.symbols.selHdgLine2.setRotation(hdgBugRot); } - var staPtrVis = !me.in_mode('toggle_display_mode', ['PLAN']); - if((me.in_mode('toggle_display_mode', ['MAP']) and me.get_switch('toggle_display_type') == "CRT") - or (me.get_switch('toggle_track_heading') and me.get_switch('toggle_display_type') == "LCD")) + var staPtrVis = !me.in_mode("toggle_display_mode", ["PLAN"]); + if((me.in_mode("toggle_display_mode", ["MAP"]) and me.get_switch("toggle_display_type") == "CRT") + or (me.get_switch("toggle_track_heading") and me.get_switch("toggle_display_type") == "LCD")) { var vorheading = userTrkTru; var adfheading = userTrkMag; @@ -440,35 +440,35 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec var vorheading = userHdgTru; var adfheading = userHdgMag; } - if (getprop("/instrumentation/nav[2]/heading-deg") != nil and me.get_switch('toggle_true_north') == 0) { + if (getprop("/instrumentation/nav[2]/heading-deg") != nil and me.get_switch("toggle_true_north") == 0) { var nav0hdg = getprop("/instrumentation/nav[2]/heading-deg") - getprop("/orientation/heading-magnetic-deg"); - } else if (getprop("/instrumentation/nav[2]/heading-deg") != nil and me.get_switch('toggle_true_north') == 1) { + } else if (getprop("/instrumentation/nav[2]/heading-deg") != nil and me.get_switch("toggle_true_north") == 1) { var nav0hdg = getprop("/instrumentation/nav[2]/heading-deg") - getprop("/orientation/heading-deg"); } else { var nav0hdg = 0; } - if (getprop("/instrumentation/nav[3]/heading-deg") != nil and me.get_switch('toggle_true_north') == 0) { + if (getprop("/instrumentation/nav[3]/heading-deg") != nil and me.get_switch("toggle_true_north") == 0) { var nav1hdg = getprop("/instrumentation/nav[3]/heading-deg") - getprop("/orientation/heading-magnetic-deg"); - } else if (getprop("/instrumentation/nav[3]/heading-deg") != nil and me.get_switch('toggle_true_north') == 1) { + } else if (getprop("/instrumentation/nav[3]/heading-deg") != nil and me.get_switch("toggle_true_north") == 1) { var nav1hdg = getprop("/instrumentation/nav[3]/heading-deg") - getprop("/orientation/heading-deg"); } else { var nav1hdg = 0; } var adf0hdg=getprop("instrumentation/adf/indicated-bearing-deg"); var adf1hdg=getprop("instrumentation/adf[1]/indicated-bearing-deg"); - if(!me.get_switch('toggle_centered')) + if(!me.get_switch("toggle_centered")) { - if(me.in_mode('toggle_display_mode', ['PLAN'])) + if(me.in_mode("toggle_display_mode", ["PLAN"])) me.symbols.trkInd.hide(); else me.symbols.trkInd.show(); - if((getprop("instrumentation/nav[2]/in-range") and me.get_switch('toggle_lh_vor_adf') == 1)) { + if((getprop("instrumentation/nav[2]/in-range") and me.get_switch("toggle_lh_vor_adf") == 1)) { me.symbols.staArrowL.setVisible(staPtrVis); me.symbols.staToL.setColor(0.195,0.96,0.097); me.symbols.staFromL.setColor(0.195,0.96,0.097); me.symbols.staArrowL.setRotation(nav0hdg*D2R); } - elsif(getprop("instrumentation/adf/in-range") and (me.get_switch('toggle_lh_vor_adf') == -1)) { + elsif(getprop("instrumentation/adf/in-range") and (me.get_switch("toggle_lh_vor_adf") == -1)) { me.symbols.staArrowL.setVisible(staPtrVis); me.symbols.staToL.setColor(0,0.6,0.85); me.symbols.staFromL.setColor(0,0.6,0.85); @@ -476,12 +476,12 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec } else { me.symbols.staArrowL.hide(); } - if((getprop("instrumentation/nav[3]/in-range") and me.get_switch('toggle_rh_vor_adf') == 1)) { + if((getprop("instrumentation/nav[3]/in-range") and me.get_switch("toggle_rh_vor_adf") == 1)) { me.symbols.staArrowR.setVisible(staPtrVis); me.symbols.staToR.setColor(0.195,0.96,0.097); me.symbols.staFromR.setColor(0.195,0.96,0.097); me.symbols.staArrowR.setRotation(nav1hdg*D2R); - } elsif(getprop("instrumentation/adf[1]/in-range") and (me.get_switch('toggle_rh_vor_adf') == -1)) { + } elsif(getprop("instrumentation/adf[1]/in-range") and (me.get_switch("toggle_rh_vor_adf") == -1)) { me.symbols.staArrowR.setVisible(staPtrVis); me.symbols.staToR.setColor(0,0.6,0.85); me.symbols.staFromR.setColor(0,0.6,0.85); @@ -498,7 +498,7 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec me.symbols.selHdgLine2.hide(); me.symbols.curHdgPtr.setVisible(staPtrVis); me.symbols.HdgBugCRT.setVisible(staPtrVis and !dispLCD); - if(me.get_switch('toggle_track_heading')) + if(me.get_switch("toggle_track_heading")) { me.symbols.HdgBugLCD.hide(); me.symbols.TrkBugLCD.setVisible(staPtrVis and dispLCD); @@ -511,12 +511,12 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec me.symbols.selHdgLine.setVisible(staPtrVis and hdg_bug_active); } else { me.symbols.trkInd.hide(); - if((getprop("instrumentation/nav[2]/in-range") and me.get_switch('toggle_lh_vor_adf') == 1)) { + if((getprop("instrumentation/nav[2]/in-range") and me.get_switch("toggle_lh_vor_adf") == 1)) { me.symbols.staArrowL2.setVisible(staPtrVis); me.symbols.staFromL2.setColor(0.195,0.96,0.097); me.symbols.staToL2.setColor(0.195,0.96,0.097); me.symbols.staArrowL2.setRotation(nav0hdg*D2R); - } elsif(getprop("instrumentation/adf/in-range") and (me.get_switch('toggle_lh_vor_adf') == -1)) { + } elsif(getprop("instrumentation/adf/in-range") and (me.get_switch("toggle_lh_vor_adf") == -1)) { me.symbols.staArrowL2.setVisible(staPtrVis); me.symbols.staFromL2.setColor(0,0.6,0.85); me.symbols.staToL2.setColor(0,0.6,0.85); @@ -524,12 +524,12 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec } else { me.symbols.staArrowL2.hide(); } - if((getprop("instrumentation/nav[3]/in-range") and me.get_switch('toggle_rh_vor_adf') == 1)) { + if((getprop("instrumentation/nav[3]/in-range") and me.get_switch("toggle_rh_vor_adf") == 1)) { me.symbols.staArrowR2.setVisible(staPtrVis); me.symbols.staFromR2.setColor(0.195,0.96,0.097); me.symbols.staToR2.setColor(0.195,0.96,0.097); me.symbols.staArrowR2.setRotation(nav1hdg*D2R); - } elsif(getprop("instrumentation/adf[1]/in-range") and (me.get_switch('toggle_rh_vor_adf') == -1)) { + } elsif(getprop("instrumentation/adf[1]/in-range") and (me.get_switch("toggle_rh_vor_adf") == -1)) { me.symbols.staArrowR2.setVisible(staPtrVis); me.symbols.staFromR2.setColor(0,0.6,0.85); me.symbols.staToR2.setColor(0,0.6,0.85); @@ -546,7 +546,7 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec me.symbols.selHdgLine.hide(); me.symbols.curHdgPtr2.setVisible(staPtrVis); me.symbols.HdgBugCRT2.setVisible(staPtrVis and !dispLCD); - if(me.get_switch('toggle_track_heading')) + if(me.get_switch("toggle_track_heading")) { me.symbols.HdgBugLCD2.hide(); me.symbols.TrkBugLCD2.setVisible(staPtrVis and dispLCD); @@ -560,16 +560,16 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec } ## run all predicates in the NDStyle hash and evaluate their true/false behavior callbacks - ## this is in line with the original design, but normally we don't need to getprop/poll here, + ## this is in line with the original design, but normally we don"t need to getprop/poll here, ## using listeners or timers would be more canvas-friendly whenever possible ## because running setprop() on any group/canvas element at framerate means that the canvas ## will be updated at frame rate too - wasteful ... (check the performance monitor!) foreach(var feature; me.nd_style.features ) { # for stuff that always needs to be updated - if (contains(feature.impl, 'common')) feature.impl.common(me); + if (contains(feature.impl, "common")) feature.impl.common(me); # conditional stuff - if(!contains(feature.impl, 'predicate')) continue; # no conditional stuff + if(!contains(feature.impl, "predicate")) continue; # no conditional stuff if ( var result=feature.impl.predicate(me) ) feature.impl.is_true(me, result); # pass the result to the predicate else @@ -578,10 +578,10 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec ## update the status flags shown on the ND (wxr, wpt, arpt, sta) # this could/should be using listeners instead ... - me.symbols['status.wxr'].setVisible( me.get_switch('toggle_weather') and me.in_mode('toggle_display_mode', ['MAP'])); - me.symbols['status.wpt'].setVisible( me.get_switch('toggle_waypoints') and me.in_mode('toggle_display_mode', ['MAP'])); - me.symbols['status.arpt'].setVisible( me.get_switch('toggle_airports') and me.in_mode('toggle_display_mode', ['MAP'])); - me.symbols['status.sta'].setVisible( me.get_switch('toggle_stations') and me.in_mode('toggle_display_mode', ['MAP'])); + me.symbols["status.wxr"].setVisible( me.get_switch("toggle_weather") and me.in_mode("toggle_display_mode", ["MAP"])); + me.symbols["status.wpt"].setVisible( me.get_switch("toggle_waypoints") and me.in_mode("toggle_display_mode", ["MAP"])); + me.symbols["status.arpt"].setVisible( me.get_switch("toggle_airports") and me.in_mode("toggle_display_mode", ["MAP"])); + me.symbols["status.sta"].setVisible( me.get_switch("toggle_stations") and me.in_mode("toggle_display_mode", ["MAP"])); # Okay, _how_ do we hook this up with FGPlot? printlog(_MP_dbg_lvl, "Total ND update took "~((systime()-_time)*100)~"ms"); setprop("/instrumentation/navdisplay["~ canvas.NavDisplay.id ~"]/update-ms", systime() - _time); diff --git a/Models/Instruments/ND/canvas/helpers.nas b/Models/Instruments/ND/canvas/helpers.nas index af562f8b..180a59f5 100644 --- a/Models/Instruments/ND/canvas/helpers.nas +++ b/Models/Instruments/ND/canvas/helpers.nas @@ -3,21 +3,21 @@ var SymbolPainter = { getOpts: func(opts){ if(opts == nil) opts = {}; var defOpts = {id:nil,color:nil,scale:1,create_group:0,update_center:0}; - if(contains(opts, 'id')) + if(contains(opts, "id")) defOpts.id = opts.id; - if(contains(opts, 'color')) + if(contains(opts, "color")) defOpts.color = opts.color; - if(contains(opts, 'scale')) + if(contains(opts, "scale")) defOpts.scale = opts.scale; - if(contains(opts, 'create_group')) + if(contains(opts, "create_group")) defOpts.create_group = opts.create_group; - if(contains(opts, 'update_center')) + if(contains(opts, "update_center")) defOpts.update_center = opts.update_center; return defOpts; }, getAircraftDir: func(){ if(me.aircraft_dir == nil) - me.aircraft_dir = split('/', getprop("/sim/aircraft-dir"))[-1]; + me.aircraft_dir = split("/", getprop("/sim/aircraft-dir"))[-1]; return me.aircraft_dir; }, svgPath: func(file){ @@ -60,16 +60,16 @@ var SymbolPainter = { else grp = grp.createChild("group"); } - var svg_path = me.svgPath('airbus_vor.svg'); + var svg_path = me.svgPath("airbus_vor.svg"); canvas.parsesvg(grp, svg_path); var scale = opts.scale; if(scale == nil) scale = 0.8; grp.setScale(scale,scale); if(opts.update_center) grp.setTranslation(-24 * scale,-24 * scale); - if(!contains(grp, 'setColor')){ + if(!contains(grp, "setColor")){ grp.setColor = func { - var layer1 = grp.getElementById('layer1'); + var layer1 = grp.getElementById("layer1"); if(layer1 == nil) return; var children = layer1.getChildren(); foreach(var c; children){ @@ -117,7 +117,7 @@ var SymbolPainter = { else grp = grp.createChild("group"); } - var svg_path = me.svgPath('airbus_airport.svg'); + var svg_path = me.svgPath("airbus_airport.svg"); canvas.parsesvg(grp, svg_path); var scale = opts.scale; if(scale == nil) scale = 0.8; @@ -127,11 +127,11 @@ var SymbolPainter = { return grp; }, draw: func(type, grp, opts = nil){ - if(type == 'VOR' or type == 'vor') + if(type == "VOR" or type == "vor") return me.drawVOR(grp, opts); - elsif(type == 'NDB' or type == 'ndb') + elsif(type == "NDB" or type == "ndb") return me.drawNDB(grp, opts); - elsif(type == 'ARPT' or type == 'arpt') + elsif(type == "ARPT" or type == "arpt") return me.drawAirport(grp, opts); else return me.drawFIX(grp, opts); diff --git a/Models/Instruments/ND/canvas/loaders.nas b/Models/Instruments/ND/canvas/loaders.nas index 54cd1b43..ae93d2c4 100644 --- a/Models/Instruments/ND/canvas/loaders.nas +++ b/Models/Instruments/ND/canvas/loaders.nas @@ -1,6 +1,6 @@ -var version = getprop('sim/version/flightgear'); -var v = split('.', version); -version = num(v[0]~'.'~v[1]); +var version = getprop("sim/version/flightgear"); +var v = split(".", version); +version = num(v[0]~"."~v[1]); setlistener("/nasal/canvas/loaded", func() { @@ -40,14 +40,14 @@ setlistener("/nasal/canvas/loaded", func() { }; var load_deps = func(name) { - print('Loading MapStructure Layer: '~ name); + print("Loading MapStructure Layer: "~ name); load(aircraft_root~"/Models/Instruments/ND/map/"~name~".lcontroller", name); load(aircraft_root~"/Models/Instruments/ND/map/"~name~".symbol", name); if(version < 3.2) load(aircraft_root~"/Models/Instruments/ND/map/"~name~".scontroller", name); } - #foreach( var name; ['APS','ALT-profile','SPD-profile','RTE','WPT','DECEL','NDB'] ) + #foreach( var name; ["APS","ALT-profile","SPD-profile","RTE","WPT","DECEL","NDB"] ) #load_deps( name ); var dep_names = [ # With these extensions, in this order: diff --git a/Models/Instruments/ND/canvas/style.nas b/Models/Instruments/ND/canvas/style.nas index 5e1620b7..8fadcba3 100644 --- a/Models/Instruments/ND/canvas/style.nas +++ b/Models/Instruments/ND/canvas/style.nas @@ -36,14 +36,14 @@ canvas.NDStyles["Airbus"] = { ## options: { position_callback: func(nd, pos){ - if(nd.get_switch('toggle_centered') or - nd.get_switch('toggle_display_mode') == 'PLAN') + if(nd.get_switch("toggle_centered") or + nd.get_switch("toggle_display_mode") == "PLAN") pos.range = (nd.rangeNm() * 1.6156087432822295); }, translation_callback: func(nd){ var t = {x: 512, y: 824}; - if(nd.get_switch('toggle_centered') or - nd.get_switch('toggle_display_mode') == 'PLAN') + if(nd.get_switch("toggle_centered") or + nd.get_switch("toggle_display_mode") == "PLAN") t.y = 512; return t; }, @@ -53,34 +53,34 @@ canvas.NDStyles["Airbus"] = { # - lat_ctrl: the property used to determine if lateral flight mode is managed # Lateral managed mode is similar to Boeing LNAV and indicates that the # aircraft should follow the current active flight plan. By default - # the lat_ctrl property is checked against 'fmgc' (managed) value. - # You can use a custom value instead on 'fmgc' by overriding 'managed_val' - # - managed_val: the value that the property defined by 'lat_ctrl' should have in case + # the lat_ctrl property is checked against "fmgc" (managed) value. + # You can use a custom value instead on "fmgc" by overriding "managed_val" + # - managed_val: the value that the property defined by "lat_ctrl" should have in case # that the lateral flight mode is managed. # You can easily override these options before creating the ND, example: - # canvas.NDStyles['Airbus'].options.defaults.fplan_active = 'my/autpilot/f-plan/active' - fplan_active: 'autopilot/route-manager/active', - lat_ctrl: 'flight-management/control/lat-ctrl', - managed_val: 'fmgc', - ver_ctrl: 'flight-management/control/ver-ctrl', - spd_ctrl: '/flight-management/control/spd-ctrl', - current_wp: '/autopilot/route-manager/current-wp', - ap1: '/flight-management/control/ap1-master', - ap2: '/flight-management/control/ap2-master', - nav1_frq: 'instrumentation/nav/frequencies/selected-mhz', - nav2_frq: 'instrumentation/nav[1]/frequencies/selected-mhz', - vor1_frq: 'instrumentation/nav[2]/frequencies/selected-mhz', - vor2_frq: 'instrumentation/nav[3]/frequencies/selected-mhz', - adf1_frq: 'instrumentation/adf/frequencies/selected-khz', - adf2_frq: 'instrumentation/adf[1]/frequencies/selected-khz', - dep_rwy: '/autopilot/route-manager/departure/runway', - dest_rwy: '/autopilot/route-manager/destination/runway', - wp_count: 'autopilot/route-manager/route/num', - level_off_alt: '/autopilot/route-manager/vnav/level-off-alt', - athr: '/flight-management/control/a-thrust', - app_mode: 'instrumentation/nd/app-mode', - chrono_node: 'instrumentation/chrono', - fpln_offset: 'autopilot/route-manager/offset', + # canvas.NDStyles["Airbus"].options.defaults.fplan_active = "my/autpilot/f-plan/active" + fplan_active: "autopilot/route-manager/active", + lat_ctrl: "flight-management/control/lat-ctrl", + managed_val: "fmgc", + ver_ctrl: "flight-management/control/ver-ctrl", + spd_ctrl: "/flight-management/control/spd-ctrl", + current_wp: "/autopilot/route-manager/current-wp", + ap1: "/flight-management/control/ap1-master", + ap2: "/flight-management/control/ap2-master", + nav1_frq: "instrumentation/nav/frequencies/selected-mhz", + nav2_frq: "instrumentation/nav[1]/frequencies/selected-mhz", + vor1_frq: "instrumentation/nav[2]/frequencies/selected-mhz", + vor2_frq: "instrumentation/nav[3]/frequencies/selected-mhz", + adf1_frq: "instrumentation/adf/frequencies/selected-khz", + adf2_frq: "instrumentation/adf[1]/frequencies/selected-khz", + dep_rwy: "/autopilot/route-manager/departure/runway", + dest_rwy: "/autopilot/route-manager/destination/runway", + wp_count: "autopilot/route-manager/route/num", + level_off_alt: "/autopilot/route-manager/vnav/level-off-alt", + athr: "/flight-management/control/a-thrust", + app_mode: "instrumentation/nd/app-mode", + chrono_node: "instrumentation/chrono", + fpln_offset: "autopilot/route-manager/offset", active_route_color: [0.4,0.7,0.4], inactive_route_color: [0.95,0.95,0.21] }, @@ -92,14 +92,14 @@ canvas.NDStyles["Airbus"] = { }, layers: [ { - name:'WXR_live', + name:"WXR_live", isMapStructure:1, always_update: 1, - update_on:[ 'toggle_range','toggle_weather','toggle_display_mode','toggle_weather_live'], + update_on:[ "toggle_range","toggle_weather","toggle_display_mode","toggle_weather_live"], predicate: func(nd, layer) { - var visible=nd.get_switch('toggle_weather') and - nd.get_switch('toggle_weather_live') and - nd.get_switch('toggle_display_mode') != "PLAN"; + var visible=nd.get_switch("toggle_weather") and + nd.get_switch("toggle_weather_live") and + nd.get_switch("toggle_display_mode") != "PLAN"; layer.group.setVisible(visible); if (visible) { layer.update(); @@ -108,33 +108,33 @@ canvas.NDStyles["Airbus"] = { options: { viewport_radius: 706 }, - 'z-index': -100, + "z-index": -100, }, { - name:'WXR', + name:"WXR", isMapStructure:1, - update_on:[ {rate_hz: 0.1}, 'toggle_range','toggle_weather','toggle_display_mode', 'toggle_weather_live'], + update_on:[ {rate_hz: 0.1}, "toggle_range","toggle_weather","toggle_display_mode", "toggle_weather_live"], predicate: func(nd, layer) { #print("Running storms predicate"); - var visible=nd.get_switch('toggle_weather') and - !nd.get_switch('toggle_weather_live') and - nd.get_switch('toggle_display_mode') != "PLAN"; + var visible=nd.get_switch("toggle_weather") and + !nd.get_switch("toggle_weather_live") and + nd.get_switch("toggle_display_mode") != "PLAN"; layer.group.setVisible(visible); if (visible) { #print("storms update requested! (timer issue when closing the dialog?)"); layer.update(); } }, # end of layer update predicate - 'z-index': -4, + "z-index": -4, }, # end of storms/WXR layer { - name:'FIX', + name:"FIX", isMapStructure:1, - update_on:['toggle_range','toggle_waypoints', - 'toggle_display_mode'], + update_on:["toggle_range","toggle_waypoints", + "toggle_display_mode"], predicate: func(nd, layer) { - var visible = nd.get_switch('toggle_waypoints') and - nd.in_mode('toggle_display_mode', ['MAP']) and + var visible = nd.get_switch("toggle_waypoints") and + nd.in_mode("toggle_display_mode", ["MAP"]) and (nd.rangeNm() <= 40); layer.group.setVisible( visible ); if (visible) @@ -147,7 +147,7 @@ canvas.NDStyles["Airbus"] = { }, options: { draw_function: func(group){ - group.createChild('path') + group.createChild("path") .moveTo(-10,0) .lineTo(0,-17) .lineTo(10,0) @@ -160,11 +160,11 @@ canvas.NDStyles["Airbus"] = { } }, # end of FIX layer { - name: 'ALT-profile', + name: "ALT-profile", isMapStructure: 1, - update_on: ['toggle_display_mode','toggle_range',{rate_hz: 2}], + update_on: ["toggle_display_mode","toggle_range",{rate_hz: 2}], predicate: func(nd, layer) { - var visible = nd.in_mode('toggle_display_mode', ['MAP', 'PLAN']);# and nd.get_switch('toggle_fplan'); + var visible = nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]);# and nd.get_switch("toggle_fplan"); layer.group.setVisible( visible ); if (visible) { layer.update(); @@ -177,11 +177,11 @@ canvas.NDStyles["Airbus"] = { }, options: { # You can overwrite these with different nodes, before creating the ND - # Example: canvas.NDStyles['Airbus'].layers['ALT-profile'].options.vnav_node = 'my/vnav/node'; + # Example: canvas.NDStyles["Airbus"].layers["ALT-profile"].options.vnav_node = "my/vnav/node"; # In order to display ALT-profile on your ND you have to create the various # nodes corresponding to the different ALT pseudowaypoint in your aircraft code. - # Every node must be set into the 'vnav_node' configured here (you can override it). - # Example: if you want to display the top-of-descent symbol you must create a 'td' + # Every node must be set into the "vnav_node" configured here (you can override it). + # Example: if you want to display the top-of-descent symbol you must create a "td" # node into vnav_node. Something like this: # /autopilot/route-manager/vnav/td/ # Each node should have the latitude-deg and longitude-deg properties. @@ -193,41 +193,41 @@ canvas.NDStyles["Airbus"] = { # sc (start of climb) # sd (start of descent) # If ec and ed are altitude constraints, their node should have the - # boolean 'alt-cstr' property set to 1. + # boolean "alt-cstr" property set to 1. vnav_node: "/autopilot/route-manager/vnav/", types: ["tc", "td", "ec", "ed","sc","sd"], svg_path: { - tc: get_local_path('res/airbus_tc.svg'), - td: get_local_path('res/airbus_td.svg'), - ec: get_local_path('res/airbus_ec.svg'), - ed: get_local_path('res/airbus_ed.svg'), - sc: get_local_path('res/airbus_sc.svg'), - sd: get_local_path('res/airbus_sd.svg') + tc: get_local_path("res/airbus_tc.svg"), + td: get_local_path("res/airbus_td.svg"), + ec: get_local_path("res/airbus_ec.svg"), + ed: get_local_path("res/airbus_ed.svg"), + sc: get_local_path("res/airbus_sc.svg"), + sd: get_local_path("res/airbus_sd.svg") }, listen: [ - 'fplan_active', - 'ver_ctrl', - 'ap1', - 'ap2', - 'current_wp' + "fplan_active", + "ver_ctrl", + "ap1", + "ap2", + "current_wp" ], draw_callback: func(){ var name = me.model.getName(); - var grp = me.element.getElementById(name~'_symbol'); + var grp = me.element.getElementById(name~"_symbol"); if(grp == nil) return; - var dfcolor = me.getStyle('default_color'); - var armed_color = me.getStyle('armed_color'); - var managed_color = me.getStyle('managed_color'); - #print('Draw: -> ' ~ name); - if(name == 'td' or name == 'sd' or name == 'sc'){ - var vnav_armed = me.model.getValue('vnav-armed'); - if(vnav_armed and name != 'td') + var dfcolor = me.getStyle("default_color"); + var armed_color = me.getStyle("armed_color"); + var managed_color = me.getStyle("managed_color"); + #print("Draw: -> " ~ name); + if(name == "td" or name == "sd" or name == "sc"){ + var vnav_armed = me.model.getValue("vnav-armed"); + if(vnav_armed and name != "td") grp.setColor(armed_color); else grp.setColor(dfcolor); } - elsif(name == 'ed' or name == 'ec'){ - var is_cstr = me.model.getValue('alt-cstr'); + elsif(name == "ed" or name == "ec"){ + var is_cstr = me.model.getValue("alt-cstr"); if(is_cstr) grp.setColor(managed_color); else @@ -236,43 +236,43 @@ canvas.NDStyles["Airbus"] = { }, init_after_callback: func{ var name = me.model.getName(); - var grp = me.element.getElementById(name~'_symbol'); - if(name != 'td' and name != 'sd' and name != 'sc'){ + var grp = me.element.getElementById(name~"_symbol"); + if(name != "td" and name != "sd" and name != "sc"){ grp.setTranslation(-66,0); } } } }, { - name:'APT', + name:"APT", isMapStructure:1, - update_on:['toggle_range','toggle_airports', - 'toggle_display_mode'], + update_on:["toggle_range","toggle_airports", + "toggle_display_mode"], predicate: func(nd, layer) { - var visible = nd.get_switch('toggle_airports') and - nd.in_mode('toggle_display_mode', ['MAP']); + var visible = nd.get_switch("toggle_airports") and + nd.in_mode("toggle_display_mode", ["MAP"]); layer.group.setVisible( visible ); if (visible) { layer.update(); } }, # end of layer update predicate style: { - svg_path: get_local_path('res/airbus_airport.svg'), + svg_path: get_local_path("res/airbus_airport.svg"), text_offset: [45, 35], label_font_color: [1,1,1], label_font_size: 28 } }, # end of APT layer { - name:'VOR-airbus', + name:"VOR-airbus", isMapStructure:1, - update_on:['toggle_range','toggle_vor','toggle_display_mode'], + update_on:["toggle_range","toggle_vor","toggle_display_mode"], # FIXME: this is a really ugly place for controller code predicate: func(nd, layer) { # print("Running vor layer predicate"); # toggle visibility here - var visible = nd.get_switch('toggle_vor') and - nd.in_mode('toggle_display_mode', ['MAP']) and + var visible = nd.get_switch("toggle_vor") and + nd.in_mode("toggle_display_mode", ["MAP"]) and (nd.rangeNm() <= 40); layer.group.setVisible( visible ); if (visible) { @@ -280,28 +280,28 @@ canvas.NDStyles["Airbus"] = { } }, # end of layer update predicate # You can override default colors within the style - # Default color: 'color' - # Tuned color: 'tuned_color' + # Default color: "color" + # Tuned color: "tuned_color" # Example: - # canvas.NDStyles['Airbus'].layers['VOR-airbus'].style.color = [1,1,1]; - # canvas.NDStyles['Airbus'].layers['VOR-airbus'].style.tuned_color = [0,0,1]; + # canvas.NDStyles["Airbus"].layers["VOR-airbus"].style.color = [1,1,1]; + # canvas.NDStyles["Airbus"].layers["VOR-airbus"].style.tuned_color = [0,0,1]; style: {}, options:{ listen: [ - 'vor1_frq', - 'vor2_frq' + "vor1_frq", + "vor2_frq" ] } }, # end of VOR layer { - name:'DME', + name:"DME", disabled:1, isMapStructure:1, - update_on:['toggle_display_mode','toggle_range','toggle_dme'], + update_on:["toggle_display_mode","toggle_range","toggle_dme"], # FIXME: this is a really ugly place for controller code predicate: func(nd, layer) { - var visible = nd.get_switch('toggle_dme') and - nd.in_mode('toggle_display_mode', ['MAP']) and + var visible = nd.get_switch("toggle_dme") and + nd.in_mode("toggle_display_mode", ["MAP"]) and (nd.rangeNm() <= 40); # toggle visibility here layer.group.setVisible( visible ); @@ -325,16 +325,16 @@ canvas.NDStyles["Airbus"] = { color_default: [0.9,0,0.47], color_tuned: [0,0.62,0.84], }, - 'z-index': -2, + "z-index": -2, }, # end of DME layer { - name:'NDB', + name:"NDB", isMapStructure:1, - update_on:['toggle_range','toggle_ndb','toggle_display_mode'], + update_on:["toggle_range","toggle_ndb","toggle_display_mode"], # FIXME: this is a really ugly place for controller code predicate: func(nd, layer) { - var visible = nd.get_switch('toggle_ndb') and - nd.in_mode('toggle_display_mode', ['MAP']) and + var visible = nd.get_switch("toggle_ndb") and + nd.in_mode("toggle_display_mode", ["MAP"]) and (nd.rangeNm() <= 40); # print("Running vor layer predicate"); # toggle visibility here @@ -344,19 +344,19 @@ canvas.NDStyles["Airbus"] = { } }, # end of layer update predicate # You can override default colors within the style - # Default color: 'color' - # Tuned color: 'tuned_color' + # Default color: "color" + # Tuned color: "tuned_color" # Example: - # canvas.NDStyles['Airbus'].layers['VOR-airbus'].style.color = [1,1,1]; - # canvas.NDStyles['Airbus'].layers['VOR-airbus'].style.tuned_color = [0,0,1]; + # canvas.NDStyles["Airbus"].layers["VOR-airbus"].style.color = [1,1,1]; + # canvas.NDStyles["Airbus"].layers["VOR-airbus"].style.tuned_color = [0,0,1]; style: { - #svg_path: get_local_path('res/airbus_ndb.svg') - svg_path: '' + #svg_path: get_local_path("res/airbus_ndb.svg") + svg_path: "" }, options: { listen: [ - 'adf1_frq', - 'adf2_frq' + "adf1_frq", + "adf2_frq" ], init_after_callback: func{ #me.element.removeAllChildren(); @@ -366,7 +366,7 @@ canvas.NDStyles["Airbus"] = { .setFont("LiberationFonts/LiberationSans-Regular.ttf") .setFontSize(28) .setTranslation(25,10); - me.ndb_sym = me.element.createChild('path'); + me.ndb_sym = me.element.createChild("path"); me.ndb_sym.moveTo(-15,15) .lineTo(0,-15) .lineTo(15,15) @@ -378,8 +378,8 @@ canvas.NDStyles["Airbus"] = { draw_callback: func{ var frq = me.model.frequency; if(frq != nil){ - var dfcolor = me.getStyle('color', [0.9,0,0.47]); - var tuned_color = me.getStyle('tuned_color', [0,0.62,0.84]); + var dfcolor = me.getStyle("color", [0.9,0,0.47]); + var tuned_color = me.getStyle("tuned_color", [0,0.62,0.84]); frq = frq / 100; var adf1_frq = getprop(me.options.adf1_frq); var adf2_frq = getprop(me.options.adf2_frq); @@ -393,13 +393,13 @@ canvas.NDStyles["Airbus"] = { } }, # end of NDB layer { - name:'TFC', + name:"TFC", #disabled:1, always_update: 1, isMapStructure:1, - update_on:['toggle_range','toggle_traffic'], + update_on:["toggle_range","toggle_traffic"], predicate: func(nd, layer) { - var visible = nd.get_switch('toggle_traffic'); + var visible = nd.get_switch("toggle_traffic"); layer.group.setVisible( visible ); if (visible) { #print("Updating MapStructure ND layer: TFC"); @@ -408,12 +408,12 @@ canvas.NDStyles["Airbus"] = { }, # end of layer update predicate }, # end of traffic layer { - name:'RWY-profile', + name:"RWY-profile", isMapStructure:1, - update_on:['toggle_range','toggle_display_mode'], + update_on:["toggle_range","toggle_display_mode"], predicate: func(nd, layer) { var visible = (nd.rangeNm() <= 40) and - nd.in_mode('toggle_display_mode', ['MAP','PLAN']) ; + nd.in_mode("toggle_display_mode", ["MAP","PLAN"]) ; layer.group.setVisible( visible ); if (visible) { layer.update(); @@ -421,51 +421,51 @@ canvas.NDStyles["Airbus"] = { }, # end of layer update predicate options: { listen: [ - 'fplan_active', - 'dep_rwy', - 'dest_rwy' + "fplan_active", + "dep_rwy", + "dest_rwy" ] } }, # end of runway layer { - name:'HOLD', + name:"HOLD", isMapStructure: 1, always_update: 1, - update_on:['toggle_range','toggle_display_mode','toggle_wpt_idx'], + update_on:["toggle_range","toggle_display_mode","toggle_wpt_idx"], predicate: func(nd, layer) { - var visible= nd.in_mode('toggle_display_mode', ['MAP','PLAN']); + var visible= nd.in_mode("toggle_display_mode", ["MAP","PLAN"]); layer.group.setVisible( visible ); if (visible) { layer.update(); } }, options: { - hold_node: '/flight-management/hold', - hold_init: 'flight-management/hold/init', - points_node: '/flight-management/hold/points', - first_point_node: '/flight-management/hold/points/point/lat', - hold_wp: '/flight-management/hold/wp', - hold_wp_idx: '/flight-management/hold/wp_id', + hold_node: "/flight-management/hold", + hold_init: "flight-management/hold/init", + points_node: "/flight-management/hold/points", + first_point_node: "/flight-management/hold/points/point/lat", + hold_wp: "/flight-management/hold/wp", + hold_wp_idx: "/flight-management/hold/wp_id", range_dependant: 1, listen: [ - 'first_point_node', - 'fplan_active', - 'lat_ctrl', - 'current_wp', - 'hold_wp', - 'hold_init', - 'hold_wp_idx' + "first_point_node", + "fplan_active", + "lat_ctrl", + "current_wp", + "hold_wp", + "hold_init", + "hold_wp_idx" ] } # end of layer update predicate }, # end of HOLD layer { - name:'RTE', + name:"RTE", isMapStructure: 1, - update_on:['toggle_range','toggle_display_mode', 'toggle_cstr', - 'toggle_wpt_idx'], + update_on:["toggle_range","toggle_display_mode", "toggle_cstr", + "toggle_wpt_idx"], predicate: func(nd, layer) { - var visible= (nd.in_mode('toggle_display_mode', ['MAP','PLAN'])); + var visible= (nd.in_mode("toggle_display_mode", ["MAP","PLAN"])); layer.group.setVisible( visible ); if (visible) { layer.update(); @@ -474,10 +474,10 @@ canvas.NDStyles["Airbus"] = { options: { display_inactive_rte: 1, listen: [ - 'fplan_active', - 'lat_ctrl', - 'current_wp', - 'wp_count' + "fplan_active", + "lat_ctrl", + "current_wp", + "wp_count" ], draw_after_callback: func{ me.setRouteStyle(); @@ -488,22 +488,22 @@ canvas.NDStyles["Airbus"] = { #inactive_color: [0.95,0.95,0.21], #active_color: [0.4,0.7,0.4], color: func{ - if(!contains(me, 'inactive_color')){ - me.inactive_color = me.getStyle('inactive_color'); + if(!contains(me, "inactive_color")){ + me.inactive_color = me.getStyle("inactive_color"); if(me.inactive_color == nil) - me.inactive_color = me.getOption('inactive_route_color'); + me.inactive_color = me.getOption("inactive_route_color"); } - if(!contains(me, 'active_color')){ - me.active_color = me.getStyle('active_color'); + if(!contains(me, "active_color")){ + me.active_color = me.getStyle("active_color"); if(me.active_color == nil) - me.active_color = me.getOption('active_route_color'); + me.active_color = me.getOption("active_route_color"); } var is_active = getprop(me.options.fplan_active); (is_active ? me.active_color : me.inactive_color); }, color_alternate_active: [0,0.62,0.84], color_missed: [0,0.62,0.84], - color_temporary: func me.getStyle('inactive_color', me.getOption('inactive_route_color')), + color_temporary: func me.getStyle("inactive_color", me.getOption("inactive_route_color")), color_secondary: [1,1,1], color_alternate_secondary: [1,1,1], line_dash: func{ @@ -518,10 +518,10 @@ canvas.NDStyles["Airbus"] = { } }, # end of route layer { - name:'WPT-airbus', + name:"WPT-airbus", isMapStructure: 1, - update_on:['toggle_range','toggle_display_mode', 'toggle_cstr', - 'toggle_wpt_idx'], + update_on:["toggle_range","toggle_display_mode", "toggle_cstr", + "toggle_wpt_idx"], style: { wp_color: [0.4,0.7,0.4], current_wp_color: [1,1,1], @@ -530,32 +530,32 @@ canvas.NDStyles["Airbus"] = { missed_constraint_color: [1,0.57,0.14] }, predicate: func(nd, layer) { - var visible= (nd.in_mode('toggle_display_mode', ['MAP','PLAN'])); + var visible= (nd.in_mode("toggle_display_mode", ["MAP","PLAN"])); layer.group.setVisible( visible ); if (visible) { - layer.toggle_cstr = nd.get_switch('toggle_cstr'); + layer.toggle_cstr = nd.get_switch("toggle_cstr"); layer.update(); } }, # end of layer update predicate options: { listen: [ - 'fplan_active', - 'lat_ctrl', - 'ver_ctrl', - 'current_wp', - 'wp_count', - 'dep_rwy', - 'dest_rwy', - 'level_off_alt' + "fplan_active", + "lat_ctrl", + "ver_ctrl", + "current_wp", + "wp_count", + "dep_rwy", + "dest_rwy", + "level_off_alt" ], } }, # end of WPT layer { - name: 'SPD-profile', + name: "SPD-profile", isMapStructure: 1, - update_on: ['toggle_display_mode','toggle_range',{rate_hz: 2}], + update_on: ["toggle_display_mode","toggle_range",{rate_hz: 2}], predicate: func(nd, layer) { - var visible = nd.in_mode('toggle_display_mode', ['MAP', 'PLAN']); + var visible = nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]); layer.group.setVisible( visible ); if (visible) { layer.update(); @@ -567,16 +567,16 @@ canvas.NDStyles["Airbus"] = { options: { spd_node: "/autopilot/route-manager/spd/", listen: [ - 'fplan_active' + "fplan_active" ] } }, { - name: 'DECEL', + name: "DECEL", isMapStructure: 1, - update_on: ['toggle_display_mode','toggle_range'], + update_on: ["toggle_display_mode","toggle_range"], predicate: func(nd, layer) { - var visible = nd.in_mode('toggle_display_mode', ['MAP', 'PLAN']); + var visible = nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]); layer.group.setVisible( visible ); if (visible) { layer.update(); @@ -587,10 +587,10 @@ canvas.NDStyles["Airbus"] = { # decel_node: node containing latitude-deg and longitude-deg used to mark the deceleration point # managed_speed_node: boolean property indicating that the aircraft is flying in managed speed mode listen: [ - 'fplan_active', - 'spd_ctrl', - 'ver_ctrl', - 'athr' + "fplan_active", + "spd_ctrl", + "ver_ctrl", + "athr" ] }, style: { @@ -601,29 +601,29 @@ canvas.NDStyles["Airbus"] = { } }, { - name:'APS', + name:"APS", isMapStructure:1, always_update: 1, - update_on:['toggle_display_mode'], + update_on:["toggle_display_mode"], predicate: func(nd, layer) { - var visible = nd.get_switch('toggle_display_mode') == "PLAN"; + var visible = nd.get_switch("toggle_display_mode") == "PLAN"; layer.group.setVisible( visible ); if (visible) { layer.update(); } }, style: { - svg_path: get_local_path('res/airbusAirplane.svg'), + svg_path: get_local_path("res/airbusAirplane.svg"), #translate: [-45,-52] }, options: { model: { parents: [geo.Coord], id: 999999, - pos: props.globals.getNode('position'), - type: 'position', + pos: props.globals.getNode("position"), + type: "position", latlon: func(){ - me.pos = props.globals.getNode('position'); + me.pos = props.globals.getNode("position"); return [ me.pos.getValue("latitude-deg"), me.pos.getValue("longitude-deg"), @@ -639,13 +639,13 @@ canvas.NDStyles["Airbus"] = { } }, { - name: 'DEBUG', + name: "DEBUG", isMapStructure: 1, always_update: 1, - update_on: ['toggle_display_mode'], + update_on: ["toggle_display_mode"], predicate: func(nd, layer){ - var map_mode = nd.in_mode('toggle_display_mode', ['MAP', 'PLAN']); - var debug_actv = getprop('autopilot/route-manager/debug/active') or 0; + var map_mode = nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]); + var debug_actv = getprop("autopilot/route-manager/debug/active") or 0; var visible = (map_mode and debug_actv); layer.group.setVisible( visible ); if (visible) { @@ -655,7 +655,7 @@ canvas.NDStyles["Airbus"] = { } ## add other layers here, layer names must match the registered names as used in *.layer files for now - ## this will all change once we're using Philosopher's MapStructure framework + ## this will all change once we"re using Philosopher"s MapStructure framework ], # end of vector with configured layers @@ -667,26 +667,26 @@ canvas.NDStyles["Airbus"] = { # TODO: support putting symbols on specific layers features: [ { - id: 'compass_mask', + id: "compass_mask", impl: { init: func(nd, symbol), - predicate: func(nd) !nd.get_switch('toggle_centered'), + predicate: func(nd) !nd.get_switch("toggle_centered"), is_true: func(nd) nd.symbols.compass_mask.show(), is_false: func(nd) nd.symbols.compass_mask.hide(), } }, { - id: 'compass_mask_ctr', + id: "compass_mask_ctr", impl: { init: func(nd, symbol), - predicate: func(nd) nd.get_switch('toggle_centered') or nd.in_mode('toggle_display_mode',['PLAN']), + predicate: func(nd) nd.get_switch("toggle_centered") or nd.in_mode("toggle_display_mode",["PLAN"]), is_true: func(nd) nd.symbols.compass_mask_ctr.show(), is_false: func(nd) nd.symbols.compass_mask_ctr.hide(), } }, { - # TODO: taOnly doesn't need to use getprop polling in update(), use a listener instead! - id: 'taOnly', # the SVG ID + # TODO: taOnly doesn"t need to use getprop polling in update(), use a listener instead! + id: "taOnly", # the SVG ID impl: { # implementation hash init: func(nd, symbol), # for updateCenter stuff, called during initialization in the ctor predicate: func(nd) getprop("instrumentation/tcas/inputs/mode") == 2, # the condition @@ -695,7 +695,7 @@ canvas.NDStyles["Airbus"] = { }, # end of taOnly behavior/callbacks }, # end of taOnly { - id: 'tas', + id: "tas", impl: { init: func(nd,symbol), predicate: func(nd) nd.aircraft_source.get_spd() > 100, @@ -707,7 +707,7 @@ canvas.NDStyles["Airbus"] = { }, }, { - id: 'tasLbl', + id: "tasLbl", impl: { init: func(nd,symbol), predicate: func(nd) nd.aircraft_source.get_spd() > 100, @@ -716,14 +716,14 @@ canvas.NDStyles["Airbus"] = { }, }, { - id: 'ilsFreq', + id: "ilsFreq", impl: { init: func(nd,symbol), - predicate: func(nd) nd.in_mode('toggle_display_mode', ['APP', 'VOR']), + predicate: func(nd) nd.in_mode("toggle_display_mode", ["APP", "VOR"]), is_true: func(nd) { nd.symbols.ilsFreq.show(); - var is_ils = (nd.get_switch('toggle_display_mode') == 'APP'); - var type = (is_ils ? 'ils' : 'vor'); + var is_ils = (nd.get_switch("toggle_display_mode") == "APP"); + var type = (is_ils ? "ils" : "vor"); var path = nd.get_nav_path(type, 0); nd.symbols.ilsFreq.setText(getprop(path~ "frequencies/selected-mhz-fmt")); if(is_ils) @@ -735,27 +735,27 @@ canvas.NDStyles["Airbus"] = { }, }, { - id: 'ilsLbl', + id: "ilsLbl", impl: { init: func(nd,symbol), - predicate: func(nd) nd.in_mode('toggle_display_mode', ['APP', 'VOR']), + predicate: func(nd) nd.in_mode("toggle_display_mode", ["APP", "VOR"]), is_true: func(nd) { nd.symbols.ilsLbl.show(); - if(nd.get_switch('toggle_display_mode') == 'APP') - nd.symbols.ilsLbl.setText('ILS'); + if(nd.get_switch("toggle_display_mode") == "APP") + nd.symbols.ilsLbl.setText("ILS"); else - nd.symbols.ilsLbl.setText('VOR 1'); + nd.symbols.ilsLbl.setText("VOR 1"); }, is_false: func(nd) nd.symbols.ilsLbl.hide(), }, }, { - id: 'wpActiveId', + id: "wpActiveId", impl: { init: func(nd,symbol), predicate: func(nd) getprop("/autopilot/route-manager/wp/id") != nil and getprop("autopilot/route-manager/active") and - nd.in_mode('toggle_display_mode', ['MAP', 'PLAN']), + nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]), is_true: func(nd) { nd.symbols.wpActiveId.setText(getprop("/autopilot/route-manager/wp/id")); nd.symbols.wpActiveId.show(); @@ -764,28 +764,28 @@ canvas.NDStyles["Airbus"] = { }, # of wpActiveId.impl }, # of wpActiveId { - id: 'wpActiveCrs', + id: "wpActiveCrs", impl: { init: func(nd,symbol), predicate: func(nd) getprop("/autopilot/route-manager/wp/id") != nil and getprop("autopilot/route-manager/active") and - nd.in_mode('toggle_display_mode', ['MAP', 'PLAN']), + nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]), is_true: func(nd) { #var cur_wp = getprop("autopilot/route-manager/current-wp"); var deg = int(getprop("/autopilot/route-manager/wp/bearing-deg")); - nd.symbols.wpActiveCrs.setText(''~deg~'°'); + nd.symbols.wpActiveCrs.setText(""~deg~"°"); nd.symbols.wpActiveCrs.show(); }, is_false: func(nd) nd.symbols.wpActiveCrs.hide(), }, # of wpActiveId.impl }, # of wpActiveId { - id: 'wpActiveDist', + id: "wpActiveDist", impl: { init: func(nd,symbol), predicate: func(nd) getprop("/autopilot/route-manager/wp/dist") != nil and getprop("autopilot/route-manager/active") and - nd.in_mode('toggle_display_mode', ['MAP', 'PLAN']), + nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]), is_true: func(nd) { var dst = getprop("/autopilot/route-manager/wp/dist"); nd.symbols.wpActiveDist.setText(sprintf("%3.01f",dst)); @@ -795,10 +795,10 @@ canvas.NDStyles["Airbus"] = { }, }, { - id: 'wpActiveDistLbl', + id: "wpActiveDistLbl", impl: { init: func(nd,symbol), - predicate: func(nd) getprop("/autopilot/route-manager/wp/dist") != nil and getprop("autopilot/route-manager/active") and nd.in_mode('toggle_display_mode', ['MAP', 'PLAN']), + predicate: func(nd) getprop("/autopilot/route-manager/wp/dist") != nil and getprop("autopilot/route-manager/active") and nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]), is_true: func(nd) { nd.symbols.wpActiveDistLbl.show(); if(getprop("/autopilot/route-manager/wp/dist") > 1000) @@ -808,10 +808,10 @@ canvas.NDStyles["Airbus"] = { }, }, { - id: 'eta', + id: "eta", impl: { init: func(nd,symbol), - predicate: func(nd) getprop("autopilot/route-manager/wp/eta") != nil and getprop("autopilot/route-manager/active") and nd.in_mode('toggle_display_mode', ['MAP', 'PLAN']), + predicate: func(nd) getprop("autopilot/route-manager/wp/eta") != nil and getprop("autopilot/route-manager/active") and nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]), is_true: func(nd) { var etaSec = getprop("/sim/time/utc/day-seconds")+ getprop("autopilot/route-manager/wp/eta-seconds"); @@ -828,12 +828,12 @@ canvas.NDStyles["Airbus"] = { }, # of eta.impl }, # of eta { - id: 'gsGroup', + id: "gsGroup", impl: { init: func(nd,symbol), - predicate: func(nd) nd.in_mode('toggle_display_mode', ['APP']), + predicate: func(nd) nd.in_mode("toggle_display_mode", ["APP"]), is_true: func(nd) { - if(nd.get_switch('toggle_centered')) + if(nd.get_switch("toggle_centered")) nd.symbols.gsGroup.setTranslation(0,0); else nd.symbols.gsGroup.setTranslation(0,150); @@ -843,19 +843,19 @@ canvas.NDStyles["Airbus"] = { }, }, { - id:'hdg', + id:"hdg", impl: { init: func(nd,symbol), - predicate: func(nd) nd.in_mode('toggle_display_mode', ['APP','MAP','VOR']), + predicate: func(nd) nd.in_mode("toggle_display_mode", ["APP","MAP","VOR"]), is_true: func(nd) { var hdgText = ""; - if(nd.in_mode('toggle_display_mode', ['MAP'])) { - if(nd.get_switch('toggle_true_north')) + if(nd.in_mode("toggle_display_mode", ["MAP"])) { + if(nd.get_switch("toggle_true_north")) hdgText = nd.aircraft_source.get_trk_tru(); else hdgText = nd.aircraft_source.get_trk_mag(); } else { - if(nd.get_switch('toggle_true_north')) + if(nd.get_switch("toggle_true_north")) hdgText = nd.aircraft_source.get_hdg_tru(); else hdgText = nd.aircraft_source.get_hdg_mag(); @@ -866,13 +866,13 @@ canvas.NDStyles["Airbus"] = { }, }, { - id:'hdgGroup', + id:"hdgGroup", impl: { init: func(nd,symbol), - predicate: func(nd) {return 0},#nd.in_mode('toggle_display_mode', ['APP','MAP','VOR']), + predicate: func(nd) {return 0},#nd.in_mode("toggle_display_mode", ["APP","MAP","VOR"]), is_true: func(nd) { nd.symbols.hdgGroup.show(); - if(nd.get_switch('toggle_centered')) + if(nd.get_switch("toggle_centered")) nd.symbols.hdgGroup.setTranslation(0,100); else nd.symbols.hdgGroup.setTranslation(0,0); @@ -881,10 +881,10 @@ canvas.NDStyles["Airbus"] = { }, }, { - id:'altArc', + id:"altArc", impl: { init: func(nd,symbol), - predicate: func(nd) {return 0},#nd.in_mode('toggle_display_mode', ['APP','MAP','VOR']), + predicate: func(nd) {return 0},#nd.in_mode("toggle_display_mode", ["APP","MAP","VOR"]), is_true: func(nd) { nd.symbols.altArc.show(); }, @@ -892,7 +892,7 @@ canvas.NDStyles["Airbus"] = { }, }, { - id:'gs', + id:"gs", impl: { init: func(nd,symbol), common: func(nd) nd.symbols.gs.setText(sprintf("%3.0f",nd.aircraft_source.get_gnd_spd() )), @@ -905,10 +905,10 @@ canvas.NDStyles["Airbus"] = { }, }, { - id:'compass', + id:"compass", impl: { init: func(nd,symbol), - predicate: func(nd) (!nd.get_switch('toggle_centered') and nd.get_switch('toggle_display_mode') != "PLAN"), + predicate: func(nd) (!nd.get_switch("toggle_centered") and nd.get_switch("toggle_display_mode") != "PLAN"), is_true: func(nd) { nd.symbols.compass.setRotation(-nd.userHdgTrk*D2R); nd.symbols.compass.show() @@ -917,10 +917,10 @@ canvas.NDStyles["Airbus"] = { }, # of compass.impl }, # of compass { - id:'compassApp', + id:"compassApp", impl: { init: func(nd,symbol), - predicate: func(nd) (nd.get_switch('toggle_centered') and nd.get_switch('toggle_display_mode') != "PLAN"), + predicate: func(nd) (nd.get_switch("toggle_centered") and nd.get_switch("toggle_display_mode") != "PLAN"), is_true: func(nd) { nd.symbols.compassApp.setRotation(-nd.userHdgTrk*D2R); nd.symbols.compassApp.show() @@ -929,34 +929,34 @@ canvas.NDStyles["Airbus"] = { }, # of compassApp.impl }, # of compassApp { - id:'northUp', + id:"northUp", impl: { init: func(nd,symbol), - predicate: func(nd) nd.get_switch('toggle_display_mode') == "PLAN", + predicate: func(nd) nd.get_switch("toggle_display_mode") == "PLAN", is_true: func(nd) nd.symbols.northUp.show(), is_false: func(nd) nd.symbols.northUp.hide(), }, # of northUp.impl }, # of northUp { - id:'planArcs', + id:"planArcs", impl: { init: func(nd,symbol), - predicate: func(nd) ((nd.in_mode('toggle_display_mode', ['APP','VOR','PLAN'])) or ((nd.get_switch('toggle_display_mode') == "MAP") and (nd.get_switch('toggle_centered')))), + predicate: func(nd) ((nd.in_mode("toggle_display_mode", ["APP","VOR","PLAN"])) or ((nd.get_switch("toggle_display_mode") == "MAP") and (nd.get_switch("toggle_centered")))), is_true: func(nd) nd.symbols.planArcs.show(), is_false: func(nd) nd.symbols.planArcs.hide(), }, # of planArcs.impl }, # of planArcs { - id:'rangeArcs', + id:"rangeArcs", impl: { init: func(nd,symbol), - predicate: func(nd) ((nd.get_switch('toggle_display_mode') == "MAP") and (!nd.get_switch('toggle_centered'))), + predicate: func(nd) ((nd.get_switch("toggle_display_mode") == "MAP") and (!nd.get_switch("toggle_centered"))), is_true: func(nd) nd.symbols.rangeArcs.show(), is_false: func(nd) nd.symbols.rangeArcs.hide(), }, # of rangeArcs.impl }, # of rangeArcs { - id:'rangePln1', + id:"rangePln1", impl: { init: func(nd,symbol), predicate: func(nd) {return 0}, @@ -968,10 +968,10 @@ canvas.NDStyles["Airbus"] = { }, }, { - id:'rangePln2', + id:"rangePln2", impl: { init: func(nd,symbol), - predicate: func(nd) nd.get_switch('toggle_display_mode') == "MAP" and !nd.get_switch('toggle_centered'), + predicate: func(nd) nd.get_switch("toggle_display_mode") == "MAP" and !nd.get_switch("toggle_centered"), is_true: func(nd) { nd.symbols.rangePln2.show(); nd.symbols.rangePln2.setText(sprintf("%3.0f",(nd.rangeNm()/2) + (nd.rangeNm()/4))); @@ -980,10 +980,10 @@ canvas.NDStyles["Airbus"] = { }, }, { - id:'rangePln3', + id:"rangePln3", impl: { init: func(nd,symbol), - predicate: func(nd) nd.get_switch('toggle_display_mode') == "PLAN" or nd.get_switch('toggle_centered'), + predicate: func(nd) nd.get_switch("toggle_display_mode") == "PLAN" or nd.get_switch("toggle_centered"), is_true: func(nd) { nd.symbols.rangePln3.show(); nd.symbols.rangePln3.setText(sprintf("%3.0f",nd.rangeNm()/2)); @@ -992,10 +992,10 @@ canvas.NDStyles["Airbus"] = { }, }, { - id:'rangePln4', + id:"rangePln4", impl: { init: func(nd,symbol), - predicate: func(nd) nd.get_switch('toggle_display_mode') == "PLAN" or nd.get_switch('toggle_centered'), + predicate: func(nd) nd.get_switch("toggle_display_mode") == "PLAN" or nd.get_switch("toggle_centered"), is_true: func(nd) { nd.symbols.rangePln4.show(); nd.symbols.rangePln4.setText(sprintf("%3.0f",nd.rangeNm())); @@ -1004,10 +1004,10 @@ canvas.NDStyles["Airbus"] = { }, }, { - id:'rangePln5', + id:"rangePln5", impl: { init: func(nd,symbol), - predicate: func(nd) nd.get_switch('toggle_display_mode') == "MAP" and !nd.get_switch('toggle_centered'), + predicate: func(nd) nd.get_switch("toggle_display_mode") == "MAP" and !nd.get_switch("toggle_centered"), is_true: func(nd) { nd.symbols.rangePln5.show(); nd.symbols.rangePln5.setText(sprintf("%3.0f",(nd.rangeNm()/2) + (nd.rangeNm()/4))); @@ -1016,10 +1016,10 @@ canvas.NDStyles["Airbus"] = { }, }, { - id:'range', + id:"range", impl: { init: func(nd,symbol), - predicate: func(nd) !nd.get_switch('toggle_centered'), + predicate: func(nd) !nd.get_switch("toggle_centered"), is_true: func(nd) { nd.symbols.range.show(); nd.symbols.range.setText(sprintf("%3.0f",nd.rangeNm()/2)); @@ -1028,10 +1028,10 @@ canvas.NDStyles["Airbus"] = { }, }, { - id:'range_r', + id:"range_r", impl: { init: func(nd,symbol), - predicate: func(nd) !nd.get_switch('toggle_centered'), + predicate: func(nd) !nd.get_switch("toggle_centered"), is_true: func(nd) { nd.symbols.range_r.show(); nd.symbols.range_r.setText(sprintf("%3.0f",nd.rangeNm()/2)); @@ -1040,12 +1040,12 @@ canvas.NDStyles["Airbus"] = { }, }, { - id:'aplSymMap', + id:"aplSymMap", impl: { init: func(nd,symbol), - predicate: func(nd) (nd.get_switch('toggle_display_mode') == "MAP" and !nd.get_switch('toggle_centered')), + predicate: func(nd) (nd.get_switch("toggle_display_mode") == "MAP" and !nd.get_switch("toggle_centered")), is_true: func(nd) { - nd.symbols.aplSymMap.set('z-index', 10); + nd.symbols.aplSymMap.set("z-index", 10); nd.symbols.aplSymMap.show(); }, @@ -1053,12 +1053,12 @@ canvas.NDStyles["Airbus"] = { }, }, { - id:'aplSymMapCtr', + id:"aplSymMapCtr", impl: { init: func(nd,symbol), - predicate: func(nd) ((nd.get_switch('toggle_display_mode') == "MAP" and nd.get_switch('toggle_centered')) or nd.in_mode('toggle_display_mode', ['APP','VOR'])), + predicate: func(nd) ((nd.get_switch("toggle_display_mode") == "MAP" and nd.get_switch("toggle_centered")) or nd.in_mode("toggle_display_mode", ["APP","VOR"])), is_true: func(nd) { - nd.symbols.aplSymMapCtr.set('z-index', 10); + nd.symbols.aplSymMapCtr.set("z-index", 10); nd.symbols.aplSymMapCtr.show(); }, @@ -1066,7 +1066,7 @@ canvas.NDStyles["Airbus"] = { }, }, { - id:'aplSymVor', + id:"aplSymVor", impl: { init: func(nd,symbol), predicate: func(nd) {return 0;}, @@ -1078,23 +1078,23 @@ canvas.NDStyles["Airbus"] = { }, }, { - id:'crsLbl', + id:"crsLbl", impl: { init: func(nd,symbol), - predicate: func(nd) nd.in_mode('toggle_display_mode', ['APP','VOR']), + predicate: func(nd) nd.in_mode("toggle_display_mode", ["APP","VOR"]), is_true: func(nd) nd.symbols.crsLbl.show(), is_false: func(nd) nd.symbols.crsLbl.hide(), }, }, { - id:'crs', + id:"crs", impl: { init: func(nd,symbol), - predicate: func(nd) nd.in_mode('toggle_display_mode', ['APP','VOR']), + predicate: func(nd) nd.in_mode("toggle_display_mode", ["APP","VOR"]), is_true: func(nd) { nd.symbols.crs.show(); - var is_ils = (nd.get_switch('toggle_display_mode') == 'APP'); - var type = (is_ils ? 'ils' : 'vor'); + var is_ils = (nd.get_switch("toggle_display_mode") == "APP"); + var type = (is_ils ? "ils" : "vor"); var path = nd.get_nav_path(type, 0); var crs = getprop(path~ "radials/selected-deg"); if(crs != nil) @@ -1104,23 +1104,23 @@ canvas.NDStyles["Airbus"] = { }, }, { - id:'dmeLbl', + id:"dmeLbl", impl: { init: func(nd,symbol), - predicate: func(nd) nd.in_mode('toggle_display_mode', ['APP','VOR']), + predicate: func(nd) nd.in_mode("toggle_display_mode", ["APP","VOR"]), is_true: func(nd) nd.symbols.dmeLbl.show(), is_false: func(nd) nd.symbols.dmeLbl.hide(), }, }, { - id:'dme', + id:"dme", impl: { init: func(nd,symbol), - predicate: func(nd) nd.in_mode('toggle_display_mode', ['APP','VOR']), + predicate: func(nd) nd.in_mode("toggle_display_mode", ["APP","VOR"]), is_true: func(nd) { nd.symbols.dme.show(); - var is_ils = (nd.get_switch('toggle_display_mode') == 'APP'); - var type = (is_ils ? 'ils' : 'vor'); + var is_ils = (nd.get_switch("toggle_display_mode") == "APP"); + var type = (is_ils ? "ils" : "vor"); var path = nd.get_nav_path(type, 0); nd.symbols.dme.setText(getprop(path~ "nav-id")); if(is_ils) @@ -1132,15 +1132,15 @@ canvas.NDStyles["Airbus"] = { }, }, { - id:'trkline', + id:"trkline", impl: { init: func(nd,symbol), predicate: func(nd){ - nd.get_switch('toggle_display_mode') == 'MAP' and - !nd.get_switch('toggle_centered') and + nd.get_switch("toggle_display_mode") == "MAP" and + !nd.get_switch("toggle_centered") and ( getprop(nd.options.defaults.lat_ctrl) != nd.options.defaults.managed_val or - nd.get_switch('toggle_trk_line') + nd.get_switch("toggle_trk_line") ) }, is_true: func(nd) { @@ -1150,11 +1150,11 @@ canvas.NDStyles["Airbus"] = { }, }, { - id:'trkInd2', + id:"trkInd2", impl: { init: func(nd,symbol), - predicate: func(nd) (nd.in_mode('toggle_display_mode', ['APP','VOR','MAP']) and - nd.get_switch('toggle_centered')), + predicate: func(nd) (nd.in_mode("toggle_display_mode", ["APP","VOR","MAP"]) and + nd.get_switch("toggle_centered")), is_true: func(nd) { nd.symbols.trkInd2.show(); nd.symbols.trkInd2.setRotation((nd.aircraft_source.get_trk_mag()-nd.aircraft_source.get_hdg_mag())*D2R); @@ -1163,11 +1163,11 @@ canvas.NDStyles["Airbus"] = { }, }, { - id:'trkline2', + id:"trkline2", impl: { init: func(nd,symbol), - predicate: func(nd) (nd.get_switch('toggle_display_mode') == 'MAP' and - nd.get_switch('toggle_centered') and + predicate: func(nd) (nd.get_switch("toggle_display_mode") == "MAP" and + nd.get_switch("toggle_centered") and getprop(nd.options.defaults.lat_ctrl) != nd.options.defaults.managed_val), is_true: func(nd) { nd.symbols.trkline2.show(); @@ -1176,10 +1176,10 @@ canvas.NDStyles["Airbus"] = { }, }, { - id:'vorCrsPtr', + id:"vorCrsPtr", impl: { init: func(nd,symbol), - predicate: func(nd) (nd.in_mode('toggle_display_mode', ['APP','VOR']) and !nd.get_switch('toggle_centered')), + predicate: func(nd) (nd.in_mode("toggle_display_mode", ["APP","VOR"]) and !nd.get_switch("toggle_centered")), is_true: func(nd) { nd.symbols.vorCrsPtr.show(); if (is_ils) { @@ -1193,21 +1193,21 @@ canvas.NDStyles["Airbus"] = { }, }, { - id:'vorCrsPtr2', + id:"vorCrsPtr2", impl: { init: func(nd,symbol), - predicate: func(nd) (nd.in_mode('toggle_display_mode', ['APP','VOR']) and nd.get_switch('toggle_centered')), + predicate: func(nd) (nd.in_mode("toggle_display_mode", ["APP","VOR"]) and nd.get_switch("toggle_centered")), is_true: func(nd) { nd.symbols.vorCrsPtr2.show(); - var is_ils = (nd.get_switch('toggle_display_mode') == 'APP'); - var type = (is_ils ? 'ils' : 'vor'); + var is_ils = (nd.get_switch("toggle_display_mode") == "APP"); + var type = (is_ils ? "ils" : "vor"); var path = nd.get_nav_path(type, 0); if (is_ils) { nd.symbols.vorCrsPtr2.setRotation((getprop("/instrumentation/nav[0]/radials/selected-deg")-nd.aircraft_source.get_hdg_mag())*D2R); } else { nd.symbols.vorCrsPtr2.setRotation((getprop("/instrumentation/nav[2]/radials/selected-deg")-nd.aircraft_source.get_hdg_mag())*D2R); } - var line = nd.symbols.vorCrsPtr2.getElementById('vorCrsPtr2_line'); + var line = nd.symbols.vorCrsPtr2.getElementById("vorCrsPtr2_line"); if(!is_ils){ line.setColor(0,0.62,0.84); line.setColorFill(0,0.62,0.84); @@ -1220,10 +1220,10 @@ canvas.NDStyles["Airbus"] = { }, }, { - id: 'gsDiamond', + id: "gsDiamond", impl: { init: func(nd,symbol), - predicate: func(nd) nd.in_mode('toggle_display_mode', ['APP']), + predicate: func(nd) nd.in_mode("toggle_display_mode", ["APP"]), is_true: func(nd) { if(getprop("instrumentation/nav/gs-needle-deflection-norm") != nil) nd.symbols.gsDiamond.setTranslation(getprop("/instrumentation/nav[0]/gs-needle-deflection-norm")*150,0); @@ -1232,10 +1232,10 @@ canvas.NDStyles["Airbus"] = { }, }, { - id:'locPtr', + id:"locPtr", impl: { init: func(nd,symbol), - predicate: func(nd) (nd.in_mode('toggle_display_mode', ['APP','VOR']) and !nd.get_switch('toggle_centered') and getprop("instrumentation/nav/in-range")), + predicate: func(nd) (nd.in_mode("toggle_display_mode", ["APP","VOR"]) and !nd.get_switch("toggle_centered") and getprop("instrumentation/nav/in-range")), is_true: func(nd) { nd.symbols.locPtr.show(); var deflection = getprop("/instrumentation/nav[0]/heading-needle-deflection-norm"); @@ -1245,27 +1245,27 @@ canvas.NDStyles["Airbus"] = { }, }, { - id:'locPtr2', + id:"locPtr2", impl: { init: func(nd,symbol), predicate: func(nd) { - var curmode = nd.get_switch('toggle_display_mode'); - var is_ils = (curmode == 'APP'); - var type = (is_ils ? 'ils' : 'vor'); + var curmode = nd.get_switch("toggle_display_mode"); + var is_ils = (curmode == "APP"); + var type = (is_ils ? "ils" : "vor"); var path = nd.get_nav_path(type, 0); - return (nd.in_mode('toggle_display_mode', ['APP','VOR']) and nd.get_switch('toggle_centered') and getprop(path~ "in-range")); + return (nd.in_mode("toggle_display_mode", ["APP","VOR"]) and nd.get_switch("toggle_centered") and getprop(path~ "in-range")); }, is_true: func(nd) { - var curmode = nd.get_switch('toggle_display_mode'); - var is_ils = (curmode == 'APP'); - var type = (is_ils ? 'ils' : 'vor'); + var curmode = nd.get_switch("toggle_display_mode"); + var is_ils = (curmode == "APP"); + var type = (is_ils ? "ils" : "vor"); var path = nd.get_nav_path(type, 0); nd.symbols.locPtr2.show(); var deflection = getprop(path~ "heading-needle-deflection-norm"); nd.symbols.locPtr2.setTranslation(deflection*150,0); - var line = nd.symbols.locPtr2.getElementById('locPtr2_line'); - var arr1 = nd.symbols.locPtr2.getElementById('locPtr2_arr1'); - var arr2 = nd.symbols.locPtr2.getElementById('locPtr2_arr2'); + var line = nd.symbols.locPtr2.getElementById("locPtr2_line"); + var arr1 = nd.symbols.locPtr2.getElementById("locPtr2_arr1"); + var arr2 = nd.symbols.locPtr2.getElementById("locPtr2_arr2"); if(!is_ils){ #nd.symbols.vorCrsPtr2.setColor(0,0.62,0.84); line.setColor(0,0.62,0.84); @@ -1283,15 +1283,15 @@ canvas.NDStyles["Airbus"] = { }, }, { - id:'locTrkPointer', + id:"locTrkPointer", impl: { init: func(nd,symbol), predicate: func(nd) { var nav_id = getprop("/instrumentation/nav/nav-id"); - var ils_mode = getprop('/flight-management/freq/ils-mode'); - var has_ils = (nav_id != nil and nav_id != ''); - (nd.get_switch('toggle_display_mode') == 'MAP' and - !nd.get_switch('toggle_centered') and has_ils and ils_mode); + var ils_mode = getprop("/flight-management/freq/ils-mode"); + var has_ils = (nav_id != nil and nav_id != ""); + (nd.get_switch("toggle_display_mode") == "MAP" and + !nd.get_switch("toggle_centered") and has_ils and ils_mode); }, is_true: func(nd) { nd.symbols.locTrkPointer.show(); @@ -1303,15 +1303,15 @@ canvas.NDStyles["Airbus"] = { }, }, { - id:'locTrkPointer2', + id:"locTrkPointer2", impl: { init: func(nd,symbol), predicate: func(nd) { var nav_id = getprop("/instrumentation/nav/nav-id"); - var ils_mode = getprop('/flight-management/freq/ils-mode'); - var has_ils = (nav_id != nil and nav_id != ''); - (nd.get_switch('toggle_display_mode') == 'MAP' and - nd.get_switch('toggle_centered') and has_ils and ils_mode); + var ils_mode = getprop("/flight-management/freq/ils-mode"); + var has_ils = (nav_id != nil and nav_id != ""); + (nd.get_switch("toggle_display_mode") == "MAP" and + nd.get_switch("toggle_centered") and has_ils and ils_mode); }, is_true: func(nd) { nd.symbols.locTrkPointer2.show(); @@ -1323,13 +1323,13 @@ canvas.NDStyles["Airbus"] = { }, }, { - id:'wind', + id:"wind", impl: { init: func(nd,symbol), predicate: ALWAYS, is_true: func(nd) { var windDir = getprop("environment/wind-from-heading-deg"); - if(!nd.get_switch('toggle_true_north')) + if(!nd.get_switch("toggle_true_north")) windDir = windDir + getprop("environment/magnetic-variation-deg"); nd.symbols.wind.setText(sprintf("%03.0f / %02.0f",windDir,getprop("environment/wind-speed-kt"))); }, @@ -1337,20 +1337,20 @@ canvas.NDStyles["Airbus"] = { }, }, { - id:'windArrow', + id:"windArrow", impl: { init: func(nd,symbol), - predicate: func(nd) (!(nd.in_mode('toggle_display_mode', ['PLAN']) and (nd.get_switch('toggle_display_type') == "LCD"))), + predicate: func(nd) (!(nd.in_mode("toggle_display_mode", ["PLAN"]) and (nd.get_switch("toggle_display_type") == "LCD"))), is_true: func(nd) { nd.symbols.windArrow.show(); var windArrowRot = getprop("environment/wind-from-heading-deg"); - if(nd.in_mode('toggle_display_mode', ['MAP','PLAN'])) { - if(nd.get_switch('toggle_true_north')) + if(nd.in_mode("toggle_display_mode", ["MAP","PLAN"])) { + if(nd.get_switch("toggle_true_north")) windArrowRot = windArrowRot - nd.aircraft_source.get_trk_tru(); else windArrowRot = windArrowRot - nd.aircraft_source.get_trk_mag(); } else { - if(nd.get_switch('toggle_true_north')) + if(nd.get_switch("toggle_true_north")) windArrowRot = windArrowRot - nd.aircraft_source.get_hdg_tru(); else windArrowRot = windArrowRot - nd.aircraft_source.get_hdg_mag(); @@ -1361,15 +1361,15 @@ canvas.NDStyles["Airbus"] = { }, }, { - id:'staToL2', + id:"staToL2", impl: { init: func(nd,symbol), predicate: func(nd) { - var path = nd.get_nav_path('vor', 0); - return !(nd.in_mode('toggle_display_mode', ['PLAN'])) and nd.get_switch('toggle_centered') and ((getprop(path~ "in-range") and nd.get_switch('toggle_lh_vor_adf') == 1) or (getprop("instrumentation/adf/in-range") and nd.get_switch('toggle_lh_vor_adf') == -1)); + var path = nd.get_nav_path("vor", 0); + return !(nd.in_mode("toggle_display_mode", ["PLAN"])) and nd.get_switch("toggle_centered") and ((getprop(path~ "in-range") and nd.get_switch("toggle_lh_vor_adf") == 1) or (getprop("instrumentation/adf/in-range") and nd.get_switch("toggle_lh_vor_adf") == -1)); }, is_true: func(nd) { - if(nd.get_switch('toggle_lh_vor_adf') < 0){ + if(nd.get_switch("toggle_lh_vor_adf") < 0){ nd.symbols.staToL2.setColor(0.195,0.96,0.097); nd.symbols.staFromL2.setColor(0.195,0.96,0.097); } else { @@ -1386,15 +1386,15 @@ canvas.NDStyles["Airbus"] = { } }, { - id:'staToR2', + id:"staToR2", impl: { init: func(nd,symbol), predicate: func(nd) { - var path = nd.get_nav_path('vor', 1); - return !(nd.in_mode('toggle_display_mode', ['PLAN'])) and nd.get_switch('toggle_centered') and ((getprop(path~ "in-range") and nd.get_switch('toggle_rh_vor_adf') == 1) or (getprop("instrumentation/adf[1]/in-range") and nd.get_switch('toggle_rh_vor_adf') == -1)); + var path = nd.get_nav_path("vor", 1); + return !(nd.in_mode("toggle_display_mode", ["PLAN"])) and nd.get_switch("toggle_centered") and ((getprop(path~ "in-range") and nd.get_switch("toggle_rh_vor_adf") == 1) or (getprop("instrumentation/adf[1]/in-range") and nd.get_switch("toggle_rh_vor_adf") == -1)); }, is_true: func(nd) { - if(nd.get_switch('toggle_rh_vor_adf') < 0){ + if(nd.get_switch("toggle_rh_vor_adf") < 0){ nd.symbols.staToR2.setColor(0.195,0.96,0.097); nd.symbols.staFromR2.setColor(0.195,0.96,0.097); } else { @@ -1411,15 +1411,15 @@ canvas.NDStyles["Airbus"] = { } }, { - id:'staToL', + id:"staToL", impl: { init: func(nd,symbol), predicate: func(nd) { - var path = nd.get_nav_path('vor', 0); - return nd.in_mode('toggle_display_mode', ['MAP']) and !nd.get_switch('toggle_centered') and ((getprop(path~ "in-range") and nd.get_switch('toggle_lh_vor_adf') == 1) or (getprop("instrumentation/adf/in-range") and nd.get_switch('toggle_lh_vor_adf') == -1)); + var path = nd.get_nav_path("vor", 0); + return nd.in_mode("toggle_display_mode", ["MAP"]) and !nd.get_switch("toggle_centered") and ((getprop(path~ "in-range") and nd.get_switch("toggle_lh_vor_adf") == 1) or (getprop("instrumentation/adf/in-range") and nd.get_switch("toggle_lh_vor_adf") == -1)); }, is_true: func(nd) { - if(nd.get_switch('toggle_lh_vor_adf') < 0){ + if(nd.get_switch("toggle_lh_vor_adf") < 0){ nd.symbols.staToL.setColor(0.195,0.96,0.097); nd.symbols.staFromL.setColor(0.195,0.96,0.097); } else { @@ -1436,15 +1436,15 @@ canvas.NDStyles["Airbus"] = { } }, { - id:'staToR', + id:"staToR", impl: { init: func(nd,symbol), predicate: func(nd) { - var path = nd.get_nav_path('vor', 1); - return nd.in_mode('toggle_display_mode', ['MAP']) and !nd.get_switch('toggle_centered') and ((getprop(path~ "in-range") and nd.get_switch('toggle_rh_vor_adf') == 1) or (getprop("instrumentation/adf[1]/in-range") and nd.get_switch('toggle_rh_vor_adf') == -1)); + var path = nd.get_nav_path("vor", 1); + return nd.in_mode("toggle_display_mode", ["MAP"]) and !nd.get_switch("toggle_centered") and ((getprop(path~ "in-range") and nd.get_switch("toggle_rh_vor_adf") == 1) or (getprop("instrumentation/adf[1]/in-range") and nd.get_switch("toggle_rh_vor_adf") == -1)); }, is_true: func(nd) { - if(nd.get_switch('toggle_rh_vor_adf') < 0){ + if(nd.get_switch("toggle_rh_vor_adf") < 0){ nd.symbols.staToR.setColor(0.195,0.96,0.097); nd.symbols.staFromR.setColor(0.195,0.96,0.097); } else { @@ -1461,13 +1461,13 @@ canvas.NDStyles["Airbus"] = { } }, { - id:'dmeL', + id:"dmeL", impl: { init: func(nd,symbol), - predicate: func(nd) (nd.get_switch('toggle_lh_vor_adf') != 0), + predicate: func(nd) (nd.get_switch("toggle_lh_vor_adf") != 0), is_true: func(nd) { nd.symbols.dmeL.show(); - if(nd.get_switch('toggle_lh_vor_adf') < 0){ + if(nd.get_switch("toggle_lh_vor_adf") < 0){ nd.symbols.vorL.setText("ADF 1"); nd.symbols.vorL.setColor(0.195,0.96,0.097); nd.symbols.vorLId.setColor(0.195,0.96,0.097); @@ -1479,7 +1479,7 @@ canvas.NDStyles["Airbus"] = { nd.symbols.vorLId.setColor(1,1,1); nd.symbols.dmeLDist.setColor(1,1,1); } - nd.symbols.dmeL.setText('NM'); + nd.symbols.dmeL.setText("NM"); nd.symbols.dmeL.setColor(0,0.59,0.8); }, is_false: func(nd){ @@ -1488,13 +1488,13 @@ canvas.NDStyles["Airbus"] = { } }, { - id:'dmeR', + id:"dmeR", impl: { init: func(nd,symbol), - predicate: func(nd) (nd.get_switch('toggle_rh_vor_adf') != 0), + predicate: func(nd) (nd.get_switch("toggle_rh_vor_adf") != 0), is_true: func(nd) { nd.symbols.dmeR.show(); - if(nd.get_switch('toggle_rh_vor_adf') < 0){ + if(nd.get_switch("toggle_rh_vor_adf") < 0){ nd.symbols.vorR.setText("ADF 2"); nd.symbols.vorR.setColor(0.195,0.96,0.097); nd.symbols.vorRId.setColor(0.195,0.96,0.097); @@ -1505,7 +1505,7 @@ canvas.NDStyles["Airbus"] = { nd.symbols.vorRId.setColor(1,1,1); nd.symbols.dmeRDist.setColor(1,1,1); } - nd.symbols.dmeR.setText('NM'); + nd.symbols.dmeR.setText("NM"); nd.symbols.dmeR.setColor(0,0.59,0.8); }, is_false: func(nd){ @@ -1514,16 +1514,16 @@ canvas.NDStyles["Airbus"] = { } }, { - id: 'vorL', + id: "vorL", impl: { init: func(nd,symbol), - predicate: func(nd) (nd.get_switch('toggle_lh_vor_adf') != 0), + predicate: func(nd) (nd.get_switch("toggle_lh_vor_adf") != 0), is_true: func(nd) { nd.symbols.vorL.show(); nd.symbols.vorLId.show(); nd.symbols.dmeLDist.show(); - if(nd.get_switch('toggle_lh_vor_adf') < 0){ - var adf = 'instrumentation/adf/'; + if(nd.get_switch("toggle_lh_vor_adf") < 0){ + var adf = "instrumentation/adf/"; var navident = getprop(adf~ "ident"); var frq = getprop(adf~ "frequencies/selected-khz"); if(navident != "") @@ -1532,10 +1532,10 @@ canvas.NDStyles["Airbus"] = { nd.symbols.vorLId.setText(sprintf("%3d", frq)); nd.symbols.dmeLDist.setText(""); } else { - var nav = nd.get_nav_path('vor', 0); + var nav = nd.get_nav_path("vor", 0); var navID = getprop(nav~"nav-id"); var frq = getprop(nav~"frequencies/selected-mhz-fmt"); - var dme = nd.get_nav_path('dme', 0); + var dme = nd.get_nav_path("dme", 0); var dst = getprop(dme~ "indicated-distance-nm"); #print(dme~ "indicated-distance-nm"); if(getprop(nav~ "in-range")) @@ -1556,10 +1556,10 @@ canvas.NDStyles["Airbus"] = { } }, { - id:'vorLSym', + id:"vorLSym", impl: { init: func(nd,symbol), - predicate: func(nd) (nd.get_switch('toggle_lh_vor_adf') != 0), + predicate: func(nd) (nd.get_switch("toggle_lh_vor_adf") != 0), is_true: func(nd) { nd.symbols.vorLSym.show(); }, @@ -1569,10 +1569,10 @@ canvas.NDStyles["Airbus"] = { } }, { - id:'vorRSym', + id:"vorRSym", impl: { init: func(nd,symbol), - predicate: func(nd) (nd.get_switch('toggle_rh_vor_adf') != 0), + predicate: func(nd) (nd.get_switch("toggle_rh_vor_adf") != 0), is_true: func(nd) { nd.symbols.vorRSym.show(); }, @@ -1582,12 +1582,12 @@ canvas.NDStyles["Airbus"] = { } }, { - id:'appMode', + id:"appMode", impl: { init: func(nd,symbol), predicate: func(nd) { var mode = getprop(nd.options.defaults.app_mode); - return (mode != '' and mode != nil); + return (mode != "" and mode != nil); }, is_true: func(nd) { var mode = getprop(nd.options.defaults.app_mode); @@ -1600,21 +1600,21 @@ canvas.NDStyles["Airbus"] = { } }, { - id:'chrono_box', + id:"chrono_box", impl: { init: func(nd,symbol), - predicate: func(nd) nd.get_switch('toggle_chrono'), + predicate: func(nd) nd.get_switch("toggle_chrono"), is_true: func(nd) { var efis_node = props.globals.getNode(nd.efis_path); var idx = efis_node.getIndex() or 0; - var chronoNode = nd.options.defaults.chrono_node~'['~idx~']'; + var chronoNode = nd.options.defaults.chrono_node~"["~idx~"]"; chronoNode = props.globals.getNode(chronoNode); var time = nil; if(chronoNode != nil){ - time = chronoNode.getValue('text'); + time = chronoNode.getValue("text"); } nd.symbols.chrono_box.show(); - if(time != nil and time != '') + if(time != nil and time != "") nd.symbols.chrono_text.setText(time); }, is_false: func(nd){ @@ -1623,7 +1623,7 @@ canvas.NDStyles["Airbus"] = { } }, { - id:'chrono_text', + id:"chrono_text", impl: { init: func(nd,symbol), predicate: func(nd) 1, @@ -1632,10 +1632,10 @@ canvas.NDStyles["Airbus"] = { } }, { - id:'degreeArrows', + id:"degreeArrows", impl: { init: func(nd,symbol), - predicate: func(nd) (nd.get_switch('toggle_display_mode') != 'PLAN' and nd.get_switch('toggle_centered')), + predicate: func(nd) (nd.get_switch("toggle_display_mode") != "PLAN" and nd.get_switch("toggle_centered")), is_true: func(nd) { nd.symbols.degreeArrows.show(); }, @@ -1645,24 +1645,24 @@ canvas.NDStyles["Airbus"] = { } }, { - id: 'legDistL', + id: "legDistL", impl: { init: func(nd,symbol), - predicate: func(nd) (nd.get_switch('toggle_display_mode') == 'MAP' and !nd.get_switch('toggle_centered')), + predicate: func(nd) (nd.get_switch("toggle_display_mode") == "MAP" and !nd.get_switch("toggle_centered")), is_true: func(nd){ - var active = getprop('autopilot/route-manager/active'); + var active = getprop("autopilot/route-manager/active"); var lat_ctrl = getprop(nd.options.defaults.lat_ctrl); var managed_v = nd.options.defaults.managed_val; var is_managed = (lat_ctrl == managed_v); - var toggle_xtrk_err = nd.get_switch('toggle_xtrk_error'); + var toggle_xtrk_err = nd.get_switch("toggle_xtrk_error"); if((!active or is_managed) and !toggle_xtrk_err){ nd.symbols.legDistL.hide(); } else { - var dist = getprop('instrumentation/gps/wp/wp[1]/course-error-nm'); - if(dist == nil or dist == '' or dist > -0.1){ + var dist = getprop("instrumentation/gps/wp/wp[1]/course-error-nm"); + if(dist == nil or dist == "" or dist > -0.1){ nd.symbols.legDistL.hide(); } else { - dist = sprintf('%.1fL', math.abs(dist)); + dist = sprintf("%.1fL", math.abs(dist)); nd.symbols.legDistL.setText(dist); nd.symbols.legDistL.show(); } @@ -1674,24 +1674,24 @@ canvas.NDStyles["Airbus"] = { } }, { - id: 'legDistR', + id: "legDistR", impl: { init: func(nd,symbol), - predicate: func(nd) (nd.get_switch('toggle_display_mode') == 'MAP' and !nd.get_switch('toggle_centered')), + predicate: func(nd) (nd.get_switch("toggle_display_mode") == "MAP" and !nd.get_switch("toggle_centered")), is_true: func(nd){ - var active = getprop('autopilot/route-manager/active'); + var active = getprop("autopilot/route-manager/active"); var lat_ctrl = getprop(nd.options.defaults.lat_ctrl); var managed_v = nd.options.defaults.managed_val; var is_managed = (lat_ctrl == managed_v); - var toggle_xtrk_err = nd.get_switch('toggle_xtrk_error'); + var toggle_xtrk_err = nd.get_switch("toggle_xtrk_error"); if((!active or is_managed) and !toggle_xtrk_err){ nd.symbols.legDistR.hide(); } else { - var dist = getprop('instrumentation/gps/wp/wp[1]/course-error-nm'); - if(dist == nil or dist == '' or dist < 0.1){ + var dist = getprop("instrumentation/gps/wp/wp[1]/course-error-nm"); + if(dist == nil or dist == "" or dist < 0.1){ nd.symbols.legDistR.hide(); } else { - dist = sprintf('%.1fR', math.abs(dist)); + dist = sprintf("%.1fR", math.abs(dist)); nd.symbols.legDistR.setText(dist); nd.symbols.legDistR.show(); } @@ -1703,24 +1703,24 @@ canvas.NDStyles["Airbus"] = { } }, { - id: 'legDistCtrL', + id: "legDistCtrL", impl: { init: func(nd,symbol), - predicate: func(nd) (nd.get_switch('toggle_display_mode') == 'MAP' and nd.get_switch('toggle_centered')), + predicate: func(nd) (nd.get_switch("toggle_display_mode") == "MAP" and nd.get_switch("toggle_centered")), is_true: func(nd){ - var active = getprop('autopilot/route-manager/active'); + var active = getprop("autopilot/route-manager/active"); var lat_ctrl = getprop(nd.options.defaults.lat_ctrl); var managed_v = nd.options.defaults.managed_val; var is_managed = (lat_ctrl == managed_v); - var toggle_xtrk_err = nd.get_switch('toggle_xtrk_error'); + var toggle_xtrk_err = nd.get_switch("toggle_xtrk_error"); if((!active or is_managed) and !toggle_xtrk_err){ nd.symbols.legDistCtrL.hide(); } else { - var dist = getprop('instrumentation/gps/wp/wp[1]/course-error-nm'); - if(dist == nil or dist == '' or dist > -0.1){ + var dist = getprop("instrumentation/gps/wp/wp[1]/course-error-nm"); + if(dist == nil or dist == "" or dist > -0.1){ nd.symbols.legDistCtrL.hide(); } else { - dist = sprintf('%.1fL', math.abs(dist)); + dist = sprintf("%.1fL", math.abs(dist)); nd.symbols.legDistCtrL.setText(dist); nd.symbols.legDistCtrL.show(); } @@ -1732,24 +1732,24 @@ canvas.NDStyles["Airbus"] = { } }, { - id: 'legDistCtrR', + id: "legDistCtrR", impl: { init: func(nd,symbol), - predicate: func(nd) (nd.get_switch('toggle_display_mode') == 'MAP' and nd.get_switch('toggle_centered')), + predicate: func(nd) (nd.get_switch("toggle_display_mode") == "MAP" and nd.get_switch("toggle_centered")), is_true: func(nd){ - var active = getprop('autopilot/route-manager/active'); + var active = getprop("autopilot/route-manager/active"); var lat_ctrl = getprop(nd.options.defaults.lat_ctrl); var managed_v = nd.options.defaults.managed_val; var is_managed = (lat_ctrl == managed_v); - var toggle_xtrk_err = nd.get_switch('toggle_xtrk_error'); + var toggle_xtrk_err = nd.get_switch("toggle_xtrk_error"); if((!active or is_managed) and !toggle_xtrk_err){ nd.symbols.legDistCtrR.hide(); } else { - var dist = getprop('instrumentation/gps/wp/wp[1]/course-error-nm'); - if(dist == nil or dist == '' or dist < 0.1){ + var dist = getprop("instrumentation/gps/wp/wp[1]/course-error-nm"); + if(dist == nil or dist == "" or dist < 0.1){ nd.symbols.legDistCtrR.hide(); } else { - dist = sprintf('%.1fR', math.abs(dist)); + dist = sprintf("%.1fR", math.abs(dist)); nd.symbols.legDistCtrR.setText(dist); nd.symbols.legDistCtrR.show(); } @@ -1761,18 +1761,18 @@ canvas.NDStyles["Airbus"] = { } }, { - id: 'offsetLbl', + id: "offsetLbl", impl: { init: func(nd,symbol), - predicate: func(nd) (nd.in_mode('toggle_display_mode', ['MAP', 'PLAN'])), + predicate: func(nd) (nd.in_mode("toggle_display_mode", ["MAP", "PLAN"])), is_true: func(nd){ - var active = getprop('autopilot/route-manager/active'); + var active = getprop("autopilot/route-manager/active"); var lat_ctrl = getprop(nd.options.defaults.lat_ctrl); var managed_v = nd.options.defaults.managed_val; var is_managed = (lat_ctrl == managed_v); var offset = getprop(nd.options.defaults.fpln_offset); var has_offset = (offset != nil and - offset != '' and + offset != "" and offset != 0); if(!active or !is_managed or !has_offset){ nd.symbols.offsetLbl.hide(); diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 5de338b3..7e88a2e6 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -7,32 +7,11 @@ var PFD_1 = nil; var PFD_2 = nil; +var PFD_1_test = nil; +var PFD_2_test = nil; var PFD1_display = nil; var PFD2_display = nil; -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("/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/ir[0]/aligned", 0); -setprop("/instrumentation/adirs/ir[1]/aligned", 0); -setprop("/instrumentation/adirs/ir[2]/aligned", 0); +var elapsedtime = 0; var ASI = 0; var ASItrgt = 0; var ASItrgtdiff = 0; @@ -60,6 +39,34 @@ var wow2 = getprop("/gear/gear[2]/wow"); var pitch = 0; var roll = 0; var spdTrend_c = 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/du/du1-test", 0); +setprop("/instrumentation/du/du1-test-time", 0); +setprop("/instrumentation/du/du6-test", 0); +setprop("/instrumentation/du/du6-test-time", 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/ir[0]/aligned", 0); +setprop("/instrumentation/adirs/ir[1]/aligned", 0); +setprop("/instrumentation/adirs/ir[2]/aligned", 0); var canvas_PFD_base = { init: func(canvas_group, file) { @@ -67,7 +74,7 @@ var canvas_PFD_base = { return "LiberationFonts/LiberationSans-Regular.ttf"; }; - canvas.parsesvg(canvas_group, file, {'font-mapper': font_mapper}); + canvas.parsesvg(canvas_group, file, {"font-mapper": font_mapper}); var svg_keys = me.getKeys(); foreach(var key; svg_keys) { @@ -93,8 +100,6 @@ var canvas_PFD_base = { } } } - - me.page = canvas_group; me.AI_horizon_trans = me["AI_horizon"].createTransform(); me.AI_horizon_rot = me["AI_horizon"].createTransform(); @@ -107,6 +112,8 @@ var canvas_PFD_base = { me.AI_horizon_hdg_trans = me["AI_heading"].createTransform(); me.AI_horizon_hdg_rot = me["AI_heading"].createTransform(); + me.page = canvas_group; + return me; }, getKeys: func() { @@ -118,17 +125,54 @@ var canvas_PFD_base = { "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"]; }, update: func() { - if ((getprop("/systems/electrical/bus/ac1") >= 110 or getprop("/systems/electrical/bus/ac2") >= 110) and getprop("/controls/lighting/DU/du1") > 0) { - PFD_1.page.show(); - PFD_1.update(); + elapsedtime = getprop("/sim/time/elapsed-sec"); + if (getprop("/systems/electrical/bus/ac1") >= 110 or getprop("/systems/electrical/bus/ac2") >= 110) { + if (getprop("/instrumentation/du/du1-test") != 1) { + setprop("/instrumentation/du/du1-test", 1); + setprop("/instrumentation/du/du1-test-time", getprop("/sim/time/elapsed-sec")); + } } else { - PFD_1.page.hide(); + setprop("/instrumentation/du/du1-test", 0); + } + if (getprop("/systems/electrical/bus/ac1") >= 110 and getprop("/systems/electrical/bus/ac2") >= 110) { + if (getprop("/instrumentation/du/du6-test") != 1) { + setprop("/instrumentation/du/du6-test", 1); + setprop("/instrumentation/du/du6-test-time", getprop("/sim/time/elapsed-sec")); + } + } else { + setprop("/instrumentation/du/du6-test", 0); } - if (getprop("/systems/electrical/bus/ac1") >= 110 and getprop("/systems/electrical/ac1-src") != "RAT" and getprop("/systems/electrical/bus/ac2") >= 110 and getprop("/systems/electrical/ac2-src") != "RAT" and getprop("/controls/lighting/DU/du6") > 0) { - PFD_2.page.show(); - PFD_2.update(); + if ((getprop("/systems/electrical/bus/ac1") >= 110 or getprop("/systems/electrical/bus/ac2") >= 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) { + 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) { + PFD_1.page.hide(); + PFD_1_test.page.show(); + } else { + PFD_1_test.page.hide(); + PFD_1.page.show(); + PFD_1.update(); + } } else { + PFD_1_test.page.hide(); + PFD_1.page.hide(); + } + if (getprop("/systems/electrical/bus/ac1") >= 110 and getprop("/systems/electrical/ac1-src") != "RAT" and getprop("/systems/electrical/bus/ac2") >= 110 and getprop("/systems/electrical/ac2-src") != "RAT" and getprop("/controls/lighting/DU/du6") > 0) { + if (getprop("/instrumentation/du/du6-test-time") + 39.5 >= 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) { + PFD_2.page.hide(); + PFD_2_test.page.show(); + } else { + PFD_2_test.page.hide(); + PFD_2.page.show(); + PFD_2.update(); + } + } else { + PFD_2_test.page.hide(); PFD_2.page.hide(); } }, @@ -359,7 +403,7 @@ var canvas_PFD_base = { } # Airspeed - # Subtract 30, since the scale starts at 30, but don't allow less than 0, or more than 420 situations + # 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) { ASI = 0; } else if (getprop("/instrumentation/airspeed-indicator/indicated-speed-kt") >= 420) { @@ -844,6 +888,46 @@ var canvas_PFD_2 = { }, }; +var canvas_PFD_1_test = { + init: func(canvas_group, file) { + var font_mapper = func(family, weight) { + return "LiberationFonts/LiberationSans-Regular.ttf"; + }; + + canvas.parsesvg(canvas_group, file, {"font-mapper": font_mapper}); + + me.page = canvas_group; + + return me; + }, + new: func(canvas_group, file) { + var m = {parents: [canvas_PFD_1_test]}; + m.init(canvas_group, file); + + return m; + }, +}; + +var canvas_PFD_2_test = { + init: func(canvas_group, file) { + var font_mapper = func(family, weight) { + return "LiberationFonts/LiberationSans-Regular.ttf"; + }; + + canvas.parsesvg(canvas_group, file, {"font-mapper": font_mapper}); + + me.page = canvas_group; + + return me; + }, + new: func(canvas_group, file) { + var m = {parents: [canvas_PFD_2_test]}; + m.init(canvas_group, file); + + return m; + }, +}; + setprop("/testing", 0); # REMOVE WHEN PFD FINISHED setlistener("sim/signals/fdm-initialized", func { @@ -862,10 +946,14 @@ setlistener("sim/signals/fdm-initialized", func { PFD1_display.addPlacement({"node": "pfd1.screen"}); PFD2_display.addPlacement({"node": "pfd2.screen"}); var group_pfd1 = PFD1_display.createGroup(); + var group_pfd1_test = PFD1_display.createGroup(); var group_pfd2 = PFD2_display.createGroup(); + var group_pfd2_test = PFD2_display.createGroup(); PFD_1 = canvas_PFD_1.new(group_pfd1, "Aircraft/IDG-A32X/Models/Instruments/PFD/res/pfd.svg"); + PFD_1_test = canvas_PFD_1_test.new(group_pfd1_test, "Aircraft/IDG-A32X/Models/Instruments/Common/res/du-test.svg"); PFD_2 = canvas_PFD_2.new(group_pfd2, "Aircraft/IDG-A32X/Models/Instruments/PFD/res/pfd.svg"); + PFD_2_test = canvas_PFD_2_test.new(group_pfd2_test, "Aircraft/IDG-A32X/Models/Instruments/Common/res/du-test.svg"); PFD_update.start(); }); diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas index c9992f45..3ba2db4c 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas @@ -7,7 +7,9 @@ var upperECAM_cfm_eis2 = nil; 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); @@ -22,6 +24,8 @@ 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); var canvas_upperECAM_base = { init: func(canvas_group, file) { @@ -29,7 +33,7 @@ var canvas_upperECAM_base = { return "LiberationFonts/LiberationSans-Regular.ttf"; }; - canvas.parsesvg(canvas_group, file, {'font-mapper': font_mapper}); + canvas.parsesvg(canvas_group, file, {"font-mapper": font_mapper}); var svg_keys = me.getKeys(); foreach(var key; svg_keys) { @@ -44,17 +48,35 @@ var canvas_upperECAM_base = { return []; }, update: func() { - if (getprop("/systems/electrical/bus/ac1") >= 110 or getprop("/systems/electrical/bus/ac2") >= 110 and getprop("/controls/lighting/DU/du3") > 0) { - if (getprop("/options/eng") == "CFM") { - upperECAM_cfm_eis2.page.show(); - upperECAM_iae_eis2.page.hide(); - upperECAM_cfm_eis2.update(); - } else if (getprop("/options/eng") == "IAE") { - upperECAM_cfm_eis2.page.hide(); - upperECAM_iae_eis2.page.show(); - upperECAM_iae_eis2.update(); + elapsedtime = getprop("/sim/time/elapsed-sec"); + if (getprop("/systems/electrical/bus/ac1") >= 110 or getprop("/systems/electrical/bus/ac2") >= 110) { + if (getprop("/instrumentation/du/du3-test") != 1) { + setprop("/instrumentation/du/du3-test", 1); + setprop("/instrumentation/du/du3-test-time", getprop("/sim/time/elapsed-sec")); } } else { + setprop("/instrumentation/du/du3-test", 0); + } + + if (getprop("/systems/electrical/bus/ac1") >= 110 or getprop("/systems/electrical/bus/ac2") >= 110 and getprop("/controls/lighting/DU/du3") > 0) { + if (getprop("/instrumentation/du/du3-test-time") + 39 >= elapsedtime) { + upperECAM_cfm_eis2.page.hide(); + upperECAM_iae_eis2.page.hide(); + upperECAM_test.page.show(); + } else { + upperECAM_test.page.hide(); + if (getprop("/options/eng") == "CFM") { + upperECAM_cfm_eis2.page.show(); + upperECAM_iae_eis2.page.hide(); + upperECAM_cfm_eis2.update(); + } else if (getprop("/options/eng") == "IAE") { + upperECAM_cfm_eis2.page.hide(); + upperECAM_iae_eis2.page.show(); + upperECAM_iae_eis2.update(); + } + } + } else { + upperECAM_test.page.hide(); upperECAM_cfm_eis2.page.hide(); upperECAM_iae_eis2.page.hide(); } @@ -713,6 +735,26 @@ var canvas_upperECAM_iae_eis2 = { }, }; +var canvas_upperECAM_test = { + init: func(canvas_group, file) { + var font_mapper = func(family, weight) { + return "LiberationFonts/LiberationSans-Regular.ttf"; + }; + + canvas.parsesvg(canvas_group, file, {"font-mapper": font_mapper}); + + me.page = canvas_group; + + return me; + }, + new: func(canvas_group, file) { + var m = {parents: [canvas_upperECAM_test]}; + m.init(canvas_group, file); + + return m; + }, +}; + setlistener("sim/signals/fdm-initialized", func { upperECAM_display = canvas.new({ "name": "upperECAM", @@ -723,9 +765,11 @@ setlistener("sim/signals/fdm-initialized", func { upperECAM_display.addPlacement({"node": "uecam.screen"}); var group_cfm_eis2 = upperECAM_display.createGroup(); var group_iae_eis2 = upperECAM_display.createGroup(); + var group_test = upperECAM_display.createGroup(); upperECAM_cfm_eis2 = canvas_upperECAM_cfm_eis2.new(group_cfm_eis2, "Aircraft/IDG-A32X/Models/Instruments/Upper-ECAM/res/cfm-eis2.svg"); upperECAM_iae_eis2 = canvas_upperECAM_iae_eis2.new(group_iae_eis2, "Aircraft/IDG-A32X/Models/Instruments/Upper-ECAM/res/iae-eis2.svg"); + upperECAM_test = canvas_upperECAM_test.new(group_test, "Aircraft/IDG-A32X/Models/Instruments/Common/res/du-test.svg"); upperECAM_update.start(); }); diff --git a/revision.txt b/revision.txt index 4af051ca..4323a87a 100644 --- a/revision.txt +++ b/revision.txt @@ -1 +1 @@ -4020 \ No newline at end of file +4022 \ No newline at end of file