From 692b6dca2bae9eeb4ad0dd6e679f9250306bf7ae Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Sun, 20 Mar 2022 17:27:11 +0000 Subject: [PATCH 01/33] PFD: revise some code for efficiency --- Models/Instruments/PFD/PFD.nas | 158 ++++++++++++++++++++------------- 1 file changed, 94 insertions(+), 64 deletions(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index be3efb55..d661662b 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -191,19 +191,31 @@ var canvas_pfd = { obj["LOC_scale"].hide(); obj["GS_scale"].hide(); + obj.temporaryNodes = { + showGroundReferenceAGL: 0, + showTailstrikeAGL: 0, + showTailstrikeGroundspeed: 0, + showTailstrikeThrust: 0, + }; + + obj.AICenter = obj["AI_center"].getCenter(); + obj.update_items = [ - props.UpdateManager.FromHashValue("pitchPFD", nil, func(val) { + props.UpdateManager.FromHashValue("pitchPFD", 0.05, func(val) { obj.AI_horizon_trans.setTranslation(0, val * 11.825); }), - props.UpdateManager.FromHashValue("roll", nil, func(val) { - obj.AI_horizon_rot.setRotation(-val * D2R, obj["AI_center"].getCenter()); - obj.AI_horizon_ground_rot.setRotation(-val * D2R, obj["AI_center"].getCenter()); - obj.AI_horizon_sky_rot.setRotation(-val * D2R, obj["AI_center"].getCenter()); + props.UpdateManager.FromHashValue("roll", 0.1, func(val) { + obj.AI_horizon_rot.setRotation(-val * D2R, obj.AICenter); + obj.AI_horizon_ground_rot.setRotation(-val * D2R, obj.AICenter); + obj.AI_horizon_sky_rot.setRotation(-val * D2R, obj.AICenter); + obj.AI_horizon_hdg_rot.setRotation(-val * D2R, obj.AICenter); obj["AI_bank"].setRotation(-val * D2R); obj["AI_agl_g"].setRotation(-val * D2R); - obj.AI_horizon_hdg_rot.setRotation(-val * D2R, obj["AI_center"].getCenter()); }), - props.UpdateManager.FromHashValue("fbwLaw", nil, func(val) { + props.UpdateManager.FromHashValue("roll", nil, func(val) { + obj.AI_horizon_hdg_rot.setRotation(-val * D2R, obj.AICenter); + }), + props.UpdateManager.FromHashValue("fbwLaw", 1, func(val) { if (val == 0) { obj["AI_bank_lim"].show(); obj["AI_pitch_lim"].show(); @@ -216,22 +228,22 @@ var canvas_pfd = { obj["AI_pitch_lim_X"].show(); } }), - props.UpdateManager.FromHashValue("horizonGround", nil, func(val) { + props.UpdateManager.FromHashValue("horizonGround", 0.1, func(val) { obj.AI_horizon_ground_trans.setTranslation(0, val * 11.825); }), - props.UpdateManager.FromHashValue("horizonPitch", nil, func(val) { + props.UpdateManager.FromHashValue("horizonPitch", 0.1, func(val) { obj.AI_horizon_hdg_trans.setTranslation(obj.middleOffset, val * 11.825); }), - props.UpdateManager.FromHashValue("slipSkid", nil, func(val) { + props.UpdateManager.FromHashValue("slipSkid", 0.1, func(val) { obj["AI_slipskid"].setTranslation(math.clamp(val, -15, 15) * 7, 0); }), - props.UpdateManager.FromHashValue("FDRollBar", nil, func(val) { + props.UpdateManager.FromHashValue("FDRollBar", 0.2, func(val) { obj["FD_roll"].setTranslation(val * 2.2, 0); }), - props.UpdateManager.FromHashValue("FDPitchBar", nil, func(val) { + props.UpdateManager.FromHashValue("FDPitchBar", 0.2, func(val) { obj["FD_pitch"].setTranslation(0, val * -3.8); }), - props.UpdateManager.FromHashValue("agl", nil, func(val) { + props.UpdateManager.FromHashValue("agl", 0.5, func(val) { if (val >= 50) { obj["AI_agl"].setText(sprintf("%s", math.round(math.clamp(val, 0, 2500),10))); } else if (val >= 5) { @@ -240,29 +252,38 @@ var canvas_pfd = { obj["AI_agl"].setText(sprintf("%s", math.round(math.clamp(val, 0, 2500)))); } obj["ground_ref"].setTranslation(0, (-val / 100) * -48.66856); - }), - props.UpdateManager.FromHashList(["agl","gear1Wow", "gear2Wow","fmgcPhase"], nil, func(val) { - if (-val.agl >= -565 and -val.agl <= 565) { - if ((val.fmgcPhase == 5 or val.fmgcPhase == 6) and !val.gear1Wow and !val.gear2Wow) { # TODO: add std too - obj["ground"].setTranslation(0, (-val.agl / 100) * -48.66856); - obj["ground"].show(); - } else { - obj["ground"].hide(); - } + obj["ground"].setTranslation(0, (-val / 100) * -48.66856); + + if (abs(val) <= 565) { + obj.temporaryNodes.showGroundReferenceAGL = 1; } else { - obj["ground"].hide(); + obj.temporaryNodes.showGroundReferenceAGL = 0; + } + + if (val <= 400) { + obj.temporaryNodes.showTailstrikeAGL = 1; + } else { + obj.temporaryNodes.showTailstrikeAGL = 0; } }), - props.UpdateManager.FromHashValue("vsNeedle", nil, func(val) { + props.UpdateManager.FromHashValue("vsNeedle", 0.1, func(val) { obj["VS_pointer"].setRotation(val * D2R); }), - props.UpdateManager.FromHashValue("vsDigit", nil, func(val) { + props.UpdateManager.FromHashValue("vsDigit", 0.5, func(val) { obj["VS_box"].setTranslation(0, val); }), - props.UpdateManager.FromHashValue("localizer", nil, func(val) { + props.UpdateManager.FromHashValue("vsPFD", 0.5, func(val) { + if (val < 2) { + obj["VS_box"].hide(); + } else { + obj["VS_digit"].setText(sprintf("%02d", val)); + obj["VS_box"].show(); + } + }), + props.UpdateManager.FromHashValue("localizer", 0.01, func(val) { obj["LOC_pointer"].setTranslation(val * 197, 0); }), - props.UpdateManager.FromHashValue("glideslope", nil, func(val) { + props.UpdateManager.FromHashValue("glideslope", 0.01, func(val) { obj["GS_pointer"].setTranslation(0, val * -197); }), props.UpdateManager.FromHashList(["athr", "thrustLvrClb"], nil, func(val) { @@ -272,24 +293,11 @@ var canvas_pfd = { obj["FMA_lvrclb"].hide(); } }), - props.UpdateManager.FromHashList(["trackPFD","headingPFD"], nil, func(val) { - obj.track_diff = geo.normdeg180(val.trackPFD - val.headingPFD); + props.UpdateManager.FromHashList(["trackPFD","headingPFD"], 0.1, func(val) { + obj.track_diff = geo.normdeg180(val.trackPFD - val.headingPFD); # store this to use in FPV obj["TRK_pointer"].setTranslation(obj.getTrackDiffPixels(obj.track_diff),0); }), - props.UpdateManager.FromHashValue("vsPFD", nil, func(val) { - if (val < 2) { - obj["VS_box"].hide(); - } else { - obj["VS_box"].show(); - } - - if (val < 10) { - obj["VS_digit"].setText(sprintf("%02d", "0" ~ val)); - } else { - obj["VS_digit"].setText(sprintf("%02d", val)); - } - }), - props.UpdateManager.FromHashList(["vsAutopilot","agl"], nil, func(val) { + props.UpdateManager.FromHashList(["vsAutopilot","agl"], 5, func(val) { if (abs(val.vsAutopilot) >= 6000 or (val.vsAutopilot <= -2000 and val.agl <= 2500) or (val.vsAutopilot <= -1200 and val.agl <= 1000)) { obj["VS_digit"].setColor(0.7333,0.3803,0); obj["VS_pointer"].setColor(0.7333,0.3803,0); @@ -300,10 +308,10 @@ var canvas_pfd = { obj["VS_pointer"].setColorFill(0.0509,0.7529,0.2941); } }), - props.UpdateManager.FromHashList(["aileronPFD","elevatorPFD"], nil, func(val) { + props.UpdateManager.FromHashList(["aileronPFD","elevatorPFD"], 0.01, func(val) { obj["AI_stick_pos"].setTranslation(val.aileronPFD * 196.8, val.elevatorPFD * 151.5); }), - props.UpdateManager.FromHashValue("headingScale", nil, func(val) { + props.UpdateManager.FromHashValue("headingScale", 0.025, func(val) { obj.heading = val; obj.heading10 = (obj.heading / 10); obj.headOffset = obj.heading10 - int(obj.heading10); @@ -368,7 +376,7 @@ var canvas_pfd = { } }), props.UpdateManager.FromHashList(["apBox","apMode"], nil, func(val) { - obj["FMA_ap"].setText(sprintf("%s", val.apMode)); + obj["FMA_athr"].setText(val.apMode); if (val.apBox and val.apMode != " ") { obj["FMA_ap_box"].show(); } else { @@ -376,7 +384,7 @@ var canvas_pfd = { } }), props.UpdateManager.FromHashList(["atBox","atMode"], nil, func(val) { - obj["FMA_athr"].setText(sprintf("%s", val.atMode)); + obj["FMA_athr"].setText(val.atMode); if (val.atBox and val.atMode != " ") { obj["FMA_athr_box"].show(); } else { @@ -384,27 +392,26 @@ var canvas_pfd = { } }), props.UpdateManager.FromHashValue("rollMode", nil, func(val) { - obj["FMA_roll"].setText(sprintf("%s", val)); + obj["FMA_roll"].setText(val); }), props.UpdateManager.FromHashValue("rollModeArmed", nil, func(val) { - obj["FMA_rollarm"].setText(sprintf("%s", val)); + obj["FMA_rollarm"].setText(val); }), props.UpdateManager.FromHashList(["pitchMode","pitchModeBox","autopilotVS","autopilotFPA","pitchMode2Armed","pitchModeArmed","pitchMode2ArmedBox","pitchModeArmedBox","rollMode","rollModeBox","rollModeArmed","rollModeArmedBox","ap1","ap2","fd1","fd2"], nil, func(val) { - obj["FMA_combined"].setText(sprintf("%s", val.pitchMode)); + obj["FMA_combined"].setText(val.pitchMode); if (val.pitchMode == "V/S") { - obj["FMA_pitch"].setText(sprintf("%s ", val.pitchMode)); + obj["FMA_pitch"].setText("V/S "); obj["vsFMArate"].setText(sprintf("%+4.0f",val.autopilotVS)); obj["vsFMArate"].show(); } elsif (val.pitchMode == "FPA") { - obj["FMA_pitch"].setText(sprintf("%s ", val.pitchMode)); + obj["FMA_pitch"].setText("FPA "); obj["vsFMArate"].setText(sprintf("%+3.1f°",val.autopilotFPA)); obj["vsFMArate"].show(); } else { - obj["FMA_pitch"].setText(sprintf("%s", val.pitchMode)); + obj["FMA_pitch"].setText(val.pitchMode); obj["vsFMArate"].hide(); } - if (val.pitchMode == "LAND" or val.pitchMode == "FLARE" or val.pitchMode == "ROLL OUT") { obj["FMA_pitch"].hide(); obj["FMA_roll"].hide(); @@ -455,13 +462,13 @@ var canvas_pfd = { } }), props.UpdateManager.FromHashValue("pitchModeArmed", nil, func(val) { - obj["FMA_pitcharm"].setText(sprintf("%s", val)); + obj["FMA_pitcharm"].setText(val); }), props.UpdateManager.FromHashValue("pitchMode2Armed", nil, func(val) { - obj["FMA_pitcharm2"].setText(sprintf("%s", val)); + obj["FMA_pitcharm2"].setText(val); }), props.UpdateManager.FromHashList(["fdBox","fdMode"], nil, func(val) { - obj["FMA_fd"].setText(sprintf("%s", val.fdMode)); + obj["FMA_fd"].setText(val.fdMode); if (val.fdBox and val.fdMode != " ") { obj["FMA_fd_box"].show(); } else { @@ -680,14 +687,21 @@ var canvas_pfd = { obj["FMA_thrust_box"].setColor(0.8078,0.8039,0.8078); } }), - props.UpdateManager.FromHashValue("flexTemp", nil, func(val) { + props.UpdateManager.FromHashValue("flexTemp", 1, func(val) { obj["FMA_flxtemp"].setText(sprintf("%s", "+" ~ val)); }), - props.UpdateManager.FromHashList(["agl","groundspeed","thr1","thr2"], nil, func(val) { - if (val.agl < 400 and val.groundspeed > 50 and val.thr1 < 0.78 and val.thr2 < 0.78) { - obj["tailstrikeInd"].show(); + props.UpdateManager.FromHashValue("groundspeed", 1, func(val) { + if (val > 50) { + obj.temporaryNodes.showTailstrikeGroundspeed = 1; } else { - obj["tailstrikeInd"].hide(); + obj.temporaryNodes.showTailstrikeGroundspeed = 0; + } + }), + props.UpdateManager.FromHashList(["thr1","thr2"], 0.05, func(val) { + if (val.thr1 < 0.78 and val.thr2 < 0.78) { + obj.temporaryNodes.showTailstrikeThrust = 1; + } else { + obj.temporaryNodes.showTailstrikeThrust = 0; } }), props.UpdateManager.FromHashList(["hdgDiff","showHdg","targetHeading"], nil, func(val) { @@ -836,7 +850,7 @@ var canvas_pfd = { me["FPV"].hide(); } else { me.AI_fpv_trans.setTranslation(me.getTrackDiffPixels(math.clamp(me.track_diff, -21, 21)), math.clamp(me.aoa, -20, 20) * 12.5); - me.AI_fpv_rot.setRotation(-notification.roll * D2R, me["AI_center"].getCenter()); + me.AI_fpv_rot.setRotation(-notification.roll * D2R, obj.AICenter); me["FPV"].setRotation(notification.roll * D2R); # It shouldn't be rotated, only the axis should be me["FPV"].show(); } @@ -1238,7 +1252,7 @@ var canvas_pfd = { me["ASI_trend_down"].hide(); } - if (-notification.agl >= -565 and -notification.agl <= 565) { + if (me.temporaryNodes.showGroundReferenceAGL) { me["ground_ref"].show(); } else { me["ground_ref"].hide(); @@ -1764,6 +1778,22 @@ var canvas_pfd = { me["CRS_pointer"].hide(); } + if (me.temporaryNodes.showGroundReferenceAGL) { + if ((notification.fmgcPhase == 5 or notification.fmgcPhase == 6) and !notification.gear1Wow and !notification.gear2Wow) { # TODO: add std too + me["ground"].show(); + } else { + me["ground"].hide(); + } + } else { + me["ground"].hide(); + } + + if (me.temporaryNodes.showTailstrikeAGL and me.temporaryNodes.showTailstrikeGroundspeed and me.temporaryNodes.showTailstrikeThrust) { + me["tailstrikeInd"].show(); + } else { + me["tailstrikeInd"].hide(); + } + foreach(var update_item; me.update_items) { update_item.update(notification); From 31e486567bc721d897ac44900e0d0bfe58ea9f52 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Mon, 21 Mar 2022 10:32:00 +0000 Subject: [PATCH 02/33] PFD: split the horizon translate animations --- Models/Instruments/PFD/PFD.nas | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index d661662b..213d32e2 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -232,7 +232,7 @@ var canvas_pfd = { obj.AI_horizon_ground_trans.setTranslation(0, val * 11.825); }), props.UpdateManager.FromHashValue("horizonPitch", 0.1, func(val) { - obj.AI_horizon_hdg_trans.setTranslation(obj.middleOffset, val * 11.825); + obj.AI_horizon_hdg_trans.setTranslation(0, val * 11.825); }), props.UpdateManager.FromHashValue("slipSkid", 0.1, func(val) { obj["AI_slipskid"].setTranslation(math.clamp(val, -15, 15) * 7, 0); @@ -336,6 +336,7 @@ var canvas_pfd = { obj.middleOffset = -obj.headOffset * 98.5416; } + obj.AI_horizon_hdg_trans.setTranslation(obj.middleOffset, 0); obj["HDG_scale"].setTranslation(obj.middleOffset, 0); obj["HDG_scale"].update(); From b2793c858b5b0c4dc8488e832f2fa520872b37d3 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Mon, 21 Mar 2022 13:50:12 +0000 Subject: [PATCH 03/33] Move FPV and DME distance to updateManager --- Models/Instruments/PFD/PFD.nas | 43 ++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 213d32e2..17cd3e4b 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -211,9 +211,8 @@ var canvas_pfd = { obj.AI_horizon_hdg_rot.setRotation(-val * D2R, obj.AICenter); obj["AI_bank"].setRotation(-val * D2R); obj["AI_agl_g"].setRotation(-val * D2R); - }), - props.UpdateManager.FromHashValue("roll", nil, func(val) { - obj.AI_horizon_hdg_rot.setRotation(-val * D2R, obj.AICenter); + obj.AI_fpv_rot.setRotation(-val * D2R, obj.AICenter); + obj["FPV"].setRotation(val * D2R); # It shouldn't be rotated, only the axis should }), props.UpdateManager.FromHashValue("fbwLaw", 1, func(val) { if (val == 0) { @@ -231,8 +230,8 @@ var canvas_pfd = { props.UpdateManager.FromHashValue("horizonGround", 0.1, func(val) { obj.AI_horizon_ground_trans.setTranslation(0, val * 11.825); }), - props.UpdateManager.FromHashValue("horizonPitch", 0.1, func(val) { - obj.AI_horizon_hdg_trans.setTranslation(0, val * 11.825); + props.UpdateManager.FromHashList(["middleOffset","horizonPitch"], 0.1, func(val) { + obj.AI_horizon_hdg_trans.setTranslation(val.middleOffset, val.horizonPitch * 11.825); }), props.UpdateManager.FromHashValue("slipSkid", 0.1, func(val) { obj["AI_slipskid"].setTranslation(math.clamp(val, -15, 15) * 7, 0); @@ -297,6 +296,9 @@ var canvas_pfd = { obj.track_diff = geo.normdeg180(val.trackPFD - val.headingPFD); # store this to use in FPV obj["TRK_pointer"].setTranslation(obj.getTrackDiffPixels(obj.track_diff),0); }), + props.UpdateManager.FromHashList(["trackPFD","headingPFD","aoaPFD"], 0.01, func(val) { + obj.AI_fpv_trans.setTranslation(obj.getTrackDiffPixels(math.clamp(obj.track_diff, -21, 21)), math.clamp(val.aoaPFD, -20, 20) * 12.5); + }), props.UpdateManager.FromHashList(["vsAutopilot","agl"], 5, func(val) { if (abs(val.vsAutopilot) >= 6000 or (val.vsAutopilot <= -2000 and val.agl <= 2500) or (val.vsAutopilot <= -1200 and val.agl <= 1000)) { obj["VS_digit"].setColor(0.7333,0.3803,0); @@ -336,7 +338,6 @@ var canvas_pfd = { obj.middleOffset = -obj.headOffset * 98.5416; } - obj.AI_horizon_hdg_trans.setTranslation(obj.middleOffset, 0); obj["HDG_scale"].setTranslation(obj.middleOffset, 0); obj["HDG_scale"].update(); @@ -357,7 +358,7 @@ var canvas_pfd = { obj["HDG_seven"].setFontSize(fontSizeHDG(obj.rightText3), 1); obj["HDG_one"].setFontSize(fontSizeHDG(obj.leftText3), 1); }), - props.UpdateManager.FromHashValue("altitudeAutopilot", nil, func(val) { + props.UpdateManager.FromHashValue("altitudeAutopilot", 50, func(val) { obj["ALT_digit_UP_metric"].setText(sprintf("%5.0fM", val * 0.3048)); }), props.UpdateManager.FromHashList(["fac1","fac2"], nil, func(val) { @@ -763,6 +764,13 @@ var canvas_pfd = { obj["ASI_decimal_DN"].setColor(0.0901,0.6039,0.7176); } }), + props.UpdateManager.FromHashValue("dmeDistance", 0.05, func(val) { + if (val < 19.95) { + obj["dme_dist"].setText(sprintf("%1.1f", val)); + } else { + obj["dme_dist"].setText(sprintf("%2.0f", val)); + } + }), ]; obj.update_items_mismatch = [ @@ -809,6 +817,7 @@ var canvas_pfd = { aoa: 0, showMetricAlt: 0, ASItrendIsShown: 0, + onsideADIRSOperating: 0, update: func(notification) { me.updatePower(notification); @@ -827,6 +836,12 @@ var canvas_pfd = { # Errors if (systems.ADIRS.ADIRunits[(me.number == 0 ? 0 : 1)].operating == 1 or (systems.ADIRS.ADIRunits[2].operating == 1 and notification.attSwitch == (me.number == 0 ? -1 : 1))) { + me.onsideADIRSOperating = 1; + } else { + me.onsideADIRSOperating = 0; + } + + if (me.onsideADIRSOperating) { me["AI_group"].show(); me["HDG_group"].show(); me["AI_error"].hide(); @@ -844,15 +859,13 @@ var canvas_pfd = { me["VS_group"].hide(); } + notification.aoaPFD = (me.number == 0 ? me.getAOAForPFD1() : me.getAOAForPFD2()); + notification.middleOffset = me.middleOffset; # FPV if (notification.trkFpa) { - me.aoa = (me.number == 0 ? me.getAOAForPFD1() : me.getAOAForPFD2()); - if (me.aoa == nil or (systems.ADIRS.ADIRunits[(me.number == 0 ? 0 : 1)].operating != 1) or (systems.ADIRS.ADIRunits[2].operating != 1 and notification.attSwitch == (me.number == 0 ? -1 : 1))){ + if (notification.aoaPFD == nil or !me.onsideADIRSOperating){ me["FPV"].hide(); } else { - me.AI_fpv_trans.setTranslation(me.getTrackDiffPixels(math.clamp(me.track_diff, -21, 21)), math.clamp(me.aoa, -20, 20) * 12.5); - me.AI_fpv_rot.setRotation(-notification.roll * D2R, obj.AICenter); - me["FPV"].setRotation(notification.roll * D2R); # It shouldn't be rotated, only the axis should be me["FPV"].show(); } } else { @@ -1720,12 +1733,6 @@ var canvas_pfd = { if (notification.dmeInRange) { me["dme_dist"].show(); me["dme_dist_legend"].show(); - - if (notification.dmeDistance < 20.0) { - me["dme_dist"].setText(sprintf("%1.1f", notification.dmeDistance)); - } else { - me["dme_dist"].setText(sprintf("%2.0f", notification.dmeDistance)); - } } else { me["dme_dist"].hide(); me["dme_dist_legend"].hide(); From 4d63d45c0dc8a266d77b785080ce5b1a8d8507f0 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Tue, 19 Apr 2022 18:15:23 +0100 Subject: [PATCH 04/33] Rewrite the bottom of the system display update code --- .../Instruments/Lower-ECAM/Lower-ECAM-APU.nas | 33 ++++++++--------- .../Lower-ECAM/Lower-ECAM-bleed.nas | 33 ++++++++--------- .../Lower-ECAM/Lower-ECAM-cond.nas | 33 ++++++++--------- .../Lower-ECAM/Lower-ECAM-cruise.nas | 33 ++++++++--------- .../Lower-ECAM/Lower-ECAM-door.nas | 33 ++++++++--------- .../Lower-ECAM/Lower-ECAM-elec.nas | 33 ++++++++--------- .../Instruments/Lower-ECAM/Lower-ECAM-eng.nas | 33 ++++++++--------- .../Lower-ECAM/Lower-ECAM-fctl.nas | 33 ++++++++--------- .../Lower-ECAM/Lower-ECAM-fuel.nas | 33 ++++++++--------- .../Instruments/Lower-ECAM/Lower-ECAM-hyd.nas | 33 ++++++++--------- .../Lower-ECAM/Lower-ECAM-press.nas | 33 ++++++++--------- .../Instruments/Lower-ECAM/Lower-ECAM-sts.nas | 36 ++++++++++--------- .../Lower-ECAM/Lower-ECAM-wheel.nas | 33 ++++++++--------- 13 files changed, 223 insertions(+), 209 deletions(-) diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-APU.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-APU.nas index 36d2560e..d9ccaecb 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-APU.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-APU.nas @@ -179,7 +179,6 @@ var canvas_lowerECAMPageApu = }), ]; - obj.displayedGForce = 0; obj.updateItemsBottom = [ props.UpdateManager.FromHashValue("acconfigUnits", nil, func(val) { obj.units = val; @@ -189,26 +188,28 @@ var canvas_lowerECAMPageApu = obj["GW-weight-unit"].setText("LBS"); } }), - props.UpdateManager.FromHashValue("hour", nil, func(val) { + props.UpdateManager.FromHashValue("hour", 1, func(val) { obj["UTCh"].setText(sprintf("%02d", val)); }), - props.UpdateManager.FromHashValue("minute", nil, func(val) { + props.UpdateManager.FromHashValue("minute", 1, func(val) { obj["UTCm"].setText(sprintf("%02d", val)); }), props.UpdateManager.FromHashValue("gForce", 0.05, func(val) { - if (obj.displayedGForce) { - obj["GLoad"].setText("G.LOAD " ~ sprintf("%3.1f", val)); - } + obj["GLoad"].setText("G.LOAD " ~ sprintf("%3.1f", val)); }), props.UpdateManager.FromHashValue("gForceDisplay", nil, func(val) { - if ((val == 1 and !obj.displayedGForce) or (val != 0 and obj.displayedGForce)) { - obj.displayedGForce = 1; + if (val) { obj["GLoad"].show(); } else { - obj.displayedGForce = 0; obj["GLoad"].hide(); } }), + props.UpdateManager.FromHashValue("satTemp", 0.5, func(val) { + obj["SAT"].setText(sprintf("%+2.0f", val)); + }), + props.UpdateManager.FromHashValue("tatTemp", 0.5, func(val) { + obj["TAT"].setText(sprintf("%+2.0f", val)); + }), ]; return obj; }, @@ -219,11 +220,6 @@ var canvas_lowerECAMPageApu = return ["APUN-needle","APUEGT-needle","APUN","APUEGT","APUAvail","APUFlapOpen","APUBleedValve","APUBleedOnline","APUBleedValveCrossBar","APUGenOnline","APUGenOff","APUGentext","APUGenLoad","APUGenbox","APUGenVolt","APUGenHz","APUBleedPSI","APUfuelLO","APU-low-oil","text3724","text3728","text3732"]; }, updateBottom: func(notification) { - foreach(var update_item_bottom; me.updateItemsBottom) - { - update_item_bottom.update(notification); - } - if (fmgc.FMGCInternal.fuelRequest and fmgc.FMGCInternal.blockConfirmed and !fmgc.FMGCInternal.fuelCalculating and notification.FWCPhase != 1) { if (me.units) { me["GW"].setText(sprintf("%s", math.round(fmgc.FMGCInternal.fuelPredGw * 1000 * LBS2KGS, 100))); @@ -237,7 +233,7 @@ var canvas_lowerECAMPageApu = } if (dmc.DMController.DMCs[1].outputs[4] != nil) { - me["SAT"].setText(sprintf("%+2.0f", dmc.DMController.DMCs[1].outputs[4].getValue())); + notification.satTemp = dmc.DMController.DMCs[1].outputs[4].getValue(); me["SAT"].setColor(0.0509,0.7529,0.2941); } else { me["SAT"].setText(sprintf("%s", "XX")); @@ -245,12 +241,17 @@ var canvas_lowerECAMPageApu = } if (dmc.DMController.DMCs[1].outputs[5] != nil) { - me["TAT"].setText(sprintf("%+2.0f", dmc.DMController.DMCs[1].outputs[5].getValue())); + notification.tatTemp = dmc.DMController.DMCs[1].outputs[5].getValue(); me["TAT"].setColor(0.0509,0.7529,0.2941); } else { me["TAT"].setText(sprintf("%s", "XX")); me["TAT"].setColor(0.7333,0.3803,0); } + + foreach(var update_item_bottom; me.updateItemsBottom) + { + update_item_bottom.update(notification); + } }, update: func(notification) { me.updatePower(); diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-bleed.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-bleed.nas index 196a8075..5170ca4e 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-bleed.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-bleed.nas @@ -388,7 +388,6 @@ var canvas_lowerECAMPageBleed = }), ]; - obj.displayedGForce = 0; obj.updateItemsBottom = [ props.UpdateManager.FromHashValue("acconfigUnits", nil, func(val) { obj.units = val; @@ -398,26 +397,28 @@ var canvas_lowerECAMPageBleed = obj["GW-weight-unit"].setText("LBS"); } }), - props.UpdateManager.FromHashValue("hour", nil, func(val) { + props.UpdateManager.FromHashValue("hour", 1, func(val) { obj["UTCh"].setText(sprintf("%02d", val)); }), - props.UpdateManager.FromHashValue("minute", nil, func(val) { + props.UpdateManager.FromHashValue("minute", 1, func(val) { obj["UTCm"].setText(sprintf("%02d", val)); }), props.UpdateManager.FromHashValue("gForce", 0.05, func(val) { - if (obj.displayedGForce) { - obj["GLoad"].setText("G.LOAD " ~ sprintf("%3.1f", val)); - } + obj["GLoad"].setText("G.LOAD " ~ sprintf("%3.1f", val)); }), props.UpdateManager.FromHashValue("gForceDisplay", nil, func(val) { - if ((val == 1 and !obj.displayedGForce) or (val != 0 and obj.displayedGForce)) { - obj.displayedGForce = 1; + if (val) { obj["GLoad"].show(); } else { - obj.displayedGForce = 0; obj["GLoad"].hide(); } }), + props.UpdateManager.FromHashValue("satTemp", 0.5, func(val) { + obj["SAT"].setText(sprintf("%+2.0f", val)); + }), + props.UpdateManager.FromHashValue("tatTemp", 0.5, func(val) { + obj["TAT"].setText(sprintf("%+2.0f", val)); + }), ]; return obj; }, @@ -436,11 +437,6 @@ var canvas_lowerECAMPageBleed = "BLEED-Pack-1-Flow-Valve-Cross","BLEED-Pack-2-Flow-Valve-Cross","BLEED-Pack-1-connection","BLEED-Pack-2-connection"]; }, updateBottom: func(notification) { - foreach(var update_item_bottom; me.updateItemsBottom) - { - update_item_bottom.update(notification); - } - if (fmgc.FMGCInternal.fuelRequest and fmgc.FMGCInternal.blockConfirmed and !fmgc.FMGCInternal.fuelCalculating and notification.FWCPhase != 1) { if (me.units) { me["GW"].setText(sprintf("%s", math.round(fmgc.FMGCInternal.fuelPredGw * 1000 * LBS2KGS, 100))); @@ -454,7 +450,7 @@ var canvas_lowerECAMPageBleed = } if (dmc.DMController.DMCs[1].outputs[4] != nil) { - me["SAT"].setText(sprintf("%+2.0f", dmc.DMController.DMCs[1].outputs[4].getValue())); + notification.satTemp = dmc.DMController.DMCs[1].outputs[4].getValue(); me["SAT"].setColor(0.0509,0.7529,0.2941); } else { me["SAT"].setText(sprintf("%s", "XX")); @@ -462,12 +458,17 @@ var canvas_lowerECAMPageBleed = } if (dmc.DMController.DMCs[1].outputs[5] != nil) { - me["TAT"].setText(sprintf("%+2.0f", dmc.DMController.DMCs[1].outputs[5].getValue())); + notification.tatTemp = dmc.DMController.DMCs[1].outputs[5].getValue(); me["TAT"].setColor(0.0509,0.7529,0.2941); } else { me["TAT"].setText(sprintf("%s", "XX")); me["TAT"].setColor(0.7333,0.3803,0); } + + foreach(var update_item_bottom; me.updateItemsBottom) + { + update_item_bottom.update(notification); + } }, update: func(notification) { me.updatePower(); diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-cond.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-cond.nas index c609eb59..e5f224b9 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-cond.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-cond.nas @@ -76,7 +76,6 @@ var canvas_lowerECAMPageCond = }), ]; - obj.displayedGForce = 0; obj.updateItemsBottom = [ props.UpdateManager.FromHashValue("acconfigUnits", nil, func(val) { obj.units = val; @@ -86,26 +85,28 @@ var canvas_lowerECAMPageCond = obj["GW-weight-unit"].setText("LBS"); } }), - props.UpdateManager.FromHashValue("hour", nil, func(val) { + props.UpdateManager.FromHashValue("hour", 1, func(val) { obj["UTCh"].setText(sprintf("%02d", val)); }), - props.UpdateManager.FromHashValue("minute", nil, func(val) { + props.UpdateManager.FromHashValue("minute", 1, func(val) { obj["UTCm"].setText(sprintf("%02d", val)); }), props.UpdateManager.FromHashValue("gForce", 0.05, func(val) { - if (obj.displayedGForce) { - obj["GLoad"].setText("G.LOAD " ~ sprintf("%3.1f", val)); - } + obj["GLoad"].setText("G.LOAD " ~ sprintf("%3.1f", val)); }), props.UpdateManager.FromHashValue("gForceDisplay", nil, func(val) { - if ((val == 1 and !obj.displayedGForce) or (val != 0 and obj.displayedGForce)) { - obj.displayedGForce = 1; + if (val) { obj["GLoad"].show(); } else { - obj.displayedGForce = 0; obj["GLoad"].hide(); } }), + props.UpdateManager.FromHashValue("satTemp", 0.5, func(val) { + obj["SAT"].setText(sprintf("%+2.0f", val)); + }), + props.UpdateManager.FromHashValue("tatTemp", 0.5, func(val) { + obj["TAT"].setText(sprintf("%+2.0f", val)); + }), ]; return obj; }, @@ -117,11 +118,6 @@ var canvas_lowerECAMPageCond = "CONDDuctTempAFT","CONDDuctTempFWD","CONDTempCKPT","CONDTempAFT","CONDTempFWD","CONDHotAirValveCross"]; }, updateBottom: func(notification) { - foreach(var update_item_bottom; me.updateItemsBottom) - { - update_item_bottom.update(notification); - } - if (fmgc.FMGCInternal.fuelRequest and fmgc.FMGCInternal.blockConfirmed and !fmgc.FMGCInternal.fuelCalculating and notification.FWCPhase != 1) { if (me.units) { me["GW"].setText(sprintf("%s", math.round(fmgc.FMGCInternal.fuelPredGw * 1000 * LBS2KGS, 100))); @@ -135,7 +131,7 @@ var canvas_lowerECAMPageCond = } if (dmc.DMController.DMCs[1].outputs[4] != nil) { - me["SAT"].setText(sprintf("%+2.0f", dmc.DMController.DMCs[1].outputs[4].getValue())); + notification.satTemp = dmc.DMController.DMCs[1].outputs[4].getValue(); me["SAT"].setColor(0.0509,0.7529,0.2941); } else { me["SAT"].setText(sprintf("%s", "XX")); @@ -143,12 +139,17 @@ var canvas_lowerECAMPageCond = } if (dmc.DMController.DMCs[1].outputs[5] != nil) { - me["TAT"].setText(sprintf("%+2.0f", dmc.DMController.DMCs[1].outputs[5].getValue())); + notification.tatTemp = dmc.DMController.DMCs[1].outputs[5].getValue(); me["TAT"].setColor(0.0509,0.7529,0.2941); } else { me["TAT"].setText(sprintf("%s", "XX")); me["TAT"].setColor(0.7333,0.3803,0); } + + foreach(var update_item_bottom; me.updateItemsBottom) + { + update_item_bottom.update(notification); + } }, update: func(notification) { me.updatePower(); diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-cruise.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-cruise.nas index ff4d4051..461f81c9 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-cruise.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-cruise.nas @@ -137,7 +137,6 @@ var canvas_lowerECAMPageCruise = }), ]; - obj.displayedGForce = 0; obj.updateItemsBottom = [ props.UpdateManager.FromHashValue("acconfigUnits", nil, func(val) { obj.units = val; @@ -147,26 +146,28 @@ var canvas_lowerECAMPageCruise = obj["GW-weight-unit"].setText("LBS"); } }), - props.UpdateManager.FromHashValue("hour", nil, func(val) { + props.UpdateManager.FromHashValue("hour", 1, func(val) { obj["UTCh"].setText(sprintf("%02d", val)); }), - props.UpdateManager.FromHashValue("minute", nil, func(val) { + props.UpdateManager.FromHashValue("minute", 1, func(val) { obj["UTCm"].setText(sprintf("%02d", val)); }), props.UpdateManager.FromHashValue("gForce", 0.05, func(val) { - if (obj.displayedGForce) { - obj["GLoad"].setText("G.LOAD " ~ sprintf("%3.1f", val)); - } + obj["GLoad"].setText("G.LOAD " ~ sprintf("%3.1f", val)); }), props.UpdateManager.FromHashValue("gForceDisplay", nil, func(val) { - if ((val == 1 and !obj.displayedGForce) or (val != 0 and obj.displayedGForce)) { - obj.displayedGForce = 1; + if (val) { obj["GLoad"].show(); } else { - obj.displayedGForce = 0; obj["GLoad"].hide(); } }), + props.UpdateManager.FromHashValue("satTemp", 0.5, func(val) { + obj["SAT"].setText(sprintf("%+2.0f", val)); + }), + props.UpdateManager.FromHashValue("tatTemp", 0.5, func(val) { + obj["TAT"].setText(sprintf("%+2.0f", val)); + }), ]; return obj; }, @@ -177,11 +178,6 @@ var canvas_lowerECAMPageCruise = return["Oil1","Oil2","OilUnit","FUsed1","FUsed2","FUsed","VIB1N1","VIB1N2","VIB2N1","VIB2N2","deltaPSI","LDGELEV-AUTO","LDGELEV","CABVS","CABALT","VS-Arrow-UP","VS-Arrow-DN","CKPT-TEMP","FWD-TEMP","AFT-TEMP","Fused-weight-unit"]; }, updateBottom: func(notification) { - foreach(var update_item_bottom; me.updateItemsBottom) - { - update_item_bottom.update(notification); - } - if (fmgc.FMGCInternal.fuelRequest and fmgc.FMGCInternal.blockConfirmed and !fmgc.FMGCInternal.fuelCalculating and notification.FWCPhase != 1) { if (me.units) { me["GW"].setText(sprintf("%s", math.round(fmgc.FMGCInternal.fuelPredGw * 1000 * LBS2KGS, 100))); @@ -195,7 +191,7 @@ var canvas_lowerECAMPageCruise = } if (dmc.DMController.DMCs[1].outputs[4] != nil) { - me["SAT"].setText(sprintf("%+2.0f", dmc.DMController.DMCs[1].outputs[4].getValue())); + notification.satTemp = dmc.DMController.DMCs[1].outputs[4].getValue(); me["SAT"].setColor(0.0509,0.7529,0.2941); } else { me["SAT"].setText(sprintf("%s", "XX")); @@ -203,12 +199,17 @@ var canvas_lowerECAMPageCruise = } if (dmc.DMController.DMCs[1].outputs[5] != nil) { - me["TAT"].setText(sprintf("%+2.0f", dmc.DMController.DMCs[1].outputs[5].getValue())); + notification.tatTemp = dmc.DMController.DMCs[1].outputs[5].getValue(); me["TAT"].setColor(0.0509,0.7529,0.2941); } else { me["TAT"].setText(sprintf("%s", "XX")); me["TAT"].setColor(0.7333,0.3803,0); } + + foreach(var update_item_bottom; me.updateItemsBottom) + { + update_item_bottom.update(notification); + } }, update: func(notification) { me.updatePower(); diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-door.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-door.nas index 9157e72c..cac1a656 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-door.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-door.nas @@ -201,7 +201,6 @@ var canvas_lowerECAMPageDoor = }), ]; - obj.displayedGForce = 0; obj.updateItemsBottom = [ props.UpdateManager.FromHashValue("acconfigUnits", nil, func(val) { obj.units = val; @@ -211,26 +210,28 @@ var canvas_lowerECAMPageDoor = obj["GW-weight-unit"].setText("LBS"); } }), - props.UpdateManager.FromHashValue("hour", nil, func(val) { + props.UpdateManager.FromHashValue("hour", 1, func(val) { obj["UTCh"].setText(sprintf("%02d", val)); }), - props.UpdateManager.FromHashValue("minute", nil, func(val) { + props.UpdateManager.FromHashValue("minute", 1, func(val) { obj["UTCm"].setText(sprintf("%02d", val)); }), props.UpdateManager.FromHashValue("gForce", 0.05, func(val) { - if (obj.displayedGForce) { - obj["GLoad"].setText("G.LOAD " ~ sprintf("%3.1f", val)); - } + obj["GLoad"].setText("G.LOAD " ~ sprintf("%3.1f", val)); }), props.UpdateManager.FromHashValue("gForceDisplay", nil, func(val) { - if ((val == 1 and !obj.displayedGForce) or (val != 0 and obj.displayedGForce)) { - obj.displayedGForce = 1; + if (val) { obj["GLoad"].show(); } else { - obj.displayedGForce = 0; obj["GLoad"].hide(); } }), + props.UpdateManager.FromHashValue("satTemp", 0.5, func(val) { + obj["SAT"].setText(sprintf("%+2.0f", val)); + }), + props.UpdateManager.FromHashValue("tatTemp", 0.5, func(val) { + obj["TAT"].setText(sprintf("%+2.0f", val)); + }), ]; return obj; }, @@ -244,11 +245,6 @@ var canvas_lowerECAMPageDoor = "Cabin4LeftSlide","Cabin4Right","Cabin4RightLbl","Cabin4RightLine","Cabin4RightSlide","DOOROXY-REGUL-LO-PR","DOOROXY-PR","DOOROXY-OxyIndicator","DOOR-VS","DOOR-VS-Container"]; }, updateBottom: func(notification) { - foreach(var update_item_bottom; me.updateItemsBottom) - { - update_item_bottom.update(notification); - } - if (fmgc.FMGCInternal.fuelRequest and fmgc.FMGCInternal.blockConfirmed and !fmgc.FMGCInternal.fuelCalculating and notification.FWCPhase != 1) { if (me.units) { me["GW"].setText(sprintf("%s", math.round(fmgc.FMGCInternal.fuelPredGw * 1000 * LBS2KGS, 100))); @@ -262,7 +258,7 @@ var canvas_lowerECAMPageDoor = } if (dmc.DMController.DMCs[1].outputs[4] != nil) { - me["SAT"].setText(sprintf("%+2.0f", dmc.DMController.DMCs[1].outputs[4].getValue())); + notification.satTemp = dmc.DMController.DMCs[1].outputs[4].getValue(); me["SAT"].setColor(0.0509,0.7529,0.2941); } else { me["SAT"].setText(sprintf("%s", "XX")); @@ -270,12 +266,17 @@ var canvas_lowerECAMPageDoor = } if (dmc.DMController.DMCs[1].outputs[5] != nil) { - me["TAT"].setText(sprintf("%+2.0f", dmc.DMController.DMCs[1].outputs[5].getValue())); + notification.tatTemp = dmc.DMController.DMCs[1].outputs[5].getValue(); me["TAT"].setColor(0.0509,0.7529,0.2941); } else { me["TAT"].setText(sprintf("%s", "XX")); me["TAT"].setColor(0.7333,0.3803,0); } + + foreach(var update_item_bottom; me.updateItemsBottom) + { + update_item_bottom.update(notification); + } }, update: func(notification) { me.updatePower(); diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-elec.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-elec.nas index 678075fc..252588d4 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-elec.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-elec.nas @@ -668,7 +668,6 @@ var canvas_lowerECAMPageElec = }), ]; - obj.displayedGForce = 0; obj.updateItemsBottom = [ props.UpdateManager.FromHashValue("acconfigUnits", nil, func(val) { obj.units = val; @@ -678,26 +677,28 @@ var canvas_lowerECAMPageElec = obj["GW-weight-unit"].setText("LBS"); } }), - props.UpdateManager.FromHashValue("hour", nil, func(val) { + props.UpdateManager.FromHashValue("hour", 1, func(val) { obj["UTCh"].setText(sprintf("%02d", val)); }), - props.UpdateManager.FromHashValue("minute", nil, func(val) { + props.UpdateManager.FromHashValue("minute", 1, func(val) { obj["UTCm"].setText(sprintf("%02d", val)); }), props.UpdateManager.FromHashValue("gForce", 0.05, func(val) { - if (obj.displayedGForce) { - obj["GLoad"].setText("G.LOAD " ~ sprintf("%3.1f", val)); - } + obj["GLoad"].setText("G.LOAD " ~ sprintf("%3.1f", val)); }), props.UpdateManager.FromHashValue("gForceDisplay", nil, func(val) { - if ((val == 1 and !obj.displayedGForce) or (val != 0 and obj.displayedGForce)) { - obj.displayedGForce = 1; + if (val) { obj["GLoad"].show(); } else { - obj.displayedGForce = 0; obj["GLoad"].hide(); } }), + props.UpdateManager.FromHashValue("satTemp", 0.5, func(val) { + obj["SAT"].setText(sprintf("%+2.0f", val)); + }), + props.UpdateManager.FromHashValue("tatTemp", 0.5, func(val) { + obj["TAT"].setText(sprintf("%+2.0f", val)); + }), ]; return obj; }, @@ -714,11 +715,6 @@ var canvas_lowerECAMPageElec = "ELEC-ACESS-SHED-label","ELEC-DCBAT-label","ELEC-DCESS-label","ELEC-DC2-label","ELEC-DC1-label","ELEC-AC1-label","ELEC-AC2-label","ELEC-ACESS-label","ELEC-Line-ESSTR-DCESS-off","ELEC-Line-Emergen-ESSTR-off","STATINV-group","StatVolt","StatHz"]; }, updateBottom: func(notification) { - foreach(var update_item_bottom; me.updateItemsBottom) - { - update_item_bottom.update(notification); - } - if (fmgc.FMGCInternal.fuelRequest and fmgc.FMGCInternal.blockConfirmed and !fmgc.FMGCInternal.fuelCalculating and notification.FWCPhase != 1) { if (me.units) { me["GW"].setText(sprintf("%s", math.round(fmgc.FMGCInternal.fuelPredGw * 1000 * LBS2KGS, 100))); @@ -732,7 +728,7 @@ var canvas_lowerECAMPageElec = } if (dmc.DMController.DMCs[1].outputs[4] != nil) { - me["SAT"].setText(sprintf("%+2.0f", dmc.DMController.DMCs[1].outputs[4].getValue())); + notification.satTemp = dmc.DMController.DMCs[1].outputs[4].getValue(); me["SAT"].setColor(0.0509,0.7529,0.2941); } else { me["SAT"].setText(sprintf("%s", "XX")); @@ -740,12 +736,17 @@ var canvas_lowerECAMPageElec = } if (dmc.DMController.DMCs[1].outputs[5] != nil) { - me["TAT"].setText(sprintf("%+2.0f", dmc.DMController.DMCs[1].outputs[5].getValue())); + notification.tatTemp = dmc.DMController.DMCs[1].outputs[5].getValue(); me["TAT"].setColor(0.0509,0.7529,0.2941); } else { me["TAT"].setText(sprintf("%s", "XX")); me["TAT"].setColor(0.7333,0.3803,0); } + + foreach(var update_item_bottom; me.updateItemsBottom) + { + update_item_bottom.update(notification); + } }, update: func(notification) { me.updatePower(); diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-eng.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-eng.nas index 7cfd565c..701cbd94 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-eng.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-eng.nas @@ -130,7 +130,6 @@ var canvas_lowerECAMPageEng = }), ]; - obj.displayedGForce = 0; obj.updateItemsBottom = [ props.UpdateManager.FromHashValue("acconfigUnits", nil, func(val) { obj.units = val; @@ -140,26 +139,28 @@ var canvas_lowerECAMPageEng = obj["GW-weight-unit"].setText("LBS"); } }), - props.UpdateManager.FromHashValue("hour", nil, func(val) { + props.UpdateManager.FromHashValue("hour", 1, func(val) { obj["UTCh"].setText(sprintf("%02d", val)); }), - props.UpdateManager.FromHashValue("minute", nil, func(val) { + props.UpdateManager.FromHashValue("minute", 1, func(val) { obj["UTCm"].setText(sprintf("%02d", val)); }), props.UpdateManager.FromHashValue("gForce", 0.05, func(val) { - if (obj.displayedGForce) { - obj["GLoad"].setText("G.LOAD " ~ sprintf("%3.1f", val)); - } + obj["GLoad"].setText("G.LOAD " ~ sprintf("%3.1f", val)); }), props.UpdateManager.FromHashValue("gForceDisplay", nil, func(val) { - if ((val == 1 and !obj.displayedGForce) or (val != 0 and obj.displayedGForce)) { - obj.displayedGForce = 1; + if (val) { obj["GLoad"].show(); } else { - obj.displayedGForce = 0; obj["GLoad"].hide(); } }), + props.UpdateManager.FromHashValue("satTemp", 0.5, func(val) { + obj["SAT"].setText(sprintf("%+2.0f", val)); + }), + props.UpdateManager.FromHashValue("tatTemp", 0.5, func(val) { + obj["TAT"].setText(sprintf("%+2.0f", val)); + }), ]; return obj; }, @@ -172,11 +173,6 @@ var canvas_lowerECAMPageEng = "VIB-N1-1","VIB-N1-2","VIB-N2-1","VIB-N2-2"]; }, updateBottom: func(notification) { - foreach(var update_item_bottom; me.updateItemsBottom) - { - update_item_bottom.update(notification); - } - if (fmgc.FMGCInternal.fuelRequest and fmgc.FMGCInternal.blockConfirmed and !fmgc.FMGCInternal.fuelCalculating and notification.FWCPhase != 1) { if (me.units) { me["GW"].setText(sprintf("%s", math.round(fmgc.FMGCInternal.fuelPredGw * 1000 * LBS2KGS, 100))); @@ -190,7 +186,7 @@ var canvas_lowerECAMPageEng = } if (dmc.DMController.DMCs[1].outputs[4] != nil) { - me["SAT"].setText(sprintf("%+2.0f", dmc.DMController.DMCs[1].outputs[4].getValue())); + notification.satTemp = dmc.DMController.DMCs[1].outputs[4].getValue(); me["SAT"].setColor(0.0509,0.7529,0.2941); } else { me["SAT"].setText(sprintf("%s", "XX")); @@ -198,12 +194,17 @@ var canvas_lowerECAMPageEng = } if (dmc.DMController.DMCs[1].outputs[5] != nil) { - me["TAT"].setText(sprintf("%+2.0f", dmc.DMController.DMCs[1].outputs[5].getValue())); + notification.tatTemp = dmc.DMController.DMCs[1].outputs[5].getValue(); me["TAT"].setColor(0.0509,0.7529,0.2941); } else { me["TAT"].setText(sprintf("%s", "XX")); me["TAT"].setColor(0.7333,0.3803,0); } + + foreach(var update_item_bottom; me.updateItemsBottom) + { + update_item_bottom.update(notification); + } }, update: func(notification) { me.updatePower(); diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-fctl.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-fctl.nas index 7458e99d..8641ea12 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-fctl.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-fctl.nas @@ -466,7 +466,6 @@ var canvas_lowerECAMPageFctl = }), ]; - obj.displayedGForce = 0; obj.updateItemsBottom = [ props.UpdateManager.FromHashValue("acconfigUnits", nil, func(val) { obj.units = val; @@ -476,26 +475,28 @@ var canvas_lowerECAMPageFctl = obj["GW-weight-unit"].setText("LBS"); } }), - props.UpdateManager.FromHashValue("hour", nil, func(val) { + props.UpdateManager.FromHashValue("hour", 1, func(val) { obj["UTCh"].setText(sprintf("%02d", val)); }), - props.UpdateManager.FromHashValue("minute", nil, func(val) { + props.UpdateManager.FromHashValue("minute", 1, func(val) { obj["UTCm"].setText(sprintf("%02d", val)); }), props.UpdateManager.FromHashValue("gForce", 0.05, func(val) { - if (obj.displayedGForce) { - obj["GLoad"].setText("G.LOAD " ~ sprintf("%3.1f", val)); - } + obj["GLoad"].setText("G.LOAD " ~ sprintf("%3.1f", val)); }), props.UpdateManager.FromHashValue("gForceDisplay", nil, func(val) { - if ((val == 1 and !obj.displayedGForce) or (val != 0 and obj.displayedGForce)) { - obj.displayedGForce = 1; + if (val) { obj["GLoad"].show(); } else { - obj.displayedGForce = 0; obj["GLoad"].hide(); } }), + props.UpdateManager.FromHashValue("satTemp", 0.5, func(val) { + obj["SAT"].setText(sprintf("%+2.0f", val)); + }), + props.UpdateManager.FromHashValue("tatTemp", 0.5, func(val) { + obj["TAT"].setText(sprintf("%+2.0f", val)); + }), ]; return obj; }, @@ -509,11 +510,6 @@ var canvas_lowerECAMPageFctl = "spoiler5Lf","ailLscale","ailRscale","path4249","path4249-3","path4249-3-6-7","path4249-3-6-7-5","path4249-3-6","pitchTrimStatus","rudderTrimInd"]; }, updateBottom: func(notification) { - foreach(var update_item_bottom; me.updateItemsBottom) - { - update_item_bottom.update(notification); - } - if (fmgc.FMGCInternal.fuelRequest and fmgc.FMGCInternal.blockConfirmed and !fmgc.FMGCInternal.fuelCalculating and notification.FWCPhase != 1) { if (me.units) { me["GW"].setText(sprintf("%s", math.round(fmgc.FMGCInternal.fuelPredGw * 1000 * LBS2KGS, 100))); @@ -527,7 +523,7 @@ var canvas_lowerECAMPageFctl = } if (dmc.DMController.DMCs[1].outputs[4] != nil) { - me["SAT"].setText(sprintf("%+2.0f", dmc.DMController.DMCs[1].outputs[4].getValue())); + notification.satTemp = dmc.DMController.DMCs[1].outputs[4].getValue(); me["SAT"].setColor(0.0509,0.7529,0.2941); } else { me["SAT"].setText(sprintf("%s", "XX")); @@ -535,12 +531,17 @@ var canvas_lowerECAMPageFctl = } if (dmc.DMController.DMCs[1].outputs[5] != nil) { - me["TAT"].setText(sprintf("%+2.0f", dmc.DMController.DMCs[1].outputs[5].getValue())); + notification.tatTemp = dmc.DMController.DMCs[1].outputs[5].getValue(); me["TAT"].setColor(0.0509,0.7529,0.2941); } else { me["TAT"].setText(sprintf("%s", "XX")); me["TAT"].setColor(0.7333,0.3803,0); } + + foreach(var update_item_bottom; me.updateItemsBottom) + { + update_item_bottom.update(notification); + } }, update: func(notification) { me.updatePower(); diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-fuel.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-fuel.nas index 055b4d70..36256a68 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-fuel.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-fuel.nas @@ -450,7 +450,6 @@ var canvas_lowerECAMPageFuel = }), ]; - obj.displayedGForce = 0; obj.updateItemsBottom = [ props.UpdateManager.FromHashValue("acconfigUnits", nil, func(val) { obj.units = val; @@ -460,26 +459,28 @@ var canvas_lowerECAMPageFuel = obj["GW-weight-unit"].setText("LBS"); } }), - props.UpdateManager.FromHashValue("hour", nil, func(val) { + props.UpdateManager.FromHashValue("hour", 1, func(val) { obj["UTCh"].setText(sprintf("%02d", val)); }), - props.UpdateManager.FromHashValue("minute", nil, func(val) { + props.UpdateManager.FromHashValue("minute", 1, func(val) { obj["UTCm"].setText(sprintf("%02d", val)); }), props.UpdateManager.FromHashValue("gForce", 0.05, func(val) { - if (obj.displayedGForce) { - obj["GLoad"].setText("G.LOAD " ~ sprintf("%3.1f", val)); - } + obj["GLoad"].setText("G.LOAD " ~ sprintf("%3.1f", val)); }), props.UpdateManager.FromHashValue("gForceDisplay", nil, func(val) { - if ((val == 1 and !obj.displayedGForce) or (val != 0 and obj.displayedGForce)) { - obj.displayedGForce = 1; + if (val) { obj["GLoad"].show(); } else { - obj.displayedGForce = 0; obj["GLoad"].hide(); } }), + props.UpdateManager.FromHashValue("satTemp", 0.5, func(val) { + obj["SAT"].setText(sprintf("%+2.0f", val)); + }), + props.UpdateManager.FromHashValue("tatTemp", 0.5, func(val) { + obj["TAT"].setText(sprintf("%+2.0f", val)); + }), ]; return obj; }, @@ -495,11 +496,6 @@ var canvas_lowerECAMPageFuel = "Fused-weight-unit","FFlow-weight-unit","FOB-weight-unit","FUEL-ENG-Master-1-Cross","FUEL-ENG-Master-2-Cross","FUEL-Pump-Left-1-Square","FUEL-Pump-Left-2-Square","FUEL-Pump-Center-1-Square","FUEL-Pump-Center-2-Square","FUEL-Pump-Right-1-Square","FUEL-Pump-Right-2-Square"]; }, updateBottom: func(notification) { - foreach(var update_item_bottom; me.updateItemsBottom) - { - update_item_bottom.update(notification); - } - if (fmgc.FMGCInternal.fuelRequest and fmgc.FMGCInternal.blockConfirmed and !fmgc.FMGCInternal.fuelCalculating and notification.FWCPhase != 1) { if (me.units) { me["GW"].setText(sprintf("%s", math.round(fmgc.FMGCInternal.fuelPredGw * 1000 * LBS2KGS, 100))); @@ -513,7 +509,7 @@ var canvas_lowerECAMPageFuel = } if (dmc.DMController.DMCs[1].outputs[4] != nil) { - me["SAT"].setText(sprintf("%+2.0f", dmc.DMController.DMCs[1].outputs[4].getValue())); + notification.satTemp = dmc.DMController.DMCs[1].outputs[4].getValue(); me["SAT"].setColor(0.0509,0.7529,0.2941); } else { me["SAT"].setText(sprintf("%s", "XX")); @@ -521,12 +517,17 @@ var canvas_lowerECAMPageFuel = } if (dmc.DMController.DMCs[1].outputs[5] != nil) { - me["TAT"].setText(sprintf("%+2.0f", dmc.DMController.DMCs[1].outputs[5].getValue())); + notification.tatTemp = dmc.DMController.DMCs[1].outputs[5].getValue(); me["TAT"].setColor(0.0509,0.7529,0.2941); } else { me["TAT"].setText(sprintf("%s", "XX")); me["TAT"].setColor(0.7333,0.3803,0); } + + foreach(var update_item_bottom; me.updateItemsBottom) + { + update_item_bottom.update(notification); + } }, update: func(notification) { me.updatePower(); diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-hyd.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-hyd.nas index 6e51edda..d20ee44b 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-hyd.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-hyd.nas @@ -409,7 +409,6 @@ var canvas_lowerECAMPageHyd = }), ]; - obj.displayedGForce = 0; obj.updateItemsBottom = [ props.UpdateManager.FromHashValue("acconfigUnits", nil, func(val) { obj.units = val; @@ -419,26 +418,28 @@ var canvas_lowerECAMPageHyd = obj["GW-weight-unit"].setText("LBS"); } }), - props.UpdateManager.FromHashValue("hour", nil, func(val) { + props.UpdateManager.FromHashValue("hour", 1, func(val) { obj["UTCh"].setText(sprintf("%02d", val)); }), - props.UpdateManager.FromHashValue("minute", nil, func(val) { + props.UpdateManager.FromHashValue("minute", 1, func(val) { obj["UTCm"].setText(sprintf("%02d", val)); }), props.UpdateManager.FromHashValue("gForce", 0.05, func(val) { - if (obj.displayedGForce) { - obj["GLoad"].setText("G.LOAD " ~ sprintf("%3.1f", val)); - } + obj["GLoad"].setText("G.LOAD " ~ sprintf("%3.1f", val)); }), props.UpdateManager.FromHashValue("gForceDisplay", nil, func(val) { - if ((val == 1 and !obj.displayedGForce) or (val != 0 and obj.displayedGForce)) { - obj.displayedGForce = 1; + if (val) { obj["GLoad"].show(); } else { - obj.displayedGForce = 0; obj["GLoad"].hide(); } }), + props.UpdateManager.FromHashValue("satTemp", 0.5, func(val) { + obj["SAT"].setText(sprintf("%+2.0f", val)); + }), + props.UpdateManager.FromHashValue("tatTemp", 0.5, func(val) { + obj["TAT"].setText(sprintf("%+2.0f", val)); + }), ]; return obj; }, @@ -452,11 +453,6 @@ var canvas_lowerECAMPageHyd = "LO-AIR-PRESS-Yellow","LO-AIR-PRESS-Blue","OVHT-Green","OVHT-Blue","OVHT-Yellow","Quantity-Indicator-Green","Quantity-Indicator-Blue","Quantity-Indicator-Yellow","Green-label","Blue-label","Yellow-label","Fire-Valve-Yellow-Cross","Fire-Valve-Green-Cross","path5561","path5561-4","path5561-5"]; }, updateBottom: func(notification) { - foreach(var update_item_bottom; me.updateItemsBottom) - { - update_item_bottom.update(notification); - } - if (fmgc.FMGCInternal.fuelRequest and fmgc.FMGCInternal.blockConfirmed and !fmgc.FMGCInternal.fuelCalculating and notification.FWCPhase != 1) { if (me.units) { me["GW"].setText(sprintf("%s", math.round(fmgc.FMGCInternal.fuelPredGw * 1000 * LBS2KGS, 100))); @@ -470,7 +466,7 @@ var canvas_lowerECAMPageHyd = } if (dmc.DMController.DMCs[1].outputs[4] != nil) { - me["SAT"].setText(sprintf("%+2.0f", dmc.DMController.DMCs[1].outputs[4].getValue())); + notification.satTemp = dmc.DMController.DMCs[1].outputs[4].getValue(); me["SAT"].setColor(0.0509,0.7529,0.2941); } else { me["SAT"].setText(sprintf("%s", "XX")); @@ -478,12 +474,17 @@ var canvas_lowerECAMPageHyd = } if (dmc.DMController.DMCs[1].outputs[5] != nil) { - me["TAT"].setText(sprintf("%+2.0f", dmc.DMController.DMCs[1].outputs[5].getValue())); + notification.tatTemp = dmc.DMController.DMCs[1].outputs[5].getValue(); me["TAT"].setColor(0.0509,0.7529,0.2941); } else { me["TAT"].setText(sprintf("%s", "XX")); me["TAT"].setColor(0.7333,0.3803,0); } + + foreach(var update_item_bottom; me.updateItemsBottom) + { + update_item_bottom.update(notification); + } }, update: func(notification) { me.updatePower(); diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-press.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-press.nas index ffa558fe..efeb9bc7 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-press.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-press.nas @@ -100,7 +100,6 @@ var canvas_lowerECAMPagePress = }), ]; - obj.displayedGForce = 0; obj.updateItemsBottom = [ props.UpdateManager.FromHashValue("acconfigUnits", nil, func(val) { obj.units = val; @@ -110,26 +109,28 @@ var canvas_lowerECAMPagePress = obj["GW-weight-unit"].setText("LBS"); } }), - props.UpdateManager.FromHashValue("hour", nil, func(val) { + props.UpdateManager.FromHashValue("hour", 1, func(val) { obj["UTCh"].setText(sprintf("%02d", val)); }), - props.UpdateManager.FromHashValue("minute", nil, func(val) { + props.UpdateManager.FromHashValue("minute", 1, func(val) { obj["UTCm"].setText(sprintf("%02d", val)); }), props.UpdateManager.FromHashValue("gForce", 0.05, func(val) { - if (obj.displayedGForce) { - obj["GLoad"].setText("G.LOAD " ~ sprintf("%3.1f", val)); - } + obj["GLoad"].setText("G.LOAD " ~ sprintf("%3.1f", val)); }), props.UpdateManager.FromHashValue("gForceDisplay", nil, func(val) { - if ((val == 1 and !obj.displayedGForce) or (val != 0 and obj.displayedGForce)) { - obj.displayedGForce = 1; + if (val) { obj["GLoad"].show(); } else { - obj.displayedGForce = 0; obj["GLoad"].hide(); } }), + props.UpdateManager.FromHashValue("satTemp", 0.5, func(val) { + obj["SAT"].setText(sprintf("%+2.0f", val)); + }), + props.UpdateManager.FromHashValue("tatTemp", 0.5, func(val) { + obj["TAT"].setText(sprintf("%+2.0f", val)); + }), ]; return obj; }, @@ -142,11 +143,6 @@ var canvas_lowerECAMPagePress = "PRESS-Pack-1","PRESS-Pack-2"]; }, updateBottom: func(notification) { - foreach(var update_item_bottom; me.updateItemsBottom) - { - update_item_bottom.update(notification); - } - if (fmgc.FMGCInternal.fuelRequest and fmgc.FMGCInternal.blockConfirmed and !fmgc.FMGCInternal.fuelCalculating and notification.FWCPhase != 1) { if (me.units) { me["GW"].setText(sprintf("%s", math.round(fmgc.FMGCInternal.fuelPredGw * 1000 * LBS2KGS, 100))); @@ -160,7 +156,7 @@ var canvas_lowerECAMPagePress = } if (dmc.DMController.DMCs[1].outputs[4] != nil) { - me["SAT"].setText(sprintf("%+2.0f", dmc.DMController.DMCs[1].outputs[4].getValue())); + notification.satTemp = dmc.DMController.DMCs[1].outputs[4].getValue(); me["SAT"].setColor(0.0509,0.7529,0.2941); } else { me["SAT"].setText(sprintf("%s", "XX")); @@ -168,12 +164,17 @@ var canvas_lowerECAMPagePress = } if (dmc.DMController.DMCs[1].outputs[5] != nil) { - me["TAT"].setText(sprintf("%+2.0f", dmc.DMController.DMCs[1].outputs[5].getValue())); + notification.tatTemp = dmc.DMController.DMCs[1].outputs[5].getValue(); me["TAT"].setColor(0.0509,0.7529,0.2941); } else { me["TAT"].setText(sprintf("%s", "XX")); me["TAT"].setColor(0.7333,0.3803,0); } + + foreach(var update_item_bottom; me.updateItemsBottom) + { + update_item_bottom.update(notification); + } }, update: func(notification) { me.updatePower(); diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-sts.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-sts.nas index b1eec1b5..09923b22 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-sts.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-sts.nas @@ -25,7 +25,6 @@ var canvas_lowerECAMPageSts = obj.update_items = [ ]; - obj.displayedGForce = 0; obj.updateItemsBottom = [ props.UpdateManager.FromHashValue("acconfigUnits", nil, func(val) { obj.units = val; @@ -35,26 +34,28 @@ var canvas_lowerECAMPageSts = obj["GW-weight-unit"].setText("LBS"); } }), - props.UpdateManager.FromHashValue("hour", nil, func(val) { + props.UpdateManager.FromHashValue("hour", 1, func(val) { obj["UTCh"].setText(sprintf("%02d", val)); }), - props.UpdateManager.FromHashValue("minute", nil, func(val) { + props.UpdateManager.FromHashValue("minute", 1, func(val) { obj["UTCm"].setText(sprintf("%02d", val)); }), props.UpdateManager.FromHashValue("gForce", 0.05, func(val) { - if (obj.displayedGForce) { - obj["GLoad"].setText("G.LOAD " ~ sprintf("%3.1f", val)); - } + obj["GLoad"].setText("G.LOAD " ~ sprintf("%3.1f", val)); }), props.UpdateManager.FromHashValue("gForceDisplay", nil, func(val) { - if ((val == 1 and !obj.displayedGForce) or (val != 0 and obj.displayedGForce)) { - obj.displayedGForce = 1; + if (val) { obj["GLoad"].show(); } else { - obj.displayedGForce = 0; obj["GLoad"].hide(); } }), + props.UpdateManager.FromHashValue("satTemp", 0.5, func(val) { + obj["SAT"].setText(sprintf("%+2.0f", val)); + }), + props.UpdateManager.FromHashValue("tatTemp", 0.5, func(val) { + obj["TAT"].setText(sprintf("%+2.0f", val)); + }), ]; return obj; }, @@ -65,13 +66,9 @@ var canvas_lowerECAMPageSts = return["Bulk","BulkLine","BulkLbl","Exit1L","Exit1R","Cabin1Left","Cabin1LeftLbl","Cabin1LeftLine","Cabin1LeftSlide","Cabin1Right","Cabin1RightLbl","Cabin1RightLine","Cabin1RightSlide","Cabin2Left","Cabin2LeftLbl", "Cabin2LeftLine","Cabin2LeftSlide","Cabin2Right","Cabin2RightLbl","Cabin2RightLine","Cabin2RightSlide","Cabin3Left","Cabin3LeftLbl","Cabin3LeftLine","Cabin3LeftSlide","Cabin3Right","Cabin3RightLbl","Cabin3RightLine","Cabin3RightSlide","AvionicsLine1", "AvionicsLbl1","AvionicsLine2","AvionicsLbl2","Cargo1Line","Cargo1Lbl","Cargo1Door","Cargo2Line","Cargo2Lbl","Cargo2Door","ExitLSlide","ExitLLine","ExitLLbl","ExitRSlide","ExitRLine","ExitRLbl","Cabin4Left","Cabin4LeftLbl","Cabin4LeftLine", - "Cabin4LeftSlide","Cabin4Right","Cabin4RightLbl","Cabin4RightLine","Cabin4RightSlide","DOOROXY-REGUL-LO-PR"];}, + "Cabin4LeftSlide","Cabin4Right","Cabin4RightLbl","Cabin4RightLine","Cabin4RightSlide","DOOROXY-REGUL-LO-PR"]; + }, updateBottom: func(notification) { - foreach(var update_item_bottom; me.updateItemsBottom) - { - update_item_bottom.update(notification); - } - if (fmgc.FMGCInternal.fuelRequest and fmgc.FMGCInternal.blockConfirmed and !fmgc.FMGCInternal.fuelCalculating and notification.FWCPhase != 1) { if (me.units) { me["GW"].setText(sprintf("%s", math.round(fmgc.FMGCInternal.fuelPredGw * 1000 * LBS2KGS, 100))); @@ -85,7 +82,7 @@ var canvas_lowerECAMPageSts = } if (dmc.DMController.DMCs[1].outputs[4] != nil) { - me["SAT"].setText(sprintf("%+2.0f", dmc.DMController.DMCs[1].outputs[4].getValue())); + notification.satTemp = dmc.DMController.DMCs[1].outputs[4].getValue(); me["SAT"].setColor(0.0509,0.7529,0.2941); } else { me["SAT"].setText(sprintf("%s", "XX")); @@ -93,12 +90,17 @@ var canvas_lowerECAMPageSts = } if (dmc.DMController.DMCs[1].outputs[5] != nil) { - me["TAT"].setText(sprintf("%+2.0f", dmc.DMController.DMCs[1].outputs[5].getValue())); + notification.tatTemp = dmc.DMController.DMCs[1].outputs[5].getValue(); me["TAT"].setColor(0.0509,0.7529,0.2941); } else { me["TAT"].setText(sprintf("%s", "XX")); me["TAT"].setColor(0.7333,0.3803,0); } + + foreach(var update_item_bottom; me.updateItemsBottom) + { + update_item_bottom.update(notification); + } }, update: func(notification) { me.updatePower(); diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-wheel.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-wheel.nas index 2d9063c9..75c18272 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-wheel.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-wheel.nas @@ -584,7 +584,6 @@ var canvas_lowerECAMPageWheel = }), ]; - obj.displayedGForce = 0; obj.updateItemsBottom = [ props.UpdateManager.FromHashValue("acconfigUnits", nil, func(val) { obj.units = val; @@ -594,26 +593,28 @@ var canvas_lowerECAMPageWheel = obj["GW-weight-unit"].setText("LBS"); } }), - props.UpdateManager.FromHashValue("hour", nil, func(val) { + props.UpdateManager.FromHashValue("hour", 1, func(val) { obj["UTCh"].setText(sprintf("%02d", val)); }), - props.UpdateManager.FromHashValue("minute", nil, func(val) { + props.UpdateManager.FromHashValue("minute", 1, func(val) { obj["UTCm"].setText(sprintf("%02d", val)); }), props.UpdateManager.FromHashValue("gForce", 0.05, func(val) { - if (obj.displayedGForce) { - obj["GLoad"].setText("G.LOAD " ~ sprintf("%3.1f", val)); - } + obj["GLoad"].setText("G.LOAD " ~ sprintf("%3.1f", val)); }), props.UpdateManager.FromHashValue("gForceDisplay", nil, func(val) { - if ((val == 1 and !obj.displayedGForce) or (val != 0 and obj.displayedGForce)) { - obj.displayedGForce = 1; + if (val) { obj["GLoad"].show(); } else { - obj.displayedGForce = 0; obj["GLoad"].hide(); } }), + props.UpdateManager.FromHashValue("satTemp", 0.5, func(val) { + obj["SAT"].setText(sprintf("%+2.0f", val)); + }), + props.UpdateManager.FromHashValue("tatTemp", 0.5, func(val) { + obj["TAT"].setText(sprintf("%+2.0f", val)); + }), ]; return obj; }, @@ -632,11 +633,6 @@ var canvas_lowerECAMPageWheel = "releaseL3","releaseL4","releaseR3","releaseR4"]; }, updateBottom: func(notification) { - foreach(var update_item_bottom; me.updateItemsBottom) - { - update_item_bottom.update(notification); - } - if (fmgc.FMGCInternal.fuelRequest and fmgc.FMGCInternal.blockConfirmed and !fmgc.FMGCInternal.fuelCalculating and notification.FWCPhase != 1) { if (me.units) { me["GW"].setText(sprintf("%s", math.round(fmgc.FMGCInternal.fuelPredGw * 1000 * LBS2KGS, 100))); @@ -650,7 +646,7 @@ var canvas_lowerECAMPageWheel = } if (dmc.DMController.DMCs[1].outputs[4] != nil) { - me["SAT"].setText(sprintf("%+2.0f", dmc.DMController.DMCs[1].outputs[4].getValue())); + notification.satTemp = dmc.DMController.DMCs[1].outputs[4].getValue(); me["SAT"].setColor(0.0509,0.7529,0.2941); } else { me["SAT"].setText(sprintf("%s", "XX")); @@ -658,12 +654,17 @@ var canvas_lowerECAMPageWheel = } if (dmc.DMController.DMCs[1].outputs[5] != nil) { - me["TAT"].setText(sprintf("%+2.0f", dmc.DMController.DMCs[1].outputs[5].getValue())); + notification.tatTemp = dmc.DMController.DMCs[1].outputs[5].getValue(); me["TAT"].setColor(0.0509,0.7529,0.2941); } else { me["TAT"].setText(sprintf("%s", "XX")); me["TAT"].setColor(0.7333,0.3803,0); } + + foreach(var update_item_bottom; me.updateItemsBottom) + { + update_item_bottom.update(notification); + } }, update: func(notification) { me.updatePower(); From 82a8622fc592c8dfbc516fc3f8f006fbcabd22d4 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Tue, 19 Apr 2022 22:10:54 +0100 Subject: [PATCH 05/33] Rewrite APU page to improve efficiency (proof of concept for future updates). 25% improvement in average update time + considerably reduce frequency and magnitude of update spikes --- .../Instruments/Lower-ECAM/Lower-ECAM-APU.nas | 207 ++++++++++-------- .../Lower-ECAM/Lower-ECAM-bleed.nas | 12 +- .../Lower-ECAM/Lower-ECAM-cond.nas | 4 +- .../Lower-ECAM/Lower-ECAM-cruise.nas | 4 +- .../Lower-ECAM/Lower-ECAM-door.nas | 4 +- .../Lower-ECAM/Lower-ECAM-elec.nas | 4 +- .../Instruments/Lower-ECAM/Lower-ECAM-eng.nas | 4 +- .../Lower-ECAM/Lower-ECAM-fctl.nas | 4 +- .../Lower-ECAM/Lower-ECAM-fuel.nas | 4 +- .../Instruments/Lower-ECAM/Lower-ECAM-hyd.nas | 10 +- .../Lower-ECAM/Lower-ECAM-press.nas | 4 +- .../Instruments/Lower-ECAM/Lower-ECAM-sts.nas | 4 +- .../Lower-ECAM/Lower-ECAM-wheel.nas | 4 +- 13 files changed, 152 insertions(+), 117 deletions(-) diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-APU.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-APU.nas index d9ccaecb..6d5bf7c2 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-APU.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-APU.nas @@ -26,46 +26,15 @@ var canvas_lowerECAMPageApu = # init obj["APUGenOff"].hide(); + obj.apuADRState = 0; + obj.apuBleedPsi = 0.0; + obj.apuEgt = 0.0; + obj.apuOilLevelLow = 0; + obj.showApuParams = 0; obj.update_items = [ - props.UpdateManager.FromHashValue("apuFlap",1, func(val) { - if (val) { - obj["APUFlapOpen"].show(); - } else { - obj["APUFlapOpen"].hide(); - } - }), - props.UpdateManager.FromHashValue("apuNeedleRot",0.1, func(val) { - obj["APUN-needle"].setRotation((val + 90) * D2R); - }), - props.UpdateManager.FromHashValue("apuEgtRot",0.1, func(val) { - obj["APUEGT-needle"].setRotation((val + 90) * D2R); - }), - props.UpdateManager.FromHashValue("apuAvailable", nil, func(val) { - if (val) { - obj["APUAvail"].show(); - } else { - obj["APUAvail"].hide(); - } - }), - props.UpdateManager.FromHashList(["apuRpm","apuEgt","apuMaster","apuGenPB"], nil, func(val) { - if (val.apuRpm > 0.001) { - obj["APUN"].setColor(0.0509,0.7529,0.2941); - obj["APUN"].setText(sprintf("%s", math.round(val.apuRpm))); - obj["APUN-needle"].show(); - obj["APUEGT"].setColor(0.0509,0.7529,0.2941); - obj["APUEGT"].setText(sprintf("%s", math.round(val.apuEgt, 5))); - obj["APUEGT-needle"].show(); - } else { - obj["APUN"].setColor(0.7333,0.3803,0); - obj["APUN"].setText(sprintf("%s", "XX")); - obj["APUN-needle"].hide(); - obj["APUEGT"].setColor(0.7333,0.3803,0); - obj["APUEGT"].setText(sprintf("%s", "XX")); - obj["APUEGT-needle"].hide(); - } - - if (val.apuMaster or val.apuRpm >= 94.9) { + props.UpdateManager.FromHashList(["apuAvailable","apuMaster","apuGenPB"], nil, func(val) { + if (val.apuMaster or val.apuAvailable) { obj["APUGenbox"].show(); if (val.apuGenPB) { obj["APUGenOff"].hide(); @@ -104,34 +73,61 @@ var canvas_lowerECAMPageApu = obj["APUfuelLO"].hide(); } }), - props.UpdateManager.FromHashList(["apuRpm","apuOilLevel","gear0Wow"], nil, func(val) { - if (val.apuRpm >= 94.9 and val.gear0Wow and val.apuOilLevel < 3.69) { - obj["APU-low-oil"].show(); + + + props.UpdateManager.FromHashValue("apuAdr", 0.5, func(val) { + obj.apuADRState = val; + }), + props.UpdateManager.FromHashValue("apuAvailable", nil, func(val) { + if (val) { + obj["APUAvail"].show(); } else { - obj["APU-low-oil"].hide(); + obj["APUAvail"].hide(); } }), - props.UpdateManager.FromHashList(["apuAdr","apuPsi","apuRpm"], nil, func(val) { - if (val.apuAdr and val.apuRpm > 0.001) { - obj["APUBleedPSI"].setColor(0.0509,0.7529,0.2941); - obj["APUBleedPSI"].setText(sprintf("%s", math.round(val.apuPsi))); + props.UpdateManager.FromHashValue("apuBleedValvePos", 0.1, func(val) { + if (val >= 0.9) { + obj["APUBleedValve"].setRotation(90 * D2R); + obj["APUBleedOnline"].show(); } else { - obj["APUBleedPSI"].setColor(0.7333,0.3803,0); - obj["APUBleedPSI"].setText(sprintf("%s", "XX")); + obj["APUBleedValve"].setRotation(0); + obj["APUBleedOnline"].hide(); } }), - props.UpdateManager.FromHashValue("apuLoad", 0.1, func(val) { - obj["APUGenLoad"].setText(sprintf("%s", math.round(val))); - - if (val <= 100) { - obj["APUGenHz"].setColor(0.0509,0.7529,0.2941); + props.UpdateManager.FromHashValue("apuBleedValvePositionsMatch", 1, func(val) { + if (val) { + obj["APUBleedValveCrossBar"].setColor(0.0509,0.7529,0.2941); + obj["APUBleedValveCrossBar"].setColorFill(0.0509,0.7529,0.2941); + obj["APUBleedValve"].setColor(0.0509,0.7529,0.2941); } else { - obj["APUGenHz"].setColor(0.7333,0.3803,0); + obj["APUBleedValveCrossBar"].setColor(0.7333,0.3803,0); + obj["APUBleedValveCrossBar"].setColorFill(0.7333,0.3803,0); + obj["APUBleedValve"].setColor(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashValue("apuHertz", 1, func(val) { - if (val == 0) { - obj["APUGenHz"].setText(sprintf("XX")); + props.UpdateManager.FromHashValue("apuEgt", 0.05, func(val) { + obj.apuEgt = sprintf("%s", math.round(val, 5)); + }), + props.UpdateManager.FromHashValue("apuEgtRot", 0.1, func(val) { + obj["APUEGT-needle"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("apuFlap", 1, func(val) { + if (val) { + obj["APUFlapOpen"].show(); + } else { + obj["APUFlapOpen"].hide(); + } + }), + props.UpdateManager.FromHashValue("apuGLC", nil, func(val) { + if (val) { + obj["APUGenOnline"].show(); + } else { + obj["APUGenOnline"].hide(); + } + }), + props.UpdateManager.FromHashValue("apuHertz", 0.5, func(val) { + if (val < 0.5) { + obj["APUGenHz"].setText("XX"); } else { obj["APUGenHz"].setText(sprintf("%s", math.round(val))); } @@ -142,7 +138,46 @@ var canvas_lowerECAMPageApu = obj["APUGenHz"].setColor(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashValue("apuVolt", 0.1, func(val) { + props.UpdateManager.FromHashValue("apuLoad", 0.5, func(val) { + obj["APUGenLoad"].setText(sprintf("%s", math.round(val))); + + if (val <= 100) { + obj["APUGenLoad"].setColor(0.0509,0.7529,0.2941); + } else { + obj["APUGenLoad"].setColor(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashValue("apuNeedleRot", 0.1, func(val) { + obj["APUN-needle"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("apuOilLevel", 0.05, func(val) { + if (val < 3.7) { + obj.apuOilLevelLow = 1; + } else { + obj.apuOilLevelLow = 0; + } + }), + props.UpdateManager.FromHashValue("apuPsi", 0.5, func(val) { + obj.apuBleedPsi = sprintf("%s", math.round(val)); + }), + props.UpdateManager.FromHashValue("apuRpm", 0.5, func(val) { + if (val >= 0.5) { + obj["APUN"].setColor(0.0509,0.7529,0.2941); + obj["APUEGT"].setColor(0.0509,0.7529,0.2941); + obj["APUN-needle"].show(); + obj["APUEGT-needle"].show(); + obj["APUN"].setText(sprintf("%s", math.round(val))); + obj.showApuParams = 1; + } else { + obj["APUN"].setColor(0.7333,0.3803,0); + obj["APUEGT"].setColor(0.7333,0.3803,0); + obj["APUN-needle"].hide(); + obj["APUEGT-needle"].hide(); + obj["APUN"].setText("XX"); + obj.showApuParams = 0; + } + }), + props.UpdateManager.FromHashValue("apuVolt", 0.5, func(val) { obj["APUGenVolt"].setText(sprintf("%s", math.round(val))); if (val >= 110 and val <= 120) { @@ -151,32 +186,6 @@ var canvas_lowerECAMPageApu = obj["APUGenVolt"].setColor(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashValue("apuGLC", nil, func(val) { - if (val) { - obj["APUGenOnline"].show(); - } else { - obj["APUGenOnline"].hide(); - } - }), - props.UpdateManager.FromHashList(["apuBleedValvePos","apuBleedValveCmd"], nil, func(val) { - if (val.apuBleedValvePos == 1) { - obj["APUBleedValve"].setRotation(90 * D2R); - obj["APUBleedOnline"].show(); - } else { - obj["APUBleedValve"].setRotation(0); - obj["APUBleedOnline"].hide(); - } - - if (val.apuBleedValveCmd == val.apuBleedValvePos) { - obj["APUBleedValveCrossBar"].setColor(0.0509,0.7529,0.2941); - obj["APUBleedValveCrossBar"].setColorFill(0.0509,0.7529,0.2941); - obj["APUBleedValve"].setColor(0.0509,0.7529,0.2941); - } else { - obj["APUBleedValveCrossBar"].setColor(0.7333,0.3803,0); - obj["APUBleedValveCrossBar"].setColorFill(0.7333,0.3803,0); - obj["APUBleedValve"].setColor(0.7333,0.3803,0); - } - }), ]; obj.updateItemsBottom = [ @@ -236,7 +245,7 @@ var canvas_lowerECAMPageApu = notification.satTemp = dmc.DMController.DMCs[1].outputs[4].getValue(); me["SAT"].setColor(0.0509,0.7529,0.2941); } else { - me["SAT"].setText(sprintf("%s", "XX")); + me["SAT"].setText("XX"); me["SAT"].setColor(0.7333,0.3803,0); } @@ -244,7 +253,7 @@ var canvas_lowerECAMPageApu = notification.tatTemp = dmc.DMController.DMCs[1].outputs[5].getValue(); me["TAT"].setColor(0.0509,0.7529,0.2941); } else { - me["TAT"].setText(sprintf("%s", "XX")); + me["TAT"].setText("XX"); me["TAT"].setColor(0.7333,0.3803,0); } @@ -264,11 +273,37 @@ var canvas_lowerECAMPageApu = return; } + if ((notification.apuBleedValveCmd >= 0.95 and notification.apuBleedValvePos) or (notification.apuBleedValveCmd <= 0.05 and !notification.apuBleedValvePos)) { + notification.apuBleedValvePositionsMatch = 1; + } else { + notification.apuBleedValvePositionsMatch = 0; + } + foreach(var update_item; me.update_items) { update_item.update(notification); } + if (me.showApuParams) { + me["APUEGT"].setText(me.apuEgt); + } else { + me["APUEGT"].setText("XX"); + } + + if (notification.apuAvailable and notification.gear0Wow and me.apuOilLevelLow) { + me["APU-low-oil"].show(); + } else { + me["APU-low-oil"].hide(); + } + + if (me.apuADRState and me.showApuParams) { + me["APUBleedPSI"].setColor(0.0509,0.7529,0.2941); + me["APUBleedPSI"].setText(me.apuBleedPsi); + } else { + me["APUBleedPSI"].setColor(0.7333,0.3803,0); + me["APUBleedPSI"].setText("XX"); + } + me.updateBottom(notification); }, updatePower: func() { diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-bleed.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-bleed.nas index 5170ca4e..c434b232 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-bleed.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-bleed.nas @@ -153,7 +153,7 @@ var canvas_lowerECAMPageBleed = obj["BLEED-Precooler-1-Inlet-Press"].setColor(0.0509,0.7529,0.2941); } } else { - obj["BLEED-Precooler-1-Inlet-Press"].setText(sprintf("%s", "XX")); + obj["BLEED-Precooler-1-Inlet-Press"].setText("XX"); obj["BLEED-Precooler-1-Inlet-Press"].setColor(0.7333,0.3803,0); } }), @@ -171,7 +171,7 @@ var canvas_lowerECAMPageBleed = obj["BLEED-Precooler-2-Inlet-Press"].setColor(0.0509,0.7529,0.2941); } } else { - obj["BLEED-Precooler-2-Inlet-Press"].setText(sprintf("%s", "XX")); + obj["BLEED-Precooler-2-Inlet-Press"].setText("XX"); obj["BLEED-Precooler-2-Inlet-Press"].setColor(0.7333,0.3803,0); } }), @@ -189,7 +189,7 @@ var canvas_lowerECAMPageBleed = obj["BLEED-Precooler-1-Outlet-Temp"].setColor(0.0509,0.7529,0.2941); } } else { - obj["BLEED-Precooler-1-Outlet-Temp"].setText(sprintf("%s", "XX")); + obj["BLEED-Precooler-1-Outlet-Temp"].setText("XX"); obj["BLEED-Precooler-1-Outlet-Temp"].setColor(0.7333,0.3803,0); } }), @@ -207,7 +207,7 @@ var canvas_lowerECAMPageBleed = obj["BLEED-Precooler-2-Outlet-Temp"].setColor(0.0509,0.7529,0.2941); } } else { - obj["BLEED-Precooler-2-Outlet-Temp"].setText(sprintf("%s", "XX")); + obj["BLEED-Precooler-2-Outlet-Temp"].setText("XX"); obj["BLEED-Precooler-2-Outlet-Temp"].setColor(0.7333,0.3803,0); } }), @@ -453,7 +453,7 @@ var canvas_lowerECAMPageBleed = notification.satTemp = dmc.DMController.DMCs[1].outputs[4].getValue(); me["SAT"].setColor(0.0509,0.7529,0.2941); } else { - me["SAT"].setText(sprintf("%s", "XX")); + me["SAT"].setText("XX"); me["SAT"].setColor(0.7333,0.3803,0); } @@ -461,7 +461,7 @@ var canvas_lowerECAMPageBleed = notification.tatTemp = dmc.DMController.DMCs[1].outputs[5].getValue(); me["TAT"].setColor(0.0509,0.7529,0.2941); } else { - me["TAT"].setText(sprintf("%s", "XX")); + me["TAT"].setText("XX"); me["TAT"].setColor(0.7333,0.3803,0); } diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-cond.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-cond.nas index e5f224b9..f68ea461 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-cond.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-cond.nas @@ -134,7 +134,7 @@ var canvas_lowerECAMPageCond = notification.satTemp = dmc.DMController.DMCs[1].outputs[4].getValue(); me["SAT"].setColor(0.0509,0.7529,0.2941); } else { - me["SAT"].setText(sprintf("%s", "XX")); + me["SAT"].setText("XX"); me["SAT"].setColor(0.7333,0.3803,0); } @@ -142,7 +142,7 @@ var canvas_lowerECAMPageCond = notification.tatTemp = dmc.DMController.DMCs[1].outputs[5].getValue(); me["TAT"].setColor(0.0509,0.7529,0.2941); } else { - me["TAT"].setText(sprintf("%s", "XX")); + me["TAT"].setText("XX"); me["TAT"].setColor(0.7333,0.3803,0); } diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-cruise.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-cruise.nas index 461f81c9..4fb900c9 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-cruise.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-cruise.nas @@ -194,7 +194,7 @@ var canvas_lowerECAMPageCruise = notification.satTemp = dmc.DMController.DMCs[1].outputs[4].getValue(); me["SAT"].setColor(0.0509,0.7529,0.2941); } else { - me["SAT"].setText(sprintf("%s", "XX")); + me["SAT"].setText("XX"); me["SAT"].setColor(0.7333,0.3803,0); } @@ -202,7 +202,7 @@ var canvas_lowerECAMPageCruise = notification.tatTemp = dmc.DMController.DMCs[1].outputs[5].getValue(); me["TAT"].setColor(0.0509,0.7529,0.2941); } else { - me["TAT"].setText(sprintf("%s", "XX")); + me["TAT"].setText("XX"); me["TAT"].setColor(0.7333,0.3803,0); } diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-door.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-door.nas index cac1a656..3f62927e 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-door.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-door.nas @@ -261,7 +261,7 @@ var canvas_lowerECAMPageDoor = notification.satTemp = dmc.DMController.DMCs[1].outputs[4].getValue(); me["SAT"].setColor(0.0509,0.7529,0.2941); } else { - me["SAT"].setText(sprintf("%s", "XX")); + me["SAT"].setText("XX"); me["SAT"].setColor(0.7333,0.3803,0); } @@ -269,7 +269,7 @@ var canvas_lowerECAMPageDoor = notification.tatTemp = dmc.DMController.DMCs[1].outputs[5].getValue(); me["TAT"].setColor(0.0509,0.7529,0.2941); } else { - me["TAT"].setText(sprintf("%s", "XX")); + me["TAT"].setText("XX"); me["TAT"].setColor(0.7333,0.3803,0); } diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-elec.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-elec.nas index 252588d4..8c49170d 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-elec.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-elec.nas @@ -731,7 +731,7 @@ var canvas_lowerECAMPageElec = notification.satTemp = dmc.DMController.DMCs[1].outputs[4].getValue(); me["SAT"].setColor(0.0509,0.7529,0.2941); } else { - me["SAT"].setText(sprintf("%s", "XX")); + me["SAT"].setText("XX"); me["SAT"].setColor(0.7333,0.3803,0); } @@ -739,7 +739,7 @@ var canvas_lowerECAMPageElec = notification.tatTemp = dmc.DMController.DMCs[1].outputs[5].getValue(); me["TAT"].setColor(0.0509,0.7529,0.2941); } else { - me["TAT"].setText(sprintf("%s", "XX")); + me["TAT"].setText("XX"); me["TAT"].setColor(0.7333,0.3803,0); } diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-eng.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-eng.nas index 701cbd94..118477a2 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-eng.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-eng.nas @@ -189,7 +189,7 @@ var canvas_lowerECAMPageEng = notification.satTemp = dmc.DMController.DMCs[1].outputs[4].getValue(); me["SAT"].setColor(0.0509,0.7529,0.2941); } else { - me["SAT"].setText(sprintf("%s", "XX")); + me["SAT"].setText("XX"); me["SAT"].setColor(0.7333,0.3803,0); } @@ -197,7 +197,7 @@ var canvas_lowerECAMPageEng = notification.tatTemp = dmc.DMController.DMCs[1].outputs[5].getValue(); me["TAT"].setColor(0.0509,0.7529,0.2941); } else { - me["TAT"].setText(sprintf("%s", "XX")); + me["TAT"].setText("XX"); me["TAT"].setColor(0.7333,0.3803,0); } diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-fctl.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-fctl.nas index 8641ea12..5bea9135 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-fctl.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-fctl.nas @@ -526,7 +526,7 @@ var canvas_lowerECAMPageFctl = notification.satTemp = dmc.DMController.DMCs[1].outputs[4].getValue(); me["SAT"].setColor(0.0509,0.7529,0.2941); } else { - me["SAT"].setText(sprintf("%s", "XX")); + me["SAT"].setText("XX"); me["SAT"].setColor(0.7333,0.3803,0); } @@ -534,7 +534,7 @@ var canvas_lowerECAMPageFctl = notification.tatTemp = dmc.DMController.DMCs[1].outputs[5].getValue(); me["TAT"].setColor(0.0509,0.7529,0.2941); } else { - me["TAT"].setText(sprintf("%s", "XX")); + me["TAT"].setText("XX"); me["TAT"].setColor(0.7333,0.3803,0); } diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-fuel.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-fuel.nas index 36256a68..d9acc89d 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-fuel.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-fuel.nas @@ -512,7 +512,7 @@ var canvas_lowerECAMPageFuel = notification.satTemp = dmc.DMController.DMCs[1].outputs[4].getValue(); me["SAT"].setColor(0.0509,0.7529,0.2941); } else { - me["SAT"].setText(sprintf("%s", "XX")); + me["SAT"].setText("XX"); me["SAT"].setColor(0.7333,0.3803,0); } @@ -520,7 +520,7 @@ var canvas_lowerECAMPageFuel = notification.tatTemp = dmc.DMController.DMCs[1].outputs[5].getValue(); me["TAT"].setColor(0.0509,0.7529,0.2941); } else { - me["TAT"].setText(sprintf("%s", "XX")); + me["TAT"].setText("XX"); me["TAT"].setColor(0.7333,0.3803,0); } diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-hyd.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-hyd.nas index d20ee44b..0666cf96 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-hyd.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-hyd.nas @@ -63,7 +63,7 @@ var canvas_lowerECAMPageHyd = obj["Blue-label"].setColor(0.7333,0.3803,0); } } else { - obj["Press-Blue"].setText(sprintf("%s", "XX")); + obj["Press-Blue"].setText("XX"); obj["Blue-Line"].setColor(0.7333,0.3803,0); obj["Blue-Line"].setColorFill(0.7333,0.3803,0); obj["Blue-Line-Top"].setColorFill(0.7333,0.3803,0); @@ -101,7 +101,7 @@ var canvas_lowerECAMPageHyd = obj["Yellow-label"].setColor(0.7333,0.3803,0); } } else { - obj["Press-Yellow"].setText(sprintf("%s", "XX")); + obj["Press-Yellow"].setText("XX"); obj["Yellow-Line"].setColor(0.7333,0.3803,0); obj["Yellow-Line"].setColorFill(0.7333,0.3803,0); obj["Yellow-Line-Top"].setColorFill(0.7333,0.3803,0); @@ -140,7 +140,7 @@ var canvas_lowerECAMPageHyd = obj["Green-label"].setColor(0.7333,0.3803,0); } } else { - obj["Press-Green"].setText(sprintf("%s", "XX")); + obj["Press-Green"].setText("XX"); obj["Green-Line"].setColor(0.7333,0.3803,0); obj["Green-Line"].setColorFill(0.7333,0.3803,0); obj["Green-Line-Top"].setColorFill(0.7333,0.3803,0); @@ -469,7 +469,7 @@ var canvas_lowerECAMPageHyd = notification.satTemp = dmc.DMController.DMCs[1].outputs[4].getValue(); me["SAT"].setColor(0.0509,0.7529,0.2941); } else { - me["SAT"].setText(sprintf("%s", "XX")); + me["SAT"].setText("XX"); me["SAT"].setColor(0.7333,0.3803,0); } @@ -477,7 +477,7 @@ var canvas_lowerECAMPageHyd = notification.tatTemp = dmc.DMController.DMCs[1].outputs[5].getValue(); me["TAT"].setColor(0.0509,0.7529,0.2941); } else { - me["TAT"].setText(sprintf("%s", "XX")); + me["TAT"].setText("XX"); me["TAT"].setColor(0.7333,0.3803,0); } diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-press.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-press.nas index efeb9bc7..de038111 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-press.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-press.nas @@ -159,7 +159,7 @@ var canvas_lowerECAMPagePress = notification.satTemp = dmc.DMController.DMCs[1].outputs[4].getValue(); me["SAT"].setColor(0.0509,0.7529,0.2941); } else { - me["SAT"].setText(sprintf("%s", "XX")); + me["SAT"].setText("XX"); me["SAT"].setColor(0.7333,0.3803,0); } @@ -167,7 +167,7 @@ var canvas_lowerECAMPagePress = notification.tatTemp = dmc.DMController.DMCs[1].outputs[5].getValue(); me["TAT"].setColor(0.0509,0.7529,0.2941); } else { - me["TAT"].setText(sprintf("%s", "XX")); + me["TAT"].setText("XX"); me["TAT"].setColor(0.7333,0.3803,0); } diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-sts.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-sts.nas index 09923b22..83bb50d1 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-sts.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-sts.nas @@ -85,7 +85,7 @@ var canvas_lowerECAMPageSts = notification.satTemp = dmc.DMController.DMCs[1].outputs[4].getValue(); me["SAT"].setColor(0.0509,0.7529,0.2941); } else { - me["SAT"].setText(sprintf("%s", "XX")); + me["SAT"].setText("XX"); me["SAT"].setColor(0.7333,0.3803,0); } @@ -93,7 +93,7 @@ var canvas_lowerECAMPageSts = notification.tatTemp = dmc.DMController.DMCs[1].outputs[5].getValue(); me["TAT"].setColor(0.0509,0.7529,0.2941); } else { - me["TAT"].setText(sprintf("%s", "XX")); + me["TAT"].setText("XX"); me["TAT"].setColor(0.7333,0.3803,0); } diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-wheel.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-wheel.nas index 75c18272..ababca41 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-wheel.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-wheel.nas @@ -649,7 +649,7 @@ var canvas_lowerECAMPageWheel = notification.satTemp = dmc.DMController.DMCs[1].outputs[4].getValue(); me["SAT"].setColor(0.0509,0.7529,0.2941); } else { - me["SAT"].setText(sprintf("%s", "XX")); + me["SAT"].setText("XX"); me["SAT"].setColor(0.7333,0.3803,0); } @@ -657,7 +657,7 @@ var canvas_lowerECAMPageWheel = notification.tatTemp = dmc.DMController.DMCs[1].outputs[5].getValue(); me["TAT"].setColor(0.0509,0.7529,0.2941); } else { - me["TAT"].setText(sprintf("%s", "XX")); + me["TAT"].setText("XX"); me["TAT"].setColor(0.7333,0.3803,0); } From 91891e59557d858eee18672fa2501bc87e274637 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Wed, 20 Apr 2022 14:02:55 +0100 Subject: [PATCH 06/33] Fix APU Hertz parameter --- .../Instruments/Lower-ECAM/Lower-ECAM-APU.nas | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-APU.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-APU.nas index 6d5bf7c2..66c29724 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-APU.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-APU.nas @@ -106,7 +106,7 @@ var canvas_lowerECAMPageApu = } }), props.UpdateManager.FromHashValue("apuEgt", 0.05, func(val) { - obj.apuEgt = sprintf("%s", math.round(val, 5)); + obj.apuEgt = sprintf("%s", math.clamp(math.round(val, 5), 0, 9995)); }), props.UpdateManager.FromHashValue("apuEgtRot", 0.1, func(val) { obj["APUEGT-needle"].setRotation((val + 90) * D2R); @@ -126,11 +126,7 @@ var canvas_lowerECAMPageApu = } }), props.UpdateManager.FromHashValue("apuHertz", 0.5, func(val) { - if (val < 0.5) { - obj["APUGenHz"].setText("XX"); - } else { - obj["APUGenHz"].setText(sprintf("%s", math.round(val))); - } + obj["APUGenHz"].setText(sprintf("%s", math.round(val))); if (val >= 390 and val <= 410) { obj["APUGenHz"].setColor(0.0509,0.7529,0.2941); @@ -162,7 +158,17 @@ var canvas_lowerECAMPageApu = }), props.UpdateManager.FromHashValue("apuRpm", 0.5, func(val) { if (val >= 0.5) { - obj["APUN"].setColor(0.0509,0.7529,0.2941); + if (val >= 107) { + obj["APUN"].setColor(1,0,0); + obj["APUN-needle"].setColor(1,0,0); + } elsif (val >= 102) { + obj["APUN"].setColor(0.7333,0.3803,0); + obj["APUN-needle"].setColor(0.7333,0.3803,0); + } else { + obj["APUN"].setColor(0.0509,0.7529,0.2941); + obj["APUN-needle"].setColor(0.0509,0.7529,0.2941); + } + obj["APUEGT"].setColor(0.0509,0.7529,0.2941); obj["APUN-needle"].show(); obj["APUEGT-needle"].show(); From 9d94182f3030d11f7841e4046cb5f28253a57974 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Wed, 20 Apr 2022 21:22:33 +0100 Subject: [PATCH 07/33] Improve bleed / cond page efficiency -- and fix that the hot air valve still worked after failure --- .../Lower-ECAM/Lower-ECAM-bleed.nas | 649 ++++++++++-------- .../Lower-ECAM/Lower-ECAM-cond.nas | 34 +- .../Lower-ECAM/Lower-ECAM-cruise.nas | 24 +- Systems/a320-aircond.xml | 3 + 4 files changed, 382 insertions(+), 328 deletions(-) diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-bleed.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-bleed.nas index c434b232..f9378110 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-bleed.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-bleed.nas @@ -23,281 +23,50 @@ var canvas_lowerECAMPageBleed = # init obj.update_items = [ - props.UpdateManager.FromHashList(["BleedCrossbleedCmd","BleedCrossbleed"], nil, func(val) { - if (val.BleedCrossbleedCmd != val.BleedCrossbleed) { - obj["BLEED-XFEED"].setColor(0.7333,0.3803,0); - obj["BLEED-XFEED-Cross"].setColorFill(0.7333,0.3803,0); - } else { - obj["BLEED-XFEED"].setColor(0.0509,0.7529,0.2941); - obj["BLEED-XFEED-Cross"].setColorFill(0.0509,0.7529,0.2941); - } - - if (val.BleedCrossbleedCmd == val.BleedCrossbleed) { - if (val.BleedCrossbleedCmd) { - obj["BLEED-XFEED"].setRotation(0); + props.UpdateManager.FromHashList(["BleedCrossbleed","apuMaster","apuBleedValvePos"], 0.1, func(val) { + if (val.apuMaster) { + if (val.apuBleedValvePos >= 0.9) { + obj["BLEED-APU-CIRCLE"].setRotation(0); + obj["BLEED-APU-connectionTop"].show(); + obj["BLEED-xbleedLeft"].show(); } else { - obj["BLEED-XFEED"].setRotation(90 * D2R); + obj["BLEED-APU-CIRCLE"].setRotation(90 * D2R); + obj["BLEED-APU-connectionTop"].hide(); + if (val.BleedCrossbleed < 0.9) { + obj["BLEED-xbleedLeft"].hide(); + } else { + obj["BLEED-xbleedLeft"].show(); + } } } else { - obj["BLEED-XFEED"].setRotation(45 * D2R); - } - - if (val.BleedCrossbleed == 1) { - obj["BLEED-xbleedCenter"].show(); - obj["BLEED-xbleedRight"].show(); - } else { - obj["BLEED-xbleedCenter"].hide(); - obj["BLEED-xbleedRight"].hide(); - } - }), - props.UpdateManager.FromHashList(["BleedHPValve1","BleedHPValve1Cmd"], nil, func(val) { - if (val.BleedHPValve1Cmd == 1) { - obj["BLEED-HP-Valve-1"].setRotation(90 * D2R); - obj["BLEED-HP-1-connection"].show(); - } else { - obj["BLEED-HP-Valve-1"].setRotation(0); - obj["BLEED-HP-1-connection"].hide(); - } - - if (val.BleedHPValve1Cmd == val.BleedHPValve1) { - obj["BLEED-HP-Valve-1"].setColor(0.0509,0.7529,0.2941); - } else { - obj["BLEED-HP-Valve-1"].setColor(0.7333,0.3803,0); - } - }), - props.UpdateManager.FromHashList(["BleedHPValve2","BleedHPValve2Cmd"], nil, func(val) { - if (val.BleedHPValve2Cmd == 1) { - obj["BLEED-HP-Valve-2"].setRotation(90 * D2R); - obj["BLEED-HP-2-connection"].show(); - } else { - obj["BLEED-HP-Valve-2"].setRotation(0); - obj["BLEED-HP-2-connection"].hide(); - } - - if (val.BleedHPValve2Cmd == val.BleedHPValve2) { - obj["BLEED-HP-Valve-2"].setColor(0.0509,0.7529,0.2941); - } else { - obj["BLEED-HP-Valve-2"].setColor(0.7333,0.3803,0); - } - }), - props.UpdateManager.FromHashList(["BleedPRVValve1Cmd","BleedPRVValve1"], nil, func(val) { - if (val.BleedPRVValve1 == 0) { - obj["BLEED-ENG-1"].setRotation(0); - } else { - obj["BLEED-ENG-1"].setRotation(90 * D2R); - } - - if (val.BleedPRVValve1Cmd == val.BleedPRVValve1) { - obj["BLEED-ENG-1"].setColor(0.0509,0.7529,0.2941); - obj["BLEED-ENG-1-Cross"].setColorFill(0.0509,0.7529,0.2941); - } else { - obj["BLEED-ENG-1"].setColor(0.7333,0.3803,0); - obj["BLEED-ENG-1-Cross"].setColorFill(0.7333,0.3803,0); - } - }), - props.UpdateManager.FromHashList(["BleedPRVValve2Cmd","BleedPRVValve2"], nil, func(val) { - if (val.BleedPRVValve2 == 0) { - obj["BLEED-ENG-2"].setRotation(0); - } else { - obj["BLEED-ENG-2"].setRotation(90 * D2R); - } - - if (val.BleedPRVValve2Cmd == val.BleedPRVValve2) { - obj["BLEED-ENG-2"].setColor(0.0509,0.7529,0.2941); - obj["BLEED-ENG-2-Cross"].setColorFill(0.0509,0.7529,0.2941); - } else { - obj["BLEED-ENG-2"].setColor(0.7333,0.3803,0); - obj["BLEED-ENG-2-Cross"].setColorFill(0.7333,0.3803,0); - } - }), - props.UpdateManager.FromHashValue("gear1Wow", nil, func(val) { - if (val) { - obj["BLEED-GND"].show(); - } else { - obj["BLEED-GND"].hide(); - } - }), - props.UpdateManager.FromHashValue("IceWingSw", nil, func(val) { - if (val) { - obj["BLEED-Anti-Ice-Left"].show(); - obj["BLEED-Anti-Ice-Right"].show(); - } else { - obj["BLEED-Anti-Ice-Left"].hide(); - obj["BLEED-Anti-Ice-Right"].hide(); - } - }), - props.UpdateManager.FromHashValue("N2_actual_1", nil, func(val) { - if (val >= 59) { - obj["BLEED-ENG-1-label"].setColor(0.8078,0.8039,0.8078); - } else { - obj["BLEED-ENG-1-label"].setColor(0.7333,0.3803,0); - } - }), - props.UpdateManager.FromHashValue("N2_actual_2", nil, func(val) { - if (val >= 59) { - obj["BLEED-ENG-2-label"].setColor(0.8078,0.8039,0.8078); - } else { - obj["BLEED-ENG-2-label"].setColor(0.7333,0.3803,0); - } - }), - props.UpdateManager.FromHashList(["BleedBMC1Working","BleedPreCoolerPSI1"], nil, func(val) { - if (val.BleedBMC1Working) { - if (val.BleedPreCoolerPSI1 >= 98) { - obj["BLEED-Precooler-1-Inlet-Press"].setText(sprintf("%s", 98)); + if (val.BleedCrossbleed < 0.9) { + obj["BLEED-xbleedLeft"].hide(); } else { - obj["BLEED-Precooler-1-Inlet-Press"].setText(sprintf("%s", math.round(val.BleedPreCoolerPSI1,2))); + obj["BLEED-xbleedLeft"].show(); } - if (val.BleedPreCoolerPSI1 < 4 or val.BleedPreCoolerPSI1 > 57) { - obj["BLEED-Precooler-1-Inlet-Press"].setColor(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashList(["ApuBleedNotOn","apuMaster"], 1, func(val) { + if (val.apuMaster) { + obj["BLEED-APU-LINES"].show(); + if (val.ApuBleedNotOn != 1) { + obj["BLEED-APU-CIRCLE"].setColor(0.0509,0.7529,0.2941); } else { - obj["BLEED-Precooler-1-Inlet-Press"].setColor(0.0509,0.7529,0.2941); + obj["BLEED-APU-CIRCLE"].setColor(0.7333,0.3803,0); } } else { - obj["BLEED-Precooler-1-Inlet-Press"].setText("XX"); - obj["BLEED-Precooler-1-Inlet-Press"].setColor(0.7333,0.3803,0); + obj["BLEED-APU-LINES"].hide(); + obj["BLEED-APU-connectionTop"].hide(); } }), - props.UpdateManager.FromHashList(["BleedBMC2Working","BleedPreCoolerPSI2"], nil, func(val) { - if (val.BleedBMC2Working) { - if (val.BleedPreCoolerPSI2 >= 98) { - obj["BLEED-Precooler-2-Inlet-Press"].setText(sprintf("%s", 98)); - } else { - obj["BLEED-Precooler-2-Inlet-Press"].setText(sprintf("%s", math.round(val.BleedPreCoolerPSI2,2))); - } - - if (val.BleedPreCoolerPSI2 < 4 or val.BleedPreCoolerPSI2 > 57) { - obj["BLEED-Precooler-2-Inlet-Press"].setColor(0.7333,0.3803,0); - } else { - obj["BLEED-Precooler-2-Inlet-Press"].setColor(0.0509,0.7529,0.2941); - } - } else { - obj["BLEED-Precooler-2-Inlet-Press"].setText("XX"); - obj["BLEED-Precooler-2-Inlet-Press"].setColor(0.7333,0.3803,0); - } - }), - props.UpdateManager.FromHashList(["BleedBMC1Working","BleedPreCoolerTemp1","BleedPRVValve1Cmd","BleedPreCoolerOvht1"], nil, func(val) { - if (val.BleedBMC1Working) { - if (val.BleedPreCoolerTemp1 >= 510) { - obj["BLEED-Precooler-1-Outlet-Temp"].setText(sprintf("%s", 510)); - } else { - obj["BLEED-Precooler-1-Outlet-Temp"].setText(sprintf("%s", math.round(val.BleedPreCoolerTemp1, 5))); - } - - if (val.BleedPRVValve1Cmd and (val.BleedPreCoolerTemp1 < 150 or val.BleedPreCoolerOvht1)) { - obj["BLEED-Precooler-1-Outlet-Temp"].setColor(0.7333,0.3803,0); - } else { - obj["BLEED-Precooler-1-Outlet-Temp"].setColor(0.0509,0.7529,0.2941); - } - } else { - obj["BLEED-Precooler-1-Outlet-Temp"].setText("XX"); - obj["BLEED-Precooler-1-Outlet-Temp"].setColor(0.7333,0.3803,0); - } - }), - props.UpdateManager.FromHashList(["BleedBMC2Working","BleedPreCoolerTemp2","BleedPRVValve2Cmd","BleedPreCoolerOvht2"], nil, func(val) { - if (val.BleedBMC2Working) { - if (val.BleedPreCoolerTemp2 >= 510) { - obj["BLEED-Precooler-2-Outlet-Temp"].setText(sprintf("%s", 510)); - } else { - obj["BLEED-Precooler-2-Outlet-Temp"].setText(sprintf("%s", math.round(val.BleedPreCoolerTemp2, 5))); - } - - if (val.BleedPRVValve2Cmd and (val.BleedPreCoolerTemp2 < 150 or val.BleedPreCoolerOvht2)) { - obj["BLEED-Precooler-2-Outlet-Temp"].setColor(0.7333,0.3803,0); - } else { - obj["BLEED-Precooler-2-Outlet-Temp"].setColor(0.0509,0.7529,0.2941); - } - } else { - obj["BLEED-Precooler-2-Outlet-Temp"].setText("XX"); - obj["BLEED-Precooler-2-Outlet-Temp"].setColor(0.7333,0.3803,0); - } - }), - props.UpdateManager.FromHashValue("Pack1Bypass", 1, func(val) { - obj["BLEED-Pack-1-Bypass-needle"].setRotation((val - 50) * D2R); - }), - props.UpdateManager.FromHashValue("Pack2Bypass", 1, func(val) { - obj["BLEED-Pack-2-Bypass-needle"].setRotation((val - 50) * D2R); - }), - props.UpdateManager.FromHashValue("Pack1OutTemp", 0.25, func(val) { - obj["BLEED-Pack-1-Out-Temp"].setText(sprintf("%s", math.round(val, 5))); - if (val > 90) { - obj["BLEED-Pack-1-Out-Temp"].setColor(0.7333,0.3803,0); - } else { - obj["BLEED-Pack-1-Out-Temp"].setColor(0.0509,0.7529,0.2941); - } - }), - props.UpdateManager.FromHashValue("Pack2OutTemp", 0.25, func(val) { - obj["BLEED-Pack-2-Out-Temp"].setText(sprintf("%s", math.round(val, 5))); - if (val > 90) { - obj["BLEED-Pack-2-Out-Temp"].setColor(0.7333,0.3803,0); - } else { - obj["BLEED-Pack-2-Out-Temp"].setColor(0.0509,0.7529,0.2941); - } - }), - props.UpdateManager.FromHashValue("Pack1OutletTemp", 0.25, func(val) { - obj["BLEED-Pack-1-Comp-Out-Temp"].setText(sprintf("%s", math.round(val, 5))); - if (val > 230) { - obj["BLEED-Pack-1-Comp-Out-Temp"].setColor(0.7333,0.3803,0); - } else { - obj["BLEED-Pack-1-Comp-Out-Temp"].setColor(0.0509,0.7529,0.2941); - } - }), - props.UpdateManager.FromHashValue("Pack2OutletTemp", 0.25, func(val) { - obj["BLEED-Pack-2-Comp-Out-Temp"].setText(sprintf("%s", math.round(val, 5))); - if (val > 230) { - obj["BLEED-Pack-2-Comp-Out-Temp"].setColor(0.7333,0.3803,0); - } else { - obj["BLEED-Pack-2-Comp-Out-Temp"].setColor(0.0509,0.7529,0.2941); - } - }), - props.UpdateManager.FromHashValue("Pack1FlowOutput", 0.5, func(val) { - obj["BLEED-Pack-1-Packflow-needle"].setRotation(val * D2R); - - }), - props.UpdateManager.FromHashValue("Pack2FlowOutput", 0.5, func(val) { - obj["BLEED-Pack-2-Packflow-needle"].setRotation(val * D2R); - }), - props.UpdateManager.FromHashList(["Pack1Switch","flowCtlValve1"], nil, func(val) { - if (val.flowCtlValve1 == 0) { - obj["BLEED-Pack-1-Packflow-needle"].setColorFill(0.7333,0.3803,0); - obj["BLEED-Pack-1-Flow-Valve"].setRotation(90 * D2R); - } else { - obj["BLEED-Pack-1-Packflow-needle"].setColorFill(0.0509,0.7529,0.2941); - obj["BLEED-Pack-1-Flow-Valve"].setRotation(0); - } - - if (val.flowCtlValve1 == val.Pack1Switch) { - obj["BLEED-Pack-1-Flow-Valve"].setColor(0.0509,0.7529,0.2941); - obj["BLEED-Pack-1-Flow-Valve-Cross"].setColorFill(0.0509,0.7529,0.2941); - } else { - obj["BLEED-Pack-1-Flow-Valve"].setColor(0.7333,0.3803,0); - obj["BLEED-Pack-1-Flow-Valve-Cross"].setColorFill(0.7333,0.3803,0); - } - }), - props.UpdateManager.FromHashList(["Pack2Switch","flowCtlValve2"], nil, func(val) { - if (val.flowCtlValve2 == 0) { - obj["BLEED-Pack-2-Packflow-needle"].setColorFill(0.7333,0.3803,0); - obj["BLEED-Pack-2-Flow-Valve"].setRotation(90 * D2R); - } else { - obj["BLEED-Pack-2-Packflow-needle"].setColorFill(0.0509,0.7529,0.2941); - obj["BLEED-Pack-2-Flow-Valve"].setRotation(0); - } - - if (val.flowCtlValve2 == val.Pack2Switch) { - obj["BLEED-Pack-2-Flow-Valve"].setColor(0.0509,0.7529,0.2941); - obj["BLEED-Pack-2-Flow-Valve-Cross"].setColorFill(0.0509,0.7529,0.2941); - } else { - obj["BLEED-Pack-2-Flow-Valve"].setColor(0.7333,0.3803,0); - obj["BLEED-Pack-2-Flow-Valve-Cross"].setColorFill(0.7333,0.3803,0); - } - }), - props.UpdateManager.FromHashList(["flowCtlValve1","flowCtlValve2","RamAirValve","gear1Wow"], nil, func(val) { - if (val.RamAirValve == 0) { + props.UpdateManager.FromHashList(["flowCtlValve1","flowCtlValve2","RamAirValve","gear1Wow"], 0.1, func(val) { + if (val.RamAirValve <= 0.1) { obj["BLEED-Ram-Air"].setRotation(90 * D2R); obj["BLEED-Ram-Air"].setColor(0.0509,0.7529,0.2941); obj["BLEED-Ram-Air"].setColorFill(0.0509,0.7529,0.2941); obj["BLEED-Ram-Air-Cross"].setColorFill(0.0509,0.7529,0.2941); obj["BLEED-Ram-Air-connection"].hide(); - } elsif (val.RamAirValve) { + } elsif (val.RamAirValve >= 0.9) { obj["BLEED-Ram-Air"].setRotation(0); if (val.gear1Wow) { obj["BLEED-Ram-Air"].setColor(0.7333,0.3803,0); @@ -323,8 +92,8 @@ var canvas_lowerECAMPageBleed = obj["BLEED-Ram-Air-connection"].show(); } - if (val.flowCtlValve1 == 0 and val.flowCtlValve2 == 0) { - if (val.gear1Wow or val.RamAirValve != 1) { + if (val.flowCtlValve1 <= 0.1 and val.flowCtlValve2 <= 0.1) { + if (val.gear1Wow or val.RamAirValve < 0.9) { obj["BLEED-cond-1"].setColor(0.7333,0.3803,0); obj["BLEED-cond-2"].setColor(0.7333,0.3803,0); obj["BLEED-cond-3"].setColor(0.7333,0.3803,0); @@ -338,52 +107,262 @@ var canvas_lowerECAMPageBleed = obj["BLEED-cond-2"].setColor(0.0509,0.7529,0.2941); obj["BLEED-cond-3"].setColor(0.0509,0.7529,0.2941); } + }), + props.UpdateManager.FromHashList(["BleedCrossbleedCmd","BleedCrossbleedPositionMatch"], nil, func(val) { + if (val.BleedCrossbleedPositionMatch) { + obj["BLEED-XFEED"].setColor(0.0509,0.7529,0.2941); + obj["BLEED-XFEED-Cross"].setColorFill(0.0509,0.7529,0.2941); + if (val.BleedCrossbleedCmd) { + obj["BLEED-XFEED"].setRotation(0); + } else { + obj["BLEED-XFEED"].setRotation(90 * D2R); + } + } else { + obj["BLEED-XFEED"].setColor(0.7333,0.3803,0); + obj["BLEED-XFEED-Cross"].setColorFill(0.7333,0.3803,0); + obj["BLEED-XFEED"].setRotation(45 * D2R); + } + }), + props.UpdateManager.FromHashValue("BleedCrossbleed", 0.1, func(val) { + if (val >= 0.9) { + obj["BLEED-xbleedCenter"].show(); + obj["BLEED-xbleedRight"].show(); + } else { + obj["BLEED-xbleedCenter"].hide(); + obj["BLEED-xbleedRight"].hide(); + } + }), + props.UpdateManager.FromHashValue("BleedHPValve1Cmd", 1, func(val) { + if (val) { + obj["BLEED-HP-Valve-1"].setRotation(90 * D2R); + obj["BLEED-HP-1-connection"].show(); + } else { + obj["BLEED-HP-Valve-1"].setRotation(0); + obj["BLEED-HP-1-connection"].hide(); + } + }), + props.UpdateManager.FromHashValue("BleedHPValve2Cmd", 1, func(val) { + if (val) { + obj["BLEED-HP-Valve-1"].setRotation(90 * D2R); + obj["BLEED-HP-1-connection"].show(); + } else { + obj["BLEED-HP-Valve-1"].setRotation(0); + obj["BLEED-HP-1-connection"].hide(); + } + }), + props.UpdateManager.FromHashValue("bleedHPValve1PositionMatch", 1, func(val) { + if (val) { + obj["BLEED-HP-Valve-1"].setColor(0.0509,0.7529,0.2941); + } else { + obj["BLEED-HP-Valve-1"].setColor(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashValue("bleedHPValve2PositionMatch", 1, func(val) { + if (val) { + obj["BLEED-HP-Valve-2"].setColor(0.0509,0.7529,0.2941); + } else { + obj["BLEED-HP-Valve-2"].setColor(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashValue("BleedPreCoolerPSI1", 1, func(val) { + obj.bleedPrecoolerInlet1Pressure = sprintf("%s", math.clamp(math.round(val, 2), -99, 98)); - if (val.flowCtlValve1 == 0) { + if (val < 4 or val > 57) { + obj.bleedPrecoolerInlet1PressureOut = 1; + } else { + obj.bleedPrecoolerInlet1PressureOut = 0; + } + }), + props.UpdateManager.FromHashValue("BleedPreCoolerPSI2", 1, func(val) { + obj.bleedPrecoolerInlet2Pressure = sprintf("%s", math.clamp(math.round(val, 2), -99, 98)); + + if (val < 4 or val > 57) { + obj.bleedPrecoolerInlet2PressureOut = 1; + } else { + obj.bleedPrecoolerInlet2PressureOut = 0; + } + }), + props.UpdateManager.FromHashValue("BleedPreCoolerTemp1", 0.5, func(val) { + obj.bleedPrecoolerTemp1 = sprintf("%s", math.clamp(math.round(val, 5), -999, 510)); + }), + props.UpdateManager.FromHashValue("BleedPreCoolerTemp2", 0.5, func(val) { + obj.bleedPrecoolerTemp2 = sprintf("%s", math.clamp(math.round(val, 5), -999, 510)); + }), + props.UpdateManager.FromHashList(["BleedBMC1Working","bleedPrecoolerTemp1Lo","BleedPRVValve1Cmd","BleedPreCoolerOvht1"], nil, func(val) { + if (val.BleedBMC1Working) { + if (val.BleedPRVValve1Cmd and (val.bleedPrecoolerTemp1Lo or val.BleedPreCoolerOvht1)) { + obj["BLEED-Precooler-1-Outlet-Temp"].setColor(0.7333,0.3803,0); + } else { + obj["BLEED-Precooler-1-Outlet-Temp"].setColor(0.0509,0.7529,0.2941); + } + } else { + obj["BLEED-Precooler-1-Outlet-Temp"].setColor(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashList(["BleedBMC2Working","bleedPrecoolerTemp2Lo","BleedPRVValve2Cmd","BleedPreCoolerOvht2"], nil, func(val) { + if (val.BleedBMC2Working) { + if (val.BleedPRVValve2Cmd and (val.bleedPrecoolerTemp2Lo or val.BleedPreCoolerOvht2)) { + obj["BLEED-Precooler-2-Outlet-Temp"].setColor(0.7333,0.3803,0); + } else { + obj["BLEED-Precooler-2-Outlet-Temp"].setColor(0.0509,0.7529,0.2941); + } + } else { + obj["BLEED-Precooler-2-Outlet-Temp"].setColor(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashValue("Pack1Bypass", 1, func(val) { + obj["BLEED-Pack-1-Bypass-needle"].setRotation((val - 50) * D2R); + }), + props.UpdateManager.FromHashValue("Pack2Bypass", 1, func(val) { + obj["BLEED-Pack-2-Bypass-needle"].setRotation((val - 50) * D2R); + }), + props.UpdateManager.FromHashValue("Pack1OutTemp", 0.5, func(val) { + obj["BLEED-Pack-1-Out-Temp"].setText(sprintf("%s", math.round(val, 5))); + + if (val > 90) { + obj["BLEED-Pack-1-Out-Temp"].setColor(0.7333,0.3803,0); + } else { + obj["BLEED-Pack-1-Out-Temp"].setColor(0.0509,0.7529,0.2941); + } + }), + props.UpdateManager.FromHashValue("Pack2OutTemp", 0.5, func(val) { + obj["BLEED-Pack-2-Out-Temp"].setText(sprintf("%s", math.round(val, 5))); + + if (val > 90) { + obj["BLEED-Pack-2-Out-Temp"].setColor(0.7333,0.3803,0); + } else { + obj["BLEED-Pack-2-Out-Temp"].setColor(0.0509,0.7529,0.2941); + } + }), + props.UpdateManager.FromHashValue("Pack1OutletTemp", 0.5, func(val) { + obj["BLEED-Pack-1-Comp-Out-Temp"].setText(sprintf("%s", math.round(val, 5))); + + if (val > 230) { + obj["BLEED-Pack-1-Comp-Out-Temp"].setColor(0.7333,0.3803,0); + } else { + obj["BLEED-Pack-1-Comp-Out-Temp"].setColor(0.0509,0.7529,0.2941); + } + }), + props.UpdateManager.FromHashValue("Pack2OutletTemp", 0.5, func(val) { + obj["BLEED-Pack-2-Comp-Out-Temp"].setText(sprintf("%s", math.round(val, 5))); + + if (val > 230) { + obj["BLEED-Pack-2-Comp-Out-Temp"].setColor(0.7333,0.3803,0); + } else { + obj["BLEED-Pack-2-Comp-Out-Temp"].setColor(0.0509,0.7529,0.2941); + } + }), + props.UpdateManager.FromHashValue("Pack1FlowOutput", 0.5, func(val) { + obj["BLEED-Pack-1-Packflow-needle"].setRotation(val * D2R); + }), + props.UpdateManager.FromHashValue("Pack2FlowOutput", 0.5, func(val) { + obj["BLEED-Pack-2-Packflow-needle"].setRotation(val * D2R); + }), + props.UpdateManager.FromHashValue("gear1Wow", 1, func(val) { + if (val) { + obj["BLEED-GND"].show(); + } else { + obj["BLEED-GND"].hide(); + } + }), + props.UpdateManager.FromHashValue("IceWingSw", 1, func(val) { + if (val) { + obj["BLEED-Anti-Ice-Left"].show(); + obj["BLEED-Anti-Ice-Right"].show(); + } else { + obj["BLEED-Anti-Ice-Left"].hide(); + obj["BLEED-Anti-Ice-Right"].hide(); + } + }), + props.UpdateManager.FromHashValue("N2_actual_1", 0.5, func(val) { + if (val >= 59) { + obj["BLEED-ENG-1-label"].setColor(0.8078,0.8039,0.8078); + } else { + obj["BLEED-ENG-1-label"].setColor(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashValue("N2_actual_2", 0.5, func(val) { + if (val >= 59) { + obj["BLEED-ENG-2-label"].setColor(0.8078,0.8039,0.8078); + } else { + obj["BLEED-ENG-2-label"].setColor(0.7333,0.3803,0); + } + }), + + props.UpdateManager.FromHashValue("flowCtlValve1", 0.1, func(val) { + if (val <= 0.1) { + obj["BLEED-Pack-1-Packflow-needle"].setColorFill(0.7333,0.3803,0); + obj["BLEED-Pack-1-Flow-Valve"].setRotation(90 * D2R); obj["BLEED-Pack-1-connection"].setColor(0.7333,0.3803,0); obj["BLEED-Pack-1-connection"].setColorFill(0.7333,0.3803,0); } else { + obj["BLEED-Pack-1-Packflow-needle"].setColorFill(0.0509,0.7529,0.2941); + obj["BLEED-Pack-1-Flow-Valve"].setRotation(0); obj["BLEED-Pack-1-connection"].setColor(0.0509,0.7529,0.2941); obj["BLEED-Pack-1-connection"].setColorFill(0.0509,0.7529,0.2941); } - - if (val.flowCtlValve2 == 0) { + }), + props.UpdateManager.FromHashValue("flowCtlValve2", 0.1, func(val) { + if (val <= 0.1) { + obj["BLEED-Pack-2-Packflow-needle"].setColorFill(0.7333,0.3803,0); + obj["BLEED-Pack-2-Flow-Valve"].setRotation(90 * D2R); obj["BLEED-Pack-2-connection"].setColor(0.7333,0.3803,0); obj["BLEED-Pack-2-connection"].setColorFill(0.7333,0.3803,0); } else { + obj["BLEED-Pack-2-Packflow-needle"].setColorFill(0.0509,0.7529,0.2941); + obj["BLEED-Pack-2-Flow-Valve"].setRotation(0); obj["BLEED-Pack-2-connection"].setColor(0.0509,0.7529,0.2941); obj["BLEED-Pack-2-connection"].setColorFill(0.0509,0.7529,0.2941); } }), - props.UpdateManager.FromHashList(["BleedCrossbleed","apuMaster","apuBleedValvePos","ApuBleedNotOn"], nil, func(val) { - if (val.apuMaster) { - obj["BLEED-APU-LINES"].show(); - if (val.apuBleedValvePos == 1) { - obj["BLEED-APU-CIRCLE"].setRotation(0); - obj["BLEED-APU-connectionTop"].show(); - obj["BLEED-xbleedLeft"].show(); - } else { - obj["BLEED-APU-CIRCLE"].setRotation(90 * D2R); - obj["BLEED-APU-connectionTop"].hide(); - if (val.BleedCrossbleed != 1) { - obj["BLEED-xbleedLeft"].hide(); - } else { - obj["BLEED-xbleedLeft"].show(); - } - } - if (val.ApuBleedNotOn != 1) { - obj["BLEED-APU-CIRCLE"].setColor(0.0509,0.7529,0.2941); - } else { - obj["BLEED-APU-CIRCLE"].setColor(0.7333,0.3803,0); - } + props.UpdateManager.FromHashValue("flowCtlValve1PositionMatch", 1, func(val) { + if (val) { + obj["BLEED-Pack-1-Flow-Valve"].setColor(0.0509,0.7529,0.2941); + obj["BLEED-Pack-1-Flow-Valve-Cross"].setColorFill(0.0509,0.7529,0.2941); } else { - if (val.BleedCrossbleed != 1) { - obj["BLEED-xbleedLeft"].hide(); - } else { - obj["BLEED-xbleedLeft"].show(); - } - obj["BLEED-APU-LINES"].hide(); - obj["BLEED-APU-connectionTop"].hide(); + obj["BLEED-Pack-1-Flow-Valve"].setColor(0.7333,0.3803,0); + obj["BLEED-Pack-1-Flow-Valve-Cross"].setColorFill(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashValue("flowCtlValve2PositionMatch", 1, func(val) { + if (val) { + obj["BLEED-Pack-2-Flow-Valve"].setColor(0.0509,0.7529,0.2941); + obj["BLEED-Pack-2-Flow-Valve-Cross"].setColorFill(0.0509,0.7529,0.2941); + } else { + obj["BLEED-Pack-2-Flow-Valve"].setColor(0.7333,0.3803,0); + obj["BLEED-Pack-2-Flow-Valve-Cross"].setColorFill(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashValue("BleedPRVValve1", 0.1, func(val) { + if (val <= 0.1) { + obj["BLEED-ENG-1"].setRotation(0); + } else { + obj["BLEED-ENG-1"].setRotation(90 * D2R); + } + }), + props.UpdateManager.FromHashValue("BleedPRVValve2", 0.1, func(val) { + if (val <= 0.1) { + obj["BLEED-ENG-2"].setRotation(0); + } else { + obj["BLEED-ENG-2"].setRotation(90 * D2R); + } + }), + props.UpdateManager.FromHashValue("BleedPRVValve1PositionMatch", 1, func(val) { + if (val) { + obj["BLEED-ENG-1"].setColor(0.0509,0.7529,0.2941); + obj["BLEED-ENG-1-Cross"].setColorFill(0.0509,0.7529,0.2941); + } else { + obj["BLEED-ENG-1"].setColor(0.7333,0.3803,0); + obj["BLEED-ENG-1-Cross"].setColorFill(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashValue("BleedPRVValve2PositionMatch", 1, func(val) { + if (val) { + obj["BLEED-ENG-2"].setColor(0.0509,0.7529,0.2941); + obj["BLEED-ENG-2-Cross"].setColorFill(0.0509,0.7529,0.2941); + } else { + obj["BLEED-ENG-2"].setColor(0.7333,0.3803,0); + obj["BLEED-ENG-2-Cross"].setColorFill(0.7333,0.3803,0); } }), ]; @@ -481,11 +460,95 @@ var canvas_lowerECAMPageBleed = return; } + if ((notification.flowCtlValve1 >= 0.95 and notification.Pack1Switch) or (notification.flowCtlValve1 <= 0.05 and !notification.Pack1Switch)) { + notification.flowCtlValve1PositionMatch = 1; + } else { + notification.flowCtlValve1PositionMatch = 0; + } + + if ((notification.flowCtlValve2 >= 0.95 and notification.Pack2Switch) or (notification.flowCtlValve2 <= 0.05 and !notification.Pack2Switch)) { + notification.flowCtlValve2PositionMatch = 1; + } else { + notification.flowCtlValve2PositionMatch = 0; + } + + if ((notification.BleedPRVValve1 >= 0.95 and notification.BleedPRVValve1Cmd) or (notification.BleedPRVValve1 <= 0.05 and !notification.BleedPRVValve1Cmd)) { + notification.BleedPRVValve1PositionMatch = 1; + } else { + notification.BleedPRVValve1PositionMatch = 0; + } + + if ((notification.BleedPRVValve2 >= 0.95 and notification.BleedPRVValve2Cmd) or (notification.BleedPRVValve2 <= 0.05 and !notification.BleedPRVValve2Cmd)) { + notification.BleedPRVValve2PositionMatch = 1; + } else { + notification.BleedPRVValve2PositionMatch = 0; + } + + if ((notification.BleedHPValve1 >= 0.95 and notification.BleedHPValve1Cmd) or (notification.BleedHPValve1 <= 0.05 and !notification.BleedHPValve1Cmd)) { + notification.bleedHPValve1PositionMatch = 1; + } else { + notification.bleedHPValve1PositionMatch = 0; + } + + if ((notification.BleedHPValve2 >= 0.95 and notification.BleedHPValve2Cmd) or (notification.BleedHPValve2 <= 0.05 and !notification.BleedHPValve2Cmd)) { + notification.bleedHPValve2PositionMatch = 1; + } else { + notification.bleedHPValve2PositionMatch = 0; + } + + if ((notification.BleedCrossbleed >= 0.95 and notification.BleedCrossbleedCmd) or (notification.BleedCrossbleed <= 0.05 and !notification.BleedCrossbleedCmd)) { + notification.BleedCrossbleedPositionMatch = 1; + } else { + notification.BleedCrossbleedPositionMatch = 0; + } + + if (notification.BleedPreCoolerTemp1 < 150) { + notification.bleedPrecoolerTemp1Lo = 1; + } else { + notification.bleedPrecoolerTemp1Lo = 0; + } + + if (notification.BleedPreCoolerTemp2 < 150) { + notification.bleedPrecoolerTemp2Lo = 1; + } else { + notification.bleedPrecoolerTemp2Lo = 0; + } + foreach(var update_item; me.update_items) { update_item.update(notification); } + if (notification.BleedBMC1Working) { + me["BLEED-Precooler-1-Outlet-Temp"].setText(me.bleedPrecoolerTemp1); + me["BLEED-Precooler-1-Inlet-Press"].setText(me.bleedPrecoolerInlet1Pressure); + + if (me.bleedPrecoolerInlet1PressureOut) { + me["BLEED-Precooler-1-Inlet-Press"].setColor(0.7333,0.3803,0); + } else { + me["BLEED-Precooler-1-Inlet-Press"].setColor(0.0509,0.7529,0.2941); + } + } else { + me["BLEED-Precooler-1-Outlet-Temp"].setText("XX"); + me["BLEED-Precooler-1-Inlet-Press"].setText("XX"); + me["BLEED-Precooler-1-Inlet-Press"].setColor(0.7333,0.3803,0); + } + + if (notification.BleedBMC2Working) { + me["BLEED-Precooler-2-Outlet-Temp"].setText(me.bleedPrecoolerTemp2); + me["BLEED-Precooler-2-Inlet-Press"].setText(me.bleedPrecoolerInlet2Pressure); + + if (me.bleedPrecoolerInlet2PressureOut) { + me["BLEED-Precooler-2-Inlet-Press"].setColor(0.7333,0.3803,0); + } else { + me["BLEED-Precooler-2-Inlet-Press"].setColor(0.0509,0.7529,0.2941); + } + } else { + me["BLEED-Precooler-2-Outlet-Temp"].setText("XX"); + me["BLEED-Precooler-2-Inlet-Press"].setText("XX"); + me["BLEED-Precooler-2-Inlet-Press"].setColor(0.7333,0.3803,0); + } + me.updateBottom(notification); }, updatePower: func() { diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-cond.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-cond.nas index f68ea461..b493d2aa 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-cond.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-cond.nas @@ -55,23 +55,25 @@ var canvas_lowerECAMPageCond = props.UpdateManager.FromHashValue("condTrimFwd", 0.01, func(val) { obj["CONDTrimValveFWD"].setRotation(val * D2R); }), - props.UpdateManager.FromHashList(["condHotAirSwitch","condHotAirValve","condHotAirCmd"], nil, func(val) { - if (!val.condHotAirSwitch or (val.condHotAirCmd == 1 and val.condHotAirValve == 0)) { + props.UpdateManager.FromHashList(["condHotAirSwitch","condHotAirValve","condHotAirCmd"], 0.01, func(val) { + if (val.condHotAirValve <= 0.01) { obj["CONDHotAirValve"].setRotation(90 * D2R); - obj["CONDHotAirValve"].setColor(0.7333,0.3803,0); - obj["CONDHotAirValveCross"].setColorFill(0.7333,0.3803,0); - } elsif (val.condHotAirCmd == 0 and val.condHotAirValve == 0) { - obj["CONDHotAirValve"].setRotation(90 * D2R); - obj["CONDHotAirValve"].setColor(0.0509,0.7529,0.2941); - obj["CONDHotAirValveCross"].setColorFill(0.0509,0.7529,0.2941); - } elsif (val.condHotAirCmd == 0 and val.condHotAirValve != 0) { - obj["CONDHotAirValve"].setRotation(0); - obj["CONDHotAirValve"].setColor(0.7333,0.3803,0); - obj["CONDHotAirValveCross"].setColorFill(0.7333,0.3803,0); + if (val.condHotAirCmd) { + obj["CONDHotAirValve"].setColor(0.7333,0.3803,0); + obj["CONDHotAirValveCross"].setColorFill(0.7333,0.3803,0); + } else { + obj["CONDHotAirValve"].setColor(0.0509,0.7529,0.2941); + obj["CONDHotAirValveCross"].setColorFill(0.0509,0.7529,0.2941); + } } else { obj["CONDHotAirValve"].setRotation(0); - obj["CONDHotAirValve"].setColor(0.0509,0.7529,0.2941); - obj["CONDHotAirValveCross"].setColorFill(0.0509,0.7529,0.2941); + if (val.condHotAirCmd) { + obj["CONDHotAirValve"].setColor(0.0509,0.7529,0.2941); + obj["CONDHotAirValveCross"].setColorFill(0.0509,0.7529,0.2941); + } else { + obj["CONDHotAirValve"].setColor(0.7333,0.3803,0); + obj["CONDHotAirValveCross"].setColorFill(0.7333,0.3803,0); + } } }), ]; @@ -108,6 +110,8 @@ var canvas_lowerECAMPageCond = obj["TAT"].setText(sprintf("%+2.0f", val)); }), ]; + obj.timer = maketimestamp(); + obj.times = []; return obj; }, getKeysBottom: func() { @@ -152,6 +156,7 @@ var canvas_lowerECAMPageCond = } }, update: func(notification) { + me.timer.stamp(); me.updatePower(); if (me.test.getVisible() == 1) { @@ -168,6 +173,7 @@ var canvas_lowerECAMPageCond = } me.updateBottom(notification); + append(me.times, me.timer.elapsedUSec()); }, updatePower: func() { if (me.name == ecam.SystemDisplayController.displayedPage.name) { diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-cruise.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-cruise.nas index 4fb900c9..cf09db22 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-cruise.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-cruise.nas @@ -77,13 +77,7 @@ var canvas_lowerECAMPageCruise = } }), props.UpdateManager.FromHashValue("pressDelta", 0.05, func(val) { - if (val > 31.9) { - obj["deltaPSI"].setText(sprintf("%2.1f", 31.9)); - } else if (val < -9.9) { - obj["deltaPSI"].setText(sprintf("%2.1f", -9.9)); - } else { - obj["deltaPSI"].setText(sprintf("%2.1f", val)); - } + obj["deltaPSI"].setText(sprintf("%2.1f", math.clamp(val, -9.9, 31.9))); if (val < -0.4 or val > 8.5) { obj["deltaPSI"].setColor(0.7333,0.3803,0); @@ -92,13 +86,7 @@ var canvas_lowerECAMPageCruise = } }), props.UpdateManager.FromHashValue("pressVS", 25, func(val) { - if (val > 9950) { - obj["CABVS"].setText(sprintf("%4.0f", 9950)); - } else if (val < -9950) { - obj["CABVS"].setText(sprintf("%4.0f", -9950)); - } else { - obj["CABVS"].setText(sprintf("%-4.0f", math.round(val,50))); - } + obj["CABVS"].setText(sprintf("%-4.0f", math.clamp(math.round(val,50), -9950, 9950))); if (val >= 25) { obj["VS-Arrow-UP"].show(); @@ -112,13 +100,7 @@ var canvas_lowerECAMPageCruise = } }), props.UpdateManager.FromHashValue("pressAlt", 25, func(val) { - if (val > 32750) { - obj["CABALT"].setText(sprintf("%5.0f", 32750)); - } else if (val < -9950) { - obj["CABALT"].setText(sprintf("%5.0f", -9950)); - } else { - obj["CABALT"].setText(sprintf("%5.0f", math.round(val,50))); - } + obj["CABALT"].setText(sprintf("%5.0f", math.clamp(math.round(val,50), -9950, 32750))); if (val > 9550) { obj["CABALT"].setColor(1,0,0); diff --git a/Systems/a320-aircond.xml b/Systems/a320-aircond.xml index 4d95eedd..34810e1a 100644 --- a/Systems/a320-aircond.xml +++ b/Systems/a320-aircond.xml @@ -545,6 +545,9 @@ + + /systems/failures/pneumatics/hot-air-valve eq 1 + /systems/electrical/bus/ac-1 ge 110 /systems/electrical/bus/ac-2 ge 110 From ecdea928eeb8ada7b3129550210d01d296acdd85 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Wed, 20 Apr 2022 21:23:27 +0100 Subject: [PATCH 08/33] Remove debug info --- Models/Instruments/Lower-ECAM/Lower-ECAM-cond.nas | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-cond.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-cond.nas index b493d2aa..5a3ea0b9 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-cond.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-cond.nas @@ -110,8 +110,6 @@ var canvas_lowerECAMPageCond = obj["TAT"].setText(sprintf("%+2.0f", val)); }), ]; - obj.timer = maketimestamp(); - obj.times = []; return obj; }, getKeysBottom: func() { @@ -156,7 +154,6 @@ var canvas_lowerECAMPageCond = } }, update: func(notification) { - me.timer.stamp(); me.updatePower(); if (me.test.getVisible() == 1) { @@ -173,7 +170,6 @@ var canvas_lowerECAMPageCond = } me.updateBottom(notification); - append(me.times, me.timer.elapsedUSec()); }, updatePower: func() { if (me.name == ecam.SystemDisplayController.displayedPage.name) { From d55f4b34d3410be1bc66232fb5cfaa99eb8ed965 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Thu, 21 Apr 2022 16:02:39 +0100 Subject: [PATCH 09/33] Cond / door / elec --- .../Lower-ECAM/Lower-ECAM-cond.nas | 4 + .../Lower-ECAM/Lower-ECAM-door.nas | 44 ++-- .../Lower-ECAM/Lower-ECAM-elec.nas | 240 +++++++++--------- 3 files changed, 146 insertions(+), 142 deletions(-) diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-cond.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-cond.nas index 5a3ea0b9..b493d2aa 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-cond.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-cond.nas @@ -110,6 +110,8 @@ var canvas_lowerECAMPageCond = obj["TAT"].setText(sprintf("%+2.0f", val)); }), ]; + obj.timer = maketimestamp(); + obj.times = []; return obj; }, getKeysBottom: func() { @@ -154,6 +156,7 @@ var canvas_lowerECAMPageCond = } }, update: func(notification) { + me.timer.stamp(); me.updatePower(); if (me.test.getVisible() == 1) { @@ -170,6 +173,7 @@ var canvas_lowerECAMPageCond = } me.updateBottom(notification); + append(me.times, me.timer.elapsedUSec()); }, updatePower: func() { if (me.name == ecam.SystemDisplayController.displayedPage.name) { diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-door.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-door.nas index 3f62927e..0307efa4 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-door.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-door.nas @@ -49,8 +49,8 @@ var canvas_lowerECAMPageDoor = obj.update_items = [ - props.UpdateManager.FromHashValue("doorL1", nil, func(val) { - if (val > 0) { + props.UpdateManager.FromHashValue("doorL1", 0.1, func(val) { + if (val >= 0.1) { obj["Cabin1Left"].show(); obj["Cabin1Left"].setColor(0.7333,0.3803,0); obj["Cabin1Left"].setColorFill(0.7333,0.3803,0); @@ -65,8 +65,8 @@ var canvas_lowerECAMPageDoor = obj["Cabin1LeftSlide"].show(); } }), - props.UpdateManager.FromHashValue("doorL4", nil, func(val) { - if (val > 0) { + props.UpdateManager.FromHashValue("doorL4", 0.1, func(val) { + if (val >= 0.1) { obj["Cabin4Left"].show(); obj["Cabin4Left"].setColor(0.7333,0.3803,0); obj["Cabin4Left"].setColorFill(0.7333,0.3803,0); @@ -81,8 +81,8 @@ var canvas_lowerECAMPageDoor = obj["Cabin4LeftSlide"].show(); } }), - props.UpdateManager.FromHashValue("doorR1", nil, func(val) { - if (val > 0) { + props.UpdateManager.FromHashValue("doorR1", 0.1, func(val) { + if (val >= 0.1) { obj["Cabin1Right"].show(); obj["Cabin1Right"].setColor(0.7333,0.3803,0); obj["Cabin1Right"].setColorFill(0.7333,0.3803,0); @@ -97,8 +97,8 @@ var canvas_lowerECAMPageDoor = obj["Cabin1RightSlide"].show(); } }), - props.UpdateManager.FromHashValue("doorR4", nil, func(val) { - if (val > 0) { + props.UpdateManager.FromHashValue("doorR4", 0.1, func(val) { + if (val >= 0.1) { obj["Cabin4Right"].show(); obj["Cabin4Right"].setColor(0.7333,0.3803,0); obj["Cabin4Right"].setColorFill(0.7333,0.3803,0); @@ -113,8 +113,8 @@ var canvas_lowerECAMPageDoor = obj["Cabin4RightSlide"].show(); } }), - props.UpdateManager.FromHashValue("cargoAft", nil, func(val) { - if (val > 0) { + props.UpdateManager.FromHashValue("cargoAft", 0.1, func(val) { + if (val >= 0.1) { obj["Cargo2Door"].setColor(0.7333,0.3803,0); obj["Cargo2Door"].setColorFill(0.7333,0.3803,0); obj["Cargo2Lbl"].show(); @@ -126,8 +126,8 @@ var canvas_lowerECAMPageDoor = obj["Cargo2Line"].hide(); } }), - props.UpdateManager.FromHashValue("cargoBulk", nil, func(val) { - if (val > 0) { + props.UpdateManager.FromHashValue("cargoBulk", 0.1, func(val) { + if (val >= 0.1) { obj["Bulk"].setColor(0.7333,0.3803,0); obj["Bulk"].setColorFill(0.7333,0.3803,0); obj["BulkLbl"].show(); @@ -139,8 +139,8 @@ var canvas_lowerECAMPageDoor = obj["BulkLine"].hide(); } }), - props.UpdateManager.FromHashValue("cargoFwd", nil, func(val) { - if (val > 0) { + props.UpdateManager.FromHashValue("cargoFwd", 0.1, func(val) { + if (val >= 0.1) { obj["Cargo1Door"].setColor(0.7333,0.3803,0); obj["Cargo1Door"].setColorFill(0.7333,0.3803,0); obj["Cargo1Lbl"].show(); @@ -152,7 +152,7 @@ var canvas_lowerECAMPageDoor = obj["Cargo1Line"].hide(); } }), - props.UpdateManager.FromHashList(["oxyPB","oxyBottlePress","oxyBottleRegulLoPr"], nil, func(val) { + props.UpdateManager.FromHashList(["oxyPB","oxyBottlePress","oxyBottleRegulLoPr"], 1, func(val) { if (val.oxyPB) { if (val.oxyBottlePress < 300 or val.oxyBottleRegulLoPr) { obj["DOOROXY-OxyIndicator"].setColor(0.7333,0.3803,0); @@ -170,14 +170,8 @@ var canvas_lowerECAMPageDoor = } obj["DOOROXY-PR"].setText(sprintf("%4.0f", math.round(val.oxyBottlePress, 10))); }), - props.UpdateManager.FromHashValue("pressVS", nil, func(val) { - if (val > 9950) { - obj["DOOR-VS"].setText(sprintf("%+4.0f", 9950)); - } else if (val < -9950) { - obj["DOOR-VS"].setText(sprintf("%+4.0f", -9950)); - } else { - obj["DOOR-VS"].setText(sprintf("%+4.0f", math.round(val,50))); - } + props.UpdateManager.FromHashValue("pressVS", 25, func(val) { + obj["DOOR-VS"].setText(sprintf("%+4.0f", math.clamp(math.round(val,50), -9950, 9950))); if (abs(val) > 2000) { obj["DOOR-VS"].setColor(0.7333,0.3803,0); @@ -185,14 +179,14 @@ var canvas_lowerECAMPageDoor = obj["DOOR-VS"].setColor(0.0509,0.7529,0.2941); } }), - props.UpdateManager.FromHashValue("FWCPhase", nil, func(val) { + props.UpdateManager.FromHashValue("FWCPhase", 1, func(val) { if (val >= 5 and val <= 7) { obj["DOOR-VS-Container"].show(); } else { obj["DOOR-VS-Container"].hide(); } }), - props.UpdateManager.FromHashValue("oxyBottleRegulLoPr", nil, func(val) { + props.UpdateManager.FromHashValue("oxyBottleRegulLoPr", 1, func(val) { if (val) { obj["DOOROXY-REGUL-LO-PR"].show(); } else { diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-elec.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-elec.nas index 8c49170d..0bc317bd 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-elec.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-elec.nas @@ -30,21 +30,17 @@ var canvas_lowerECAMPageElec = obj["IDG1-RISE-Value"].hide(); obj.update_items = [ - props.UpdateManager.FromHashValue("apuLoad", 0.1, func(val) { + props.UpdateManager.FromHashValue("apuLoad", 0.5, func(val) { obj["APUGenLoad"].setText(sprintf("%s", math.round(val))); - if (val < 110) { - obj["APUGenHz"].setColor(0.0509,0.7529,0.2941); + if (val <= 100) { + obj["APUGenLoad"].setColor(0.0509,0.7529,0.2941); } else { - obj["APUGenHz"].setColor(0.7333,0.3803,0); + obj["APUGenLoad"].setColor(0.7333,0.3803,0); } }), props.UpdateManager.FromHashValue("apuHertz", 0.5, func(val) { - if (val == 0) { - obj["APUGenHz"].setText(sprintf("XX")); - } else { - obj["APUGenHz"].setText(sprintf("%s", math.round(val))); - } + obj["APUGenHz"].setText(sprintf("%s", math.round(val))); if (val >= 390 and val <= 410) { obj["APUGenHz"].setColor(0.0509,0.7529,0.2941); @@ -52,7 +48,7 @@ var canvas_lowerECAMPageElec = obj["APUGenHz"].setColor(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashValue("apuVolt", 0.1, func(val) { + props.UpdateManager.FromHashValue("apuVolt", 0.5, func(val) { obj["APUGenVolt"].setText(sprintf("%s", math.round(val))); if (val >= 110 and val <= 120) { @@ -61,7 +57,7 @@ var canvas_lowerECAMPageElec = obj["APUGenVolt"].setColor(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashList(["apuMaster","apuVolt","apuLoad","apuHertz","apuGLC"], nil, func(val) { + props.UpdateManager.FromHashList(["apuMaster","apuVolt","apuLoad","apuHertz","apuGLC"], 0.5, func(val) { if (val.apuMaster == 0) { obj["APUGentext"].setColor(0.8078,0.8039,0.8078); } else { @@ -74,7 +70,7 @@ var canvas_lowerECAMPageElec = } } }), - props.UpdateManager.FromHashList(["apuMaster","apuGenPB"], nil, func(val) { + props.UpdateManager.FromHashList(["apuMaster","apuGenPB"], 1, func(val) { if (val.apuMaster == 0) { obj["APU-content"].hide(); obj["APUGEN-off"].hide(); @@ -90,7 +86,7 @@ var canvas_lowerECAMPageElec = } } }), - props.UpdateManager.FromHashValue("elecIDG1Disc", nil, func(val) { + props.UpdateManager.FromHashValue("elecIDG1Disc", 1, func(val) { if (!val) { obj["IDG1-DISC"].show(); obj["ELEC-IDG-1-label"].setColor(0.7333,0.3803,0); @@ -99,7 +95,7 @@ var canvas_lowerECAMPageElec = obj["ELEC-IDG-1-label"].setColor(0.8078,0.8039,0.8078); } }), - props.UpdateManager.FromHashValue("elecIDG2Disc", nil, func(val) { + props.UpdateManager.FromHashValue("elecIDG2Disc", 1, func(val) { if (!val) { obj["IDG2-DISC"].show(); obj["ELEC-IDG-2-label"].setColor(0.7333,0.3803,0); @@ -108,7 +104,7 @@ var canvas_lowerECAMPageElec = obj["ELEC-IDG-2-label"].setColor(0.8078,0.8039,0.8078); } }), - props.UpdateManager.FromHashValue("engine1Running", nil, func(val) { + props.UpdateManager.FromHashValue("engine1Running", 1, func(val) { if (val == 0) { obj["ELEC-IDG-1-num-label"].setColor(0.7333,0.3803,0); obj["GEN1-num-label"].setColor(0.7333,0.3803,0); @@ -117,7 +113,7 @@ var canvas_lowerECAMPageElec = obj["GEN1-num-label"].setColor(0.8078,0.8039,0.8078); } }), - props.UpdateManager.FromHashValue("engine2Running", nil, func(val) { + props.UpdateManager.FromHashValue("engine2Running", 1, func(val) { if (val == 0) { obj["ELEC-IDG-2-num-label"].setColor(0.7333,0.3803,0); obj["GEN2-num-label"].setColor(0.7333,0.3803,0); @@ -165,14 +161,14 @@ var canvas_lowerECAMPageElec = obj["ELEC-Line-AC2-TR2"].setColor(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashList(["elecGen1GLC","elecAcTie1"], nil, func(val) { + props.UpdateManager.FromHashList(["elecGen1GLC","elecAcTie1"], 1, func(val) { if (val.elecGen1GLC or val.elecAcTie1) { obj["AC1-in"].show(); } else { obj["AC1-in"].hide(); } }), - props.UpdateManager.FromHashList(["elecGen2GLC","elecAcTie2"], nil, func(val) { + props.UpdateManager.FromHashList(["elecGen2GLC","elecAcTie2"], 1, func(val) { if (val.elecGen2GLC or val.elecAcTie2) { obj["AC2-in"].show(); } else { @@ -193,14 +189,14 @@ var canvas_lowerECAMPageElec = obj["ACESS-SHED"].show(); } }), - props.UpdateManager.FromHashValue("ElecGalleyShed", nil, func(val) { + props.UpdateManager.FromHashValue("ElecGalleyShed", 1, func(val) { if (val) { obj["GalleyShed"].show(); } else { obj["GalleyShed"].hide(); } }), - props.UpdateManager.FromHashList(["elecBat1Switch","elecBat2Switch","dcBat"], nil, func(val) { + props.UpdateManager.FromHashList(["elecBat1Switch","elecBat2Switch","dcBat"], 0.5, func(val) { if (val.elecBat1Switch or val.elecBat2Switch) { obj["ELEC-DCBAT-label"].setText("DC BAT"); if (val.dcBat > 25) { @@ -213,7 +209,55 @@ var canvas_lowerECAMPageElec = obj["ELEC-DCBAT-label"].setColor(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashList(["elecBat1Switch","elecBat1Volt","elecBat1Amp","elecBat1Direction","elecBat1Fault"], nil, func(val) { + props.UpdateManager.FromHashValue("elecBat1Volt", 0.5, func(val) { + obj["Bat1Volt"].setText(sprintf("%2.0f", val)); + if (val >= 25 and val <= 31) { + obj["Bat1Volt"].setColor(0.0509,0.7529,0.2941); + } else { + obj["Bat1Volt"].setColor(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashList(["elecBat1Amp","elecBat1Direction"], 0.5, func(val) { + obj["Bat1Ampere"].setText(sprintf("%2.0f", val.elecBat1Amp)); + + if (val.elecBat1Amp > 5 and val.elecBat1Direction == 1) { + obj["Bat1Ampere"].setColor(0.7333,0.3803,0); + } else { + obj["Bat1Ampere"].setColor(0.0509,0.7529,0.2941); + } + }), + props.UpdateManager.FromHashList(["elecBat1Volt","elecBat1Amp","elecBat1Fault"], 0.5, func(val) { + if (val.elecBat1Fault or val.elecBat1Volt < 25 or val.elecBat1Volt > 31 or val.elecBat1Amp > 5) { + obj["BAT1-label"].setColor(0.7333,0.3803,0); + } else { + obj["BAT1-label"].setColor(0.8078,0.8039,0.8078); + } + }), + props.UpdateManager.FromHashValue("elecBat2Volt", 0.5, func(val) { + obj["Bat2Volt"].setText(sprintf("%2.0f", val)); + if (val >= 25 and val <= 31) { + obj["Bat2Volt"].setColor(0.0509,0.7529,0.2941); + } else { + obj["Bat2Volt"].setColor(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashList(["elecBat2Amp","elecBat2Direction"], 0.5, func(val) { + obj["Bat2Ampere"].setText(sprintf("%2.0f", val.elecBat2Amp)); + + if (val.elecBat2Amp > 5 and val.elecBat2Direction == 1) { + obj["Bat2Ampere"].setColor(0.7333,0.3803,0); + } else { + obj["Bat2Ampere"].setColor(0.0509,0.7529,0.2941); + } + }), + props.UpdateManager.FromHashList(["elecBat2Volt","elecBat2Amp","elecBat2Fault"], 0.5, func(val) { + if (val.elecBat2Fault or val.elecBat2Volt < 25 or val.elecBat2Volt > 31 or val.elecBat2Amp > 5) { + obj["BAT2-label"].setColor(0.7333,0.3803,0); + } else { + obj["BAT2-label"].setColor(0.8078,0.8039,0.8078); + } + }), + props.UpdateManager.FromHashList(["elecBat1Switch","elecBat1Direction"], 1, func(val) { if (val.elecBat1Switch == 0) { obj["BAT1-OFF"].show(); obj["BAT1-content"].hide(); @@ -222,22 +266,7 @@ var canvas_lowerECAMPageElec = } else { obj["BAT1-OFF"].hide(); obj["BAT1-content"].show(); - obj["Bat1Ampere"].setText(sprintf("%2.0f", val.elecBat1Amp)); - obj["Bat1Volt"].setText(sprintf("%2.0f", val.elecBat1Volt)); - - if (val.elecBat1Volt >= 24.95 and val.elecBat1Volt <= 31.05) { - obj["Bat1Volt"].setColor(0.0509,0.7529,0.2941); - } else { - obj["Bat1Volt"].setColor(0.7333,0.3803,0); - } - - if (val.elecBat1Amp > 5 and val.elecBat1Direction == 1) { - obj["Bat1Ampere"].setColor(0.7333,0.3803,0); - } else { - obj["Bat1Ampere"].setColor(0.0509,0.7529,0.2941); - } - if (val.elecBat1Direction == 0) { obj["BAT1-discharge"].hide(); obj["BAT1-charge"].hide(); @@ -251,14 +280,8 @@ var canvas_lowerECAMPageElec = } } } - - if (val.elecBat1Fault or val.elecBat1Volt < 25 or val.elecBat1Volt > 31 or val.elecBat1Amp > 5) { - obj["BAT1-label"].setColor(0.7333,0.3803,0); - } else { - obj["BAT1-label"].setColor(0.8078,0.8039,0.8078); - } }), - props.UpdateManager.FromHashList(["elecBat2Switch","elecBat2Volt","elecBat2Amp","elecBat2Direction","elecBat2Fault"], nil, func(val) { + props.UpdateManager.FromHashList(["elecBat2Switch","elecBat2Direction"], 1, func(val) { if (val.elecBat2Switch == 0) { obj["BAT2-OFF"].show(); obj["BAT2-content"].hide(); @@ -267,22 +290,7 @@ var canvas_lowerECAMPageElec = } else { obj["BAT2-OFF"].hide(); obj["BAT2-content"].show(); - obj["Bat2Ampere"].setText(sprintf("%2.0f", val.elecBat2Amp)); - obj["Bat2Volt"].setText(sprintf("%2.0f", val.elecBat2Volt)); - - if (val.elecBat2Volt >= 24.95 and val.elecBat2Volt <= 31.05) { - obj["Bat2Volt"].setColor(0.0509,0.7529,0.2941); - } else { - obj["Bat2Volt"].setColor(0.7333,0.3803,0); - } - - if (val.elecBat2Amp > 5 and val.elecBat2Direction == 1) { - obj["Bat2Ampere"].setColor(0.7333,0.3803,0); - } else { - obj["Bat2Ampere"].setColor(0.0509,0.7529,0.2941); - } - if (val.elecBat2Direction == 0) { obj["BAT2-discharge"].hide(); obj["BAT2-charge"].hide(); @@ -296,14 +304,8 @@ var canvas_lowerECAMPageElec = } } } - - if (val.elecBat2Fault or val.elecBat2Volt < 25 or val.elecBat2Volt > 31 or val.elecBat2Amp > 5) { - obj["BAT2-label"].setColor(0.7333,0.3803,0); - } else { - obj["BAT2-label"].setColor(0.8078,0.8039,0.8078); - } }), - props.UpdateManager.FromHashList(["elecTR1Amp","elecTR1Volt"], nil, func(val) { + props.UpdateManager.FromHashList(["elecTR1Amp","elecTR1Volt"], 0.5, func(val) { obj["TR1Volt"].setText(sprintf("%s", math.round(val.elecTR1Volt))); obj["TR1Ampere"].setText(sprintf("%s", math.round(val.elecTR1Amp))); @@ -325,7 +327,7 @@ var canvas_lowerECAMPageElec = obj["TR1Ampere"].setColor(0.0509,0.7529,0.2941); } }), - props.UpdateManager.FromHashList(["elecTR2Amp","elecTR2Volt"], nil, func(val) { + props.UpdateManager.FromHashList(["elecTR2Amp","elecTR2Volt"], 0.5, func(val) { obj["TR2Volt"].setText(sprintf("%s", math.round(val.elecTR2Volt))); obj["TR2Ampere"].setText(sprintf("%s", math.round(val.elecTR2Amp))); @@ -347,41 +349,37 @@ var canvas_lowerECAMPageElec = obj["TR2Ampere"].setColor(0.0509,0.7529,0.2941); } }), - props.UpdateManager.FromHashList(["elecExtHertz","elecExtVolt","elecGroundCart"], nil, func(val) { - if (val.elecGroundCart == 0) { - obj["EXTPWR-group"].hide(); + props.UpdateManager.FromHashValue("elecExtHertz", 0.5, func(val) { + if (val > 410 or val < 390) { + obj["ExtHz"].setColor(0.7333,0.3803,0); } else { - obj["EXTPWR-group"].show(); - obj["ExtVolt"].setText(sprintf("%s", math.round(val.elecExtVolt))); - obj["ExtHz"].setText(sprintf("%s", math.round(val.elecExtHertz))); - - if (val.elecExtHertz > 410 or val.elecExtHertz < 390 or val.elecExtVolt > 120 or val.elecExtVolt < 110) { - obj["EXTPWR-label"].setColor(0.7333,0.3803,0); - } else { - obj["EXTPWR-label"].setColor(0.0509,0.7529,0.2941); - } - - if (val.elecExtHertz > 410 or val.elecExtHertz < 390) { - obj["ExtHz"].setColor(0.7333,0.3803,0); - } else { - obj["ExtHz"].setColor(0.0509,0.7529,0.2941); - } - - if (val.elecExtVolt > 120 or val.elecExtVolt < 110) { - obj["ExtVolt"].setColor(0.7333,0.3803,0); - } else { - obj["ExtVolt"].setColor(0.0509,0.7529,0.2941); - } + obj["ExtHz"].setColor(0.0509,0.7529,0.2941); + } + obj.extPwrHertz = sprintf("%s", math.round(val)); + }), + props.UpdateManager.FromHashValue("elecExtVolt", 0.5, func(val) { + if (val > 120 or val < 110) { + obj["ExtVolt"].setColor(0.7333,0.3803,0); + } else { + obj["ExtVolt"].setColor(0.0509,0.7529,0.2941); + } + obj.extPwrVoltage = sprintf("%s", math.round(val)); + }), + props.UpdateManager.FromHashList(["elecExtHertz","elecExtVolt"], 0.5, func(val) { + if (val.elecExtHertz > 410 or val.elecExtHertz < 390 or val.elecExtVolt > 120 or val.elecExtVolt < 110) { + obj["EXTPWR-label"].setColor(0.7333,0.3803,0); + } else { + obj["EXTPWR-label"].setColor(0.0509,0.7529,0.2941); } }), - props.UpdateManager.FromHashValue("elecDCTie1", nil, func(val) { + props.UpdateManager.FromHashValue("elecDCTie1", 1, func(val) { if (val) { obj["ELEC-Line-DC1-DCESS_DCBAT"].show(); } else { obj["ELEC-Line-DC1-DCESS_DCBAT"].hide(); } }), - props.UpdateManager.FromHashValue("elecDCTie2", nil, func(val) { + props.UpdateManager.FromHashValue("elecDCTie2", 1, func(val) { if (val) { obj["ELEC-Line-DC2-DCESS_DCBAT"].show(); obj["ELEC-Line-DC2-DCBAT"].show(); @@ -390,28 +388,28 @@ var canvas_lowerECAMPageElec = obj["ELEC-Line-DC2-DCBAT"].hide(); } }), - props.UpdateManager.FromHashValue("elecDCTie1", nil, func(val) { + props.UpdateManager.FromHashValue("elecDCTie1", 1, func(val) { if (val) { obj["ELEC-Line-DC1-DCBAT"].show(); } else { obj["ELEC-Line-DC1-DCBAT"].hide(); } }), - props.UpdateManager.FromHashValue("elecDcEssFeedBat", nil, func(val) { + props.UpdateManager.FromHashValue("elecDcEssFeedBat", 1, func(val) { if (val) { obj["ELEC-Line-DC1-DCESS"].show(); } else { obj["ELEC-Line-DC1-DCESS"].hide(); } }), - props.UpdateManager.FromHashValue("elecTrEssContact", nil, func(val) { + props.UpdateManager.FromHashValue("elecTrEssContact", 1, func(val) { if (val) { obj["ELEC-Line-ESSTR-DCESS"].show(); } else { obj["ELEC-Line-ESSTR-DCESS"].hide(); } }), - props.UpdateManager.FromHashList(["elecEmerGenVoltsRelay","elec15XE1"], nil, func(val) { + props.UpdateManager.FromHashList(["elecEmerGenVoltsRelay","elec15XE1"], 1, func(val) { if (val.elecEmerGenVoltsRelay) { if (val.elec15XE1) { obj["EMERGEN-out"].show(); @@ -424,7 +422,7 @@ var canvas_lowerECAMPageElec = obj["ELEC-Line-Emergen-ESSTR"].hide(); } }), - props.UpdateManager.FromHashList(["elecTREssAmp","elecTREssVolt","elecTrEssContact"], nil, func(val) { + props.UpdateManager.FromHashList(["elecTREssAmp","elecTREssVolt","elecTrEssContact"], 0.5, func(val) { if (val.elecTrEssContact) { obj["ESSTR-group"].show(); obj["ESSTR-Volt"].setText(sprintf("%s", math.round(val.elecTREssVolt))); @@ -451,8 +449,8 @@ var canvas_lowerECAMPageElec = obj["ESSTR-group"].hide(); } }), - props.UpdateManager.FromHashList(["elecEmerGenHertz","elecEmerGenVolts","elecEmerGenVoltsRelay"], nil, func(val) { - if (val.elecEmerGenVolts == 0) { + props.UpdateManager.FromHashList(["elecEmerGenHertz","elecEmerGenVolts","elecEmerGenVoltsRelay"], 0.5, func(val) { + if (val.elecEmerGenVolts < 110) { obj["EMERGEN-group"].hide(); obj["ELEC-Line-Emergen-ESSTR"].hide(); obj["ELEC-Line-Emergen-ESSTR-off"].show(); @@ -485,7 +483,7 @@ var canvas_lowerECAMPageElec = } } }), - props.UpdateManager.FromHashList(["elecGen1Switch","elecGen1Hertz","elecGen1Volt","engine1Running","elecGen1Relay"], nil, func(val) { + props.UpdateManager.FromHashList(["elecGen1Switch","elecGen1Hertz","elecGen1Volt","engine1Running","elecGen1Relay"], 0.5, func(val) { if (val.elecGen1Switch == 0) { obj["GEN1-content"].hide(); obj["GEN1-off"].show(); @@ -524,7 +522,7 @@ var canvas_lowerECAMPageElec = } } }), - props.UpdateManager.FromHashList(["elecGen2Switch","elecGen2Hertz","elecGen2Volt","engine1Running","elecGen2Relay"], nil, func(val) { + props.UpdateManager.FromHashList(["elecGen2Switch","elecGen2Hertz","elecGen2Volt","engine1Running","elecGen2Relay"], 0.5, func(val) { if (val.elecGen2Switch == 0) { obj["GEN2-content"].hide(); obj["GEN2-off"].show(); @@ -563,21 +561,21 @@ var canvas_lowerECAMPageElec = } } }), - props.UpdateManager.FromHashList(["elecTR1Contact","elecAC1"], nil, func(val) { - if (val.elecTR1Contact) { + props.UpdateManager.FromHashValue("elecTR1Contact", 1, func(val) { + if (val) { obj["ELEC-Line-TR1-DC1"].show(); } else { obj["ELEC-Line-TR1-DC1"].hide(); } }), - props.UpdateManager.FromHashList(["elecTR2Contact","elecAC2"], nil, func(val) { - if (val.elecTR2Contact) { + props.UpdateManager.FromHashValue("elecTR2Contact", 1, func(val) { + if (val) { obj["ELEC-Line-TR2-DC2"].show(); } else { obj["ELEC-Line-TR2-DC2"].hide(); } }), - props.UpdateManager.FromHashList(["elecAcEssFeed1","elecAcEssFeed2","elecAC1","elecAC2"], nil, func(val) { + props.UpdateManager.FromHashList(["elecAcEssFeed1","elecAcEssFeed2","elecAC1","elecAC2"], 0.5, func(val) { if (val.elecAcEssFeed1) { if (val.elecAC1 >= 110) { obj["ELEC-Line-AC1-ACESS"].show(); @@ -597,49 +595,49 @@ var canvas_lowerECAMPageElec = obj["ELEC-Line-AC2-ACESS"].hide(); } }), - props.UpdateManager.FromHashList(["elecGen1Volt","elecGen1GLC"], nil, func(val) { + props.UpdateManager.FromHashList(["elecGen1Volt","elecGen1GLC"], 0.5, func(val) { if (val.elecGen1Volt >= 110 and val.elecGen1GLC) { obj["ELEC-Line-GEN1-AC1"].show(); } else { obj["ELEC-Line-GEN1-AC1"].hide(); } }), - props.UpdateManager.FromHashList(["elecGen2Volt","elecGen2GLC"], nil, func(val) { + props.UpdateManager.FromHashList(["elecGen2Volt","elecGen2GLC"], 0.5, func(val) { if (val.elecGen2Volt >= 110 and val.elecGen2GLC) { obj["ELEC-Line-GEN2-AC2"].show(); } else { obj["ELEC-Line-GEN2-AC2"].hide(); } }), - props.UpdateManager.FromHashValue("elecAcTie1", nil, func(val) { + props.UpdateManager.FromHashValue("elecAcTie1", 1, func(val) { if (val) { obj["ELEC-Line-APU-AC1"].show(); } else { obj["ELEC-Line-APU-AC1"].hide(); } }), - props.UpdateManager.FromHashValue("elecAcTie2", nil, func(val) { + props.UpdateManager.FromHashValue("elecAcTie2", 1, func(val) { if (val) { obj["ELEC-Line-EXT-AC2"].show(); } else { obj["ELEC-Line-EXT-AC2"].hide(); } }), - props.UpdateManager.FromHashList(["elecAcTie1","elecAcTie2","apuGLC","elecExtEPC"], nil, func(val) { + props.UpdateManager.FromHashList(["elecAcTie1","elecAcTie2","apuGLC","elecExtEPC"], 1, func(val) { if ((val.apuGLC and val.elecAcTie2) or (val.elecExtEPC and val.elecAcTie1) or (val.elecAcTie1 and val.elecAcTie2)) { obj["ELEC-Line-APU-EXT"].show(); } else { obj["ELEC-Line-APU-EXT"].hide(); } }), - props.UpdateManager.FromHashValue("elecExtEPC", nil, func(val) { + props.UpdateManager.FromHashValue("elecExtEPC", 1, func(val) { if (val) { obj["EXT-out"].show(); } else { obj["EXT-out"].hide(); } }), - props.UpdateManager.FromHashValue("apuGLC", nil, func(val) { + props.UpdateManager.FromHashValue("apuGLC", 1, func(val) { if (val) { obj["APU-out"].show(); } else { @@ -653,18 +651,18 @@ var canvas_lowerECAMPageElec = obj["ELEC-Line-ACESS-TRESS"].hide(); } }), - props.UpdateManager.FromHashValue("elec15XE2", nil, func(val) { + props.UpdateManager.FromHashValue("elec15XE2", 1, func(val) { if (val) { obj["STATINV-group"].show(); } else { obj["STATINV-group"].hide(); } }), - props.UpdateManager.FromHashValue("statInvVolts", 0.1, func(val) { - obj["StatVolt"].setText(sprintf("%s",math.round(val))); + props.UpdateManager.FromHashValue("statInvVolts", 0.5, func(val) { + obj["StatVolt"].setText(sprintf("%s", math.round(val))); }), props.UpdateManager.FromHashValue("statInvHertz", 0.5, func(val) { - obj["StatHz"].setText(sprintf("%s",math.round(val))); + obj["StatHz"].setText(sprintf("%s", math.round(val))); }), ]; @@ -764,6 +762,14 @@ var canvas_lowerECAMPageElec = update_item.update(notification); } + if (notification.elecGroundCart == 0) { + me["EXTPWR-group"].hide(); + } else { + me["EXTPWR-group"].show(); + me["ExtVolt"].setText(me.extPwrVoltage); + me["ExtHz"].setText(me.extPwrHertz); + } + me.updateBottom(notification); }, updatePower: func() { From 96a251eff27862ca1ec4deb3a7a4eacc3d0c2750 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Thu, 21 Apr 2022 20:48:44 +0100 Subject: [PATCH 10/33] FCTL / FUEL --- .../Lower-ECAM/Lower-ECAM-fctl.nas | 42 +++++----- .../Lower-ECAM/Lower-ECAM-fuel.nas | 81 ++++++++++--------- 2 files changed, 66 insertions(+), 57 deletions(-) diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-fctl.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-fctl.nas index 5bea9135..1cfdefb4 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-fctl.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-fctl.nas @@ -23,7 +23,7 @@ var canvas_lowerECAMPageFctl = # init obj.update_items = [ - props.UpdateManager.FromHashList(["green","elac1","elac2","sec2"], nil, func(val) { + props.UpdateManager.FromHashList(["green","elac1","elac2","sec2"], 1, func(val) { if (val.green >= 1450) { if (val.elac2 or val.sec2) { obj["elevLgreen"].setColor(0.0509,0.7529,0.2941); @@ -53,7 +53,7 @@ var canvas_lowerECAMPageFctl = obj["spdbrkgreen"].setColor(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashList(["yellow","elac2","sec2"], nil, func(val) { + props.UpdateManager.FromHashList(["yellow","elac2","sec2"], 1, func(val) { if (val.yellow >= 1450) { if (val.elac2 or val.sec2) { obj["elevRyellow"].setColor(0.0509,0.7529,0.2941); @@ -70,7 +70,7 @@ var canvas_lowerECAMPageFctl = obj["spdbrkyellow"].setColor(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashList(["blue","elac1","elac2","sec1"], nil, func(val) { + props.UpdateManager.FromHashList(["blue","elac1","elac2","sec1"], 1, func(val) { if (val.blue >= 1500) { if (val.elac1) { obj["ailLblue"].setColor(0.0509,0.7529,0.2941); @@ -106,7 +106,7 @@ var canvas_lowerECAMPageFctl = props.UpdateManager.FromHashValue("fctlAilR", 0.001, func(val) { obj["ailR"].setTranslation(0, val * -100); }), - props.UpdateManager.FromHashList(["blue","green","elac1","elac2"], nil, func(val) { + props.UpdateManager.FromHashList(["blue","green","elac1","elac2"], 1, func(val) { if ((val.blue < 1500 or !val.elac1) and (val.green < 1500 or !val.elac2)) { obj["ailL"].setColor(0.7333,0.3803,0); } else { @@ -124,7 +124,7 @@ var canvas_lowerECAMPageFctl = props.UpdateManager.FromHashValue("fctlElevR", 0.001, func(val) { obj["elevR"].setTranslation(0, val * 100); }), - props.UpdateManager.FromHashList(["blue","green","yellow","elac1","elac2","sec1","sec2"], nil, func(val) { + props.UpdateManager.FromHashList(["blue","green","yellow","elac1","elac2","sec1","sec2"], 1, func(val) { if ((val.blue < 1500 or (!val.elac1 and !val.sec1)) and (val.green < 1500 or (!val.elac2 and !val.sec2))) { obj["elevL"].setColor(0.7333,0.3803,0); } else { @@ -149,7 +149,7 @@ var canvas_lowerECAMPageFctl = obj["PTupdn"].hide(); } }), - props.UpdateManager.FromHashValue("elac1", nil, func(val) { + props.UpdateManager.FromHashValue("elac1", 1, func(val) { if (val) { obj["elac1"].setColor(0.0509,0.7529,0.2941); obj["path4249"].setColor(0.0509,0.7529,0.2941); @@ -158,7 +158,7 @@ var canvas_lowerECAMPageFctl = obj["path4249"].setColor(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashValue("elac2", nil, func(val) { + props.UpdateManager.FromHashValue("elac2", 1, func(val) { if (val) { obj["elac2"].setColor(0.0509,0.7529,0.2941); obj["path4249-3"].setColor(0.0509,0.7529,0.2941); @@ -167,7 +167,7 @@ var canvas_lowerECAMPageFctl = obj["path4249-3"].setColor(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashValue("sec1", nil, func(val) { + props.UpdateManager.FromHashValue("sec1", 1, func(val) { if (val) { obj["sec1"].setColor(0.0509,0.7529,0.2941); obj["path4249-3-6-7"].setColor(0.0509,0.7529,0.2941); @@ -176,7 +176,7 @@ var canvas_lowerECAMPageFctl = obj["path4249-3-6-7"].setColor(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashValue("sec2", nil, func(val) { + props.UpdateManager.FromHashValue("sec2", 1, func(val) { if (val) { obj["sec2"].setColor(0.0509,0.7529,0.2941); obj["path4249-3-6-7-5"].setColor(0.0509,0.7529,0.2941); @@ -185,7 +185,7 @@ var canvas_lowerECAMPageFctl = obj["path4249-3-6-7-5"].setColor(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashValue("sec3", nil, func(val) { + props.UpdateManager.FromHashValue("sec3", 1, func(val) { if (val) { obj["sec3"].setColor(0.0509,0.7529,0.2941); obj["path4249-3-6"].setColor(0.0509,0.7529,0.2941); @@ -217,7 +217,7 @@ var canvas_lowerECAMPageFctl = props.UpdateManager.FromHashValue("fctlRudderTrim", 0.01, func(val) { obj["rudderTrimInd"].setRotation(val * -0.024); }), - props.UpdateManager.FromHashValue("fctlTHSJam", nil, func(val) { + props.UpdateManager.FromHashValue("fctlTHSJam", 1, func(val) { if (val) { obj["pitchTrimStatus"].setColor(0.7333,0.3803,0); } else { @@ -314,7 +314,7 @@ var canvas_lowerECAMPageFctl = obj["spoiler5Rex"].show(); } }), - props.UpdateManager.FromHashList(["spoilerL1Failure","spoilerL1","green"], nil, func(val) { + props.UpdateManager.FromHashList(["spoilerL1Failure","spoilerL1","green"], 1, func(val) { if (val.spoilerL1Failure or val.green < 1500) { obj["spoiler1Lex"].setColor(0.7333,0.3803,0); obj["spoiler1Lrt"].setColor(0.7333,0.3803,0); @@ -329,7 +329,7 @@ var canvas_lowerECAMPageFctl = obj["spoiler1Lf"].hide(); } }), - props.UpdateManager.FromHashList(["spoilerL2Failure","spoilerL2","yellow"], nil, func(val) { + props.UpdateManager.FromHashList(["spoilerL2Failure","spoilerL2","yellow"], 1, func(val) { if (val.spoilerL2Failure or val.yellow < 1500) { obj["spoiler2Lex"].setColor(0.7333,0.3803,0); obj["spoiler2Lrt"].setColor(0.7333,0.3803,0); @@ -344,7 +344,7 @@ var canvas_lowerECAMPageFctl = obj["spoiler2Lf"].hide(); } }), - props.UpdateManager.FromHashList(["spoilerL3Failure","spoilerL3","blue"], nil, func(val) { + props.UpdateManager.FromHashList(["spoilerL3Failure","spoilerL3","blue"], 1, func(val) { if (val.spoilerL3Failure or val.blue < 1500) { obj["spoiler3Lex"].setColor(0.7333,0.3803,0); obj["spoiler3Lrt"].setColor(0.7333,0.3803,0); @@ -359,7 +359,7 @@ var canvas_lowerECAMPageFctl = obj["spoiler3Lf"].hide(); } }), - props.UpdateManager.FromHashList(["spoilerL4Failure","spoilerL4","yellow"], nil, func(val) { + props.UpdateManager.FromHashList(["spoilerL4Failure","spoilerL4","yellow"], 1, func(val) { if (val.spoilerL4Failure or val.yellow < 1500) { obj["spoiler4Lex"].setColor(0.7333,0.3803,0); obj["spoiler4Lrt"].setColor(0.7333,0.3803,0); @@ -374,7 +374,7 @@ var canvas_lowerECAMPageFctl = obj["spoiler4Lf"].hide(); } }), - props.UpdateManager.FromHashList(["spoilerL5Failure","spoilerL5","green"], nil, func(val) { + props.UpdateManager.FromHashList(["spoilerL5Failure","spoilerL5","green"], 1, func(val) { if (val.spoilerL5Failure or val.green < 1500) { obj["spoiler5Lex"].setColor(0.7333,0.3803,0); obj["spoiler5Lrt"].setColor(0.7333,0.3803,0); @@ -389,7 +389,7 @@ var canvas_lowerECAMPageFctl = obj["spoiler5Lf"].hide(); } }), - props.UpdateManager.FromHashList(["spoilerR1Failure","spoilerR1","green"], nil, func(val) { + props.UpdateManager.FromHashList(["spoilerR1Failure","spoilerR1","green"], 1, func(val) { if (val.spoilerR1Failure or val.green < 1500) { obj["spoiler1Rex"].setColor(0.7333,0.3803,0); obj["spoiler1Rrt"].setColor(0.7333,0.3803,0); @@ -404,7 +404,7 @@ var canvas_lowerECAMPageFctl = obj["spoiler1Rf"].hide(); } }), - props.UpdateManager.FromHashList(["spoilerR2Failure","spoilerR2","yellow"], nil, func(val) { + props.UpdateManager.FromHashList(["spoilerR2Failure","spoilerR2","yellow"], 1, func(val) { if (val.spoilerR2Failure or val.yellow < 1500) { obj["spoiler2Rex"].setColor(0.7333,0.3803,0); obj["spoiler2Rrt"].setColor(0.7333,0.3803,0); @@ -419,7 +419,7 @@ var canvas_lowerECAMPageFctl = obj["spoiler2Rf"].hide(); } }), - props.UpdateManager.FromHashList(["spoilerR3Failure","spoilerR3","blue"], nil, func(val) { + props.UpdateManager.FromHashList(["spoilerR3Failure","spoilerR3","blue"], 1, func(val) { if (val.spoilerR3Failure or val.blue < 1500) { obj["spoiler3Rex"].setColor(0.7333,0.3803,0); obj["spoiler3Rrt"].setColor(0.7333,0.3803,0); @@ -434,7 +434,7 @@ var canvas_lowerECAMPageFctl = obj["spoiler3Rf"].hide(); } }), - props.UpdateManager.FromHashList(["spoilerR4Failure","spoilerR4","yellow"], nil, func(val) { + props.UpdateManager.FromHashList(["spoilerR4Failure","spoilerR4","yellow"], 1, func(val) { if (val.spoilerR4Failure or val.yellow < 1500) { obj["spoiler4Rex"].setColor(0.7333,0.3803,0); obj["spoiler4Rrt"].setColor(0.7333,0.3803,0); @@ -449,7 +449,7 @@ var canvas_lowerECAMPageFctl = obj["spoiler4Rf"].hide(); } }), - props.UpdateManager.FromHashList(["spoilerR5Failure","spoilerR5","green"], nil, func(val) { + props.UpdateManager.FromHashList(["spoilerR5Failure","spoilerR5","green"], 1, func(val) { if (val.spoilerR5Failure or val.green < 1500) { obj["spoiler5Rex"].setColor(0.7333,0.3803,0); obj["spoiler5Rrt"].setColor(0.7333,0.3803,0); diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-fuel.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-fuel.nas index d9acc89d..6ca419d6 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-fuel.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-fuel.nas @@ -99,6 +99,13 @@ var canvas_lowerECAMPageFuel = obj["FUEL-Right-Outer-quantity"].setText(sprintf("%s", math.round(val, 10))); } }), + props.UpdateManager.FromHashValue("fuelCenterQty", 0.25, func(val) { + if (obj.units) { + obj["FUEL-Center-quantity"].setText(sprintf("%s", math.round(val * LBS2KGS, 10))); + } else { + obj["FUEL-Center-quantity"].setText(sprintf("%s", math.round(val, 10))); + } + }), props.UpdateManager.FromHashValue("fuelLeftInnerQty", 0.25, func(val) { if (obj.units) { obj["FUEL-Left-Inner-quantity"].setText(sprintf("%s", math.round(val * LBS2KGS, 10))); @@ -113,17 +120,11 @@ var canvas_lowerECAMPageFuel = obj["FUEL-Right-Inner-quantity"].setText(sprintf("%s", math.round(val, 10))); } }), - props.UpdateManager.FromHashList(["fadecPower1","fadecPower2","fadecPowerStart","fuelflow_1","fuelflow_2"], nil, func(val) { - if (val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) { - obj["FUEL-Flow-per-min"].setColor(0.0509,0.7529,0.2941); - if (obj.units) { - obj["FUEL-Flow-per-min"].setText(sprintf("%s", math.round(((val.fuelflow_1 + val.fuelflow_2) * LBS2KGS) / 60, 10))); - } else { - obj["FUEL-Flow-per-min"].setText(sprintf("%s", math.round((val.fuelflow_1 + val.fuelflow_2) / 60, 10))); - } + props.UpdateManager.FromHashList(["fuelflow_1","fuelflow_2"], nil, func(val) { + if (obj.units) { + obj.fuelFlowPerMinute = sprintf("%s", math.round(((val.fuelflow_1 + val.fuelflow_2) * LBS2KGS) / 60, 10)); } else { - obj["FUEL-Flow-per-min"].setColor(0.7333,0.3803,0); - obj["FUEL-Flow-per-min"].setText("XX"); + obj.fuelFlowPerMinute = sprintf("%s", math.round((val.fuelflow_1 + val.fuelflow_2) / 60, 10)); } }), props.UpdateManager.FromHashValue("N1_actual_1", 0.05, func(val) { @@ -144,7 +145,7 @@ var canvas_lowerECAMPageFuel = obj["FUEL-ENG-2-label"].setColor(0.8078,0.8039,0.8078); } }), - props.UpdateManager.FromHashValue("fuelLeftSwitch1", nil, func(val) { + props.UpdateManager.FromHashValue("fuelLeftSwitch1", 1, func(val) { if (val) { obj["FUEL-Pump-Left-1-Open"].show(); obj["FUEL-Pump-Left-1-Closed"].hide(); @@ -163,7 +164,7 @@ var canvas_lowerECAMPageFuel = obj["FUEL-Pump-Left-1-Closed"].setColorFill(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashValue("fuelLeftSwitch2", nil, func(val) { + props.UpdateManager.FromHashValue("fuelLeftSwitch2", 1, func(val) { if (val) { obj["FUEL-Pump-Left-2-Open"].show(); obj["FUEL-Pump-Left-2-Closed"].hide(); @@ -182,7 +183,7 @@ var canvas_lowerECAMPageFuel = obj["FUEL-Pump-Left-2-Closed"].setColorFill(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashValue("fuelCenterSwitch1", nil, func(val) { + props.UpdateManager.FromHashValue("fuelCenterSwitch1", 1, func(val) { if (val) { obj["FUEL-Pump-Center-1-Open"].show(); obj["FUEL-Pump-Center-1-Closed"].hide(); @@ -201,7 +202,7 @@ var canvas_lowerECAMPageFuel = obj["FUEL-Pump-Center-1-Closed"].setColorFill(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashValue("fuelCenterSwitch2", nil, func(val) { + props.UpdateManager.FromHashValue("fuelCenterSwitch2", 1, func(val) { if (val) { obj["FUEL-Pump-Center-2-Open"].show(); obj["FUEL-Pump-Center-2-Closed"].hide(); @@ -220,7 +221,7 @@ var canvas_lowerECAMPageFuel = obj["FUEL-Pump-Center-2-Closed"].setColorFill(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashValue("fuelRightSwitch1", nil, func(val) { + props.UpdateManager.FromHashValue("fuelRightSwitch1", 1, func(val) { if (val) { obj["FUEL-Pump-Right-1-Open"].show(); obj["FUEL-Pump-Right-1-Closed"].hide(); @@ -239,7 +240,7 @@ var canvas_lowerECAMPageFuel = obj["FUEL-Pump-Right-1-Closed"].setColorFill(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashValue("fuelRightSwitch2", nil, func(val) { + props.UpdateManager.FromHashValue("fuelRightSwitch2", 1, func(val) { if (val) { obj["FUEL-Pump-Right-2-Open"].show(); obj["FUEL-Pump-Right-2-Closed"].hide(); @@ -258,15 +259,15 @@ var canvas_lowerECAMPageFuel = obj["FUEL-Pump-Right-2-Closed"].setColorFill(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashList(["fuelCenterSwitch1","fuelCenterSwitch2"], nil, func(val) { + props.UpdateManager.FromHashList(["fuelCenterSwitch1","fuelCenterSwitch2"], 1, func(val) { if (!val.fuelCenterSwitch1 and !val.fuelCenterSwitch2) { obj["FUEL-Center-blocked"].show(); } else { obj["FUEL-Center-blocked"].hide(); } }), - props.UpdateManager.FromHashList(["fuelCrossfeedValve","fuelCrossfeedSwitch"], nil, func(val) { - if (val.fuelCrossfeedValve == 1) { + props.UpdateManager.FromHashList(["fuelCrossfeedValve","fuelCrossfeedSwitch"], 0.1, func(val) { + if (val.fuelCrossfeedValve >= 0.9) { obj["FUEL-XFEED"].setRotation(0); obj["FUEL-XFEED-pipes"].show(); if (val.fuelCrossfeedSwitch) { @@ -278,7 +279,7 @@ var canvas_lowerECAMPageFuel = obj["FUEL-XFEED"].setColorFill(0.7333,0.3803,0); obj["FUEL-XFEED-Cross"].setColorFill(0.7333,0.3803,0); } - } elsif (val.fuelCrossfeedValve == 0) { + } elsif (val.fuelCrossfeedValve <= 0.1) { obj["FUEL-XFEED"].setRotation(90 * D2R); obj["FUEL-XFEED-pipes"].hide(); if (!val.fuelCrossfeedSwitch) { @@ -298,9 +299,9 @@ var canvas_lowerECAMPageFuel = obj["FUEL-XFEED-Cross"].setColorFill(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashList(["fuelEngine1Valve","engineCutoff1"], nil, func(val) { - if (val.fuelEngine1Valve) { - if (val.fuelEngine1Valve == 1) { + props.UpdateManager.FromHashList(["fuelEngine1Valve","engineCutoff1"], 0.1, func(val) { + if (val.fuelEngine1Valve > 0.1) { + if (val.fuelEngine1Valve >= 0.9) { obj["FUEL-ENG-Master-1"].setRotation(0); } else { obj["FUEL-ENG-Master-1"].setRotation(45 * D2R); @@ -327,9 +328,9 @@ var canvas_lowerECAMPageFuel = obj["FUEL-ENG-1-pipe"].setColorFill(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashList(["fuelEngine2Valve","engineCutoff2"], nil, func(val) { - if (val.fuelEngine2Valve) { - if (val.fuelEngine2Valve == 1) { + props.UpdateManager.FromHashList(["fuelEngine2Valve","engineCutoff2"], 0.1, func(val) { + if (val.fuelEngine2Valve > 0.1) { + if (val.fuelEngine1Valve >= 0.9) { obj["FUEL-ENG-Master-2"].setRotation(0); } else { obj["FUEL-ENG-Master-2"].setRotation(45 * D2R); @@ -356,11 +357,11 @@ var canvas_lowerECAMPageFuel = obj["FUEL-ENG-2-pipe"].setColorFill(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashValue("fuelTransferValve1", nil, func(val) { - if (val == 0) { + props.UpdateManager.FromHashValue("fuelTransferValve1", 0.1, func(val) { + if (val <= 0.1) { obj["FUEL-Left-Transfer"].hide(); } else { - if (val == 1) { + if (val >= 0.9) { obj["FUEL-Left-Transfer"].setColor(0.0509,0.7529,0.2941); } else { obj["FUEL-Left-Transfer"].setColor(0.7333,0.3803,0); @@ -368,11 +369,11 @@ var canvas_lowerECAMPageFuel = obj["FUEL-Left-Transfer"].show(); } }), - props.UpdateManager.FromHashValue("fuelTransferValve2", nil, func(val) { - if (val == 0) { + props.UpdateManager.FromHashValue("fuelTransferValve2", 0.1, func(val) { + if (val <= 0.1) { obj["FUEL-Right-Transfer"].hide(); } else { - if (val == 1) { + if (val >= 0.9) { obj["FUEL-Right-Transfer"].setColor(0.0509,0.7529,0.2941); } else { obj["FUEL-Right-Transfer"].setColor(0.7333,0.3803,0); @@ -387,7 +388,7 @@ var canvas_lowerECAMPageFuel = obj["FUEL-On-Board"].setText(sprintf("%s", math.round(val, 10))); } }), - props.UpdateManager.FromHashValue("fuelTempLeftOuter", 0.25, func(val) { + props.UpdateManager.FromHashValue("fuelTempLeftOuter", 0.5, func(val) { obj["FUEL-Left-Outer-temp"].setText(sprintf("%s", math.round(val))); if (val > 55 or val < -40) { obj["FUEL-Left-Outer-temp"].setColor(0.7333,0.3803,0); @@ -395,7 +396,7 @@ var canvas_lowerECAMPageFuel = obj["FUEL-Left-Outer-temp"].setColor(0.0509,0.7529,0.2941); } }), - props.UpdateManager.FromHashValue("fuelTempLeftInner", 0.25, func(val) { + props.UpdateManager.FromHashValue("fuelTempLeftInner", 0.5, func(val) { obj["FUEL-Left-Inner-temp"].setText(sprintf("%s", math.round(val))); if (val > 45 or val < -40) { obj["FUEL-Left-Inner-temp"].setColor(0.7333,0.3803,0); @@ -403,7 +404,7 @@ var canvas_lowerECAMPageFuel = obj["FUEL-Left-Inner-temp"].setColor(0.0509,0.7529,0.2941); } }), - props.UpdateManager.FromHashValue("fuelTempRightInner", 0.25, func(val) { + props.UpdateManager.FromHashValue("fuelTempRightInner", 0.5, func(val) { obj["FUEL-Right-Inner-temp"].setText(sprintf("%s", math.round(val))); if (val > 45 or val < -40) { obj["FUEL-Right-Inner-temp"].setColor(0.7333,0.3803,0); @@ -411,7 +412,7 @@ var canvas_lowerECAMPageFuel = obj["FUEL-Right-Inner-temp"].setColor(0.0509,0.7529,0.2941); } }), - props.UpdateManager.FromHashValue("fuelTempRightOuter", 0.25, func(val) { + props.UpdateManager.FromHashValue("fuelTempRightOuter", 0.5, func(val) { obj["FUEL-Right-Outer-temp"].setText(sprintf("%s", math.round(val))); if (val > 55 or val < -40) { obj["FUEL-Right-Outer-temp"].setColor(0.7333,0.3803,0); @@ -545,6 +546,14 @@ var canvas_lowerECAMPageFuel = update_item.update(notification); } + if (notification.fadecPower1 or notification.fadecPower2 or notification.fadecPowerStart) { + me["FUEL-Flow-per-min"].setColor(0.0509,0.7529,0.2941); + me["FUEL-Flow-per-min"].setText(me.fuelFlowPerMinute); + } else { + me["FUEL-Flow-per-min"].setColor(0.7333,0.3803,0); + me["FUEL-Flow-per-min"].setText("XX"); + } + me.updateBottom(notification); }, updatePower: func() { From f020da9bc4681cff4dbdf56ef1b1d8b6f665de7f Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Thu, 21 Apr 2022 20:57:10 +0100 Subject: [PATCH 11/33] Hyd / press --- .../Instruments/Lower-ECAM/Lower-ECAM-hyd.nas | 36 +++++++++---------- .../Lower-ECAM/Lower-ECAM-press.nas | 32 ++++------------- 2 files changed, 25 insertions(+), 43 deletions(-) diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-hyd.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-hyd.nas index 0666cf96..40231d6a 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-hyd.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-hyd.nas @@ -165,63 +165,63 @@ var canvas_lowerECAMPageHyd = obj["Pump-Yellow-label"].setColor(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashValue("hydBlueResvLoPrs", nil, func(val) { + props.UpdateManager.FromHashValue("hydBlueResvLoPrs", 1, func(val) { if (val) { obj["LO-AIR-PRESS-Blue"].show(); } else { obj["LO-AIR-PRESS-Blue"].hide(); } }), - props.UpdateManager.FromHashValue("hydGreenResvLoPrs", nil, func(val) { + props.UpdateManager.FromHashValue("hydGreenResvLoPrs", 1, func(val) { if (val) { obj["LO-AIR-PRESS-Green"].show(); } else { obj["LO-AIR-PRESS-Green"].hide(); } }), - props.UpdateManager.FromHashValue("hydYellowResvLoPrs", nil, func(val) { + props.UpdateManager.FromHashValue("hydYellowResvLoPrs", 1, func(val) { if (val) { obj["LO-AIR-PRESS-Yellow"].show(); } else { obj["LO-AIR-PRESS-Yellow"].hide(); } }), - props.UpdateManager.FromHashValue("hydYellowElecPumpOvht", nil, func(val) { + props.UpdateManager.FromHashValue("hydYellowElecPumpOvht", 1, func(val) { if (val) { obj["ELEC-OVHT-Yellow"].show(); } else { obj["ELEC-OVHT-Yellow"].hide(); } }), - props.UpdateManager.FromHashValue("hydBlueElecPumpOvht", nil, func(val) { + props.UpdateManager.FromHashValue("hydBlueElecPumpOvht", 1, func(val) { if (val) { obj["ELEC-OVHT-Blue"].show(); } else { obj["ELEC-OVHT-Blue"].hide(); } }), - props.UpdateManager.FromHashValue("hydBlueResvOvht", nil, func(val) { + props.UpdateManager.FromHashValue("hydBlueResvOvht", 1, func(val) { if (val) { obj["OVHT-Blue"].show(); } else { obj["OVHT-Blue"].hide(); } }), - props.UpdateManager.FromHashValue("hydGreenResvOvht", nil, func(val) { + props.UpdateManager.FromHashValue("hydGreenResvOvht", 1, func(val) { if (val) { obj["OVHT-Green"].show(); } else { obj["OVHT-Green"].hide(); } }), - props.UpdateManager.FromHashValue("hydYellowResvOvht", nil, func(val) { + props.UpdateManager.FromHashValue("hydYellowResvOvht", 1, func(val) { if (val) { obj["OVHT-Yellow"].show(); } else { obj["OVHT-Yellow"].hide(); } }), - props.UpdateManager.FromHashValue("hydRATPosition", nil, func(val) { + props.UpdateManager.FromHashValue("hydRATPosition", 1, func(val) { if (val) { obj["RAT-stowed"].hide(); obj["RAT-not-stowed"].show(); @@ -230,8 +230,8 @@ var canvas_lowerECAMPageHyd = obj["RAT-not-stowed"].hide(); } }), - props.UpdateManager.FromHashValue("hydGreenFireValve", nil, func(val) { - if (val != 0) { + props.UpdateManager.FromHashValue("hydGreenFireValve", 0.1, func(val) { + if (val >= 0.1) { obj["Fire-Valve-Green"].setColor(0.7333,0.3803,0); obj["Fire-Valve-Green-Cross"].setColorFill(0.7333,0.3803,0); obj["Fire-Valve-Green"].setRotation(90 * D2R); @@ -241,8 +241,8 @@ var canvas_lowerECAMPageHyd = obj["Fire-Valve-Green"].setRotation(0); } }), - props.UpdateManager.FromHashValue("hydYellowFireValve", nil, func(val) { - if (val != 0) { + props.UpdateManager.FromHashValue("hydYellowFireValve", 0.1, func(val) { + if (val >= 0.1) { obj["Fire-Valve-Yellow"].setColor(0.7333,0.3803,0); obj["Fire-Valve-Yellow-Cross"].setColorFill(0.7333,0.3803,0); obj["Fire-Valve-Yellow"].setRotation(90 * D2R); @@ -266,7 +266,7 @@ var canvas_lowerECAMPageHyd = obj["ELEC-Yellow-label"].setColor(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashList(["yellow","hydYellowElecPumpSwitch"], nil, func(val) { + props.UpdateManager.FromHashList(["yellow","hydYellowElecPumpSwitch"], 1, func(val) { if (!val.hydYellowElecPumpSwitch) { obj["ELEC-Yellow-on"].hide(); obj["ELEC-Yellow-off"].show(); @@ -280,7 +280,7 @@ var canvas_lowerECAMPageHyd = } } }), - props.UpdateManager.FromHashList(["blue","hydBlueElecPumpSwitch"], nil, func(val) { + props.UpdateManager.FromHashList(["blue","hydBlueElecPumpSwitch"], 1, func(val) { if (val.hydBlueElecPumpSwitch) { obj["Pump-Blue-off"].hide(); if (val.blue > 1450) { @@ -302,7 +302,7 @@ var canvas_lowerECAMPageHyd = obj["Pump-Blue"].setColor(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashList(["yellow","hydYellowEDPPumpSwitch"], nil, func(val) { + props.UpdateManager.FromHashList(["yellow","hydYellowEDPPumpSwitch"], 1, func(val) { if (val.hydYellowEDPPumpSwitch) { obj["Pump-Yellow-off"].hide(); if (val.yellow > 1450) { @@ -324,7 +324,7 @@ var canvas_lowerECAMPageHyd = obj["Pump-Yellow"].setColor(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashList(["green","hydGreenEDPPumpSwitch"], nil, func(val) { + props.UpdateManager.FromHashList(["green","hydGreenEDPPumpSwitch"], 1, func(val) { if (val.hydGreenEDPPumpSwitch) { obj["Pump-Green-off"].hide(); if (val.green > 1450) { @@ -345,7 +345,7 @@ var canvas_lowerECAMPageHyd = obj["Pump-Green"].setColor(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashList(["hydPTUSwitch","hydPTUDiff","hydPTUActive","hydPTUFault"], nil, func(val) { + props.UpdateManager.FromHashList(["hydPTUSwitch","hydPTUDiff","hydPTUActive","hydPTUFault"], 1, func(val) { if (val.hydPTUSwitch and !val.hydPTUFault) { obj["PTU-connection"].setColor(0.0509,0.7529,0.2941); diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-press.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-press.nas index de038111..61000629 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-press.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-press.nas @@ -27,13 +27,7 @@ var canvas_lowerECAMPagePress = obj.update_items = [ props.UpdateManager.FromHashValue("pressDelta", 0.05, func(val) { - if (val > 31.9) { - obj["PRESS-deltaP"].setText(sprintf("%2.1f", 31.9)); - } else if (val < -9.9) { - obj["PRESS-deltaP"].setText(sprintf("%2.1f", -9.9)); - } else { - obj["PRESS-deltaP"].setText(sprintf("%2.1f", val)); - } + obj["PRESS-deltaP"].setText(sprintf("%2.1f", math.clamp(val, -9.9, 31.9))); if (val < -0.4 or val > 8.5) { obj["PRESS-deltaP"].setColor(0.7333,0.3803,0); @@ -42,13 +36,7 @@ var canvas_lowerECAMPagePress = } }), props.UpdateManager.FromHashValue("pressVS", 25, func(val) { - if (val > 9950) { - obj["PRESS-Cab-VS"].setText(sprintf("%4.0f", 9950)); - } else if (val < -9950) { - obj["PRESS-Cab-VS"].setText(sprintf("%4.0f", -9950)); - } else { - obj["PRESS-Cab-VS"].setText(sprintf("%-4.0f", math.round(val,50))); - } + obj["PRESS-Cab-VS"].setText(sprintf("%-4.0f", math.clamp(math.round(val,50), -9950, 9950))); if (abs(val) > 2000) { obj["PRESS-Cab-VS"].setColor(0.7333,0.3803,0); @@ -57,13 +45,7 @@ var canvas_lowerECAMPagePress = } }), props.UpdateManager.FromHashValue("pressAlt", 25, func(val) { - if (val > 32750) { - obj["PRESS-Cab-Alt"].setText(sprintf("%5.0f", 32750)); - } else if (val < -9950) { - obj["PRESS-Cab-Alt"].setText(sprintf("%5.0f", -9950)); - } else { - obj["PRESS-Cab-Alt"].setText(sprintf("%5.0f", math.round(val,50))); - } + obj["PRESS-Cab-Alt"].setText(sprintf("%5.0f", math.clamp(math.round(val,50), -9950, 32750))); if (val > 9550) { obj["PRESS-Cab-Alt"].setColor(1,0,0); @@ -80,8 +62,8 @@ var canvas_lowerECAMPagePress = obj["PRESS-Sys-1"].hide(); } }), - props.UpdateManager.FromHashList(["flowCtlValve1","engine1State"], nil, func(val) { - if (val.flowCtlValve1 == 0 and val.engine1State == 3) { + props.UpdateManager.FromHashList(["flowCtlValve1","engine1State"], 0.1, func(val) { + if (val.flowCtlValve1 <= 0.1 and val.engine1State == 3) { obj["PRESS-Pack-1-Triangle"].setColor(0.7333,0.3803,0); obj["PRESS-Pack-1"].setColor(0.7333,0.3803,0); } else { @@ -89,8 +71,8 @@ var canvas_lowerECAMPagePress = obj["PRESS-Pack-1"].setColor(0.8078,0.8039,0.8078); } }), - props.UpdateManager.FromHashList(["flowCtlValve2","engine2State"], nil, func(val) { - if (val.flowCtlValve2 == 0 and val.engine2State == 3) { + props.UpdateManager.FromHashList(["flowCtlValve2","engine2State"], 0.1, func(val) { + if (val.flowCtlValve2 <= 0.1 and val.engine2State == 3) { obj["PRESS-Pack-2-Triangle"].setColor(0.7333,0.3803,0); obj["PRESS-Pack-2"].setColor(0.7333,0.3803,0); } else { From 4e5a2a09915377e59e3c4f329b5a9e2f3fdfb0d6 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Sat, 23 Apr 2022 12:34:52 +0100 Subject: [PATCH 12/33] Wheel --- .../Lower-ECAM/Lower-ECAM-wheel.nas | 89 ++++++++++--------- Models/Instruments/Lower-ECAM/res/wheel.svg | 15 ++-- 2 files changed, 53 insertions(+), 51 deletions(-) diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-wheel.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-wheel.nas index ababca41..1a077d5a 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-wheel.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-wheel.nas @@ -33,16 +33,16 @@ var canvas_lowerECAMPageWheel = obj.update_items = [ - props.UpdateManager.FromHashList(["gearPosNorm","gearPosNorm1","gearPosNorm2","gearLever"], nil, func(val) { - if (val.gearLever and (val.gearPosNorm != 1 or val.gearPosNorm1 != 1 or val.gearPosNorm2 != 1)) { + props.UpdateManager.FromHashList(["gearPosNorm","gearPosNorm1","gearPosNorm2","gearLever"], 0.01, func(val) { + if (val.gearLever and (val.gearPosNorm <= 0.99 or val.gearPosNorm1 <= 0.99 or val.gearPosNorm2 <= 0.99)) { obj["lgctltext"].show(); - } elsif (!val.gearLever and (val.gearPosNorm != 0 or val.gearPosNorm1 != 0 or val.gearPosNorm2 != 0)) { + } elsif (!val.gearLever and (val.gearPosNorm >= 0.01 or val.gearPosNorm1 >= 0.01 or val.gearPosNorm2 >= 0.01)) { obj["lgctltext"].show(); } else { obj["lgctltext"].hide(); } }), - props.UpdateManager.FromHashValue("gearPosNorm", nil, func(val) { + props.UpdateManager.FromHashValue("gearPosNorm", 0.01, func(val) { if (val < 0.2) { obj["Triangle-Nose1"].hide(); obj["Triangle-Nose2"].hide(); @@ -51,7 +51,7 @@ var canvas_lowerECAMPageWheel = obj["Triangle-Nose2"].show(); } - if (val == 1) { + if (val >= 0.99) { obj["Triangle-Nose1"].setColor(0.0509,0.7529,0.2941); obj["Triangle-Nose2"].setColor(0.0509,0.7529,0.2941); } else { @@ -59,7 +59,7 @@ var canvas_lowerECAMPageWheel = obj["Triangle-Nose2"].setColor(1,0,0); } }), - props.UpdateManager.FromHashValue("gearPosNorm1", nil, func(val) { + props.UpdateManager.FromHashValue("gearPosNorm1", 0.01, func(val) { if (val < 0.2) { obj["Triangle-Left1"].hide(); obj["Triangle-Left2"].hide(); @@ -68,7 +68,7 @@ var canvas_lowerECAMPageWheel = obj["Triangle-Left2"].show(); } - if (val == 1) { + if (val >= 0.99) { obj["Triangle-Left1"].setColor(0.0509,0.7529,0.2941); obj["Triangle-Left2"].setColor(0.0509,0.7529,0.2941); } else { @@ -76,7 +76,7 @@ var canvas_lowerECAMPageWheel = obj["Triangle-Left2"].setColor(1,0,0); } }), - props.UpdateManager.FromHashValue("gearPosNorm2", nil, func(val) { + props.UpdateManager.FromHashValue("gearPosNorm2", 0.01, func(val) { if (val < 0.2) { obj["Triangle-Right1"].hide(); obj["Triangle-Right2"].hide(); @@ -85,7 +85,7 @@ var canvas_lowerECAMPageWheel = obj["Triangle-Right2"].show(); } - if (val == 1) { + if (val >= 0.99) { obj["Triangle-Right1"].setColor(0.0509,0.7529,0.2941); obj["Triangle-Right2"].setColor(0.0509,0.7529,0.2941); } else { @@ -93,7 +93,7 @@ var canvas_lowerECAMPageWheel = obj["Triangle-Right2"].setColor(1,0,0); } }), - props.UpdateManager.FromHashList(["yellow","green","NWSSwitch","brakesMode","val.accumPressPsiPressPsi","leftBrakeFCS","rightBrakeFCS"], nil, func(val) { + props.UpdateManager.FromHashList(["yellow","green","accumPressPsi","brakesMode","NWSSwitch"], 1, func(val) { if (val.NWSSwitch and val.yellow >= 1500) { obj["NWStext"].hide(); obj["NWS"].hide(); @@ -125,18 +125,6 @@ var canvas_lowerECAMPageWheel = obj["BSCU2"].hide(); } - if (val.green >= 1500) { - obj["normbrkhyd"].setColor(0.0509,0.7529,0.2941); - } else { - obj["normbrkhyd"].setColor(0.7333,0.3803,0); - } - - if (val.yellow >= 1500) { - obj["altnbrkhyd"].setColor(0.0509,0.7529,0.2941); - } else { - obj["altnbrkhyd"].setColor(0.7333,0.3803,0); - } - if (!val.NWSSwitch or val.green < 1500) { obj["NORMbrk"].show(); obj["normbrk-rect"].show(); @@ -161,7 +149,7 @@ var canvas_lowerECAMPageWheel = obj["ALTNbrk"].setColor(0.0509,0.7529,0.2941); } } - + if (val.brakesMode == 2 and val.accumPressPsi < 200 and val.yellow < 1500) { obj["accuonlyarrow"].hide(); obj["accuonly"].hide(); @@ -185,7 +173,22 @@ var canvas_lowerECAMPageWheel = obj["brakearrow"].hide(); obj["accupress_text"].hide(); } - + }), + props.UpdateManager.FromHashValue("green", 1, func(val) { + if (val >= 1500) { + obj["normbrkhyd"].setColor(0.0509,0.7529,0.2941); + } else { + obj["normbrkhyd"].setColor(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashValue("yellow", 1, func(val) { + if (val >= 1500) { + obj["altnbrkhyd"].setColor(0.0509,0.7529,0.2941); + } else { + obj["altnbrkhyd"].setColor(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashList(["brakesMode","leftBrakeFCS","rightBrakeFCS"], 0.1, func(val) { if (val.brakesMode == 1) { obj["releaseL1"].hide(); obj["releaseL2"].hide(); @@ -196,7 +199,7 @@ var canvas_lowerECAMPageWheel = obj["releaseR3"].hide(); obj["releaseR4"].hide(); } else { # Display if the brakes are released and in alternate braking - if (val.leftBrakeFCS == 0) { + if (val.leftBrakeFCS <= 0.1) { obj["releaseL1"].show(); obj["releaseL2"].show(); obj["releaseL3"].show(); @@ -208,7 +211,7 @@ var canvas_lowerECAMPageWheel = obj["releaseL4"].hide(); } - if (val.rightBrakeFCS == 0) { + if (val.rightBrakeFCS <= 0.1) { obj["releaseR1"].show(); obj["releaseR2"].show(); obj["releaseR3"].show(); @@ -221,7 +224,7 @@ var canvas_lowerECAMPageWheel = } } }), - props.UpdateManager.FromHashList(["brakeAutobrkMode","NWSSwitch"], nil, func(val) { + props.UpdateManager.FromHashList(["brakeAutobrkMode","NWSSwitch"], 1, func(val) { if (val.brakeAutobrkMode == 0) { obj["autobrkind"].hide(); } elsif (val.brakeAutobrkMode == 1) { @@ -319,15 +322,15 @@ var canvas_lowerECAMPageWheel = props.UpdateManager.FromHashValue("wheelRightDoor", 0.5, func(val) { obj["rightdoor"].setRotation(val * D2R); }), - props.UpdateManager.FromHashValue("wheelLeftDoorPos", 0.01, func(val) { - if (val == 0) { + props.UpdateManager.FromHashValue("wheelLeftDoorPos", 0.1, func(val) { + if (val <= 0.1) { obj["leftdoor"].setColorFill(0.0509,0.7529,0.2941); } else { obj["leftdoor"].setColorFill(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashValue("wheelNoseDoorPos", 0.01, func(val) { - if (val == 0) { + props.UpdateManager.FromHashValue("wheelNoseDoorPos", 0.1, func(val) { + if (val <= 0.1) { obj["nosegeardoorL"].setColorFill(0.0509,0.7529,0.2941); obj["nosegeardoorR"].setColorFill(0.0509,0.7529,0.2941); } else { @@ -335,8 +338,8 @@ var canvas_lowerECAMPageWheel = obj["nosegeardoorR"].setColorFill(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashValue("wheelRightDoorPos", 0.01, func(val) { - if (val == 0) { + props.UpdateManager.FromHashValue("wheelRightDoorPos", 0.1, func(val) { + if (val <= 0.1) { obj["rightdoor"].setColorFill(0.0509,0.7529,0.2941); } else { obj["rightdoor"].setColorFill(0.7333,0.3803,0); @@ -432,7 +435,7 @@ var canvas_lowerECAMPageWheel = obj["spoiler5Rex"].show(); } }), - props.UpdateManager.FromHashList(["spoilerL1Failure","spoilerL1","green"], nil, func(val) { + props.UpdateManager.FromHashList(["spoilerL1Failure","spoilerL1","green"], 0.5, func(val) { if (val.spoilerL1Failure or val.green < 1500) { obj["spoiler1Lex"].setColor(0.7333,0.3803,0); obj["spoiler1Lrt"].setColor(0.7333,0.3803,0); @@ -447,7 +450,7 @@ var canvas_lowerECAMPageWheel = obj["spoiler1Lf"].hide(); } }), - props.UpdateManager.FromHashList(["spoilerL2Failure","spoilerL2","yellow"], nil, func(val) { + props.UpdateManager.FromHashList(["spoilerL2Failure","spoilerL2","yellow"], 0.5, func(val) { if (val.spoilerL2Failure or val.yellow < 1500) { obj["spoiler2Lex"].setColor(0.7333,0.3803,0); obj["spoiler2Lrt"].setColor(0.7333,0.3803,0); @@ -462,7 +465,7 @@ var canvas_lowerECAMPageWheel = obj["spoiler2Lf"].hide(); } }), - props.UpdateManager.FromHashList(["spoilerL3Failure","spoilerL3","blue"], nil, func(val) { + props.UpdateManager.FromHashList(["spoilerL3Failure","spoilerL3","blue"], 0.5, func(val) { if (val.spoilerL3Failure or val.blue < 1500) { obj["spoiler3Lex"].setColor(0.7333,0.3803,0); obj["spoiler3Lrt"].setColor(0.7333,0.3803,0); @@ -477,7 +480,7 @@ var canvas_lowerECAMPageWheel = obj["spoiler3Lf"].hide(); } }), - props.UpdateManager.FromHashList(["spoilerL4Failure","spoilerL4","yellow"], nil, func(val) { + props.UpdateManager.FromHashList(["spoilerL4Failure","spoilerL4","yellow"], 0.5, func(val) { if (val.spoilerL4Failure or val.yellow < 1500) { obj["spoiler4Lex"].setColor(0.7333,0.3803,0); obj["spoiler4Lrt"].setColor(0.7333,0.3803,0); @@ -492,7 +495,7 @@ var canvas_lowerECAMPageWheel = obj["spoiler4Lf"].hide(); } }), - props.UpdateManager.FromHashList(["spoilerL5Failure","spoilerL5","green"], nil, func(val) { + props.UpdateManager.FromHashList(["spoilerL5Failure","spoilerL5","green"], 0.5, func(val) { if (val.spoilerL5Failure or val.green < 1500) { obj["spoiler5Lex"].setColor(0.7333,0.3803,0); obj["spoiler5Lrt"].setColor(0.7333,0.3803,0); @@ -507,7 +510,7 @@ var canvas_lowerECAMPageWheel = obj["spoiler5Lf"].hide(); } }), - props.UpdateManager.FromHashList(["spoilerR1Failure","spoilerR1","green"], nil, func(val) { + props.UpdateManager.FromHashList(["spoilerR1Failure","spoilerR1","green"], 0.5, func(val) { if (val.spoilerR1Failure or val.green < 1500) { obj["spoiler1Rex"].setColor(0.7333,0.3803,0); obj["spoiler1Rrt"].setColor(0.7333,0.3803,0); @@ -522,7 +525,7 @@ var canvas_lowerECAMPageWheel = obj["spoiler1Rf"].hide(); } }), - props.UpdateManager.FromHashList(["spoilerR2Failure","spoilerR2","yellow"], nil, func(val) { + props.UpdateManager.FromHashList(["spoilerR2Failure","spoilerR2","yellow"], 0.5, func(val) { if (val.spoilerR2Failure or val.yellow < 1500) { obj["spoiler2Rex"].setColor(0.7333,0.3803,0); obj["spoiler2Rrt"].setColor(0.7333,0.3803,0); @@ -537,7 +540,7 @@ var canvas_lowerECAMPageWheel = obj["spoiler2Rf"].hide(); } }), - props.UpdateManager.FromHashList(["spoilerR3Failure","spoilerR3","blue"], nil, func(val) { + props.UpdateManager.FromHashList(["spoilerR3Failure","spoilerR3","blue"], 0.5, func(val) { if (val.spoilerR3Failure or val.blue < 1500) { obj["spoiler3Rex"].setColor(0.7333,0.3803,0); obj["spoiler3Rrt"].setColor(0.7333,0.3803,0); @@ -552,7 +555,7 @@ var canvas_lowerECAMPageWheel = obj["spoiler3Rf"].hide(); } }), - props.UpdateManager.FromHashList(["spoilerR4Failure","spoilerR4","yellow"], nil, func(val) { + props.UpdateManager.FromHashList(["spoilerR4Failure","spoilerR4","yellow"], 0.5, func(val) { if (val.spoilerR4Failure or val.yellow < 1500) { obj["spoiler4Rex"].setColor(0.7333,0.3803,0); obj["spoiler4Rrt"].setColor(0.7333,0.3803,0); @@ -567,7 +570,7 @@ var canvas_lowerECAMPageWheel = obj["spoiler4Rf"].hide(); } }), - props.UpdateManager.FromHashList(["spoilerR5Failure","spoilerR5","green"], nil, func(val) { + props.UpdateManager.FromHashList(["spoilerR5Failure","spoilerR5","green"], 0.5, func(val) { if (val.spoilerR5Failure or val.green < 1500) { obj["spoiler5Rex"].setColor(0.7333,0.3803,0); obj["spoiler5Rrt"].setColor(0.7333,0.3803,0); diff --git a/Models/Instruments/Lower-ECAM/res/wheel.svg b/Models/Instruments/Lower-ECAM/res/wheel.svg index d58675c9..984bc9ed 100644 --- a/Models/Instruments/Lower-ECAM/res/wheel.svg +++ b/Models/Instruments/Lower-ECAM/res/wheel.svg @@ -5,7 +5,7 @@ viewBox="0 0 1024 1024" version="1.1" id="svg2" - inkscape:version="1.1 (c68e22c387, 2021-05-23)" + inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)" sodipodi:docname="wheel.svg" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" @@ -22,7 +22,6 @@ image/svg+xml - @@ -38,12 +37,12 @@ inkscape:pageopacity="1" inkscape:pageshadow="2" inkscape:window-width="1920" - inkscape:window-height="986" + inkscape:window-height="974" id="namedview371" showgrid="true" - inkscape:zoom="1.8101934" - inkscape:cx="932.77328" - inkscape:cy="542.48348" + inkscape:zoom="0.9050967" + inkscape:cx="483.92619" + inkscape:cy="964.53782" inkscape:window-x="-11" inkscape:window-y="-11" inkscape:window-maximized="1" @@ -323,13 +322,13 @@ ANTI SKID Date: Sat, 23 Apr 2022 13:57:56 +0100 Subject: [PATCH 13/33] Optimize IESI --- Models/Instruments/IESI/IESI.nas | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/Models/Instruments/IESI/IESI.nas b/Models/Instruments/IESI/IESI.nas index 8e2600d7..9cc69e0e 100644 --- a/Models/Instruments/IESI/IESI.nas +++ b/Models/Instruments/IESI/IESI.nas @@ -50,7 +50,7 @@ var canvas_IESI = { obj.AI_horizon_rot = obj["AI_horizon"].createTransform(); obj._aiCenter = obj["AI_center"].getCenter(); - obj._cachedInhg = nil; + obj._cachedInhg = -999; obj._cachedMode = nil; obj._canReset = 0; obj._excessMotionInInit = 0; @@ -62,10 +62,10 @@ var canvas_IESI = { obj._roll = 0; obj.update_items = [ - props.UpdateManager.FromHashValue("airspeed", nil, func(val) { + props.UpdateManager.FromHashValue("airspeed", 0.1, func(val) { obj["ASI_scale"].setTranslation(0, math.clamp(val - 30, 0, 490) * 8.295); }), - props.UpdateManager.FromHashList(["altitude","altitude_ind"], nil, func(val) { + props.UpdateManager.FromHashList(["altitude","altitude_ind"], 0.5, func(val) { val.altitude = math.clamp(val.altitude, -2000, 50000); if (val.altitude < 0) { obj["negText"].show(); @@ -103,7 +103,7 @@ var canvas_IESI = { obj.altTens = num(right(sprintf("%02d", val.altitude), 2)); obj["ALT_tens"].setTranslation(0, obj.altTens * 3.16); }), - props.UpdateManager.FromHashValue("showMach", nil, func(val) { + props.UpdateManager.FromHashValue("showMach", 1, func(val) { if (val) { obj["ASI_mach_decimal"].show(); obj["ASI_mach"].show(); @@ -112,22 +112,18 @@ var canvas_IESI = { obj["ASI_mach"].hide(); } }), - props.UpdateManager.FromHashValue("mach", nil, func(val) { - if (val >= 0.999) { - obj["ASI_mach"].setText("99"); - } else { - obj["ASI_mach"].setText(sprintf("%2.0f", val * 100)); - } + props.UpdateManager.FromHashValue("mach", 0.001, func(val) { + obj["ASI_mach"].setText(sprintf("%2.0f", math.clamp(val * 100, 0, 99))); }), - props.UpdateManager.FromHashValue("pitch", nil, func(val) { + props.UpdateManager.FromHashValue("pitch", 0.025, func(val) { obj.AI_horizon_trans.setTranslation(0, val * 16.74); }), - props.UpdateManager.FromHashValue("roll", nil, func(val) { + props.UpdateManager.FromHashValue("roll", 0.025, func(val) { obj._roll = -val * D2R; obj.AI_horizon_rot.setRotation(obj._roll, obj._aiCenter); obj["AI_bank"].setRotation(obj._roll); }), - props.UpdateManager.FromHashValue("skid", nil, func(val) { + props.UpdateManager.FromHashValue("skid", 0.1, func(val) { if (abs(val) >= 84.99) { obj["AI_slipskid"].hide(); } else { @@ -146,7 +142,7 @@ var canvas_IESI = { me._powerResult = me.updatePower(notification); if (me._powerResult == 0) { return; } - if (notification.qnh_inhg != me._cachedInhg or notification.altimeter_mode != me._cachedMode) { + if (math.abs(notification.qnh_inhg - me._cachedInhg) > 0.005 or notification.altimeter_mode != me._cachedMode) { me._cachedInhg = notification.qnh_inhg; me._cachedMode = notification.altimeter_mode; me.updateQNH(notification); From 46c5d595f85378ead2a4c84f2e1d4cd7365957e5 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Tue, 26 Apr 2022 18:35:57 +0100 Subject: [PATCH 14/33] Optimise E/WD display --- Models/Instruments/Upper-ECAM/Upper-ECAM.nas | 32 ++++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas index 637e79f5..b1e09262 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas @@ -167,10 +167,10 @@ var canvas_upperECAM = { obj["FlapDots"].hide(); } }), - props.UpdateManager.FromHashValue("flexTemp", 1, func(val) { + props.UpdateManager.FromHashValue("flexTemp", 0.5, func(val) { obj["FlxLimTemp"].setText(sprintf("%2.0d",val)); }), - props.UpdateManager.FromHashValue("slatLocked", nil, func(val) { + props.UpdateManager.FromHashValue("slatLocked", 1, func(val) { if (val) { if (slatLockGoing == 0) { slatLockGoing = 1; @@ -185,10 +185,10 @@ var canvas_upperECAM = { ]; obj.update_items_fadec_powered_n1 = [ - props.UpdateManager.FromHashValue("N1_1", 0.01, func(val) { + props.UpdateManager.FromHashValue("N1_1", 0.1, func(val) { obj["N11-needle"].setRotation((val + 90) * D2R); }), - props.UpdateManager.FromHashValue("N1_2", 0.01, func(val) { + props.UpdateManager.FromHashValue("N1_2", 0.1, func(val) { obj["N12-needle"].setRotation((val + 90) * D2R); }), props.UpdateManager.FromHashValue("N1_actual_1", 0.025, func(val) { @@ -199,23 +199,23 @@ var canvas_upperECAM = { obj["N12"].setText(sprintf("%s", math.floor(val + 0.05))); obj["N12-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); }), - props.UpdateManager.FromHashValue("N1_lim", 0.01, func(val) { + props.UpdateManager.FromHashValue("N1_lim", 0.1, func(val) { obj["N11-ylim"].setRotation((val + 90) * D2R); obj["N12-ylim"].setRotation((val + 90) * D2R); }), - props.UpdateManager.FromHashValue("N1thr_1", 0.01, func(val) { + props.UpdateManager.FromHashValue("N1thr_1", 0.1, func(val) { obj["N11-thr"].setRotation((val + 90) * D2R); }), - props.UpdateManager.FromHashValue("N1thr_2", 0.01, func(val) { + props.UpdateManager.FromHashValue("N1thr_2", 0.1, func(val) { obj["N12-thr"].setRotation((val + 90) * D2R); }), ]; obj.update_items_fadec_powered_epr = [ - props.UpdateManager.FromHashValue("EPR_1", 0.0001, func(val) { + props.UpdateManager.FromHashValue("EPR_1", 0.1, func(val) { obj["EPR1-needle"].setRotation((val + 90) * D2R); }), - props.UpdateManager.FromHashValue("EPR_2", 0.0001, func(val) { + props.UpdateManager.FromHashValue("EPR_2", 0.1, func(val) { obj["EPR2-needle"].setRotation((val + 90) * D2R); }), props.UpdateManager.FromHashValue("EPR_actual_1", 0.0001, func(val) { @@ -228,14 +228,14 @@ var canvas_upperECAM = { obj["EPR2"].setText(sprintf("%1.0f", math.floor(epr2))); obj["EPR2-decimal"].setText(sprintf("%03d", (epr2 - int(epr2)) * 1000)); }), - props.UpdateManager.FromHashValue("EPR_lim", 0.0001, func(val) { + props.UpdateManager.FromHashValue("EPR_lim", 0.1, func(val) { obj["EPR1-ylim"].setRotation((val + 90) * D2R); obj["EPR2-ylim"].setRotation((val + 90) * D2R); }), - props.UpdateManager.FromHashValue("EPRthr_1", 0.0001, func(val) { + props.UpdateManager.FromHashValue("EPRthr_1", 0.1, func(val) { obj["EPR1-thr"].setRotation((val + 90) * D2R); }), - props.UpdateManager.FromHashValue("EPRthr_2", 0.0001, func(val) { + props.UpdateManager.FromHashValue("EPRthr_2", 0.1, func(val) { obj["EPR2-thr"].setRotation((val + 90) * D2R); }), ]; @@ -330,7 +330,7 @@ var canvas_upperECAM = { obj["FlxLimTemp"].hide(); } }), - props.UpdateManager.FromHashList(["eng1_n1", "N1_mode_1"], nil, func(val) { + props.UpdateManager.FromHashList(["eng1_n1", "N1_mode_1"], 1, func(val) { if (val.eng1_n1 and val.N1_mode_1) { obj["N11-thr"].show(); obj["N11-ylim"].hide(); # Keep it hidden, since N1 mode limit calculation is not done yet @@ -339,7 +339,7 @@ var canvas_upperECAM = { obj["N11-ylim"].hide(); } }), - props.UpdateManager.FromHashList(["eng2_n1", "N1_mode_2"], nil, func(val) { + props.UpdateManager.FromHashList(["eng2_n1", "N1_mode_2"], 1, func(val) { if (val.eng2_n1 == 1 and val.N1_mode_2) { obj["N12-thr"].show(); obj["N12-ylim"].hide(); # Keep it hidden, since N1 mode limit calculation is not done yet @@ -354,13 +354,13 @@ var canvas_upperECAM = { props.UpdateManager.FromHashValue("egt_1", 0.5, func(val) { obj["EGT1"].setText(sprintf("%s", math.round(val))); }), - props.UpdateManager.FromHashValue("egt_1_needle", 0.01, func(val) { + props.UpdateManager.FromHashValue("egt_1_needle", 0.1, func(val) { obj["EGT1-needle"].setRotation((val + 90) * D2R); }), props.UpdateManager.FromHashValue("egt_2", 0.5, func(val) { obj["EGT2"].setText(sprintf("%s", math.round(val))); }), - props.UpdateManager.FromHashValue("egt_2_needle", 0.01, func(val) { + props.UpdateManager.FromHashValue("egt_2_needle", 0.1, func(val) { obj["EGT2-needle"].setRotation((val + 90) * D2R); }), ]; From c1881b8ba40ba930c8bf10c9cf3a67185663e907 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Tue, 26 Apr 2022 18:48:34 +0100 Subject: [PATCH 15/33] Change to integer thrust mode representation --- Models/Instruments/Upper-ECAM/Upper-ECAM.nas | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas index d6aab69c..b616a62d 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas @@ -262,7 +262,7 @@ var canvas_upperECAM = { obj["N1Lim"].setText(sprintf("%s", math.floor(val + 0.05))); obj["N1Lim-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); }), - props.UpdateManager.FromHashList(["fadecPower1", "fadecPower2", "fadecPowerStart", "thrustLimit"], nil, func(val) { + props.UpdateManager.FromHashList(["fadecPower1", "fadecPower2", "fadecPowerStart", "thrustLimitInt"], 1, func(val) { if (val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) { obj["N1Lim"].show(); obj["N1Lim-decimal"].show(); @@ -281,7 +281,7 @@ var canvas_upperECAM = { obj["N1Lim-XX2"].show(); } - if ((val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) and val.thrustLimit == "FLX") { + if ((val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) and val.thrustLimitInt == 3) { obj["FlxLimDegreesC"].show(); obj["FlxLimTemp"].show(); } else { @@ -305,7 +305,7 @@ var canvas_upperECAM = { obj["N1Lim"].setText(sprintf("%s", math.floor(val + 0.05))); obj["N1Lim-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); }), - props.UpdateManager.FromHashList(["fadecPower1", "fadecPower2", "fadecPowerStart", "thrustLimit", "N1_mode_1", "N1_mode_2"], nil, func(val) { + props.UpdateManager.FromHashList(["fadecPower1", "fadecPower2", "fadecPowerStart", "thrustLimitInt", "N1_mode_1", "N1_mode_2"], 1, func(val) { if (val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) { if (val.N1_mode_1 > 0 and val.N1_mode_2 > 0) { if (val.N1_mode_1 == 2 and val.N1_mode_2 == 2) { @@ -315,13 +315,13 @@ var canvas_upperECAM = { obj["N1Lim-percent"].hide(); obj["N1Lim-mode"].hide(); obj["N1Lim-XX"].show(); - if (val.thrustLimit != "MREV") { + if (val.thrustLimitInt != 4) { obj["N1Lim-XX2"].show(); } else { obj["N1Lim-XX2"].hide(); } } else { - if (val.thrustLimit != "MREV") { + if (val.thrustLimitInt != 4) { obj["N1Lim"].show(); obj["N1Lim-decimal"].show(); obj["N1Lim-decpnt"].show(); @@ -339,7 +339,7 @@ var canvas_upperECAM = { obj["EPRMode"].hide(); obj["N1Mode"].show(); } else { - if (val.thrustLimit != "MREV") { + if (val.thrustLimitInt != 4) { obj["EPRLim"].show(); obj["EPRLim-decimal"].show(); obj["EPRLim-decpnt"].show(); @@ -365,7 +365,7 @@ var canvas_upperECAM = { obj["N1Mode"].hide(); } - if ((val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) and val.thrustLimit == "FLX" and val.N1_mode_1 == 0 and val.N1_mode_2 == 0) { + if ((val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) and val.thrustLimitInt == 3 and val.N1_mode_1 == 0 and val.N1_mode_2 == 0) { obj["FlxLimDegreesC"].show(); obj["FlxLimTemp"].show(); } else { @@ -1178,6 +1178,7 @@ var input = { alphaFloor: "/fdm/jsbsim/fadec/alpha-floor", eprLimit: "/fdm/jsbsim/fadec/limit/active-epr", thrustLimit: "/fdm/jsbsim/fadec/limit/active-mode", + thrustLimitInt: "/fdm/jsbsim/fadec/limit/active-mode-int", n1Limit: "/fdm/jsbsim/fadec/limit/active-n1", flexTemp: "/fdm/jsbsim/fadec/limit/flex-temp", fadecPower1: "/systems/fadec/powered1", From 3ec66e31c189bffc77d2f0f37e3264f33b84fe51 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Thu, 28 Apr 2022 16:14:30 +0100 Subject: [PATCH 16/33] Begin speed and mach rework --- Models/Instruments/PFD/PFD.nas | 614 ++++++++++++--------------------- 1 file changed, 215 insertions(+), 399 deletions(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 17cd3e4b..5d1cbe42 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -46,6 +46,7 @@ var autoland_pitch_land = props.globals.initNode("/instrumentation/pfd/logic/aut var autoland_ap_disc_ft = props.globals.initNode("/instrumentation/pfd/logic/autoland/ap-disc-ft", 0, "INT"); var canvas_pfd = { + ASItrendIsShown: 0, middleOffset: 0, heading: 0, heading10: 0, @@ -67,15 +68,11 @@ var canvas_pfd = { ASItrend: 0, ASItrgt: 0, ASItrgtdiff: 0, - V1trgt: 0, - VRtrgt: 0, V2trgt: 0, Strgt: 0, Ftrgt: 0, flaptrgt: 0, cleantrgt: 0, - SPDv1trgtdiff: 0, - SPDvrtrgtdiff: 0, SPDv2trgtdiff: 0, SPDstrgtdiff: 0, SPDftrgtdiff: 0, @@ -137,6 +134,7 @@ var canvas_pfd = { obj.units = acconfig_weight_kgs.getValue(); # temporary vars + obj.ASItrendIsShown = 0; obj.middleOffset = 0; obj.heading = 0; obj.heading10 = 0; @@ -158,15 +156,11 @@ var canvas_pfd = { obj.ASItrend = 0; obj.ASItrgt = 0; obj.ASItrgtdiff = 0; - obj.V1trgt = 0; - obj.VRtrgt = 0; obj.V2trgt = 0; obj.Strgt = 0; obj.Ftrgt = 0; obj.flaptrgt = 0; obj.cleantrgt = 0; - obj.SPDv1trgtdiff = 0; - obj.SPDvrtrgtdiff = 0; obj.SPDv2trgtdiff = 0; obj.SPDstrgtdiff = 0; obj.SPDftrgtdiff = 0; @@ -201,10 +195,10 @@ var canvas_pfd = { obj.AICenter = obj["AI_center"].getCenter(); obj.update_items = [ - props.UpdateManager.FromHashValue("pitchPFD", 0.05, func(val) { + props.UpdateManager.FromHashValue("pitchPFD", 0.025, func(val) { obj.AI_horizon_trans.setTranslation(0, val * 11.825); }), - props.UpdateManager.FromHashValue("roll", 0.1, func(val) { + props.UpdateManager.FromHashValue("roll", 0.025, func(val) { obj.AI_horizon_rot.setRotation(-val * D2R, obj.AICenter); obj.AI_horizon_ground_rot.setRotation(-val * D2R, obj.AICenter); obj.AI_horizon_sky_rot.setRotation(-val * D2R, obj.AICenter); @@ -236,20 +230,22 @@ var canvas_pfd = { props.UpdateManager.FromHashValue("slipSkid", 0.1, func(val) { obj["AI_slipskid"].setTranslation(math.clamp(val, -15, 15) * 7, 0); }), - props.UpdateManager.FromHashValue("FDRollBar", 0.2, func(val) { + props.UpdateManager.FromHashValue("FDRollBar", 0.1, func(val) { obj["FD_roll"].setTranslation(val * 2.2, 0); }), - props.UpdateManager.FromHashValue("FDPitchBar", 0.2, func(val) { + props.UpdateManager.FromHashValue("FDPitchBar", 0.1, func(val) { obj["FD_pitch"].setTranslation(0, val * -3.8); }), props.UpdateManager.FromHashValue("agl", 0.5, func(val) { + var roundingFactor = 1; if (val >= 50) { - obj["AI_agl"].setText(sprintf("%s", math.round(math.clamp(val, 0, 2500),10))); + roundingFactor = 10; } else if (val >= 5) { - obj["AI_agl"].setText(sprintf("%s", math.round(math.clamp(val, 0, 2500),5))); - } else { - obj["AI_agl"].setText(sprintf("%s", math.round(math.clamp(val, 0, 2500)))); + roundingFactor = 5; } + + obj["AI_agl"].setText(sprintf("%s", math.round(math.clamp(val, 0, 2500), roundingFactor))); + obj["ground_ref"].setTranslation(0, (-val / 100) * -48.66856); obj["ground"].setTranslation(0, (-val / 100) * -48.66856); @@ -285,7 +281,7 @@ var canvas_pfd = { props.UpdateManager.FromHashValue("glideslope", 0.01, func(val) { obj["GS_pointer"].setTranslation(0, val * -197); }), - props.UpdateManager.FromHashList(["athr", "thrustLvrClb"], nil, func(val) { + props.UpdateManager.FromHashList(["athr", "thrustLvrClb"], 1, func(val) { if (val.athr and val.thrustLvrClb) { obj["FMA_lvrclb"].show(); } else { @@ -361,7 +357,7 @@ var canvas_pfd = { props.UpdateManager.FromHashValue("altitudeAutopilot", 50, func(val) { obj["ALT_digit_UP_metric"].setText(sprintf("%5.0fM", val * 0.3048)); }), - props.UpdateManager.FromHashList(["fac1","fac2"], nil, func(val) { + props.UpdateManager.FromHashList(["fac1","fac2"], 1, func(val) { if (obj.number == 0) { # LHS only acc to manual if (!val.fac1 and !val.fac2) { obj["spdLimError"].show(); @@ -370,7 +366,7 @@ var canvas_pfd = { } } }), - props.UpdateManager.FromHashValue("athrArm", nil, func(val) { + props.UpdateManager.FromHashValue("athrArm", 1, func(val) { if (val != 1) { obj["FMA_athr"].setColor(0.8078,0.8039,0.8078); } else { @@ -477,7 +473,7 @@ var canvas_pfd = { obj["FMA_fd_box"].hide(); } }), - props.UpdateManager.FromHashList(["fd1","fd2","ap1","ap2"], nil, func(val) { + props.UpdateManager.FromHashList(["fd1","fd2","ap1","ap2"], 1, func(val) { if (val.fd1 or val.fd2 or val.ap1 or val.ap2) { obj["FMA_pitcharm"].show(); obj["FMA_pitcharm2"].show(); @@ -492,7 +488,7 @@ var canvas_pfd = { obj["FMA_roll"].hide(); } }), - props.UpdateManager.FromHashList(["gear1Wow","gear2Wow","fmgcPhase","engine1State","engine2State"], nil, func(val) { + props.UpdateManager.FromHashList(["gear1Wow","gear2Wow","fmgcPhase","engine1State","engine2State"], 1, func(val) { if ((val.gear1Wow or val.gear2Wow) and val.fmgcPhase != 0 and val.fmgcPhase != 1) { obj["AI_stick"].show(); obj["AI_stick_pos"].show(); @@ -504,7 +500,7 @@ var canvas_pfd = { obj["AI_stick_pos"].hide(); } }), - props.UpdateManager.FromHashList(["markerO","markerM","markerI"], nil, func(val) { + props.UpdateManager.FromHashList(["markerO","markerM","markerI"], 1, func(val) { if (val.markerO) { obj["outerMarker"].show(); obj["middleMarker"].hide(); @@ -523,7 +519,7 @@ var canvas_pfd = { obj["innerMarker"].hide(); } }), - props.UpdateManager.FromHashList(["pfdILS1","pfdILS2"], nil, func(val) { + props.UpdateManager.FromHashList(["pfdILS1","pfdILS2"], 1, func(val) { if ((obj.number == 0 and val.pfdILS1) or (obj.number == 1 and val.pfdILS2)) { obj["LOC_scale"].show(); obj["GS_scale"].show(); @@ -544,8 +540,8 @@ var canvas_pfd = { obj["GS_pointer"].hide(); } }), - props.UpdateManager.FromHashList(["fd1","fd2","rollMode","pitchMode","trkFpa","pitchPFD","roll","gear1Wow"], nil, func(val) { - if (((obj.number == 0 and val.fd1) or (obj.number == 1 and val.fd2)) and val.trkFpa == 0 and val.pitchPFD < 25 and val.pitchPFD > -13 and val.roll < 45 and val.roll > -45) { + props.UpdateManager.FromHashList(["fd1","fd2","rollMode","pitchMode","trkFpa","pitchWithinLimits","rollWithinLimits","gear1Wow"], nil, func(val) { + if (((obj.number == 0 and val.fd1) or (obj.number == 1 and val.fd2)) and val.trkFpa == 0 and val.pitchWithinLimits and val.rollWithinLimits) { if (val.rollMode != " " and !val.gear1Wow) { obj["FD_roll"].show(); } else { @@ -699,26 +695,30 @@ var canvas_pfd = { obj.temporaryNodes.showTailstrikeGroundspeed = 0; } }), - props.UpdateManager.FromHashList(["thr1","thr2"], 0.05, func(val) { + props.UpdateManager.FromHashList(["thr1","thr2"], 0.005, func(val) { if (val.thr1 < 0.78 and val.thr2 < 0.78) { obj.temporaryNodes.showTailstrikeThrust = 1; } else { obj.temporaryNodes.showTailstrikeThrust = 0; } }), - props.UpdateManager.FromHashList(["hdgDiff","showHdg","targetHeading"], nil, func(val) { + props.UpdateManager.FromHashValue("targetHeading", 0.5, func(val) { + obj["HDG_digit_L"].setText(sprintf("%3.0f", val)); + obj["HDG_digit_R"].setText(sprintf("%3.0f", val)); + }), + props.UpdateManager.FromHashValue("hdgDiff", 0.1, func(val) { + obj["HDG_target"].setTranslation((val / 10) * 98.5416, 0); + }), + props.UpdateManager.FromHashList(["hdgDiff","showHdg"], 0.01, func(val) { if (val.showHdg and val.hdgDiff >= -23.62 and val.hdgDiff <= 23.62) { - obj["HDG_target"].setTranslation((val.hdgDiff / 10) * 98.5416, 0); obj["HDG_digit_L"].hide(); obj["HDG_digit_R"].hide(); obj["HDG_target"].show(); } else if (val.showHdg and val.hdgDiff < -23.62 and val.hdgDiff >= -180) { - obj["HDG_digit_L"].setText(sprintf("%3.0f", val.targetHeading)); obj["HDG_digit_L"].show(); obj["HDG_digit_R"].hide(); obj["HDG_target"].hide(); } else if (val.showHdg and val.hdgDiff > 23.62 and val.hdgDiff <= 180) { - obj["HDG_digit_R"].setText(sprintf("%3.0f", val.targetHeading)); obj["HDG_digit_R"].show(); obj["HDG_digit_L"].hide(); obj["HDG_target"].hide(); @@ -728,14 +728,14 @@ var canvas_pfd = { obj["HDG_target"].hide(); } }), - props.UpdateManager.FromHashList(["altimeterHpa","altimeterInhg","altimeterInhgMode"], nil, func(val) { + props.UpdateManager.FromHashList(["altimeterHpa","altimeterInhg","altimeterInhgMode"], 0.005, func(val) { if (val.altimeterInhgMode == 0) { obj["QNH_setting"].setText(sprintf("%4.0f", val.altimeterHpa)); } else { obj["QNH_setting"].setText(sprintf("%2.2f", val.altimeterInhg)); } }), - props.UpdateManager.FromHashList(["altimeterStd","altitudeAutopilot"], nil, func(val) { + props.UpdateManager.FromHashList(["altimeterStd","altitudeAutopilot"], 25, func(val) { if (val.altimeterStd == 1) { if (val.altitudeAutopilot < 10000) { obj["ALT_digit_UP"].setText(sprintf("%s", "FL " ~ val.altitudeAutopilot / 100)); @@ -749,7 +749,7 @@ var canvas_pfd = { obj["ALT_digit_DN"].setText(sprintf("%5.0f", val.altitudeAutopilot)); } }), - props.UpdateManager.FromHashValue("managedSpd", nil, func(val) { + props.UpdateManager.FromHashValue("managedSpd", 1, func(val) { if (val) { obj["ASI_target"].setColor(0.6901,0.3333,0.7450); obj["ASI_digit_UP"].setColor(0.6901,0.3333,0.7450); @@ -764,13 +764,133 @@ var canvas_pfd = { obj["ASI_decimal_DN"].setColor(0.0901,0.6039,0.7176); } }), - props.UpdateManager.FromHashValue("dmeDistance", 0.05, func(val) { + props.UpdateManager.FromHashValue("dmeDistance", 0.025, func(val) { if (val < 19.95) { obj["dme_dist"].setText(sprintf("%1.1f", val)); } else { obj["dme_dist"].setText(sprintf("%2.0f", val)); } }), + props.UpdateManager.FromHashValue("speedError", 1, func(val) { + if (!val) { + obj["ASI_error"].hide(); + obj["ASI_buss"].hide(); + obj["ASI_buss_ref"].hide(); + obj["ASI_buss_ref_blue"].hide(); + obj["ASI_frame"].setColor(1,1,1); + obj["ASI_group"].show(); + obj["VLS_min"].hide(); + obj["ALPHA_PROT"].hide(); + obj["ALPHA_MAX"].hide(); + obj["ALPHA_SW"].hide(); + } else { + obj["ASI_group"].hide(); + obj["ASI_frame"].setColor(1,0,0); + obj["clean_speed"].hide(); + obj["S_target"].hide(); + obj["F_target"].hide(); + obj["flap_max"].hide(); + obj["v1_group"].hide(); + obj["v1_text"].hide(); + obj["vr_speed"].hide(); + obj["ground"].hide(); # Why? + obj["ground_ref"].hide(); + obj["VLS_min"].hide(); + obj["VLS_min"].hide(); + obj["ALPHA_PROT"].hide(); + obj["ALPHA_MAX"].hide(); + obj["ALPHA_SW"].hide(); + } + }), + props.UpdateManager.FromHashList(["speedError","fac1","fac2"], 1, func(val) { + if (!val.speedError and (val.fac1 or val.fac2)) { + obj["ASI_max"].show(); + } else { + obj["ASI_max"].hide(); + } + }), + props.UpdateManager.FromHashList(["speedError","fac1","fac2","ASItrendIsShown"], 1, func(val) { + if (!val.speedError and (val.fac1 or val.fac2)) { + if (val.ASItrendIsShown == 1) { + obj["ASI_trend_up"].show(); + obj["ASI_trend_down"].hide(); + } else if (val.ASItrendIsShown == -1) { + obj["ASI_trend_up"].hide(); + obj["ASI_trend_down"].show(); + } else { + obj["ASI_trend_up"].hide(); + obj["ASI_trend_down"].hide(); + } + } else { + obj["ASI_trend_up"].hide(); + obj["ASI_trend_down"].hide(); + } + }), + props.UpdateManager.FromHashValue("ASI", 0.5, func(val) { + obj["ASI_scale"].setTranslation(0, val * 6.6); + }), + props.UpdateManager.FromHashValue("ASImax", 0.5, func(val) { + obj["ASI_max"].setTranslation(0, val * -6.6); + }), + props.UpdateManager.FromHashValue("ASItrend", 0.1, func(val) { + obj["ASI_trend_up"].setTranslation(0, math.clamp(val, 0, 50) * -6.6); + obj["ASI_trend_down"].setTranslation(0, math.clamp(val, -50, 0) * -6.6); + }), + props.UpdateManager.FromHashValue("V1trgt", 0.5, func(val) { + obj["v1_group"].setTranslation(0, val * -6.6); + obj["v1_text"].setText(sprintf("%3.0f", fmgc.FMGCInternal.v1)); + }), + props.UpdateManager.FromHashList(["speedError","showVr","SPDv1trgtdiff","fmgcPhase","agl"], 0.5, func(val) { + if (!val.speedError and val.showVr) { + if (val.agl < 55 and val.fmgcPhase <= 2 and abs(val.SPDv1trgtdiff) <= 42) { + obj["v1_group"].show(); + obj["v1_text"].hide(); + } else if (notification.agl < 55 and fmgc.FMGCInternal.phase <= 2) { + obj["v1_group"].hide(); + obj["v1_text"].show(); + } else { + obj["v1_group"].hide(); + obj["v1_text"].hide(); + } + } else { + obj["v1_group"].hide(); + obj["v1_text"].hide(); + } + }), + props.UpdateManager.FromHashValue("VRtrgt", 0.5, func(val) { + obj["vr_speed"].setTranslation(0, val * -6.6); + }), + props.UpdateManager.FromHashList(["speedError","showVr","SPDvrtrgtdiff","fmgcPhase","agl"], 0.5, func(val) { + if (!val.speedError and val.showVr) { + if (val.agl < 55 and val.fmgcPhase <= 2 and abs(val.SPDvrtrgtdiff) <= 42) { + obj["vr_speed"].show(); + } else { + obj["vr_speed"].hide(); + } + } else { + obj["vr_speed"].hide(); + } + }), + props.UpdateManager.FromHashList(["machError","ind_mach"], 0.001, func(val) { + if (val.machError) { + obj["ASI_mach"].hide(); + obj["machError"].show(); + } else { + obj["machError"].hide(); + + if (val.ind_mach >= 0.999) { + obj["ASI_mach"].setText(".999"); + } else { + obj["ASI_mach"].setText(sprintf(".%3.0f", val.ind_mach * 1000)); + } + + if (val.ind_mach >= 0.5) { + obj["ASI_mach"].show(); + } else { + obj["ASI_mach"].hide(); + } + } + }), ]; obj.update_items_mismatch = [ @@ -816,7 +936,6 @@ var canvas_pfd = { }, aoa: 0, showMetricAlt: 0, - ASItrendIsShown: 0, onsideADIRSOperating: 0, update: func(notification) { me.updatePower(notification); @@ -861,6 +980,20 @@ var canvas_pfd = { notification.aoaPFD = (me.number == 0 ? me.getAOAForPFD1() : me.getAOAForPFD2()); notification.middleOffset = me.middleOffset; + + # FD Hide / Show + if (notification.pitchPFD < 25 and notification.pitchPFD > -13) { + notification.pitchWithinLimits = 1; + } else { + notification.pitchWithinLimits = 0; + } + + if (abs(notification.roll) < 45) { + notification.rollWithinLimits = 1; + } else { + notification.rollWithinLimits = 0; + } + # FPV if (notification.trkFpa) { if (notification.aoaPFD == nil or !me.onsideADIRSOperating){ @@ -900,379 +1033,80 @@ var canvas_pfd = { me["ilsError"].hide(); } + # Airspeed if (dmc.DMController.DMCs[me.number].outputs[0] != nil) { me.ind_spd = dmc.DMController.DMCs[me.number].outputs[0].getValue(); - me["ASI_error"].hide(); - me["ASI_buss"].hide(); - me["ASI_buss_ref"].hide(); - me["ASI_buss_ref_blue"].hide(); - me["ASI_frame"].setColor(1,1,1); - me["ASI_group"].show(); - me["VLS_min"].hide(); - me["ALPHA_PROT"].hide(); - me["ALPHA_MAX"].hide(); - me["ALPHA_SW"].hide(); + notification.speedError = 0; if (me.ind_spd <= 30) { - me.ASI = 0; + notification.ASI = 0; } else if (me.ind_spd >= 420) { - me.ASI = 390; + notification.ASI = 390; } else { - me.ASI = me.ind_spd - 30; + notification.ASI = me.ind_spd - 30; } if (fmgc.FMGCInternal.maxspeed <= 30) { - me.ASImax = 0 - me.ASI; + notification.ASImax = 0 - me.ASI; } else if (fmgc.FMGCInternal.maxspeed >= 420) { - me.ASImax = 390 - me.ASI; + notification.ASImax = 390 - me.ASI; } else { - me.ASImax = fmgc.FMGCInternal.maxspeed - 30 - me.ASI; - } - - me["ASI_scale"].setTranslation(0, me.ASI * 6.6); - - if (notification.fac1 or notification.fac2) { - me["ASI_max"].setTranslation(0, me.ASImax * -6.6); - me["ASI_max"].show(); - } else { - me["ASI_max"].hide(); - } - - if (!fmgc.FMGCInternal.takeoffState and fmgc.FMGCInternal.phase >= 1 and !notification.gear1Wow and !notification.gear2Wow) { - if (fmgc.FMGCInternal.vls_min <= 30) { - me.VLSmin = 0 - me.ASI; - } else if (fmgc.FMGCInternal.vls_min >= 420) { - me.VLSmin = 390 - me.ASI; - } else { - me.VLSmin = fmgc.FMGCInternal.vls_min - 30 - me.ASI; - } - - if (fmgc.FMGCInternal.alpha_prot <= 30) { - me.ALPHAprot = 0 - me.ASI; - } else if (fmgc.FMGCInternal.alpha_prot >= 420) { - me.ALPHAprot = 390 - me.ASI; - } else { - me.ALPHAprot = fmgc.FMGCInternal.alpha_prot - 30 - me.ASI; - } - - if (fmgc.FMGCInternal.alpha_max <= 30) { - me.ALPHAmax = 0 - me.ASI; - } else if (fmgc.FMGCInternal.alpha_max >= 420) { - me.ALPHAmax = 390 - me.ASI; - } else { - me.ALPHAmax = fmgc.FMGCInternal.alpha_max - 30 - me.ASI; - } - - if (fmgc.FMGCInternal.vsw <= 30) { - me.ALPHAvsw = 0 - me.ASI; - } else if (fmgc.FMGCInternal.vsw >= 420) { - me.ALPHAvsw = 390 - me.ASI; - } else { - me.ALPHAvsw = fmgc.FMGCInternal.vsw - 30 - me.ASI; - } - - if (notification.fac1 or notification.fac2) { - me["VLS_min"].setTranslation(0, me.VLSmin * -6.6); - me["VLS_min"].show(); - if (notification.fbwLaw == 0) { - me["ALPHA_PROT"].setTranslation(0, me.ALPHAprot * -6.6); - me["ALPHA_MAX"].setTranslation(0, me.ALPHAmax * -6.6); - me["ALPHA_PROT"].show(); - me["ALPHA_MAX"].show(); - me["ALPHA_SW"].hide(); - } else { - me["ALPHA_PROT"].hide(); - me["ALPHA_MAX"].hide(); - me["ALPHA_SW"].setTranslation(0, me.ALPHAvsw * -6.6); - me["ALPHA_SW"].show(); - } - } else { - me["VLS_min"].hide(); - me["ALPHA_PROT"].hide(); - me["ALPHA_MAX"].hide(); - me["ALPHA_SW"].hide(); - } - } - - me.tgt_ias = notification.targetIasPFD; - me.tgt_kts = notification.targetKts; - - if (notification.managedSpd) { - if (fmgc.FMGCInternal.decel) { - me.tgt_ias = fmgc.FMGCInternal.vappSpeedSet ? fmgc.FMGCInternal.vapp_appr : fmgc.FMGCInternal.vapp; - me.tgt_kts = fmgc.FMGCInternal.vappSpeedSet ? fmgc.FMGCInternal.vapp_appr : fmgc.FMGCInternal.vapp; - } else if (fmgc.FMGCInternal.phase == 6) { - me.tgt_ias = fmgc.FMGCInternal.clean; - me.tgt_kts = fmgc.FMGCInternal.clean; - } - } - - if (me.tgt_ias <= 30) { - me.ASItrgt = 0 - me.ASI; - } else if (me.tgt_ias >= 420) { - me.ASItrgt = 390 - me.ASI; - } else { - me.ASItrgt = me.tgt_ias - 30 - me.ASI; - } - - me.ASItrgtdiff = me.tgt_ias - me.ind_spd; - - if (me.ASItrgtdiff >= -42 and me.ASItrgtdiff <= 42) { - me["ASI_target"].setTranslation(0, me.ASItrgt * -6.6); - me["ASI_digit_UP"].hide(); - me["ASI_decimal_UP"].hide(); - me["ASI_digit_DN"].hide(); - me["ASI_decimal_DN"].hide(); - me["ASI_target"].show(); - } else if (me.ASItrgtdiff < -42) { - if (notification.ktsMach) { - me["ASI_digit_DN"].setText(sprintf("%3.0f", notification.targetMach * 1000)); - me["ASI_decimal_UP"].hide(); - me["ASI_decimal_DN"].show(); - } else { - me["ASI_digit_DN"].setText(sprintf("%3.0f", me.tgt_kts)); - me["ASI_decimal_UP"].hide(); - me["ASI_decimal_DN"].hide(); - } - me["ASI_digit_DN"].show(); - me["ASI_digit_UP"].hide(); - me["ASI_target"].hide(); - } else if (me.ASItrgtdiff > 42) { - if (notification.ktsMach) { - me["ASI_digit_UP"].setText(sprintf("%3.0f", notification.targetMach * 1000)); - me["ASI_decimal_UP"].show(); - me["ASI_decimal_DN"].hide(); - } else { - me["ASI_digit_UP"].setText(sprintf("%3.0f", me.tgt_kts)); - me["ASI_decimal_UP"].hide(); - me["ASI_decimal_DN"].hide(); - } - me["ASI_digit_UP"].show(); - me["ASI_digit_DN"].hide(); - me["ASI_target"].hide(); + notification.ASImax = fmgc.FMGCInternal.maxspeed - 30 - notification.ASI; } if (fmgc.FMGCInternal.v1set) { if (fmgc.FMGCInternal.v1 <= 30) { - me.V1trgt = 0 - me.ASI; + notification.V1trgt = 0 - notification.ASI; } else if (fmgc.FMGCInternal.v1 >= 420) { - me.V1trgt = 390 - me.ASI; + notification.V1trgt = 390 - notification.ASI; } else { - me.V1trgt = fmgc.FMGCInternal.v1 - 30 - me.ASI; + notification.V1trgt = fmgc.FMGCInternal.v1 - 30 - notification.ASI; } - me.SPDv1trgtdiff = fmgc.FMGCInternal.v1 - me.ind_spd; - - if (notification.agl < 55 and fmgc.FMGCInternal.phase <= 2 and me.SPDv1trgtdiff >= -42 and me.SPDv1trgtdiff <= 42) { - me["v1_group"].show(); - me["v1_text"].hide(); - me["v1_group"].setTranslation(0, me.V1trgt * -6.6); - } else if (notification.agl < 55 and fmgc.FMGCInternal.phase <= 2) { - me["v1_group"].hide(); - me["v1_text"].show(); - me["v1_text"].setText(sprintf("%3.0f", fmgc.FMGCInternal.v1)); - } else { - me["v1_group"].hide(); - me["v1_text"].hide(); - } + notification.SPDv1trgtdiff = fmgc.FMGCInternal.v1 - me.ind_spd; + notification.showV1 = 1; } else { - me["v1_group"].hide(); - me["v1_text"].hide(); + notification.V1trgt = 0; + notification.SPDv1trgtdiff = 0; + notification.showV1 = 0; } if (fmgc.FMGCInternal.vrset) { if (fmgc.FMGCInternal.vr <= 30) { - me.VRtrgt = 0 - me.ASI; + notification.VRtrgt = 0 - notification.ASI; } else if (fmgc.FMGCInternal.vr >= 420) { - me.VRtrgt = 390 - me.ASI; + notification.VRtrgt = 390 - notification.ASI; } else { - me.VRtrgt = fmgc.FMGCInternal.vr - 30 - me.ASI; + notification.VRtrgt = fmgc.FMGCInternal.vr - 30 - notification.ASI; } - me.SPDvrtrgtdiff = fmgc.FMGCInternal.vr - me.ind_spd; - - if (notification.agl < 55 and fmgc.FMGCInternal.phase <= 2 and me.SPDvrtrgtdiff >= -42 and me.SPDvrtrgtdiff <= 42) { - me["vr_speed"].show(); - me["vr_speed"].setTranslation(0, me.VRtrgt * -6.6); - } else { - me["vr_speed"].hide(); - } + notification.SPDvrtrgtdiff = fmgc.FMGCInternal.vr - me.ind_spd; + notification.showVr = 1; } else { - me["vr_speed"].hide(); + notification.VRtrgt = 0; + notification.SPDvrtrgtdiff = 0; + notification.showVr = 0; } - if (fmgc.FMGCInternal.v2set) { - if (fmgc.FMGCInternal.v2 <= 30) { - me.V2trgt = 0 - me.ASI; - } else if (fmgc.FMGCInternal.v2 >= 420) { - me.V2trgt = 390 - me.ASI; - } else { - me.V2trgt = fmgc.FMGCInternal.v2 - 30 - me.ASI; - } - - me.SPDv2trgtdiff = fmgc.FMGCInternal.v2 - me.ind_spd; - - if (notification.agl < 55 and fmgc.FMGCInternal.phase <= 2 and me.SPDv2trgtdiff >= -42 and me.SPDv2trgtdiff <= 42) { - me["ASI_target"].show(); - me["ASI_target"].setTranslation(0, me.V2trgt * -6.6); - me["ASI_digit_UP"].setText(sprintf("%3.0f", fmgc.FMGCInternal.v2)); - } else if (notification.agl < 55 and fmgc.FMGCInternal.phase <= 2) { - me["ASI_target"].hide(); - me["ASI_digit_UP"].setText(sprintf("%3.0f", fmgc.FMGCInternal.v2)); - } - } - - if (notification.fac1 or notification.fac2) { - if (notification.flapsInput == '1') { - me["F_target"].hide(); - me["clean_speed"].hide(); - - if (fmgc.FMGCInternal.slat <= 30) { - me.Strgt = 0 - me.ASI; - } else if (fmgc.FMGCInternal.slat >= 420) { - me.Strgt = 390 - me.ASI; - } else { - me.Strgt = fmgc.FMGCInternal.slat - 30 - me.ASI; - } - - me.SPDstrgtdiff = fmgc.FMGCInternal.slat - me.ind_spd; - - if (me.SPDstrgtdiff >= -42 and me.SPDstrgtdiff <= 42 and notification.agl >= 400) { - me["S_target"].show(); - me["S_target"].setTranslation(0, me.Strgt * -6.6); - } else { - me["S_target"].hide(); - } - - me.SPDflaptrgtdiff = 200 - me.ind_spd; - - if (me.SPDflaptrgtdiff >= -42 and me.SPDflaptrgtdiff <= 42) { - me["flap_max"].show(); - me["flap_max"].setTranslation(0, (200 - 30 - me.ASI) * -6.6); - } else { - me["flap_max"].hide(); - } - } else if (notification.flapsInput == '2') { - me["S_target"].hide(); - me["clean_speed"].hide(); - - if (fmgc.FMGCInternal.flap2 <= 30) { - me.Ftrgt = 0 - me.ASI; - } else if (fmgc.FMGCInternal.flap2 >= 420) { - me.Ftrgt = 390 - me.ASI; - } else { - me.Ftrgt = fmgc.FMGCInternal.flap2 - 30 - me.ASI; - } - - me.SPDftrgtdiff = fmgc.FMGCInternal.flap2 - me.ind_spd; - - if (me.SPDftrgtdiff >= -42 and me.SPDftrgtdiff <= 42 and notification.agl >= 400) { - me["F_target"].show(); - me["F_target"].setTranslation(0, me.Ftrgt * -6.6); - } else { - me["F_target"].hide(); - } - - me.SPDflaptrgtdiff = 185 - me.ind_spd; - - if (me.SPDflaptrgtdiff >= -42 and me.SPDflaptrgtdiff <= 42) { - me["flap_max"].show(); - me["flap_max"].setTranslation(0, (185 - 30 - me.ASI) * -6.6); - } else { - me["flap_max"].hide(); - } - } else if (notification.flapsInput == '3') { - me["S_target"].hide(); - me["clean_speed"].hide(); - - if (fmgc.FMGCInternal.flap3 <= 30) { - me.Ftrgt = 0 - me.ASI; - } else if (fmgc.FMGCInternal.flap3 >= 420) { - me.Ftrgt = 390 - me.ASI; - } else { - me.Ftrgt = fmgc.FMGCInternal.flap3 - 30 - me.ASI; - } - - me.SPDftrgtdiff = fmgc.FMGCInternal.flap3 - me.ind_spd; - - if (me.SPDftrgtdiff >= -42 and me.SPDftrgtdiff <= 42 and notification.agl >= 400) { - me["F_target"].show(); - me["F_target"].setTranslation(0, me.Ftrgt * -6.6); - } else { - me["F_target"].hide(); - } - - me.SPDflaptrgtdiff = 177 - me.ind_spd; - - if (me.SPDflaptrgtdiff >= -42 and me.SPDflaptrgtdiff <= 42) { - me["flap_max"].show(); - me["flap_max"].setTranslation(0, (177 - 30 - me.ASI) * -6.6); - } else { - me["flap_max"].hide(); - } - } else if (notification.flapsInput == '4') { - me["S_target"].hide(); - me["F_target"].hide(); - me["clean_speed"].hide(); - me["flap_max"].hide(); - } else { - me["S_target"].hide(); - me["F_target"].hide(); - - me.SPDcleantrgtdiff = fmgc.FMGCInternal.clean - me.ind_spd; - - if (me.SPDcleantrgtdiff >= -42 and me.SPDcleantrgtdiff <= 42) { - me["clean_speed"].show(); - me["clean_speed"].setTranslation(0, (fmgc.FMGCInternal.clean - 30 - me.ASI) * -6.6); - } else { - me["clean_speed"].hide(); - } - - me.SPDflaptrgtdiff = 230 - me.ind_spd; - - if (me.SPDflaptrgtdiff >= -42 and me.SPDflaptrgtdiff <= 42) { - me["flap_max"].show(); - me["flap_max"].setTranslation(0, (230 - 30 - me.ASI) * -6.6); - } else { - me["flap_max"].hide(); - } - } + notification.ASItrend = dmc.DMController.DMCs[me.number].outputs[6].getValue() - notification.ASI; + if (notification.ASItrend >= 2 or (me.ASItrendIsShown != 0 and notification.ASItrend >= 1)) { + me.ASItrendIsShown = 1; + } else if (me.ASItrend <= -2 or (me.ASItrendIsShown != 0 and notification.ASItrend <= -1)) { + me.ASItrendIsShown = -1; } else { - me["S_target"].hide(); - me["F_target"].hide(); - me["clean_speed"].hide(); - me["flap_max"].hide(); + me.ASItrendIsShown = 0; } - - me.ASItrend = dmc.DMController.DMCs[me.number].outputs[6].getValue() - me.ASI; - me["ASI_trend_up"].setTranslation(0, math.clamp(me.ASItrend, 0, 50) * -6.6); - me["ASI_trend_down"].setTranslation(0, math.clamp(me.ASItrend, -50, 0) * -6.6); - - if (notification.fac1 or notification.fac2) { - if (me.ASItrend >= 2 or (me.ASItrendIsShown and me.ASItrend >= 1)) { - me["ASI_trend_up"].show(); - me["ASI_trend_down"].hide(); - me.ASItrendIsShown = 1; - } else if (me.ASItrend <= -2 or (me.ASItrendIsShown and me.ASItrend <= -1)) { - me["ASI_trend_up"].hide(); - me["ASI_trend_down"].show(); - me.ASItrendIsShown = 1; - } else { - me["ASI_trend_up"].hide(); - me["ASI_trend_down"].hide(); - } - } else { - me["ASI_trend_up"].hide(); - me["ASI_trend_down"].hide(); - } - + notification.ASItrendIsShown = me.ASItrendIsShown; + if (me.temporaryNodes.showGroundReferenceAGL) { me["ground_ref"].show(); } else { me["ground_ref"].hide(); } } else { - me["ASI_group"].hide(); + me.ind_spd = dmc.DMController.DMCs[me.number].outputs[0].getValue(); + notification.speedError = 1; + if (!systems.ADIRS.Operating.adr[0].getValue() and !systems.ADIRS.Operating.adr[1].getValue() and !systems.ADIRS.Operating.adr[2].getValue()) { me["ASI_buss"].show(); me["ASI_buss_ref"].show(); @@ -1286,40 +1120,22 @@ var canvas_pfd = { me["ASI_buss_ref_blue"].hide(); me["ASI_error"].show(); } - me["ASI_frame"].setColor(1,0,0); - me["clean_speed"].hide(); - me["S_target"].hide(); - me["F_target"].hide(); - me["flap_max"].hide(); - me["v1_group"].hide(); - me["v1_text"].hide(); - me["vr_speed"].hide(); - me["ground"].hide(); - me["ground_ref"].hide(); - me["VLS_min"].hide(); - me["VLS_min"].hide(); - me["ALPHA_PROT"].hide(); - me["ALPHA_MAX"].hide(); - me["ALPHA_SW"].hide(); + + notification.ASItrendIsShown = 0; + notification.V1trgt = 0; + notification.SPDv1trgtdiff = 0; + notification.showV1 = 0; + notification.VRtrgt = 0; + notification.SPDvrtrgtdiff = 0; + notification.showVr = 0; } + # Mach if (dmc.DMController.DMCs[me.number].outputs[2] != nil) { - me.ind_mach = dmc.DMController.DMCs[me.number].outputs[2].getValue(); - me["machError"].hide(); - - if (me.ind_mach >= 0.999) { - me["ASI_mach"].setText(".999"); - } else { - me["ASI_mach"].setText(sprintf(".%3.0f", me.ind_mach * 1000)); - } - - if (me.ind_mach >= 0.5) { - me["ASI_mach"].show(); - } else { - me["ASI_mach"].hide(); - } + notification.ind_mach = dmc.DMController.DMCs[me.number].outputs[2].getValue(); + notification.machError = 0; } else { - me["machError"].show(); + notification.machError = 1; } # Altitude From da6dfac9ffc2b7874ab5ec73da33e3d78cb08fba Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Thu, 28 Apr 2022 19:08:09 +0100 Subject: [PATCH 17/33] Finish moving airspeed to emesary --- Models/Instruments/PFD/PFD.nas | 363 ++++++++++++++++++++++++++++----- 1 file changed, 314 insertions(+), 49 deletions(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 5d1cbe42..177d374c 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -47,6 +47,7 @@ var autoland_ap_disc_ft = props.globals.initNode("/instrumentation/pfd/logic/aut var canvas_pfd = { ASItrendIsShown: 0, + middleOffset: 0, heading: 0, heading10: 0, @@ -63,26 +64,6 @@ var canvas_pfd = { magnetic_hdg: 0, magnetic_hdg_dif: 0, alt_diff_cur: 0, - ASI: 0, - ASImax: 0, - ASItrend: 0, - ASItrgt: 0, - ASItrgtdiff: 0, - V2trgt: 0, - Strgt: 0, - Ftrgt: 0, - flaptrgt: 0, - cleantrgt: 0, - SPDv2trgtdiff: 0, - SPDstrgtdiff: 0, - SPDftrgtdiff: 0, - SPDflaptrgtdiff: 0, - SPDcleantrgtdiff: 0, - ind_mach: 0, - ind_spd: 0, - tgt_kts: 0, - tgt_ias: 0, - vapp: 0, new: func(svg, name, number) { var obj = {parents: [canvas_pfd] }; obj.canvas = canvas.new({ @@ -151,26 +132,6 @@ var canvas_pfd = { obj.magnetic_hdg = 0; obj.magnetic_hdg_dif = 0; obj.alt_diff_cur = 0; - obj.ASI = 0; - obj.ASImax = 0; - obj.ASItrend = 0; - obj.ASItrgt = 0; - obj.ASItrgtdiff = 0; - obj.V2trgt = 0; - obj.Strgt = 0; - obj.Ftrgt = 0; - obj.flaptrgt = 0; - obj.cleantrgt = 0; - obj.SPDv2trgtdiff = 0; - obj.SPDstrgtdiff = 0; - obj.SPDftrgtdiff = 0; - obj.SPDflaptrgtdiff = 0; - obj.SPDcleantrgtdiff = 0; - obj.ind_mach = 0; - obj.ind_spd = 0; - obj.tgt_kts = 0; - obj.tgt_ias = 0; - obj.vapp = 0; # hide non-updated objects obj["FMA_catmode"].hide(); @@ -845,7 +806,7 @@ var canvas_pfd = { if (val.agl < 55 and val.fmgcPhase <= 2 and abs(val.SPDv1trgtdiff) <= 42) { obj["v1_group"].show(); obj["v1_text"].hide(); - } else if (notification.agl < 55 and fmgc.FMGCInternal.phase <= 2) { + } else if (val.agl < 55 and fmgc.FMGCInternal.phase <= 2) { obj["v1_group"].hide(); obj["v1_text"].show(); } else { @@ -871,6 +832,18 @@ var canvas_pfd = { obj["vr_speed"].hide(); } }), + props.UpdateManager.FromHashList(["speedError","showV2","SPDv2trgtdiff","fmgcPhase","agl","V2trgt"], 0.5, func(val) { + if (!val.speedError and val.showVr) { + if (val.agl < 55 and val.fmgcPhase <= 2 and abs(val.SPDv2trgtdiff) <= 42) { + obj["ASI_target"].show(); + obj["ASI_target"].setTranslation(0, me.V2trgt * -6.6); + obj["ASI_digit_UP"].setText(sprintf("%3.0f", fmgc.FMGCInternal.v2)); + } else if (val.agl < 55 and fmgc.FMGCInternal.phase <= 2) { + obj["ASI_target"].hide(); + obj["ASI_digit_UP"].setText(sprintf("%3.0f", fmgc.FMGCInternal.v2)); + } + } + }), props.UpdateManager.FromHashList(["machError","ind_mach"], 0.001, func(val) { if (val.machError) { obj["ASI_mach"].hide(); @@ -891,6 +864,145 @@ var canvas_pfd = { } } }), + props.UpdateManager.FromHashList(["flapMaxSpeed","ASI"], 0.5, func(val) { + obj["flap_max"].setTranslation(0, (val.flapMaxSpeed - 30 - val.ASI) * -6.6); + }), + props.UpdateManager.FromHashList(["speedError","fac1","fac2","flapMaxSpeed","flapsInput","ind_spd"], 0.5, func(val) { + if (!val.speedError and (val.fac1 or val.fac2)) { + if (abs(val.flapMaxSpeed - val.ind_spd) <= 42 and val.flapsInput != 4) { + obj["flap_max"].show(); + } else { + obj["flap_max"].hide(); + } + } else { + obj["flap_max"].hide(); + } + }), + props.UpdateManager.FromHashValue("Ctrgt", , 0.5, func(val) { + obj["clean_speed"].setTranslation(0, val * -6.6); + }), + props.UpdateManager.FromHashValue("Ftrgt", 0.5, func(val) { + obj["F_target"].setTranslation(0, val * -6.6); + }), + props.UpdateManager.FromHashValue("Strgt", 0.5, func(val) { + obj["S_target"].setTranslation(0, val * -6.6); + }), + props.UpdateManager.FromHashList(["speedError","fac1","fac2","flapsInput","SPDstrgtdiff","SPDftrgtdiff","SPDcleantrgtdiff","agl"], 0.5, func(val) { + if (!val.speedError and (val.fac1 or val.fac2)) { + if (val.flapsInput == 1) { + obj["F_target"].hide(); + obj["clean_speed"].hide(); + + if (abs(val.SPDstrgtdiff) <= 42 and val.agl >= 400) { + obj["S_target"].show(); + } else { + obj["S_target"].hide(); + } + } else if (val.flapsInput == 2 or val.flapsInput == 3) { + obj["S_target"].hide(); + obj["clean_speed"].hide(); + + if (abs(val.SPDftrgtdiff) <= 42 and val.agl >= 400) { + obj["F_target"].show(); + } else { + obj["F_target"].hide(); + } + } else if (val.flapsInput == 4) { + obj["S_target"].hide(); + obj["F_target"].hide(); + obj["clean_speed"].hide(); + } else { + obj["S_target"].hide(); + obj["F_target"].hide(); + + if (abs(val.SPDcleantrgtdiff) <= 42) { + obj["clean_speed"].show(); + } else { + obj["clean_speed"].hide(); + } + + } + } else { + obj["S_target"].hide(); + obj["F_target"].hide(); + obj["clean_speed"].hide(); + } + }), + props.UpdateManager.FromHashValue("bussTranslate", 0.2, func(val) { + obj["ASI_buss"].setTranslation(0, val); + obj["ASI_buss_ref_blue"].setTranslation(0, val); + }), + props.UpdateManager.FromHashList(["speedError","fac1","fac2","fbwLaw","fmgcPhase","gear1Wow","gear2Wow","fmgcTakeoffState"], 1, func(val) { + if (!val.fmgcTakeoffState and val.fmgcPhase >= 1 and !val.gear1Wow and !val.gear2Wow and !val.speedError and (val.fac1 or val.fac2)) { + obj["VLS_min"].show(); + if (val.fbwLaw == 0) { + obj["ALPHA_PROT"].show(); + obj["ALPHA_MAX"].show(); + obj["ALPHA_SW"].hide(); + } else { + obj["ALPHA_PROT"].hide(); + obj["ALPHA_MAX"].hide(); + obj["ALPHA_SW"].show(); + } + } else { + obj["VLS_min"].hide(); + obj["ALPHA_PROT"].hide(); + obj["ALPHA_MAX"].hide(); + obj["ALPHA_SW"].hide(); + } + }), + props.UpdateManager.FromHashValue("ALPHAprot", 0.5, func(val) { + obj["ALPHA_PROT"].setTranslation(0, val * -6.6); + }), + props.UpdateManager.FromHashValue("ALPHAmax", 0.5, func(val) { + obj["ALPHA_MAX"].setTranslation(0, val * -6.6); + }), + props.UpdateManager.FromHashValue("ALPHAvsw", 0.5, func(val) { + obj["ALPHA_SW"].setTranslation(0, val * -6.6); + }), + props.UpdateManager.FromHashValue("VLSmin", 0.5, func(val) { + obj["VLS_min"].setTranslation(0, val * -6.6); + }), + props.UpdateManager.FromHashValue("ASItrgt", 0.5, func(val) { + obj["ASI_target"].setTranslation(0, val * -6.6); + }), + props.UpdateManager.FromHashList(["speedError","ASItrgtdiff","targetMach","tgt_kts","ktsMach"], 0.5, func(val) { + if (!val.speedError) { + if (abs(val.ASItrgtdiff) <= 42) { + obj["ASI_digit_UP"].hide(); + obj["ASI_decimal_UP"].hide(); + obj["ASI_digit_DN"].hide(); + obj["ASI_decimal_DN"].hide(); + obj["ASI_target"].show(); + } else if (val.ASItrgtdiff < -42) { + if (val.ktsMach) { + obj["ASI_digit_DN"].setText(sprintf("%3.0f", val.targetMach * 1000)); + obj["ASI_decimal_UP"].hide(); + obj["ASI_decimal_DN"].show(); + } else { + obj["ASI_digit_DN"].setText(sprintf("%3.0f", val.tgt_kts)); + obj["ASI_decimal_UP"].hide(); + obj["ASI_decimal_DN"].hide(); + } + obj["ASI_digit_DN"].show(); + obj["ASI_digit_UP"].hide(); + obj["ASI_target"].hide(); + } else if (val.ASItrgtdiff > 42) { + if (val.ktsMach) { + obj["ASI_digit_UP"].setText(sprintf("%3.0f", val.targetMach * 1000)); + obj["ASI_decimal_UP"].show(); + obj["ASI_decimal_DN"].hide(); + } else { + obj["ASI_digit_UP"].setText(sprintf("%3.0f", val.tgt_kts)); + obj["ASI_decimal_UP"].hide(); + obj["ASI_decimal_DN"].hide(); + } + obj["ASI_digit_UP"].show(); + obj["ASI_digit_DN"].hide(); + obj["ASI_target"].hide(); + } + } + }), ]; obj.update_items_mismatch = [ @@ -1036,6 +1148,7 @@ var canvas_pfd = { # Airspeed if (dmc.DMController.DMCs[me.number].outputs[0] != nil) { me.ind_spd = dmc.DMController.DMCs[me.number].outputs[0].getValue(); + notification.ind_spd = me.ind_spd; notification.speedError = 0; if (me.ind_spd <= 30) { @@ -1088,10 +1201,144 @@ var canvas_pfd = { notification.showVr = 0; } + if (fmgc.FMGCInternal.v2set) { + if (fmgc.FMGCInternal.v2 <= 30) { + notification.V2trgt = 0 - notification.ASI; + } else if (fmgc.FMGCInternal.v2 >= 420) { + notification.V2trgt = 390 - notification.ASI; + } else { + notification.V2trgt = fmgc.FMGCInternal.v2 - 30 - notification.ASI; + } + + notification.SPDv2trgtdiff = fmgc.FMGCInternal.v2 - me.ind_spd; + notification.showV2 = 1; + } else { + notification.V2trgt = 0; + notification.SPDv2trgtdiff = 0; + notification.showV2 = 0; + } + + if (notification.fac1 or notification.fac2) { + if (notification.flapsInput == 1) { + if (fmgc.FMGCInternal.slat <= 30) { + notification.Strgt = 0 - notification.ASI; + } else if (fmgc.FMGCInternal.slat >= 420) { + notification.Strgt = 390 - notification.ASI; + } else { + notification.Strgt = fmgc.FMGCInternal.slat - 30 - notification.ASI; + } + + notification.SPDstrgtdiff = fmgc.FMGCInternal.slat - me.ind_spd; + notification.flapMaxSpeed = 200; + } else if (notification.flapsInput == 2) { + if (fmgc.FMGCInternal.flap2 <= 30) { + notification.Ftrgt = 0 - notification.ASI; + } else if (fmgc.FMGCInternal.flap2 >= 420) { + notification.Ftrgt = 390 - notification.ASI; + } else { + notification.Ftrgt = fmgc.FMGCInternal.flap2 - 30 - notification.ASI; + } + + me.SPDftrgtdiff = fmgc.FMGCInternal.flap2 - me.ind_spd; + notification.flapMaxSpeed = 185; + } else if (notification.flapsInput == 3) { + if (fmgc.FMGCInternal.flap3 <= 30) { + notification.Ftrgt = 0 - notification.ASI; + } else if (fmgc.FMGCInternal.flap3 >= 420) { + notification.Ftrgt = 390 - notification.ASI; + } else { + notification.Ftrgt = fmgc.FMGCInternal.flap3 - 30 - notification.ASI; + } + + notification.SPDftrgtdiff = fmgc.FMGCInternal.flap3 - me.ind_spd; + notification.flapMaxSpeed = 177; + } else if (notification.flapsInput == 0) { + notification.Ctrgt = fmgc.FMGCInternal.clean - 30 - notification.ASI; + + notification.SPDcleantrgtdiff = fmgc.FMGCInternal.clean - me.ind_spd; + notification.flapMaxSpeed = 230; + } + } else { + notification.SPDcleantrgtdiff = 0; + notification.SPDftrgtdiff = 0; + notification.SPDstrgtdiff = 0; + notification.Strgt = 0; + notification.Ftrgt = 0; + notification.Ctrgt = 0; + notification.flapMaxSpeed = 0; + } + + notification.fmgcTakeoffState = fmgc.FMGCInternal.takeoffState; + + if (!fmgc.FMGCInternal.takeoffState and fmgc.FMGCInternal.phase >= 1 and !notification.gear1Wow and !notification.gear2Wow) { + if (fmgc.FMGCInternal.vls_min <= 30) { + notification.VLSmin = 0 - notification.ASI; + } else if (fmgc.FMGCInternal.vls_min >= 420) { + notification.VLSmin = 390 - notification.ASI; + } else { + notification.VLSmin = fmgc.FMGCInternal.vls_min - 30 - notification.ASI; + } + + if (fmgc.FMGCInternal.alpha_prot <= 30) { + notification.ALPHAprot = 0 - notification.ASI; + } else if (fmgc.FMGCInternal.alpha_prot >= 420) { + notification.ALPHAprot = 390 - notification.ASI; + } else { + notification.ALPHAprot = fmgc.FMGCInternal.alpha_prot - 30 - notification.ASI; + } + + if (fmgc.FMGCInternal.alpha_max <= 30) { + notification.ALPHAmax = 0 - notification.ASI; + } else if (fmgc.FMGCInternal.alpha_max >= 420) { + notification.ALPHAmax = 390 - notification.ASI; + } else { + notification.ALPHAmax = fmgc.FMGCInternal.alpha_max - 30 - notification.ASI; + } + + if (fmgc.FMGCInternal.vsw <= 30) { + notification.ALPHAvsw = 0 - notification.ASI; + } else if (fmgc.FMGCInternal.vsw >= 420) { + notification.ALPHAvsw = 390 - notification.ASI; + } else { + notification.ALPHAvsw = fmgc.FMGCInternal.vsw - 30 - notification.ASI; + } + } else { + notification.ALPHAprot = 0; + notification.ALPHAmax = 0; + notification.ALPHAvsw = 0; + notification.VLSmin = 0; + } + + + me.tgt_ias = notification.targetIasPFD; + me.tgt_kts = notification.targetKts; + + if (notification.managedSpd) { + if (fmgc.FMGCInternal.decel) { + me.tgt_ias = fmgc.FMGCInternal.vappSpeedSet ? fmgc.FMGCInternal.vapp_appr : fmgc.FMGCInternal.vapp; + me.tgt_kts = fmgc.FMGCInternal.vappSpeedSet ? fmgc.FMGCInternal.vapp_appr : fmgc.FMGCInternal.vapp; + } else if (fmgc.FMGCInternal.phase == 6) { + me.tgt_ias = fmgc.FMGCInternal.clean; + me.tgt_kts = fmgc.FMGCInternal.clean; + } + } + + notification.tgt_kts = me.tgt_kts; + + if (me.tgt_ias <= 30) { + notification.ASItrgt = 0 - notification.ASI; + } else if (me.tgt_ias >= 420) { + notification.ASItrgt = 390 - notification.ASI; + } else { + notification.ASItrgt = me.tgt_ias - 30 - notification.ASI; + } + + notification.ASItrgtdiff = me.tgt_ias - notification.ind_spd; + notification.ASItrend = dmc.DMController.DMCs[me.number].outputs[6].getValue() - notification.ASI; if (notification.ASItrend >= 2 or (me.ASItrendIsShown != 0 and notification.ASItrend >= 1)) { me.ASItrendIsShown = 1; - } else if (me.ASItrend <= -2 or (me.ASItrendIsShown != 0 and notification.ASItrend <= -1)) { + } else if (notification.ASItrend <= -2 or (me.ASItrendIsShown != 0 and notification.ASItrend <= -1)) { me.ASItrendIsShown = -1; } else { me.ASItrendIsShown = 0; @@ -1104,15 +1351,13 @@ var canvas_pfd = { me["ground_ref"].hide(); } } else { - me.ind_spd = dmc.DMController.DMCs[me.number].outputs[0].getValue(); + notification.ind_spd = 0; notification.speedError = 1; if (!systems.ADIRS.Operating.adr[0].getValue() and !systems.ADIRS.Operating.adr[1].getValue() and !systems.ADIRS.Operating.adr[2].getValue()) { me["ASI_buss"].show(); me["ASI_buss_ref"].show(); me["ASI_buss_ref_blue"].show(); - me["ASI_buss"].setTranslation(0, notification.bussTranslate); - me["ASI_buss_ref_blue"].setTranslation(0, notification.bussTranslate); me["ASI_error"].hide(); } else { me["ASI_buss"].hide(); @@ -1121,13 +1366,33 @@ var canvas_pfd = { me["ASI_error"].show(); } + notification.ASI = 0; + notification.ASImax = 0; + notification.ASItrgt = 0; + notification.ASItrgtdiff = 0; + notification.ASItrend = 0; + notification.ALPHAprot = 0; + notification.ALPHAmax = 0; + notification.ALPHAvsw = 0; notification.ASItrendIsShown = 0; - notification.V1trgt = 0; - notification.SPDv1trgtdiff = 0; + notification.Ctrgt = 0; + notification.flapMaxSpeed = 0; + notification.Ftrgt = 0; + notification.Strgt = 0; notification.showV1 = 0; - notification.VRtrgt = 0; - notification.SPDvrtrgtdiff = 0; notification.showVr = 0; + notification.showV2 = 0; + notification.SPDcleantrgtdiff = 0; + notification.SPDftrgtdiff = 0; + notification.SPDstrgtdiff = 0; + notification.SPDv1trgtdiff = 0; + notification.SPDvrtrgtdiff = 0; + notification.SPDv2trgtdiff = 0; + notification.tgt_kts = 0; + notification.V1trgt = 0; + notification.VRtrgt = 0; + notification.V2trgt = 0; + notification.VLSmin = 0; } # Mach From b00e9f228a225585b1e6bac8a4bcd0387aa0be37 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Thu, 28 Apr 2022 19:13:25 +0100 Subject: [PATCH 18/33] Bugfix --- Models/Instruments/PFD/PFD.nas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 177d374c..15d7d1f2 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -1239,7 +1239,7 @@ var canvas_pfd = { notification.Ftrgt = fmgc.FMGCInternal.flap2 - 30 - notification.ASI; } - me.SPDftrgtdiff = fmgc.FMGCInternal.flap2 - me.ind_spd; + notification.SPDftrgtdiff = fmgc.FMGCInternal.flap2 - me.ind_spd; notification.flapMaxSpeed = 185; } else if (notification.flapsInput == 3) { if (fmgc.FMGCInternal.flap3 <= 30) { From 6bac9e6d8fa9ad28439f387b1b2bca152905221c Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Thu, 28 Apr 2022 19:14:23 +0100 Subject: [PATCH 19/33] Bugfix 2 --- Models/Instruments/PFD/PFD.nas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 15d7d1f2..979731cc 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -836,7 +836,7 @@ var canvas_pfd = { if (!val.speedError and val.showVr) { if (val.agl < 55 and val.fmgcPhase <= 2 and abs(val.SPDv2trgtdiff) <= 42) { obj["ASI_target"].show(); - obj["ASI_target"].setTranslation(0, me.V2trgt * -6.6); + obj["ASI_target"].setTranslation(0, val.V2trgt * -6.6); obj["ASI_digit_UP"].setText(sprintf("%3.0f", fmgc.FMGCInternal.v2)); } else if (val.agl < 55 and fmgc.FMGCInternal.phase <= 2) { obj["ASI_target"].hide(); From c2bc2c8e557c5d3736c20379f0fc0b86b6ad27dc Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Fri, 29 Apr 2022 16:46:04 +0100 Subject: [PATCH 20/33] Move rest of PFD to emesary --- Models/Instruments/PFD/PFD.nas | 537 ++++++++++++++++++--------------- 1 file changed, 296 insertions(+), 241 deletions(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 979731cc..fda9ba75 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -1003,6 +1003,285 @@ var canvas_pfd = { } } }), + props.UpdateManager.FromHashList(["showPFDILS","magnetic_hdg_dif"], 0.01, func(val) { + if (val.showPFDILS) { + if (abs(val.magnetic_hdg_dif) <= 23.62) { + obj["CRS_pointer"].setTranslation((val.magnetic_hdg_dif / 10) * 98.5416, 0); + + obj["ILS_HDG_L"].hide(); + obj["ILS_HDG_R"].hide(); + obj["CRS_pointer"].show(); + } else if (val.magnetic_hdg_dif < -23.62 and val.magnetic_hdg_dif >= -180) { + obj["ILS_HDG_L"].show(); + obj["ILS_HDG_R"].hide(); + obj["CRS_pointer"].hide(); + } else if (val.magnetic_hdg_dif > 23.62 and val.magnetic_hdg_dif <= 180) { + obj["ILS_HDG_L"].hide(); + obj["ILS_HDG_R"].show(); + obj["CRS_pointer"].hide(); + } else { + obj["ILS_HDG_L"].hide(); + obj["ILS_HDG_R"].hide(); + obj["CRS_pointer"].hide(); + } + } else { + obj["ILS_HDG_L"].hide(); + obj["ILS_HDG_R"].hide(); + obj["CRS_pointer"].hide(); + } + }), + props.UpdateManager.FromHashValue("ilsCrs", 0.5, func(val) { + if (int(val) < 10) { + obj["ILS_left"].setText(sprintf("00%1.0f", int(val))); + obj["ILS_right"].setText(sprintf("00%1.0f", int(val))); + } else if (int(val) < 100) { + obj["ILS_left"].setText(sprintf("0%2.0f", int(val))); + obj["ILS_right"].setText(sprintf("0%2.0f", int(val))); + } else { + obj["ILS_left"].setText(sprintf("%3.0f", int(val))); + obj["ILS_right"].setText(sprintf("%3.0f", int(val))); + } + }), + props.UpdateManager.FromHashValue("altimeterStd", 1, func(val) { + if (val) { + obj["QNH"].hide(); + obj["QNH_setting"].hide(); + } else { + obj["QNH_std"].hide(); + obj["QNH_box"].hide(); + } + }), + props.UpdateManager.FromHashList(["showDecisionHeight","agl","decision","radio","baro","radioNo"], 0.5, func(val) { + if (val.showDecisionHeight) { + if (val.agl <= 2500) { + obj["AI_agl"].show(); + if (val.agl <= val.decision) { + obj["AI_agl"].setColor(0.7333,0.3803,0); + obj["AI_agl"].setFontSize(55); + } else { + if (val.agl <= 400) { + obj["AI_agl"].setFontSize(55); + } else { + obj["AI_agl"].setFontSize(45); + } + obj["AI_agl"].setColor(0.0509,0.7529,0.2941); + } + } else { + obj["AI_agl"].hide(); + } + } else { + obj["FMA_dh"].hide(); + obj["FMA_dhn"].hide(); + obj["FMA_nodh"].hide(); + + if (val.agl <= 2500) { + obj["AI_agl"].show(); + + # Minimums + if (int(val.radio) != 99999) { + obj["FMA_dh"].setText("RADIO"); + obj["FMA_dh"].show(); + obj["FMA_dhn"].setText(sprintf("%.0f", val.radio)); + obj["FMA_dhn"].show(); + obj["FMA_nodh"].hide(); + hundredAbove.setValue(val.radio + 100); + minimum.setValue(val.radio); + + if (val.agl <= val.radio + 100) { + obj["AI_agl"].setColor(0.7333,0.3803,0); + obj["AI_agl"].setFontSize(55); + } else { + if (val.agl <= 400) { + obj["AI_agl"].setFontSize(55); + } else { + obj["AI_agl"].setFontSize(45); + } + obj["AI_agl"].setColor(0.0509,0.7529,0.2941); + } + } else if (int(val.baro) != 99999) { + obj["FMA_dh"].setText("BARO"); + obj["FMA_dh"].show(); + obj["FMA_dhn"].setText(sprintf("%.0f", val.baro)); + obj["FMA_dhn"].show(); + obj["FMA_nodh"].hide(); + hundredAbove.setValue(val.baro + 100); + minimum.setValue(val.baro); + + if (val.agl <= val.baro + 100) { + obj["AI_agl"].setColor(0.7333,0.3803,0); + obj["AI_agl"].setFontSize(55); + } else { + if (val.agl <= 400) { + obj["AI_agl"].setFontSize(55); + } else { + obj["AI_agl"].setFontSize(45); + } + obj["AI_agl"].setColor(0.0509,0.7529,0.2941); + } + } else if (val.radioNo) { + obj["FMA_dh"].setText("BARO"); + obj["FMA_dh"].show(); + obj["FMA_dhn"].setText("100"); + obj["FMA_dhn"].show(); + obj["FMA_nodh"].hide(); + hundredAbove.setValue(100); + minimum.setValue(0); + + if (val.agl <= 400) { + obj["AI_agl"].setFontSize(55); + } else { + obj["AI_agl"].setFontSize(45); + } + + if (val.agl <= 100) { + obj["AI_agl"].setColor(0.7333,0.3803,0); + } else { + obj["AI_agl"].setColor(0.0509,0.7529,0.2941); + } + } else { + obj["FMA_dh"].hide(); + obj["FMA_dhn"].hide(); + obj["FMA_nodh"].show(); + hundredAbove.setValue(400); + minimum.setValue(300); + + if (val.agl <= 400) { + obj["AI_agl"].setColor(0.7333,0.3803,0); + obj["AI_agl"].setFontSize(55); + } else { + obj["AI_agl"].setColor(0.0509,0.7529,0.2941); + obj["AI_agl"].setFontSize(45); + } + } + } else { + obj["AI_agl"].hide(); + obj["FMA_nodh"].hide(); + + # Minimums + if (int(val.radio) != 99999) { + obj["FMA_dh"].setText("RADIO"); + obj["FMA_dh"].show(); + obj["FMA_dhn"].setText(sprintf("%.0f", val.radio)); + obj["FMA_dhn"].show(); + obj["FMA_nodh"].hide(); + } else if (int(val.baro) != 99999) { + obj["FMA_dh"].setText("BARO"); + obj["FMA_dh"].show(); + obj["FMA_dhn"].setText(sprintf("%.0f", val.baro)); + obj["FMA_dhn"].show(); + obj["FMA_nodh"].hide(); + } else if (fmgc.FMGCInternal.radioNo) { + obj["FMA_dh"].setText("BARO"); + obj["FMA_dh"].show(); + obj["FMA_dhn"].setText("100"); + obj["FMA_dhn"].show(); + obj["FMA_nodh"].hide(); + } else { + obj["FMA_dh"].hide(); + obj["FMA_dhn"].hide(); + obj["FMA_nodh"].show(); + } + } + } + }), + props.UpdateManager.FromHashValue("altError", 1, func(val) { + if (val) { + obj["ALT_error"].show(); + obj["ALT_frame"].setColor(1,0,0); + obj["ALT_group"].hide(); + obj["ALT_tens"].hide(); + obj["ALT_neg"].hide(); + obj["ALT_group2"].hide(); + obj["ALT_scale"].hide(); + obj["ALT_box_flash"].hide(); + obj["ALT_box_amber"].hide(); + obj["ALT_box"].hide(); + obj["Metric_box"].hide(); + obj["Metric_letter"].hide(); + obj["Metric_cur_alt"].hide(); + obj["ALT_digit_UP_metric"].hide(); + } else { + obj["ALT_error"].hide(); + obj["ALT_frame"].setColor(1,1,1); + obj["ALT_group"].show(); + obj["ALT_tens"].show(); + obj["ALT_box"].show(); + obj["ALT_group2"].show(); + obj["ALT_scale"].show(); + } + }), + props.UpdateManager.FromHashList(["altError","showMetric"], 1, func(val) { + if (!val.altError and val.showMetric) { + obj["ALT_digit_UP_metric"].show(); + obj["Metric_box"].show(); + obj["Metric_letter"].show(); + obj["Metric_cur_alt"].show(); + } else { + obj["ALT_digit_UP_metric"].hide(); + obj["Metric_box"].hide(); + obj["Metric_letter"].hide(); + obj["Metric_cur_alt"].hide(); + } + }), + props.UpdateManager.FromHashValue("altitude", 0.5, func(val) { + obj["Metric_cur_alt"].setText(sprintf("%5.0f", val * 0.3048)); + + 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["ALT_neg"].show(); + } else { + obj["ALT_neg"].hide(); + } + }), + props.UpdateManager.FromHashValue("altitude", 0.1, func(val) { + obj.altOffset = val / 500 - int(val / 500); + obj.middleAltOffset = nil; + + if (obj.altOffset > 0.5) { + obj.middleAltOffset = -(obj.altOffset - 1) * 243.3424; + } else { + obj.middleAltOffset = -obj.altOffset * 243.3424; + } + + obj["ALT_scale"].setTranslation(0, -obj.middleAltOffset); + obj["ALT_scale"].update(); + obj["ALT_tens"].setTranslation(0, num(right(sprintf("%02d", val), 2)) * 1.392); + }), + props.UpdateManager.FromHashValue("altitudeDigits", 1, func(val) { + obj["ALT_digits"].setText(sprintf("%d", val)); + }), + props.UpdateManager.FromHashValue("altitudeDifference", 0.1, func(val) { + obj["ALT_target"].setTranslation(0, (val / 100) * -48.66856); + }), + props.UpdateManager.FromHashValue("altitudeAutopilot", 25, func(val) { + obj["ALT_target_digit"].setText(sprintf("%03d", math.round(val / 100))); + }), + props.UpdateManager.FromHashList(["altError","altitudeDifference"], 1, func(val) { + if (!val.altError and abs(val.altitudeDifference) <= 565) { + obj["ALT_digit_UP"].hide(); + obj["ALT_digit_DN"].hide(); + obj["ALT_target"].show(); + } else { + if (val.altitudeDifference < -565 and !val.altError) { + obj["ALT_digit_DN"].show(); + obj["ALT_digit_UP"].hide(); + } else if (val.altitudeDifference > 565 and !val.altError) { + obj["ALT_digit_UP"].show(); + obj["ALT_digit_DN"].hide(); + } else { + obj["ALT_digit_UP"].hide(); + obj["ALT_digit_DN"].hide(); + } + obj["ALT_target"].hide(); + } + }), ]; obj.update_items_mismatch = [ @@ -1404,72 +1683,13 @@ var canvas_pfd = { } # Altitude - if (dmc.DMController.DMCs[me.number].outputs[1] != nil) { - me["ALT_error"].hide(); - me["ALT_frame"].setColor(1,1,1); - me["ALT_group"].show(); - me["ALT_tens"].show(); - me["ALT_box"].show(); - me["ALT_group2"].show(); - me["ALT_scale"].show(); - - me.altitude = dmc.DMController.DMCs[me.number].outputs[1].getValue(); + notification.showMetric = me.showMetricAlt; - if (me.showMetricAlt) { - me["ALT_digit_UP_metric"].show(); - me["Metric_box"].show(); - me["Metric_letter"].show(); - me["Metric_cur_alt"].show(); - me["Metric_cur_alt"].setText(sprintf("%5.0f", me.altitude * 0.3048)); - } else { - me["ALT_digit_UP_metric"].hide(); - me["Metric_box"].hide(); - me["Metric_letter"].hide(); - me["Metric_cur_alt"].hide(); - } - - me.altOffset = me.altitude / 500 - int(me.altitude / 500); - me.middleAltText = roundaboutAlt(me.altitude / 100); - me.middleAltOffset = nil; - if (me.altOffset > 0.5) { - me.middleAltOffset = -(me.altOffset - 1) * 243.3424; - } else { - me.middleAltOffset = -me.altOffset * 243.3424; - } - me["ALT_scale"].setTranslation(0, -me.middleAltOffset); - me["ALT_scale"].update(); - me["ALT_five"].setText(sprintf("%03d", abs(me.middleAltText+10))); - me["ALT_four"].setText(sprintf("%03d", abs(me.middleAltText+5))); - me["ALT_three"].setText(sprintf("%03d", abs(me.middleAltText))); - me["ALT_two"].setText(sprintf("%03d", abs(me.middleAltText-5))); - me["ALT_one"].setText(sprintf("%03d", abs(me.middleAltText-10))); - - if (me.altitude < 0) { - me["ALT_neg"].show(); - } else { - me["ALT_neg"].hide(); - } - - me["ALT_digits"].setText(sprintf("%d", dmc.DMController.DMCs[me.number].outputs[3].getValue())); - me["ALT_tens"].setTranslation(0, num(right(sprintf("%02d", me.altitude), 2)) * 1.392); - - me.alt_diff_cur = dmc.DMController.DMCs[me.number].outputs[7].getValue(); - if (me.alt_diff_cur >= -565 and me.alt_diff_cur <= 565) { - me["ALT_target"].setTranslation(0, (me.alt_diff_cur / 100) * -48.66856); - me["ALT_target_digit"].setText(sprintf("%03d", math.round(notification.altitudeAutopilot / 100))); - me["ALT_digit_UP"].hide(); - me["ALT_digit_DN"].hide(); - me["ALT_target"].show(); - } else { - me["ALT_target"].hide(); - if (me.alt_diff_cur < -565) { - me["ALT_digit_DN"].show(); - me["ALT_digit_UP"].hide(); - } else if (me.alt_diff_cur > 565) { - me["ALT_digit_UP"].show(); - me["ALT_digit_DN"].hide(); - } - } + if (dmc.DMController.DMCs[me.number].outputs[1] != nil) { + notification.altError = 0; + notification.altitude = 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(); if (!ecam.altAlertFlash and !ecam.altAlertSteady) { if (me.number == 0) { @@ -1550,20 +1770,10 @@ var canvas_pfd = { } } } else { - me["ALT_error"].show(); - me["ALT_frame"].setColor(1,0,0); - me["ALT_group"].hide(); - me["ALT_tens"].hide(); - me["ALT_neg"].hide(); - me["ALT_group2"].hide(); - me["ALT_scale"].hide(); - me["ALT_box_flash"].hide(); - me["ALT_box_amber"].hide(); - me["ALT_box"].hide(); - me["Metric_box"].hide(); - me["Metric_letter"].hide(); - me["Metric_cur_alt"].hide(); - me["ALT_digit_UP_metric"].hide(); + notification.altError = 1; + notification.altitude = -9999; + notification.altitudeDigits = -9999; + notification.altitudeDifference = -9999; } if (notification.pitchMode == "LAND" or notification.pitchMode == "FLARE" or notification.pitchMode == "ROLL OUT") { @@ -1598,133 +1808,14 @@ var canvas_pfd = { } } + notification.radioNo = fmgc.FMGCInternal.radioNo; if (fmgc.FMGCInternal.phase < 3 or fmgc.flightPlanController.arrivalDist >= 250) { - me["FMA_dh"].hide(); - me["FMA_dhn"].hide(); - me["FMA_nodh"].hide(); - if (notification.agl <= 2500) { - me["AI_agl"].show(); - if (notification.agl <= notification.decision) { - me["AI_agl"].setColor(0.7333,0.3803,0); - me["AI_agl"].setFontSize(55); - } else { - if (notification.agl <= 400) { - me["AI_agl"].setFontSize(55); - } else { - me["AI_agl"].setFontSize(45); - } - me["AI_agl"].setColor(0.0509,0.7529,0.2941); - } - } else { - me["AI_agl"].hide(); - } + notification.showDecisionHeight = 0; } else { - if (notification.agl <= 2500) { - me["AI_agl"].show(); - if (int(notification.radio) != 99999) { - me["FMA_dh"].setText("RADIO"); - me["FMA_dh"].show(); - me["FMA_dhn"].setText(sprintf("%.0f", notification.radio)); - me["FMA_dhn"].show(); - me["FMA_nodh"].hide(); - hundredAbove.setValue(notification.radio + 100); - minimum.setValue(notification.radio); - if (notification.agl <= notification.radio + 100) { - me["AI_agl"].setColor(0.7333,0.3803,0); - me["AI_agl"].setFontSize(55); - } else { - if (notification.agl <= 400) { - me["AI_agl"].setFontSize(55); - } else { - me["AI_agl"].setFontSize(45); - } - me["AI_agl"].setColor(0.0509,0.7529,0.2941); - } - } else if (int(notification.baro) != 99999) { - me["FMA_dh"].setText("BARO"); - me["FMA_dh"].show(); - me["FMA_dhn"].setText(sprintf("%.0f", notification.baro)); - me["FMA_dhn"].show(); - me["FMA_nodh"].hide(); - hundredAbove.setValue(notification.baro + 100); - minimum.setValue(notification.baro); - if (notification.agl <= notification.baro + 100) { - me["AI_agl"].setColor(0.7333,0.3803,0); - me["AI_agl"].setFontSize(55); - } else { - if (notification.agl <= 400) { - me["AI_agl"].setFontSize(55); - } else { - me["AI_agl"].setFontSize(45); - } - me["AI_agl"].setColor(0.0509,0.7529,0.2941); - } - } else if (fmgc.FMGCInternal.radioNo) { - me["FMA_dh"].setText("BARO"); - me["FMA_dh"].show(); - me["FMA_dhn"].setText("100"); - me["FMA_dhn"].show(); - me["FMA_nodh"].hide(); - hundredAbove.setValue(100); - minimum.setValue(0); - if (notification.agl <= 400) { - me["AI_agl"].setFontSize(55); - } else { - me["AI_agl"].setFontSize(45); - } - - if (notification.agl <= 100) { - me["AI_agl"].setColor(0.7333,0.3803,0); - } else { - me["AI_agl"].setColor(0.0509,0.7529,0.2941); - } - } else { - me["FMA_dh"].hide(); - me["FMA_dhn"].hide(); - me["FMA_nodh"].show(); - hundredAbove.setValue(400); - minimum.setValue(300); - if (notification.agl <= 400) { - me["AI_agl"].setColor(0.7333,0.3803,0); - me["AI_agl"].setFontSize(55); - } else { - me["AI_agl"].setColor(0.0509,0.7529,0.2941); - me["AI_agl"].setFontSize(45); - } - } - } else { - me["AI_agl"].hide(); - me["FMA_nodh"].hide(); - if (int(notification.radio) != 99999) { - me["FMA_dh"].setText("RADIO"); - me["FMA_dh"].show(); - me["FMA_dhn"].setText(sprintf("%.0f", notification.radio)); - me["FMA_dhn"].show(); - me["FMA_nodh"].hide(); - } else if (int(notification.baro) != 99999) { - me["FMA_dh"].setText("BARO"); - me["FMA_dh"].show(); - me["FMA_dhn"].setText(sprintf("%.0f", notification.baro)); - me["FMA_dhn"].show(); - me["FMA_nodh"].hide(); - } else if (fmgc.FMGCInternal.radioNo) { - me["FMA_dh"].setText("BARO"); - me["FMA_dh"].show(); - me["FMA_dhn"].setText("100"); - me["FMA_dhn"].show(); - me["FMA_nodh"].hide(); - } else { - me["FMA_dh"].hide(); - me["FMA_dhn"].hide(); - me["FMA_nodh"].show(); - } - } + notification.showDecisionHeight = 1; } if (notification.altimeterStd == 1) { - me["QNH"].hide(); - me["QNH_setting"].hide(); - if (notification.altitude < fmgc.FMGCInternal.transAlt and fmgc.FMGCInternal.phase == 4) { if (me.number == 0) { if (qnh_going1 == 0) { @@ -1759,9 +1850,6 @@ var canvas_pfd = { me["QNH_box"].show(); } } else { - me["QNH_std"].hide(); - me["QNH_box"].hide(); - if (notification.altitude >= fmgc.FMGCInternal.transAlt and fmgc.FMGCInternal.phase == 2) { if (me.number == 0) { if (qnh_going1 == 0) { @@ -1827,44 +1915,11 @@ var canvas_pfd = { } if (((me.number == 0 and notification.pfdILS1) or (me.number == 1 and notification.pfdILS2)) and size(me.split_ils) == 2) { - me.magnetic_hdg = notification.ilsCrs; - me.magnetic_hdg_dif = geo.normdeg180(me.magnetic_hdg - notification.headingPFD); - if (me.magnetic_hdg_dif >= -23.62 and me.magnetic_hdg_dif <= 23.62) { - me["CRS_pointer"].setTranslation((me.magnetic_hdg_dif / 10) * 98.5416, 0); - me["ILS_HDG_R"].hide(); - me["ILS_HDG_L"].hide(); - me["CRS_pointer"].show(); - } else if (me.magnetic_hdg_dif < -23.62 and me.magnetic_hdg_dif >= -180) { - if (int(me.magnetic_hdg) < 10) { - me["ILS_left"].setText(sprintf("00%1.0f", int(me.magnetic_hdg))); - } else if (int(me.magnetic_hdg) < 100) { - me["ILS_left"].setText(sprintf("0%2.0f", int(me.magnetic_hdg))); - } else { - me["ILS_left"].setText(sprintf("%3.0f", int(me.magnetic_hdg))); - } - me["ILS_HDG_L"].show(); - me["ILS_HDG_R"].hide(); - me["CRS_pointer"].hide(); - } else if (me.magnetic_hdg_dif > 23.62 and me.magnetic_hdg_dif <= 180) { - if (int(me.magnetic_hdg) < 10) { - me["ILS_right"].setText(sprintf("00%1.0f", int(me.magnetic_hdg))); - } else if (int(me.magnetic_hdg) < 100) { - me["ILS_right"].setText(sprintf("0%2.0f", int(me.magnetic_hdg))); - } else { - me["ILS_right"].setText(sprintf("%3.0f", int(me.magnetic_hdg))); - } - me["ILS_HDG_R"].show(); - me["ILS_HDG_L"].hide(); - me["CRS_pointer"].hide(); - } else { - me["ILS_HDG_R"].hide(); - me["ILS_HDG_L"].hide(); - me["CRS_pointer"].hide(); - } + notification.showPFDILS = 1; + notification.magnetic_hdg_dif = geo.normdeg180(me.magnetic_hdg - notification.headingPFD); } else { - me["ILS_HDG_R"].hide(); - me["ILS_HDG_L"].hide(); - me["CRS_pointer"].hide(); + notification.showPFDILS = 0; + notification.magnetic_hdg_dif = 0; } if (me.temporaryNodes.showGroundReferenceAGL) { From ed70a34d9d7ea980566b434d24dc846f65a7c4f7 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Fri, 29 Apr 2022 20:48:35 +0100 Subject: [PATCH 21/33] Fix decision height --- Models/Instruments/PFD/PFD.nas | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index fda9ba75..b0959096 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -1052,7 +1052,11 @@ var canvas_pfd = { } }), props.UpdateManager.FromHashList(["showDecisionHeight","agl","decision","radio","baro","radioNo"], 0.5, func(val) { - if (val.showDecisionHeight) { + if (!val.showDecisionHeight) { + obj["FMA_dh"].hide(); + obj["FMA_dhn"].hide(); + obj["FMA_nodh"].hide(); + if (val.agl <= 2500) { obj["AI_agl"].show(); if (val.agl <= val.decision) { @@ -1070,10 +1074,6 @@ var canvas_pfd = { obj["AI_agl"].hide(); } } else { - obj["FMA_dh"].hide(); - obj["FMA_dhn"].hide(); - obj["FMA_nodh"].hide(); - if (val.agl <= 2500) { obj["AI_agl"].show(); From 56abd3a3c373afc4869a93f109a2b22ce27385e8 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Fri, 29 Apr 2022 20:55:11 +0100 Subject: [PATCH 22/33] Speed up speed scale --- Models/Instruments/IESI/IESI.nas | 34 ++++++++++++++------------------ Models/Instruments/PFD/PFD.nas | 30 +++++++++++++--------------- 2 files changed, 29 insertions(+), 35 deletions(-) diff --git a/Models/Instruments/IESI/IESI.nas b/Models/Instruments/IESI/IESI.nas index 9cc69e0e..7277fe89 100644 --- a/Models/Instruments/IESI/IESI.nas +++ b/Models/Instruments/IESI/IESI.nas @@ -65,9 +65,10 @@ var canvas_IESI = { props.UpdateManager.FromHashValue("airspeed", 0.1, func(val) { obj["ASI_scale"].setTranslation(0, math.clamp(val - 30, 0, 490) * 8.295); }), - props.UpdateManager.FromHashList(["altitude","altitude_ind"], 0.5, func(val) { - val.altitude = math.clamp(val.altitude, -2000, 50000); - if (val.altitude < 0) { + props.UpdateManager.FromHashValue("altitude", 0.5, func(val) { + val = math.clamp(val, -2000, 50000); + + if (val < 0) { obj["negText"].show(); obj._isNegativeAlt = 1; } else { @@ -75,8 +76,8 @@ var canvas_IESI = { obj._isNegativeAlt = 0; } - obj.altOffset = (val.altitude / 500) - int(val.altitude / 500); - obj.middleAltText = roundaboutAlt(val.altitude / 100); + obj.altOffset = (val / 500) - int(val / 500); + obj.middleAltText = roundaboutAlt(val / 100); if (obj.altOffset > 0.5) { obj._middleAltOffset = -(obj.altOffset - 1) * 258.5528; } else { @@ -85,24 +86,19 @@ 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_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_two"].setText(sprintf("%03d", abs(obj.middleAltText - 5))); + obj["ALT_one"].setText(sprintf("%03d", abs(obj.middleAltText - 10))); - - if (val.altitude < 0 and val.altitude_ind > 20) { - val.altitude_ind = 20; - } elsif (val.altitude > 0 and val.altitude_ind > 500) { - val.altitude_ind = 500; - } - - obj["ALT_digits"].setText(sprintf("%s", val.altitude_ind)); - obj["ALT_meters"].setText(sprintf("%5.0f", math.round(val.altitude * 0.3048, 10))); - obj.altTens = num(right(sprintf("%02d", val.altitude), 2)); + obj["ALT_meters"].setText(sprintf("%5.0f", math.round(val * 0.3048, 10))); + obj.altTens = num(right(sprintf("%02d", val), 2)); obj["ALT_tens"].setTranslation(0, obj.altTens * 3.16); }), + props.UpdateManager.FromHashValue("altitude_ind", 0.5, func(val) { + obj["ALT_digits"].setText(sprintf("%s", math.clamp(val, -20, 500))); + }), props.UpdateManager.FromHashValue("showMach", 1, func(val) { if (val) { obj["ASI_mach_decimal"].show(); diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index b0959096..e3e34f4c 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -249,11 +249,9 @@ var canvas_pfd = { obj["FMA_lvrclb"].hide(); } }), - props.UpdateManager.FromHashList(["trackPFD","headingPFD"], 0.1, func(val) { + props.UpdateManager.FromHashList(["trackPFD","headingPFD","aoaPFD"], 0.01, func(val) { obj.track_diff = geo.normdeg180(val.trackPFD - val.headingPFD); # store this to use in FPV obj["TRK_pointer"].setTranslation(obj.getTrackDiffPixels(obj.track_diff),0); - }), - props.UpdateManager.FromHashList(["trackPFD","headingPFD","aoaPFD"], 0.01, func(val) { obj.AI_fpv_trans.setTranslation(obj.getTrackDiffPixels(math.clamp(obj.track_diff, -21, 21)), math.clamp(val.aoaPFD, -20, 20) * 12.5); }), props.UpdateManager.FromHashList(["vsAutopilot","agl"], 5, func(val) { @@ -787,17 +785,17 @@ var canvas_pfd = { obj["ASI_trend_down"].hide(); } }), - props.UpdateManager.FromHashValue("ASI", 0.5, func(val) { + props.UpdateManager.FromHashValue("ASI", 0.1, func(val) { obj["ASI_scale"].setTranslation(0, val * 6.6); }), - props.UpdateManager.FromHashValue("ASImax", 0.5, func(val) { + props.UpdateManager.FromHashValue("ASImax", 0.1, func(val) { obj["ASI_max"].setTranslation(0, val * -6.6); }), props.UpdateManager.FromHashValue("ASItrend", 0.1, func(val) { obj["ASI_trend_up"].setTranslation(0, math.clamp(val, 0, 50) * -6.6); obj["ASI_trend_down"].setTranslation(0, math.clamp(val, -50, 0) * -6.6); }), - props.UpdateManager.FromHashValue("V1trgt", 0.5, func(val) { + props.UpdateManager.FromHashValue("V1trgt", 0.1, func(val) { obj["v1_group"].setTranslation(0, val * -6.6); obj["v1_text"].setText(sprintf("%3.0f", fmgc.FMGCInternal.v1)); }), @@ -818,7 +816,7 @@ var canvas_pfd = { obj["v1_text"].hide(); } }), - props.UpdateManager.FromHashValue("VRtrgt", 0.5, func(val) { + props.UpdateManager.FromHashValue("VRtrgt", 0.1, func(val) { obj["vr_speed"].setTranslation(0, val * -6.6); }), props.UpdateManager.FromHashList(["speedError","showVr","SPDvrtrgtdiff","fmgcPhase","agl"], 0.5, func(val) { @@ -864,7 +862,7 @@ var canvas_pfd = { } } }), - props.UpdateManager.FromHashList(["flapMaxSpeed","ASI"], 0.5, func(val) { + props.UpdateManager.FromHashList(["flapMaxSpeed","ASI"], 0.1, func(val) { obj["flap_max"].setTranslation(0, (val.flapMaxSpeed - 30 - val.ASI) * -6.6); }), props.UpdateManager.FromHashList(["speedError","fac1","fac2","flapMaxSpeed","flapsInput","ind_spd"], 0.5, func(val) { @@ -878,13 +876,13 @@ var canvas_pfd = { obj["flap_max"].hide(); } }), - props.UpdateManager.FromHashValue("Ctrgt", , 0.5, func(val) { + props.UpdateManager.FromHashValue("Ctrgt", , 0.1, func(val) { obj["clean_speed"].setTranslation(0, val * -6.6); }), - props.UpdateManager.FromHashValue("Ftrgt", 0.5, func(val) { + props.UpdateManager.FromHashValue("Ftrgt", 0.1, func(val) { obj["F_target"].setTranslation(0, val * -6.6); }), - props.UpdateManager.FromHashValue("Strgt", 0.5, func(val) { + props.UpdateManager.FromHashValue("Strgt", 0.1, func(val) { obj["S_target"].setTranslation(0, val * -6.6); }), props.UpdateManager.FromHashList(["speedError","fac1","fac2","flapsInput","SPDstrgtdiff","SPDftrgtdiff","SPDcleantrgtdiff","agl"], 0.5, func(val) { @@ -951,19 +949,19 @@ var canvas_pfd = { obj["ALPHA_SW"].hide(); } }), - props.UpdateManager.FromHashValue("ALPHAprot", 0.5, func(val) { + props.UpdateManager.FromHashValue("ALPHAprot", 0.1, func(val) { obj["ALPHA_PROT"].setTranslation(0, val * -6.6); }), - props.UpdateManager.FromHashValue("ALPHAmax", 0.5, func(val) { + props.UpdateManager.FromHashValue("ALPHAmax", 0.1, func(val) { obj["ALPHA_MAX"].setTranslation(0, val * -6.6); }), - props.UpdateManager.FromHashValue("ALPHAvsw", 0.5, func(val) { + props.UpdateManager.FromHashValue("ALPHAvsw", 0.1, func(val) { obj["ALPHA_SW"].setTranslation(0, val * -6.6); }), - props.UpdateManager.FromHashValue("VLSmin", 0.5, func(val) { + props.UpdateManager.FromHashValue("VLSmin", 0.1, func(val) { obj["VLS_min"].setTranslation(0, val * -6.6); }), - props.UpdateManager.FromHashValue("ASItrgt", 0.5, func(val) { + props.UpdateManager.FromHashValue("ASItrgt", 0.1, func(val) { obj["ASI_target"].setTranslation(0, val * -6.6); }), props.UpdateManager.FromHashList(["speedError","ASItrgtdiff","targetMach","tgt_kts","ktsMach"], 0.5, func(val) { From 2b27c7d483f9106b250db3be9210061ee7c66743 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Fri, 29 Apr 2022 21:06:45 +0100 Subject: [PATCH 23/33] Synchronize the heading scale with the target scale --- Models/Instruments/PFD/PFD.nas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index e3e34f4c..e495db34 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -665,7 +665,7 @@ var canvas_pfd = { obj["HDG_digit_L"].setText(sprintf("%3.0f", val)); obj["HDG_digit_R"].setText(sprintf("%3.0f", val)); }), - props.UpdateManager.FromHashValue("hdgDiff", 0.1, func(val) { + props.UpdateManager.FromHashValue("hdgDiff", 0.025, func(val) { obj["HDG_target"].setTranslation((val / 10) * 98.5416, 0); }), props.UpdateManager.FromHashList(["hdgDiff","showHdg"], 0.01, func(val) { From cf9a657195349c980e8f4a49058fd2cffa5cc0ac Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Sat, 30 Apr 2022 13:14:13 +0100 Subject: [PATCH 24/33] IESI - revise power so that it also uses Emesary --- A320-main.xml | 4 + Models/Instruments/IESI/IESI.nas | 305 ++++++++++++++++++------------- Models/Instruments/PFD/PFD.nas | 22 +-- Nasal/FMGC/FMGC-c.nas | 12 +- Systems/a320-misc.xml | 1 + 5 files changed, 203 insertions(+), 141 deletions(-) diff --git a/A320-main.xml b/A320-main.xml index 4248d265..983e4fd8 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -1758,7 +1758,11 @@ + false false + + false + diff --git a/Models/Instruments/IESI/IESI.nas b/Models/Instruments/IESI/IESI.nas index 7277fe89..67ca58c6 100644 --- a/Models/Instruments/IESI/IESI.nas +++ b/Models/Instruments/IESI/IESI.nas @@ -4,7 +4,6 @@ # props.nas nodes var iesi_init = props.globals.initNode("/instrumentation/iesi/iesi-init", 0, "BOOL"); -var iesi_reset = props.globals.initNode("/instrumentation/iesi/att-reset", 0, "DOUBLE"); var pinPrograms = { metricAltitude: 1, @@ -29,6 +28,7 @@ var canvas_IESI = { }; canvas.parsesvg(obj.group, svg, {"font-mapper": obj.font_mapper} ); + foreach(var key; obj.getKeys()) { obj[key] = obj.group.getElementById(key); @@ -46,20 +46,28 @@ var canvas_IESI = { obj[key].set("clip-frame", canvas.Element.PARENT); } }; + obj.AI_horizon_trans = obj["AI_horizon"].createTransform(); obj.AI_horizon_rot = obj["AI_horizon"].createTransform(); obj._aiCenter = obj["AI_center"].getCenter(); + obj._cachedInhg = -999; + obj._cachedMetric = pinPrograms.metricAltitude; obj._cachedMode = nil; + obj._cachedShowInhg = pinPrograms.showInHg; obj._canReset = 0; obj._excessMotionInInit = 0; obj._fastInit = 0; obj._IESITime = 0; obj._isNegativeAlt = 0; obj._middleAltOffset = nil; - obj._powerResult = 0; - obj._roll = 0; + obj.iesiInAlign = 0; + + + obj["IESI"].hide(); + obj["IESI_Init"].show(); + obj["ATTflag"].hide(); obj.update_items = [ props.UpdateManager.FromHashValue("airspeed", 0.1, func(val) { @@ -78,6 +86,7 @@ var canvas_IESI = { obj.altOffset = (val / 500) - int(val / 500); obj.middleAltText = roundaboutAlt(val / 100); + if (obj.altOffset > 0.5) { obj._middleAltOffset = -(obj.altOffset - 1) * 258.5528; } else { @@ -86,6 +95,7 @@ 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))); @@ -93,8 +103,8 @@ var canvas_IESI = { obj["ALT_one"].setText(sprintf("%03d", abs(obj.middleAltText - 10))); obj["ALT_meters"].setText(sprintf("%5.0f", math.round(val * 0.3048, 10))); - obj.altTens = num(right(sprintf("%02d", val), 2)); - obj["ALT_tens"].setTranslation(0, obj.altTens * 3.16); + + obj["ALT_tens"].setTranslation(0, num(right(sprintf("%02d", val), 2)) * 3.16); }), props.UpdateManager.FromHashValue("altitude_ind", 0.5, func(val) { obj["ALT_digits"].setText(sprintf("%s", math.clamp(val, -20, 500))); @@ -111,16 +121,15 @@ var canvas_IESI = { props.UpdateManager.FromHashValue("mach", 0.001, func(val) { obj["ASI_mach"].setText(sprintf("%2.0f", math.clamp(val * 100, 0, 99))); }), - props.UpdateManager.FromHashValue("pitch", 0.025, func(val) { + props.UpdateManager.FromHashValue("iesiPitch", 0.025, func(val) { obj.AI_horizon_trans.setTranslation(0, val * 16.74); }), props.UpdateManager.FromHashValue("roll", 0.025, func(val) { - obj._roll = -val * D2R; - obj.AI_horizon_rot.setRotation(obj._roll, obj._aiCenter); - obj["AI_bank"].setRotation(obj._roll); + obj.AI_horizon_rot.setRotation(-val * D2R, obj._aiCenter); + obj["AI_bank"].setRotation(-val * D2R); }), props.UpdateManager.FromHashValue("skid", 0.1, func(val) { - if (abs(val) >= 84.99) { + if (abs(val) >= 85) { obj["AI_slipskid"].hide(); } else { obj["AI_slipskid"].setTranslation(-val, 0); @@ -128,112 +137,172 @@ var canvas_IESI = { } }), ]; + + obj.update_items_init = [ + props.UpdateManager.FromHashList(["iesiAlignTime","elapsedTime"], 0.5, func(val) { + if (val.iesiAlignTime + 90 >= val.elapsedTime) { + obj.iesiInAlign = 1; + } else { + obj.iesiInAlign = 0; + } + }), + props.UpdateManager.FromHashList(["iesiInAlign","iesiFastInit","irAlignFault"], 1, func(val) { + if (val.iesiInAlign) { + if (!val.iesiFastInit and val.irAlignFault) { + obj._excessMotionInInit = 1; + } + } + }), + props.UpdateManager.FromHashList(["iesiExcessMotion","iesiFastInit","iesiInAlign"], 1, func(val) { + if (val.iesiInAlign) { + if (val.iesiFastInit) { + obj["IESI"].show(); + obj["IESI_Init"].hide(); + obj["AI_bank"].hide(); + obj["AI_bank_center"].hide(); + obj["AI_bank_scale"].hide(); + obj["AI_horizon"].hide(); + obj["AI_sky_bank"].hide(); + obj["ATTflag_text"].setText("ATT 10s"); + obj["ATTflag_text"].setColor(0,0,0); + obj["ATTflag_rect"].setScale(1.5,1); + obj["ATTflag_rect"].setTranslation(-250,0); + obj["ATTflag_rect"].setColorFill(1,1,0); + obj["ATTflag_rect"].setColor(1,1,0); + obj["ATTflag"].show(); + obj["attRst"].hide(); + obj["attRstRect"].hide(); + } else { + obj["IESI"].hide(); + obj["IESI_Init"].show(); + obj["ATTflag"].hide(); + } + } else { + if (!val.iesiExcessMotion) { + obj["IESI_Init"].hide(); + obj["IESI"].show(); + obj["AI_bank"].show(); + obj["AI_bank_center"].show(); + obj["AI_bank_scale"].show(); + obj["AI_index"].show(); + obj["AI_horizon"].show(); + obj["AI_sky_bank"].show(); + obj["ATTflag"].hide(); + } else { + obj["IESI_Init"].hide(); + obj["IESI"].show(); + obj["AI_bank"].hide(); + obj["AI_bank_center"].hide(); + obj["AI_bank_scale"].hide(); + obj["AI_horizon"].hide(); + obj["AI_sky_bank"].hide(); + obj["ATTflag_text"].setText("ATT"); + obj["ATTflag_text"].setColor(1,0,0); + obj["ATTflag_rect"].setScale(1,1); + obj["ATTflag_rect"].setTranslation(0,0); + obj["ATTflag_rect"].setColorFill(0,0,0); + obj["ATTflag_rect"].setColor(0,0,0); + obj["ATTflag"].show(); + obj["attRst"].show(); + obj["attRstRect"].show(); + } + } + }), + ]; + + obj.update_items_power = [ + props.UpdateManager.FromHashList(["iesiPowered","iesiBrt"], 0.005, func(val) { + if (val.iesiPowered and val.iesiBrt > 0.01) { + obj.group.setVisible(1); + } else { + obj.group.setVisible(0); + } + }), + props.UpdateManager.FromHashList(["iesiPowered","acconfig","iesiInit"], 1, func(val) { + if (val.iesiPowered) { + if (val.iesiInit) return; + obj.initIESI(val.acconfig); + } elsif (val.iesiInit) { + obj._canReset = 0; + obj._excessMotionInInit = 0; + obj._fastInit = 0; + iesi_init.setBoolValue(0); + } + }), + ]; return obj; - }, + }, getKeys: func() { return ["IESI","IESI_Init","attRst","attRstRect","att90s","ATTflag","ATTflag_rect","ATTflag_text","ALTwarn","SPDwarn","ASI_scale","ASI_mach","ASI_mach_decimal","AI_center","AI_index","AI_horizon","AI_sky_bank","AI_bank","AI_bank_center","AI_slipskid","ALT_scale","ALT_one","ALT_two","ALT_three","ALT_four","ALT_five","ALT_digits","ALT_tens","ALT_meters","QNH_setting","QNH_std","negText","negText2","AI_bank_scale","metricM","metricBox"]; }, - alignFault: props.globals.getNode("/systems/navigation/align-fault"), update: func(notification) { - me._powerResult = me.updatePower(notification); - if (me._powerResult == 0) { return; } + me.updatePower(notification); - if (math.abs(notification.qnh_inhg - me._cachedInhg) > 0.005 or notification.altimeter_mode != me._cachedMode) { - me._cachedInhg = notification.qnh_inhg; - me._cachedMode = notification.altimeter_mode; + foreach(var update_item; me.update_items_power) + { + update_item.update(notification); + } + + if (!me.group.getVisible()) { return; } + + notification.iesiAlignTime = me._IESITime; + notification.iesiExcessMotion = me._excessMotionInInit; + notification.iesiFastInit = me._fastInit; + notification.iesiInAlign = me.iesiInAlign; + + foreach(var update_item; me.update_items_init) + { + update_item.update(notification); + } + + if (math.abs(notification.qnh_inhg_iesi - me._cachedInhg) > 0.005 or notification.altimeter_mode_iesi != me._cachedMode or pinPrograms.showInHg != me._cachedShowInhg) { + me._cachedInhg = notification.qnh_inhg_iesi; + me._cachedMode = notification.altimeter_mode_iesi; + me._cachedShowInhg = pinPrograms.showInHg; me.updateQNH(notification); } - if (me._IESITime + 90 >= notification.elapsedTime) { - if (!me._fastInit and me.alignFault.getBoolValue()) { - me._excessMotionInInit = 1; - } - - if (me._fastInit) { - me["IESI"].show(); - me["IESI_Init"].hide(); - me["AI_bank"].hide(); - me["AI_bank_center"].hide(); - me["AI_bank_scale"].hide(); - me["AI_horizon"].hide(); - me["AI_sky_bank"].hide(); - me["ATTflag_text"].setText("ATT 10s"); - me["ATTflag_text"].setColor(0,0,0); - me["ATTflag_rect"].setScale(1.5,1); - me["ATTflag_rect"].setTranslation(-250,0); - me["ATTflag_rect"].setColorFill(1,1,0); - me["ATTflag_rect"].setColor(1,1,0); - me["ATTflag"].show(); - me["attRst"].hide(); - me["attRstRect"].hide(); - } else { - me["IESI"].hide(); - me["IESI_Init"].show(); - me["ATTflag"].hide(); - return; - } - } else { - if (pinPrograms.metricAltitude) { - me["ALT_meters"].show(); - me["metricM"].show(); - me["metricBox"].show(); - - if (me._isNegativeAlt) { - me["negText2"].show(); - } else { - me["negText2"].hide(); - } - } else { - me["ALT_meters"].hide(); - me["metricM"].hide(); - me["metricBox"].hide(); - me["negText2"].hide(); - } - - if (!me._excessMotionInInit) { - me["IESI_Init"].hide(); - me["IESI"].show(); - me["AI_bank"].show(); - me["AI_bank_center"].show(); - me["AI_bank_scale"].show(); - me["AI_index"].show(); - me["AI_horizon"].show(); - me["AI_sky_bank"].show(); - me["ATTflag"].hide(); - } else { - me["IESI_Init"].hide(); - me["IESI"].show(); - me["AI_bank"].hide(); - me["AI_bank_center"].hide(); - me["AI_bank_scale"].hide(); - me["AI_horizon"].hide(); - me["AI_sky_bank"].hide(); - me["ATTflag_text"].setText("ATT"); - me["ATTflag_text"].setColor(1,0,0); - me["ATTflag_rect"].setScale(1,1); - me["ATTflag_rect"].setTranslation(0,0); - me["ATTflag_rect"].setColorFill(0,0,0); - me["ATTflag_rect"].setColor(0,0,0); - me["ATTflag"].show(); - me["attRst"].show(); - me["attRstRect"].show(); - } - } + if (me.iesiInAlign and !me._fastInit) return; foreach(var update_item; me.update_items) { update_item.update(notification); } + + if (!me.iesiInAlign and pinPrograms.metricAltitude != me._cachedMetric) { + me._cachedMetric = pinPrograms.metricAltitude; + me.updateMetric(pinPrograms.metricAltitude); + } + + if (pinPrograms.metricAltitude) { + if (me._isNegativeAlt) { + me["negText2"].show(); + } else { + me["negText2"].hide(); + } + } + }, + updateMetric: func(val) { + if (val) { + me["ALT_meters"].show(); + me["metricM"].show(); + me["metricBox"].show(); + } else { + me["ALT_meters"].hide(); + me["metricM"].hide(); + me["metricBox"].hide(); + me["negText2"].hide(); + } }, updateQNH: func(notification) { - if (notification.altimeter_mode) { + if (notification.altimeter_mode_iesi) { me["QNH_setting"].hide(); me["QNH_std"].show(); } else { if (pinPrograms.showInHg) { - me["QNH_setting"].setText(sprintf("%4.0f", notification.qnh_hpa) ~ "/" ~ sprintf("%2.2f", notification.qnh_inhg)); + me["QNH_setting"].setText(sprintf("%4.0f", notification.qnh_hpa_iesi) ~ "/" ~ sprintf("%2.2f", notification.qnh_inhg_iesi)); } else { - me["QNH_setting"].setText(sprintf("%4.0f", notification.qnh_hpa)); + me["QNH_setting"].setText(sprintf("%4.0f", notification.qnh_hpa_iesi)); } me["QNH_std"].hide(); me["QNH_setting"].show(); @@ -248,28 +317,13 @@ var canvas_IESI = { } else if (me._IESITime + 90 < notification.elapsedTime and notification.iesiInit and !me._canReset) { me._canReset = 1; } - - if (notification.iesiPowered) { - if (notification.acconfig != 1 and notification.iesiInit != 1) { - iesi_init.setBoolValue(1); - me._IESITime = notification.elapsedTime - (me._fastInit ? 80 : 0); - } else if (notification.acconfig == 1 and notification.iesiInit != 1) { - iesi_init.setBoolValue(1); - me._IESITime = notification.elapsedTime - 87; - } - } elsif (notification.iesiInit) { - me._canReset = 0; - me._excessMotionInInit = 0; - me._fastInit = 0; - iesi_init.setBoolValue(0); - } - - if (notification.iesiPowered and notification.iesiBrt > 0.01) { - me.group.setVisible(1); - return 1; + }, + initIESI: func(acconfig) { + iesi_init.setBoolValue(1); + if (!acconfig) { + me._IESITime = pts.Sim.Time.elapsedSec.getValue() - (me._fastInit ? 80 : 0); } else { - me.group.setVisible(0); - return 0; + me._IESITime = pts.Sim.Time.elapsedSec.getValue() - 87; } }, }; @@ -302,40 +356,41 @@ var IESIRecipient = var A320IESI = IESIRecipient.new("A320 IESI"); 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", - "altimeter_mode": "/instrumentation/altimeter[6]/std", + "altimeter_mode_iesi": "/instrumentation/altimeter[6]/std", "attReset": "/instrumentation/iesi/att-reset", "iesiBrt": "/controls/lighting/DU/iesi", "iesiInit": "/instrumentation/iesi/iesi-init", + "iesiPitch": "/instrumentation/iesi/pitch-deg", "iesiPowered": "/instrumentation/iesi/power/power-on", + "irAlignFault": "/systems/navigation/align-fault", "mach": "/instrumentation/airspeed-indicator/indicated-mach", - "pitch": "/instrumentation/iesi/pitch-deg", - "qnh_hpa": "/instrumentation/altimeter[6]/setting-hpa", - "qnh_inhg": "/instrumentation/altimeter[6]/setting-inhg", + "qnh_hpa_iesi": "/instrumentation/altimeter[6]/setting-hpa", + "qnh_inhg_iesi": "/instrumentation/altimeter[6]/setting-inhg", "roll": "/orientation/roll-deg", - "skid": "/instrumentation/iesi/slip-skid", "showMach": "/instrumentation/iesi/display/show-mach", + "skid": "/instrumentation/iesi/slip-skid", }; foreach (var name; keys(input)) { emesary.GlobalTransmitter.NotifyAll(notifications.FrameNotificationAddProperty.new("A320 IESI", name, input[name])); } +# Helper functions var showIESI = func { var dlg = canvas.Window.new([512, 512], "dialog").set("resize", 1); dlg.setCanvas(A320IESI.MainScreen.canvas); } var roundabout = func(x) { - var y = x - int(x); - return y < 0.5 ? int(x) : 1 + int(x); + return (x - int(x)) < 0.5 ? int(x) : 1 + int(x); }; var roundaboutAlt = func(x) { - var y = x * 0.2 - int(x * 0.2); - return y < 0.5 ? 5 * int(x * 0.2) : 5 + 5 * int(x * 0.2); + return (x * 0.2 - int(x * 0.2)) < 0.5 ? 5 * int(x * 0.2) : 5 + 5 * int(x * 0.2); }; \ No newline at end of file diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index e495db34..053d7b99 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -16,7 +16,6 @@ var alt_inhg = props.globals.getNode("/instrumentation/altimeter/setting-inhg", var aoa_1 = props.globals.getNode("/systems/navigation/adr/output/aoa-1", 1); var aoa_2 = props.globals.getNode("/systems/navigation/adr/output/aoa-2", 1); var aoa_3 = props.globals.getNode("/systems/navigation/adr/output/aoa-3", 1); -var elapsedtime = props.globals.getNode("/sim/time/elapsed-sec", 1); var hundredAbove = props.globals.getNode("/instrumentation/pfd/hundred-above", 1); var minimum = props.globals.getNode("/instrumentation/pfd/minimums", 1); @@ -26,6 +25,7 @@ var amberFlash = [0, 0]; var dhFlash = 0; var ilsFlash = [0,0]; var qnhFlash = [0,0]; +var elapsedtime_act = nil; var du1_test = props.globals.initNode("/instrumentation/du/du1-test", 0, "BOOL"); var du1_test_time = props.globals.initNode("/instrumentation/du/du1-test-time", 0.0, "DOUBLE"); var du1_offtime = props.globals.initNode("/instrumentation/du/du1-off-time", 0.0, "DOUBLE"); @@ -876,7 +876,7 @@ var canvas_pfd = { obj["flap_max"].hide(); } }), - props.UpdateManager.FromHashValue("Ctrgt", , 0.1, func(val) { + props.UpdateManager.FromHashValue("Ctrgt", 0.1, func(val) { obj["clean_speed"].setTranslation(0, val * -6.6); }), props.UpdateManager.FromHashValue("Ftrgt", 0.1, func(val) { @@ -1995,7 +1995,7 @@ var canvas_pfd = { me.testTimeNode = du1_test_time; } - var elapsedtime_act = elapsedtime.getValue(); + elapsedtime_act = pts.Sim.Time.elapsedSec.getValue(); if (me.powerNode.getValue() >= 110) { if (!me.on) { if (me.offTimeNode.getValue() + 3 < elapsedtime_act) { @@ -2245,20 +2245,19 @@ setlistener("/systems/electrical/bus/ac-2", func() { }, 0, 0); # Helper Functions - var roundabout = func(x) { - var y = x - int(x); - return y < 0.5 ? int(x) : 1 + int(x); + return (x - int(x)) < 0.5 ? int(x) : 1 + int(x); }; var roundaboutAlt = func(x) { - var y = x * 0.2 - int(x * 0.2); - return y < 0.5 ? 5 * int(x * 0.2) : 5 + 5 * int(x * 0.2); + return (x * 0.2 - int(x * 0.2)) < 0.5 ? 5 * int(x * 0.2) : 5 + 5 * int(x * 0.2); }; +var _fontSizeHDGTempVar = nil; + var fontSizeHDG = func(input) { - var test = input / 3; - if (test == int(test)) { + _fontSizeHDGTempVar = input / 3; + if (_fontSizeHDGTempVar == int(_fontSizeHDGTempVar)) { return 42; } else { return 32; @@ -2274,6 +2273,7 @@ var showPFD2 = func { var dlg = canvas.Window.new([512, 512], "dialog").set("resize", 1); dlg.setCanvas(A320PFD2.MainScreen.canvas); } + # Flash managers var ils_going1 = 0; var ilsTimer1 = maketimer(0.50, func { @@ -2380,4 +2380,4 @@ setlistener("/modes/pfd/fma/pitch-mode", func(pitch) { } else { autoland_pitch_land.setBoolValue(0); } -},0,0); +}, 0, 0); diff --git a/Nasal/FMGC/FMGC-c.nas b/Nasal/FMGC/FMGC-c.nas index b918532f..df839956 100644 --- a/Nasal/FMGC/FMGC-c.nas +++ b/Nasal/FMGC/FMGC-c.nas @@ -554,21 +554,23 @@ var fmaAthr = func { } } +var elapsedTimeBoxes = nil; var showAllBoxes = func { + elapsedTimeBoxes = pts.Sim.Time.elapsedSec.getValue(); if (Modes.PFD.FMA.rollMode.getValue() != " ") { - Modes.PFD.FMA.rollModeTime.setValue(pts.Sim.Time.elapsedSec.getValue()); + Modes.PFD.FMA.rollModeTime.setValue(elapsedTimeBoxes); } if (Modes.PFD.FMA.pitchMode.getValue() != " ") { - Modes.PFD.FMA.pitchModeTime.setValue(pts.Sim.Time.elapsedSec.getValue()); + Modes.PFD.FMA.pitchModeTime.setValue(elapsedTimeBoxes); } if (Modes.PFD.FMA.rollModeArmed.getValue() != " ") { - Modes.PFD.FMA.rollModeArmedTime.setValue(pts.Sim.Time.elapsedSec.getValue()); + Modes.PFD.FMA.rollModeArmedTime.setValue(elapsedTimeBoxes); } if (Modes.PFD.FMA.pitchModeArmed.getValue() != " ") { - Modes.PFD.FMA.pitchModeArmedTime.setValue(pts.Sim.Time.elapsedSec.getValue()); + Modes.PFD.FMA.pitchModeArmedTime.setValue(elapsedTimeBoxes); } if (Modes.PFD.FMA.pitchMode2Armed.getValue() != " ") { - Modes.PFD.FMA.pitchMode2ArmedTime.setValue(pts.Sim.Time.elapsedSec.getValue()); + Modes.PFD.FMA.pitchMode2ArmedTime.setValue(elapsedTimeBoxes); } } diff --git a/Systems/a320-misc.xml b/Systems/a320-misc.xml index fa8d5edd..31696c72 100644 --- a/Systems/a320-misc.xml +++ b/Systems/a320-misc.xml @@ -571,6 +571,7 @@ 4 /controls/lighting/DU/iesi + /instrumentation/iesi/power/power-on From c845cda5af3be8d76bce45bdd6af0137df993fe6 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Sat, 30 Apr 2022 13:17:25 +0100 Subject: [PATCH 25/33] 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(); From e89d1250be0e7de9011276c991dca84f9a152be4 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Sat, 30 Apr 2022 15:01:02 +0100 Subject: [PATCH 26/33] Align fault - fix to use absolute value of speed --- Systems/a320-adr.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Systems/a320-adr.xml b/Systems/a320-adr.xml index 02baba04..307bc125 100644 --- a/Systems/a320-adr.xml +++ b/Systems/a320-adr.xml @@ -27,6 +27,8 @@ velocities/r-aero-deg_sec_filter ge 2 velocities/v-north-fps_filter ge 0.5 velocities/v-east-fps_filter ge 0.5 + velocities/v-north-fps_filter le -0.5 + velocities/v-east-fps_filter le -0.5 From a6770fe3e26c24b0453fe2ee9e47591a0577f7b3 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Sat, 30 Apr 2022 16:52:58 +0100 Subject: [PATCH 27/33] Begin to rewrite lower ECAM power --- .../Instruments/Lower-ECAM/Lower-ECAM-APU.nas | 59 ++++++------ .../Lower-ECAM/Lower-ECAM-base.nas | 3 +- Models/Instruments/Lower-ECAM/Lower-ECAM.nas | 5 + Systems/a320-misc.xml | 94 +++++++++++++++++-- 4 files changed, 118 insertions(+), 43 deletions(-) diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-APU.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-APU.nas index 66c29724..62df0b79 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-APU.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-APU.nas @@ -194,6 +194,25 @@ var canvas_lowerECAMPageApu = }), ]; + obj.updateItemsPower = [ + props.UpdateManager.FromHashList(["du3Power","du4Power","du3InTest","du4InTest","ecamDuXfr","pageMatch"], 1, func(val) { + if (val.pageMatch) { + if (val.du4Power) { + obj.group.setVisible(val.du4InTest ? 0 : 1); + obj.test.setVisible(val.du4InTest ? 1 : 0); + } else if (val.ecamDuXfr and val.du3Power) { + obj.group.setVisible(val.du3InTest ? 0 : 1); + obj.test.setVisible(val.du3InTest ? 1 : 0); + } else { + obj.group.setVisible(0); + obj.test.setVisible(0); + } + } else { + obj.group.setVisible(0); + } + }), + ]; + obj.updateItemsBottom = [ props.UpdateManager.FromHashValue("acconfigUnits", nil, func(val) { obj.units = val; @@ -269,7 +288,7 @@ var canvas_lowerECAMPageApu = } }, update: func(notification) { - me.updatePower(); + me.updatePower(notification); if (me.test.getVisible() == 1) { me.updateTest(notification); @@ -312,38 +331,16 @@ var canvas_lowerECAMPageApu = me.updateBottom(notification); }, - updatePower: func() { + updatePower: func(notification) { if (me.name == ecam.SystemDisplayController.displayedPage.name) { - if (du4_lgt.getValue() > 0.01 and systems.ELEC.Bus.ac2.getValue() >= 110) { - if (du4_test_time.getValue() + du4_test_amount.getValue() >= pts.Sim.Time.elapsedSec.getValue()) { - me.group.setVisible(0); - me.test.setVisible(1); - } else { - me.group.setVisible(1); - me.test.setVisible(0); - } - } else { - if (pts.Modes.EcamDuXfr.getBoolValue()) { - if (du3_lgt.getValue() > 0.01 and systems.ELEC.Bus.acEss.getValue() >= 110) { - if (du3_test_time.getValue() + du3_test_amount.getValue() >= pts.Sim.Time.elapsedSec.getValue()) { - me.group.setVisible(0); - me.test.setVisible(1); - } else { - me.group.setVisible(1); - me.test.setVisible(0); - } - } else { - me.group.setVisible(0); - me.test.setVisible(0); - } - } else { - me.group.setVisible(0); - me.test.setVisible(0); - } - } + notification.pageMatch = 1; } else { - me.group.setVisible(0); - # don't hide the test group; just let whichever page is active control it + notification.pageMatch = 0; + } + + foreach(var update_item; me.updateItemsPower) + { + update_item.update(notification); } }, }; diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-base.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-base.nas index 98e9260d..3e23d36b 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-base.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-base.nas @@ -73,8 +73,7 @@ var canvas_lowerECAM_base = } }, # Due to weirdness of the parents hash / me reference - # you need to access it using me.Test_white rather than - # me["Test_white"] + # you need to access it using me.Test_white updateTest: func(notification) { if (du4_test_time.getValue() + 1 >= notification.elapsedTime) { me.Test_white.show(); diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas index 02c0bc3f..e228ca74 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas @@ -61,6 +61,11 @@ var input = { gForceDisplay: "/ECAM/Lower/g-force-display", hour: "/sim/time/utc/hour", minute: "/sim/time/utc/minute", + du3Power: "/instrumentation/displays/du3/power-on", + du4Power: "/instrumentation/displays/du4/power-on", + du3InTest: "/instrumentation/displays/du3/test-active", + du4InTest: "/instrumentation/displays/du4/test-active", + ecamDuXfr: "/modes/ecam-du-xfr", }; foreach (var name; keys(input)) { diff --git a/Systems/a320-misc.xml b/Systems/a320-misc.xml index 31696c72..f3526b79 100644 --- a/Systems/a320-misc.xml +++ b/Systems/a320-misc.xml @@ -29,16 +29,6 @@ - - - - /instrumentation/iesi/att-reset-cmd - 0.5 - 100 - - - - @@ -526,6 +516,12 @@ + + /instrumentation/iesi/att-reset-cmd + 0.5 + 100 + + @@ -579,4 +575,82 @@ + + + + + + /systems/electrical/bus/ac-ess ge 110 + /controls/lighting/DU/du3 ge 0.01 + + + + + /instrumentation/displays/du3/power-command + 5 + 100 + + + + + + /instrumentation/displays/du3/power-transient-timer ne 0 + + + + + + + /instrumentation/du/du3-test-amount + /instrumentation/du/du3-test-time + + + + + + + + /instrumentation/displays/du3/test-sum ge /sim/time/elapsed-sec + + + + + + + /systems/electrical/bus/ac-2 ge 110 + /controls/lighting/DU/du4 ge 0.01 + + + + + /instrumentation/displays/du4/power-command + 5 + 100 + + + + + + /instrumentation/displays/du4/power-transient-timer ne 0 + + + + + + + /instrumentation/du/du4-test-amount + /instrumentation/du/du4-test-time + + + + + + + + /instrumentation/displays/du4/test-sum ge /sim/time/elapsed-sec + + + + + From 12e7258f2353f69a5a572ac94ad59f5658db11d8 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Tue, 3 May 2022 15:22:49 +0100 Subject: [PATCH 28/33] Correct the ILS course indication --- Models/Instruments/PFD/PFD.nas | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index f9b22f31..7e8f7333 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -61,7 +61,6 @@ var canvas_pfd = { rightText3: 0, track_diff: 0, split_ils: 0, - magnetic_hdg: 0, magnetic_hdg_dif: 0, alt_diff_cur: 0, new: func(svg, name, number) { @@ -129,7 +128,6 @@ var canvas_pfd = { obj.rightText3 = 0; obj.track_diff = 0; obj.split_ils = 0; - obj.magnetic_hdg = 0; obj.magnetic_hdg_dif = 0; obj.alt_diff_cur = 0; @@ -1914,7 +1912,7 @@ var canvas_pfd = { if (((me.number == 0 and notification.pfdILS1) or (me.number == 1 and notification.pfdILS2)) and size(me.split_ils) == 2) { notification.showPFDILS = 1; - notification.magnetic_hdg_dif = geo.normdeg180(me.magnetic_hdg - notification.headingPFD); + notification.magnetic_hdg_dif = geo.normdeg180(notification.ilsCrs - notification.headingPFD); } else { notification.showPFDILS = 0; notification.magnetic_hdg_dif = 0; From 6aac392eeccf154bc9053a9f8c950ddee3dce499 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Tue, 3 May 2022 16:19:17 +0100 Subject: [PATCH 29/33] PFD: fix bugs --- Models/Instruments/PFD/PFD.nas | 69 ++++++++++++++++-------------- Models/Instruments/PFD/res/pfd.svg | 23 +++++----- 2 files changed, 49 insertions(+), 43 deletions(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 7e8f7333..aeb5a6d1 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -234,10 +234,10 @@ var canvas_pfd = { obj["VS_box"].show(); } }), - props.UpdateManager.FromHashValue("localizer", 0.01, func(val) { + props.UpdateManager.FromHashValue("localizer", 0.0025, func(val) { obj["LOC_pointer"].setTranslation(val * 197, 0); }), - props.UpdateManager.FromHashValue("glideslope", 0.01, func(val) { + props.UpdateManager.FromHashValue("glideslope", 0.0025, func(val) { obj["GS_pointer"].setTranslation(0, val * -197); }), props.UpdateManager.FromHashList(["athr", "thrustLvrClb"], 1, func(val) { @@ -331,7 +331,7 @@ var canvas_pfd = { } }), props.UpdateManager.FromHashList(["apBox","apMode"], nil, func(val) { - obj["FMA_athr"].setText(val.apMode); + obj["FMA_ap"].setText(val.apMode); if (val.apBox and val.apMode != " ") { obj["FMA_ap_box"].show(); } else { @@ -692,7 +692,7 @@ var canvas_pfd = { obj["QNH_setting"].setText(sprintf("%2.2f", val.altimeterInhg)); } }), - props.UpdateManager.FromHashList(["altimeterStd","altitudeAutopilot"], 25, func(val) { + props.UpdateManager.FromHashList(["altimeterStd","altitudeAutopilot"], 1, func(val) { if (val.altimeterStd == 1) { if (val.altitudeAutopilot < 10000) { obj["ALT_digit_UP"].setText(sprintf("%s", "FL " ~ val.altitudeAutopilot / 100)); @@ -1219,36 +1219,42 @@ var canvas_pfd = { obj["Metric_cur_alt"].hide(); } }), - props.UpdateManager.FromHashValue("altitudePFD", 0.5, func(val) { - obj["Metric_cur_alt"].setText(sprintf("%5.0f", val * 0.3048)); - - 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["ALT_neg"].show(); + props.UpdateManager.FromHashList(["altitudePFD","altError"], 0.5, func(val) { + if (!val.altError) { + obj["Metric_cur_alt"].setText(sprintf("%5.0f", val.altitudePFD * 0.3048)); + + obj.middleAltText = roundaboutAlt(val.altitudePFD / 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.altitudePFD < 0) { + obj["ALT_neg"].show(); + } else { + obj["ALT_neg"].hide(); + } } else { obj["ALT_neg"].hide(); } }), - props.UpdateManager.FromHashValue("altitudePFD", 0.1, func(val) { - obj.altOffset = val / 500 - int(val / 500); - obj.middleAltOffset = nil; - - if (obj.altOffset > 0.5) { - obj.middleAltOffset = -(obj.altOffset - 1) * 243.3424; - } else { - obj.middleAltOffset = -obj.altOffset * 243.3424; + props.UpdateManager.FromHashList(["altitudePFD","altError"], 0.1, func(val) { + if (!val.altError) { + obj.altOffset = val / 500 - int(val.altitudePFD / 500); + obj.middleAltOffset = nil; + + if (obj.altOffset > 0.5) { + obj.middleAltOffset = -(obj.altOffset - 1) * 243.3424; + } else { + obj.middleAltOffset = -obj.altOffset * 243.3424; + } + + obj["ALT_scale"].setTranslation(0, -obj.middleAltOffset); + obj["ALT_scale"].update(); + obj["ALT_tens"].setTranslation(0, num(right(sprintf("%02d", val.altitudePFD), 2)) * 1.392); } - - obj["ALT_scale"].setTranslation(0, -obj.middleAltOffset); - obj["ALT_scale"].update(); - obj["ALT_tens"].setTranslation(0, num(right(sprintf("%02d", val), 2)) * 1.392); }), props.UpdateManager.FromHashValue("altitudeDigits", 1, func(val) { obj["ALT_digits"].setText(sprintf("%d", val)); @@ -1695,6 +1701,7 @@ var canvas_pfd = { alt_going2 = 0; amber_going2 = 0; } + me["ALT_box"].show(); me["ALT_box_flash"].hide(); me["ALT_box_amber"].hide(); } else { @@ -2073,14 +2080,14 @@ var canvas_pfd = { getAOAForPFD1: func() { if (air_data_switch.getValue() != -1 and adr_1_switch.getValue() and !adr_1_fault.getValue()) return aoa_1.getValue(); if (air_data_switch.getValue() == -1 and adr_3_switch.getValue() and !adr_3_fault.getValue()) return aoa_3.getValue(); - return nil; + return 0; }, # Get Angle of Attack from ADR2 or, depending on Switching panel, ADR3 getAOAForPFD2: func() { if (air_data_switch.getValue() != 1 and adr_2_switch.getValue() and !adr_2_fault.getValue()) return aoa_2.getValue(); if (air_data_switch.getValue() == 1 and adr_3_switch.getValue() and !adr_3_fault.getValue()) return aoa_3.getValue(); - return nil; + return 0; }, # Convert difference between magnetic heading and track measured in degrees to pixel for display on PFDs diff --git a/Models/Instruments/PFD/res/pfd.svg b/Models/Instruments/PFD/res/pfd.svg index 94fe82fd..215a66e5 100644 --- a/Models/Instruments/PFD/res/pfd.svg +++ b/Models/Instruments/PFD/res/pfd.svg @@ -22,7 +22,6 @@ image/svg+xml - @@ -37,13 +36,13 @@ units="pt" inkscape:snap-global="false" showguides="true" - inkscape:current-layer="ALT_group" + inkscape:current-layer="svg2" inkscape:window-maximized="1" inkscape:window-y="-11" inkscape:window-x="-11" - inkscape:cy="673.69595" - inkscape:cx="1065.6983" - inkscape:zoom="5.6568545" + inkscape:cy="228.04193" + inkscape:cx="941.86619" + inkscape:zoom="2.8284273" showgrid="false" id="namedview371" inkscape:window-height="974" @@ -2397,15 +2396,15 @@ inkscape:connector-curvature="0" id="path1283" d="m 856.4002,481.90842 2.2e-4,-15.92813 h 52.07464 v 93.34657 h -52.07457 v -15.26583" - style="fill:#000000;fill-opacity:1;stroke:#ffff00;stroke-width:3.19994998;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + style="fill:#000000;fill-opacity:1;stroke:#ffff00;stroke-width:3.19995;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + style="fill:none;fill-opacity:1;stroke:#ffff00;stroke-width:3.19995;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> RADIO 0250 Date: Tue, 3 May 2022 16:20:46 +0100 Subject: [PATCH 30/33] Fix other bug --- Models/Instruments/PFD/PFD.nas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index aeb5a6d1..82bdba9f 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -1242,7 +1242,7 @@ var canvas_pfd = { }), props.UpdateManager.FromHashList(["altitudePFD","altError"], 0.1, func(val) { if (!val.altError) { - obj.altOffset = val / 500 - int(val.altitudePFD / 500); + obj.altOffset = val.altitudePFD / 500 - int(val.altitudePFD / 500); obj.middleAltOffset = nil; if (obj.altOffset > 0.5) { From 9e7e07d1024bc2fa68c27eb5003dab0d52a00f14 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Tue, 3 May 2022 19:54:52 +0100 Subject: [PATCH 31/33] Remove thing that I accidentally removed before last push --- Models/Instruments/PFD/PFD.nas | 1 + 1 file changed, 1 insertion(+) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 0d1ebf61..4bf3ffc8 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -1078,6 +1078,7 @@ var canvas_pfd = { getKeysMismatch: func() { return ["ERRCODE"]; }, + showMetricAlt: 0, onsideADIRSOperating: 0, update: func(notification) { me.updatePower(notification); From d6f2de875644ff42b82d775ddc65ef6f37eb4338 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Tue, 3 May 2022 19:56:52 +0100 Subject: [PATCH 32/33] IESI - set altimeter also on acconfig startup --- AircraftConfig/acconfig.nas | 1 + 1 file changed, 1 insertion(+) diff --git a/AircraftConfig/acconfig.nas b/AircraftConfig/acconfig.nas index 7b570335..549c83a5 100644 --- a/AircraftConfig/acconfig.nas +++ b/AircraftConfig/acconfig.nas @@ -509,6 +509,7 @@ var taxi_b = func { libraries.toggleSTD(); } setprop("/instrumentation/altimeter[0]/setting-inhg", getprop("/environment/metar[0]/pressure-inhg") or 29.92); + setprop("/instrumentation/altimeter[6]/setting-inhg", getprop("/environment/metar[0]/pressure-inhg") or 29.92); settimer(taxi_c, 2); } var taxi_c = func { From f10242d5730787f1740c01206f5ed329f36d17a9 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Tue, 3 May 2022 20:02:20 +0100 Subject: [PATCH 33/33] Fix that pitch trim field had incorrect width --- .../Lower-ECAM/Lower-ECAM-fctl.nas | 2 +- Models/Instruments/Lower-ECAM/res/fctl.svg | 155 +++++++++--------- 2 files changed, 79 insertions(+), 78 deletions(-) diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-fctl.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-fctl.nas index 1cfdefb4..84ed7c4e 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-fctl.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-fctl.nas @@ -138,7 +138,7 @@ var canvas_lowerECAMPageFctl = } }), props.UpdateManager.FromHashValue("fctlElevTrim", 0.01, func(val) { - obj["PT"].setText(sprintf("%2.1f", val)); + obj["PT"].setText(sprintf("%4.1f", val)); if (val >= 0.09) { obj["PTupdn"].setText("UP"); obj["PTupdn"].show(); diff --git a/Models/Instruments/Lower-ECAM/res/fctl.svg b/Models/Instruments/Lower-ECAM/res/fctl.svg index f038ae46..d871b070 100644 --- a/Models/Instruments/Lower-ECAM/res/fctl.svg +++ b/Models/Instruments/Lower-ECAM/res/fctl.svg @@ -1,19 +1,19 @@ + inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)" + sodipodi:docname="fctl.svg" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:dc="http://purl.org/dc/elements/1.1/"> @@ -22,7 +22,6 @@ image/svg+xml - @@ -37,17 +36,19 @@ guidetolerance="10" inkscape:pageopacity="1" inkscape:pageshadow="2" - inkscape:window-width="1366" - inkscape:window-height="705" + inkscape:window-width="1920" + inkscape:window-height="974" id="namedview371" - showgrid="false" - inkscape:zoom="1.28" - inkscape:cx="608.14718" - inkscape:cy="323.45523" - inkscape:window-x="-8" - inkscape:window-y="-8" + showgrid="true" + inkscape:zoom="5.12" + inkscape:cx="705.66406" + inkscape:cy="772.46094" + inkscape:window-x="-11" + inkscape:window-y="-11" inkscape:window-maximized="1" - inkscape:current-layer="svg2"> + inkscape:current-layer="svg2" + inkscape:pagecheckerboard="0" + inkscape:document-units="pt"> @@ -316,7 +317,7 @@ id="tspan4317" x="390.37976" y="387.46661" - style="font-size:39.1399231px;line-height:1.25;fill:#0dc04b;fill-opacity:1">1 + style="font-size:39.1399px;line-height:1.25;fill:#0dc04b;fill-opacity:1">1 2 + style="font-size:36.8339px;line-height:1.25">2 3 + style="font-size:34.8349px;line-height:1.25">3 1 + style="font-size:39.1399px;line-height:1.25;fill:#0dc04b;fill-opacity:1">1 2 + style="font-size:36.8339px;line-height:1.25">2 SEC + style="font-size:33.5112px;line-height:1.25;fill:#ffffff;fill-opacity:1">SEC SPD BRK + style="font-size:34.581px;line-height:1.25;fill:#ffffff;fill-opacity:1">SPD BRK PITCH TRIM + style="font-size:37.5371px;line-height:1.25">PITCH TRIM G + style="font-size:34.2665px;line-height:1.25">G Y + style="font-size:34.508px;line-height:1.25">Y DN + x="617.86084" + y="513.65326" + style="font-size:34.6309px;line-height:1.25;stroke-width:0.966793px">DN ° + style="font-size:32px;line-height:1.25;fill:#179ab7;fill-opacity:1">° B + style="font-size:34.8201px;line-height:1.25">B Y + style="font-size:34.508px;line-height:1.25">Y RUD + style="font-size:32.4441px;line-height:1.25">RUD   AIL + style="font-size:38.6374px;line-height:1.25;fill:#ffffff;fill-opacity:1">AIL L + style="font-size:34.5197px;line-height:1.25">L   AIL + style="font-size:38.6374px;line-height:1.25;fill:#ffffff;fill-opacity:1">AIL R + style="font-size:34.5133px;line-height:1.25">R G + style="font-size:34.2665px;line-height:1.25">G G + style="font-size:34.2665px;line-height:1.25">G B + style="font-size:34.8201px;line-height:1.25">B G + style="font-size:34.2665px;line-height:1.25">G L + style="font-size:34.5197px;line-height:1.25">L R + style="font-size:34.508px;line-height:1.25">R B + style="font-size:34.8201px;line-height:1.25">B B + style="font-size:34.8201px;line-height:1.25">B G + style="font-size:34.2665px;line-height:1.25">G B + style="font-size:34.8201px;line-height:1.25">B Y + style="font-size:34.508px;line-height:1.25">Y ELEV + style="font-size:36.0853px;line-height:1.25">ELEV ELEV + style="font-size:36.0853px;line-height:1.25">ELEV 000 + style="font-size:35.8204px;line-height:1.25">0000 G + style="font-size:34.2665px;line-height:1.25">G B + style="font-size:34.7532px;line-height:1.25">B Y + style="font-size:34.508px;line-height:1.25">Y 1 + style="font-size:43.1136px;line-height:1.25">1 2 + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:43.1136px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans'">2 4 + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:43.1136px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans'">4 1 + style="font-size:43.1136px;line-height:1.25">1 3 + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:43.1136px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans'">3 5 + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:43.1136px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans'">5