From 366c8e4d4c7583aeaa75ce55329df0a39282977f Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Tue, 19 Jan 2021 17:30:25 +0000 Subject: [PATCH] PFD: fix bug where it would desync RHS PFD --- Models/Instruments/PFD/PFD.nas | 5 +-- Nasal/Displays/DMC.nas | 13 +++--- Nasal/Libraries/libraries.nas | 21 ++++++++++ Systems/pfd.xml | 74 +++++++++++++++++++++++++++++++++- 4 files changed, 103 insertions(+), 10 deletions(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index e5ba1342..fca480d4 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -134,7 +134,6 @@ var adr_3_fault = props.globals.getNode("/controls/navigation/adirscp/lights/adr var air_data_switch = props.globals.getNode("/controls/navigation/switching/air-data", 1); # Create Nodes: -var alt_diff = props.globals.initNode("/instrumentation/pfd/alt-diff", 0.0, "DOUBLE"); var heading = props.globals.initNode("/instrumentation/pfd/heading-deg", 0.0, "DOUBLE"); var horizon_pitch = props.globals.initNode("/instrumentation/pfd/horizon-pitch", 0.0, "DOUBLE"); var horizon_ground = props.globals.initNode("/instrumentation/pfd/horizon-ground", 0.0, "DOUBLE"); @@ -1690,7 +1689,7 @@ var canvas_PFD_1 = { me["ALT_tens"].setTranslation(0, altTens * 1.392); ap_alt_cur = ap_alt.getValue(); - alt_diff_cur = alt_diff.getValue(); + alt_diff_cur = dmc.DMController.DMCs[0].outputs[7].getValue(); if (alt_diff_cur >= -565 and alt_diff_cur <= 565) { me["ALT_target"].setTranslation(0, (alt_diff_cur / 100) * -48.66856); me["ALT_target_digit"].setText(sprintf("%03d", math.round(ap_alt_cur / 100))); @@ -2461,7 +2460,7 @@ var canvas_PFD_2 = { me["ALT_tens"].setTranslation(0, altTens * 1.392); ap_alt_cur = ap_alt.getValue(); - alt_diff_cur = alt_diff.getValue(); + alt_diff_cur = dmc.DMController.DMCs[1].outputs[7].getValue(); if (alt_diff_cur >= -565 and alt_diff_cur <= 565) { me["ALT_target"].setTranslation(0, (alt_diff_cur / 100) * -48.66856); me["ALT_target_digit"].setText(sprintf("%03d", math.round(ap_alt_cur / 100))); diff --git a/Nasal/Displays/DMC.nas b/Nasal/Displays/DMC.nas index 6b555bf9..efe94e5b 100644 --- a/Nasal/Displays/DMC.nas +++ b/Nasal/Displays/DMC.nas @@ -13,11 +13,12 @@ var DMC = { d.airspeeds = [props.globals.getNode("/systems/navigation/adr/output/cas-1", 1), props.globals.getNode("/systems/navigation/adr/output/cas-2", 1), props.globals.getNode("/systems/navigation/adr/output/cas-3", 1)]; d.altitudes = [props.globals.getNode("/systems/navigation/adr/output/baro-alt-corrected-1-capt", 1), props.globals.getNode("/systems/navigation/adr/output/baro-alt-corrected-2-capt", 1), props.globals.getNode("/systems/navigation/adr/output/baro-alt-corrected-3-capt", 1)]; d.machs = [props.globals.getNode("/systems/navigation/adr/output/mach-1", 1), props.globals.getNode("/systems/navigation/adr/output/mach-2", 1), props.globals.getNode("/systems/navigation/adr/output/mach-3", 1)]; - d.altitudesPfd = [props.globals.getNode("instrumentation/altimeter[0]/indicated-altitude-ft-pfd", 1), props.globals.getNode("instrumentation/altimeter[1]/indicated-altitude-ft-pfd", 1), props.globals.getNode("instrumentation/altimeter[2]/indicated-altitude-ft-pfd", 1)]; + d.altitudesPfd = [props.globals.getNode("/instrumentation/altimeter[0]/indicated-altitude-ft-pfd", 1), props.globals.getNode("/instrumentation/altimeter[1]/indicated-altitude-ft-pfd", 1), props.globals.getNode("/instrumentation/altimeter[2]/indicated-altitude-ft-pfd", 1)]; d.sats = [props.globals.getNode("/systems/navigation/adr/output/sat-1", 1), props.globals.getNode("/systems/navigation/adr/output/sat-2", 1), props.globals.getNode("/systems/navigation/adr/output/sat-3", 1)]; d.tats = [props.globals.getNode("/systems/navigation/adr/output/tat-1", 1), props.globals.getNode("/systems/navigation/adr/output/tat-2", 1), props.globals.getNode("/systems/navigation/adr/output/tat-3", 1)]; - d.trends = [props.globals.getNode("instrumentation/pfd/speed-lookahead-1", 1), props.globals.getNode("instrumentation/pfd/speed-lookahead-2", 1), props.globals.getNode("instrumentation/pfd/speed-lookahead-3", 1)]; - d.outputs = [nil, nil, nil, nil, nil, nil, nil]; # airspeed, altitude, mach, pfd altitude, sat, tat, speed trend + d.trends = [props.globals.getNode("/instrumentation/pfd/speed-lookahead-1", 1), props.globals.getNode("/instrumentation/pfd/speed-lookahead-2", 1), props.globals.getNode("/instrumentation/pfd/speed-lookahead-3", 1)]; + d.altitudeDiffs = [props.globals.getNode("//instrumentation/pfd/alt-diff[0]", 1), props.globals.getNode("//instrumentation/pfd/alt-diff[1]", 1), props.globals.getNode("//instrumentation/pfd/alt-diff[2]", 1)]; + d.outputs = [nil, nil, nil, nil, nil, nil, nil, nil]; # airspeed, altitude, mach, pfd altitude, sat, tat, speed trend, altitudeDiffs return d; }, changeActiveADIRS: func(newADIRS) { @@ -32,6 +33,7 @@ var DMC = { me.outputs[4] = me.sats[ADIRS]; me.outputs[5] = me.tats[ADIRS]; me.outputs[6] = me.trends[ADIRS]; + me.outputs[7] = me.altitudeDiffs[ADIRS]; }, setOutputsNil: func() { me.outputs[0] = nil; @@ -41,6 +43,7 @@ var DMC = { me.outputs[4] = nil; me.outputs[5] = nil; me.outputs[6] = nil; + me.outputs[7] = nil; }, update: func() { if (systems.ADIRS.ADIRunits[me.activeADIRS].operative and systems.ADIRS.ADIRunits[me.activeADIRS].outputOn) { @@ -71,8 +74,8 @@ var DMController = { # update DMC2 to correct properties for first officer PFD me.DMCs[1].altitudes = [props.globals.getNode("/systems/navigation/adr/output/baro-alt-corrected-1-fo", 1), props.globals.getNode("/systems/navigation/adr/output/baro-alt-corrected-2-fo", 1), props.globals.getNode("/systems/navigation/adr/output/baro-alt-corrected-3-fo", 1)]; - me.DMCs[1].altitudesPfd = [props.globals.getNode("instrumentation/altimeter[3]/indicated-altitude-ft-pfd", 1), props.globals.getNode("instrumentation/altimeter[4]/indicated-altitude-ft-pfd", 1), props.globals.getNode("instrumentation/altimeter[5]/indicated-altitude-ft-pfd", 1)]; - + me.DMCs[1].altitudesPfd = [props.globals.getNode("/instrumentation/altimeter[3]/indicated-altitude-ft-pfd", 1), props.globals.getNode("/instrumentation/altimeter[4]/indicated-altitude-ft-pfd", 1), props.globals.getNode("/instrumentation/altimeter[5]/indicated-altitude-ft-pfd", 1)]; + me.DMCs[1].altitudeDiffs = [props.globals.getNode("//instrumentation/pfd/alt-diff[3]", 1), props.globals.getNode("//instrumentation/pfd/alt-diff[4]", 1), props.globals.getNode("//instrumentation/pfd/alt-diff[5]", 1)]; me._init = 1; } }, diff --git a/Nasal/Libraries/libraries.nas b/Nasal/Libraries/libraries.nas index ac09a897..338cf8f7 100644 --- a/Nasal/Libraries/libraries.nas +++ b/Nasal/Libraries/libraries.nas @@ -378,4 +378,25 @@ foreach (var name; keys(input)) { emesary.GlobalTransmitter.NotifyAll(notifications.FrameNotificationAddProperty.new("A320 Libraries", name, input[name])); } +# TODO split EFIS altimeters +var newinhg = nil; +setlistener("/instrumentation/altimeter/setting-inhg", func() { + newinhg = getprop("/instrumentation/altimeter/setting-inhg"); + setprop("/instrumentation/altimeter[1]/setting-inhg", newinhg); + setprop("/instrumentation/altimeter[2]/setting-inhg", newinhg); + setprop("/instrumentation/altimeter[3]/setting-inhg", newinhg); + setprop("/instrumentation/altimeter[4]/setting-inhg", newinhg); + setprop("/instrumentation/altimeter[5]/setting-inhg", newinhg); +}, 0, 0); + +var newhpa = nil; +setlistener("/instrumentation/altimeter/setting-hpa", func() { + newhpa = getprop("/instrumentation/altimeter/setting-hpa"); + setprop("/instrumentation/altimeter[1]/setting-hpa", newhpa); + setprop("/instrumentation/altimeter[2]/setting-hpa", newhpa); + setprop("/instrumentation/altimeter[3]/setting-hpa", newhpa); + setprop("/instrumentation/altimeter[4]/setting-hpa", newhpa); + setprop("/instrumentation/altimeter[5]/setting-hpa", newhpa); +}, 0, 0); + setprop("/systems/acconfig/libraries-loaded", 1); diff --git a/Systems/pfd.xml b/Systems/pfd.xml index c3749535..733054dc 100644 --- a/Systems/pfd.xml +++ b/Systems/pfd.xml @@ -136,9 +136,79 @@ /it-autoflight/internal/alt - /instrumentation/altimeter/indicated-altitude-ft + /instrumentation/altimeter[0]/indicated-altitude-ft - /instrumentation/pfd/alt-diff + /instrumentation/pfd/alt-diff[0] + + + + Altitude bug diff + gain + 0.05 + 1.0 + + /it-autoflight/internal/alt + + + /instrumentation/altimeter[1]/indicated-altitude-ft + + /instrumentation/pfd/alt-diff[1] + + + + Altitude bug diff + gain + 0.05 + 1.0 + + /it-autoflight/internal/alt + + + /instrumentation/altimeter[2]/indicated-altitude-ft + + /instrumentation/pfd/alt-diff[2] + + + + Altitude bug diff + gain + 0.05 + 1.0 + + /it-autoflight/internal/alt + + + /instrumentation/altimeter[3]/indicated-altitude-ft + + /instrumentation/pfd/alt-diff[3] + + + + Altitude bug diff + gain + 0.05 + 1.0 + + /it-autoflight/internal/alt + + + /instrumentation/altimeter[4]/indicated-altitude-ft + + /instrumentation/pfd/alt-diff[4] + + + + Altitude bug diff + gain + 0.05 + 1.0 + + /it-autoflight/internal/alt + + + /instrumentation/altimeter[5]/indicated-altitude-ft + + /instrumentation/pfd/alt-diff[5]