From 01ec6a06b77dc72def77a727c3c290a7bf3d9b28 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Sat, 6 Nov 2021 16:50:56 +0000 Subject: [PATCH] Improve ATT RESET / ATT 10S messages --- Models/Instruments/IESI/IESI.nas | 100 +++++++++++++++------------ Models/Instruments/IESI/res/iesi.svg | 17 +---- 2 files changed, 57 insertions(+), 60 deletions(-) diff --git a/Models/Instruments/IESI/IESI.nas b/Models/Instruments/IESI/IESI.nas index c3a3c67b..a9d5831e 100644 --- a/Models/Instruments/IESI/IESI.nas +++ b/Models/Instruments/IESI/IESI.nas @@ -6,11 +6,6 @@ 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 ASI = 0; -var _showIESI = 0; -var _fast = 0; -var _IESITime = 0; - var pinPrograms = { metricAltitude: 1, showInHg: 1, @@ -54,23 +49,27 @@ var canvas_IESI = { obj.AI_horizon_trans = obj["AI_horizon"].createTransform(); obj.AI_horizon_rot = obj["AI_horizon"].createTransform(); - obj.middleAltOffset = nil; + obj._cachedInhg = nil; obj._excessMotion = 0; + obj._fast = 0; + obj._IESITime = 0; + obj._showIESI = 0; + obj.ASI = 0; obj.canReset = 0; obj.isNegativeAlt = 0; - obj.att10s.hide(); + obj.middleAltOffset = nil; obj.update_items = [ props.UpdateManager.FromHashValue("airspeed", nil, func(val) { # Subtract 30, since the scale starts at 30, but don't allow less than 0, or more than 520 knots if (val <= 30) { - ASI = 0; + obj.ASI = 0; } else if (val >= 520) { - ASI = 490; + obj.ASI = 490; } else { - ASI = val - 30; + obj.ASI = val - 30; } - obj["ASI_scale"].setTranslation(0, ASI * 8.295); + obj["ASI_scale"].setTranslation(0, obj.ASI * 8.295); }), props.UpdateManager.FromHashList(["altitude","altitude_ind"], nil, func(val) { if (val.altitude > 50000) { @@ -154,16 +153,10 @@ var canvas_IESI = { obj.updateQNH(val); }), ]; - - _showIESI = 0; - _fast = 0; - _IESITime = 0.0; - obj._cachedInhg = nil; - return obj; }, getKeys: func() { - return ["IESI","IESI_Init","att90s","att10s","ATTflag","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"]; + 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"]; }, update: func(notification) { if (notification.qnh_inhg != me._cachedInhg) { @@ -176,21 +169,33 @@ var canvas_IESI = { return; } - if (_IESITime + 90 >= notification.elapsedTime) { + if (me._IESITime + 90 >= notification.elapsedTime) { if (notification.groundspeed > 2) { me._excessMotion = 1; } - me["IESI"].hide(); - me["IESI_Init"].show(); - if (_fast) { - me["att10s"].show(); - me["att90s"].hide(); + if (me._fast) { + 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["att10s"].hide(); - me["att90s"].show(); + me["IESI"].hide(); + me["IESI_Init"].show(); + me["ATTflag"].hide(); } - me["ATTflag"].hide(); return; } else { if (pinPrograms.metricAltitude) { @@ -209,7 +214,6 @@ var canvas_IESI = { me["metricBox"].hide(); me["negText2"].hide(); } - _fast = 0; if (!me._excessMotion) { me["IESI_Init"].hide(); @@ -227,10 +231,17 @@ var canvas_IESI = { me["AI_bank"].hide(); me["AI_bank_center"].hide(); me["AI_bank_scale"].hide(); - me["AI_index"].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(); } } @@ -257,30 +268,26 @@ var canvas_IESI = { updatePower: func(notification) { # todo 20W power consumption if (notification.attReset == 1 and me.canReset) { - if (notification.iesiInit and _IESITime + 90 >= notification.elapsedTime and !me._excessMotion) { - _fast = 1; - } else { - _fast = 0; - } - me._excessMotion = 0; - iesi_init.setBoolValue(0); me.canReset = 0; - } else if (_IESITime + 90 < notification.elapsedTime and notification.iesiInit and !me.canReset) { + me._excessMotion = 0; + me._fast = 1; + iesi_init.setBoolValue(0); + } else if (me._IESITime + 90 < notification.elapsedTime and notification.iesiInit and !me.canReset) { me.canReset = 1; } if (notification.dcEss >= 25 or (notification.relay7XB and notification.dcHot1703 >= 25)) { - _showIESI = 1; + me._showIESI = 1; if (notification.acconfig != 1 and notification.iesiInit != 1) { iesi_init.setBoolValue(1); - if (_fast) { - _IESITime = notification.elapsedTime - 80; + if (me._fast) { + me._IESITime = notification.elapsedTime - 80; } else { - _IESITime = notification.elapsedTime; + me._IESITime = notification.elapsedTime; } } else if (notification.acconfig == 1 and notification.iesiInit != 1) { iesi_init.setBoolValue(1); - _IESITime = notification.elapsedTime - 87; + me._IESITime = notification.elapsedTime - 87; } } elsif (notification.iesiInit) { if (!me._transientVar) { @@ -289,15 +296,18 @@ var canvas_IESI = { if (systems.ELEC.Bus.dcEss.getValue() >= 25 or (systems.ELEC.Bus.dcHot1703.getValue() >= 25 and systems.ELEC.Relay.relay7XB.getValue())) { me._transientVar = 0; } else { - _showIESI = 0; - iesi_init.setBoolValue(0); + me.canReset = 0; + me._excessMotion = 0; + me._fast = 0; + me._showIESI = 0; me._transientVar = 0; + iesi_init.setBoolValue(0); } }, 0.2); # 200ms delay power transients } } - if (_showIESI and notification.iesiBrt > 0.01) { + if (me._showIESI and notification.iesiBrt > 0.01) { me.group.setVisible(1); } else { me.group.setVisible(0); diff --git a/Models/Instruments/IESI/res/iesi.svg b/Models/Instruments/IESI/res/iesi.svg index fc9c3e3a..8bdc1875 100644 --- a/Models/Instruments/IESI/res/iesi.svg +++ b/Models/Instruments/IESI/res/iesi.svg @@ -43,7 +43,7 @@ showgrid="true" inkscape:zoom="0.93517029" inkscape:cx="815.35952" - inkscape:cy="847.9739" + inkscape:cy="762.42799" inkscape:window-x="-11" inkscape:window-y="-11" inkscape:window-maximized="1" @@ -170,7 +170,7 @@ x="304.32764" height="91.330338" width="406.27161" - id="rect12278" + id="attRstRect" style="fill:#c9d121;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.17302;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> STD - ATT 10s