From c845cda5af3be8d76bce45bdd6af0137df993fe6 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Sat, 30 Apr 2022 13:17:25 +0100 Subject: [PATCH] Fix confusion between IESI and PFD nodes --- Models/Instruments/IESI/IESI.nas | 34 ++++++++++++++++++-------------- Models/Instruments/PFD/PFD.nas | 12 +++++------ 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/Models/Instruments/IESI/IESI.nas b/Models/Instruments/IESI/IESI.nas index 67ca58c6..51dc6810 100644 --- a/Models/Instruments/IESI/IESI.nas +++ b/Models/Instruments/IESI/IESI.nas @@ -70,12 +70,22 @@ var canvas_IESI = { obj["ATTflag"].hide(); obj.update_items = [ - props.UpdateManager.FromHashValue("airspeed", 0.1, func(val) { + props.UpdateManager.FromHashValue("airspeedIESI", 0.1, func(val) { obj["ASI_scale"].setTranslation(0, math.clamp(val - 30, 0, 490) * 8.295); }), - props.UpdateManager.FromHashValue("altitude", 0.5, func(val) { + props.UpdateManager.FromHashValue("altitudeIESI", 0.5, func(val) { val = math.clamp(val, -2000, 50000); + obj["ALT_meters"].setText(sprintf("%5.0f", math.round(val * 0.3048, 10))); + + obj.middleAltText = roundaboutAlt(val / 100); + + obj["ALT_five"].setText(sprintf("%03d", abs(obj.middleAltText + 10))); + obj["ALT_four"].setText(sprintf("%03d", abs(obj.middleAltText + 5))); + obj["ALT_three"].setText(sprintf("%03d", abs(obj.middleAltText))); + obj["ALT_two"].setText(sprintf("%03d", abs(obj.middleAltText - 5))); + obj["ALT_one"].setText(sprintf("%03d", abs(obj.middleAltText - 10))); + if (val < 0) { obj["negText"].show(); obj._isNegativeAlt = 1; @@ -83,9 +93,11 @@ var canvas_IESI = { obj["negText"].hide(); obj._isNegativeAlt = 0; } + }), + props.UpdateManager.FromHashValue("altitudeIESI", 0.1, func(val) { + val = math.clamp(val, -2000, 50000); obj.altOffset = (val / 500) - int(val / 500); - obj.middleAltText = roundaboutAlt(val / 100); if (obj.altOffset > 0.5) { obj._middleAltOffset = -(obj.altOffset - 1) * 258.5528; @@ -96,17 +108,9 @@ var canvas_IESI = { obj["ALT_scale"].setTranslation(0, -obj._middleAltOffset); obj["ALT_scale"].update(); - obj["ALT_five"].setText(sprintf("%03d", abs(obj.middleAltText + 10))); - obj["ALT_four"].setText(sprintf("%03d", abs(obj.middleAltText + 5))); - obj["ALT_three"].setText(sprintf("%03d", abs(obj.middleAltText))); - obj["ALT_two"].setText(sprintf("%03d", abs(obj.middleAltText - 5))); - obj["ALT_one"].setText(sprintf("%03d", abs(obj.middleAltText - 10))); - - obj["ALT_meters"].setText(sprintf("%5.0f", math.round(val * 0.3048, 10))); - obj["ALT_tens"].setTranslation(0, num(right(sprintf("%02d", val), 2)) * 3.16); }), - props.UpdateManager.FromHashValue("altitude_ind", 0.5, func(val) { + props.UpdateManager.FromHashValue("altitude_indIESI", 0.5, func(val) { obj["ALT_digits"].setText(sprintf("%s", math.clamp(val, -20, 500))); }), props.UpdateManager.FromHashValue("showMach", 1, func(val) { @@ -359,9 +363,9 @@ emesary.GlobalTransmitter.Register(A320IESI); # Emesary Frame Notifiaction Properties var input = { "acconfig": "/systems/acconfig/autoconfig-running", - "airspeed": "/instrumentation/airspeed-indicator[0]/indicated-speed-kt", - "altitude": "/instrumentation/altimeter[6]/indicated-altitude-ft", - "altitude_ind": "/instrumentation/altimeter[6]/indicated-altitude-ft-pfd", + "airspeedIESI": "/instrumentation/airspeed-indicator[0]/indicated-speed-kt", + "altitudeIESI": "/instrumentation/altimeter[6]/indicated-altitude-ft", + "altitude_indIESI": "/instrumentation/altimeter[6]/indicated-altitude-ft-pfd", "altimeter_mode_iesi": "/instrumentation/altimeter[6]/std", "attReset": "/instrumentation/iesi/att-reset", "iesiBrt": "/controls/lighting/DU/iesi", diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 053d7b99..f9b22f31 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -1221,7 +1221,7 @@ var canvas_pfd = { obj["Metric_cur_alt"].hide(); } }), - props.UpdateManager.FromHashValue("altitude", 0.5, func(val) { + props.UpdateManager.FromHashValue("altitudePFD", 0.5, func(val) { obj["Metric_cur_alt"].setText(sprintf("%5.0f", val * 0.3048)); obj.middleAltText = roundaboutAlt(val / 100); @@ -1238,7 +1238,7 @@ var canvas_pfd = { obj["ALT_neg"].hide(); } }), - props.UpdateManager.FromHashValue("altitude", 0.1, func(val) { + props.UpdateManager.FromHashValue("altitudePFD", 0.1, func(val) { obj.altOffset = val / 500 - int(val / 500); obj.middleAltOffset = nil; @@ -1685,7 +1685,7 @@ var canvas_pfd = { if (dmc.DMController.DMCs[me.number].outputs[1] != nil) { notification.altError = 0; - notification.altitude = dmc.DMController.DMCs[me.number].outputs[1].getValue(); + notification.altitudePFD = dmc.DMController.DMCs[me.number].outputs[1].getValue(); notification.altitudeDigits = dmc.DMController.DMCs[me.number].outputs[3].getValue(); notification.altitudeDifference = dmc.DMController.DMCs[me.number].outputs[7].getValue(); @@ -1769,7 +1769,7 @@ var canvas_pfd = { } } else { notification.altError = 1; - notification.altitude = -9999; + notification.altitudePFD = -9999; notification.altitudeDigits = -9999; notification.altitudeDifference = -9999; } @@ -1814,7 +1814,7 @@ var canvas_pfd = { } if (notification.altimeterStd == 1) { - if (notification.altitude < fmgc.FMGCInternal.transAlt and fmgc.FMGCInternal.phase == 4) { + if (notification.altitudePFD < fmgc.FMGCInternal.transAlt and fmgc.FMGCInternal.phase == 4) { if (me.number == 0) { if (qnh_going1 == 0) { qnhTimer1.start(); @@ -1848,7 +1848,7 @@ var canvas_pfd = { me["QNH_box"].show(); } } else { - if (notification.altitude >= fmgc.FMGCInternal.transAlt and fmgc.FMGCInternal.phase == 2) { + if (notification.altitudePFD >= fmgc.FMGCInternal.transAlt and fmgc.FMGCInternal.phase == 2) { if (me.number == 0) { if (qnh_going1 == 0) { qnhTimer1.start();