From 56abd3a3c373afc4869a93f109a2b22ce27385e8 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Fri, 29 Apr 2022 20:55:11 +0100 Subject: [PATCH] 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) {