1
0
Fork 0

Better ASI scale, add roll markings on IESI

This commit is contained in:
legoboyvdlp R 2020-10-25 17:45:08 +00:00
parent b273f23d40
commit b1b2143c0b
3 changed files with 865 additions and 747 deletions

View file

@ -14,7 +14,6 @@ var mach_act = 0;
# 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 iesi_time = props.globals.initNode("/instrumentation/iesi/iesi-init-time", 0.0, "DOUBLE");
var iesi_brt = props.globals.getNode("/controls/lighting/DU/iesi", 1);
var iesi_rate = props.globals.getNode("/systems/acconfig/options/iesi-rate", 1);
var et = props.globals.getNode("/sim/time/elapsed-sec", 1);
@ -22,8 +21,7 @@ var aconfig = props.globals.getNode("/systems/acconfig/autoconfig-running", 1);
var airspeed = props.globals.getNode("/instrumentation/airspeed-indicator/indicated-speed-kt", 1);
var mach = props.globals.getNode("/instrumentation/airspeed-indicator/indicated-mach", 1);
var pitch = props.globals.getNode("/orientation/pitch-deg", 1);
var roll = props.globals.getNode("/orientation/roll-deg", 1);
var pitch = props.globals.getNode("/instrumentation/iesi/pitch-deg", 1);
var skid = props.globals.getNode("/instrumentation/iesi/slip-skid", 1);
var altitude = props.globals.getNode("/instrumentation/altimeter/indicated-altitude-ft", 1);
var altitude_ind = props.globals.getNode("/instrumentation/altimeter/indicated-altitude-ft-pfd", 1);
@ -32,6 +30,8 @@ var altimeter_mode = props.globals.getNode("/instrumentation/altimeter[0]/std",
var qnh_hpa = props.globals.getNode("/instrumentation/altimeter/setting-hpa", 1);
var qnh_inhg = props.globals.getNode("/instrumentation/altimeter/setting-inhg", 1);
var _IESITime = 0;
var canvas_IESI_base = {
init: func(canvas_group, file) {
var font_mapper = func(family, weight) {
@ -68,6 +68,10 @@ var canvas_IESI_base = {
me.AI_horizon_trans = me["AI_horizon"].createTransform();
me.AI_horizon_rot = me["AI_horizon"].createTransform();
me._showIESI = 0;
me._fast = 0;
_IESITime = 0.0;
me.page = canvas_group;
return me;
@ -81,7 +85,7 @@ var canvas_IESI_base = {
# todo transient max 0.2s
# todo 20W power consumption
if (iesi_reset.getValue() == 1) {
if (iesi_init.getBoolValue() and iesi_time.getValue() + 90 >= et.getValue()) {
if (iesi_init.getBoolValue() and _IESITime + 90 >= et.getValue()) {
me._fast = 1;
} else {
me._fast = 0;
@ -96,14 +100,14 @@ var canvas_IESI_base = {
if (aconfig.getValue() != 1 and iesi_init.getValue() != 1) {
iesi_init.setBoolValue(1);
if (me._fast) {
iesi_time.setValue(cur_time - 80);
_IESITime = cur_time - 80;
me._fast = 0;
} else {
iesi_time.setValue(cur_time);
_IESITime = cur_time;
}
} else if (aconfig.getValue() == 1 and iesi_init.getValue() != 1) {
iesi_init.setBoolValue(1);
iesi_time.setValue(cur_time - 87);
_IESITime = cur_time - 87;
}
} else {
me._showIESI = 0;
@ -124,10 +128,11 @@ var canvas_IESI = {
m.init(canvas_group, file);
m._cachedInhg = -99;
m._machWasAbove50 = 0;
m._roll = 0;
return m;
},
getKeys: func() {
return ["IESI","IESI_Init","ASI_scale","ASI_mach","ASI_mach_decimal","AI_center","AI_horizon","AI_bank","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"];
return ["IESI","IESI_Init","ASI_scale","ASI_mach","ASI_mach_decimal","AI_center","AI_horizon","AI_bank","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"];
},
update: func() {
if (qnh_inhg.getValue() != me._cachedInhg) {
@ -135,7 +140,7 @@ var canvas_IESI = {
me.updateQNH();
}
if (iesi_time.getValue() + 90 >= et.getValue()) {
if (_IESITime + 90 >= et.getValue()) {
me["IESI"].hide();
me["IESI_Init"].show();
return;
@ -145,13 +150,13 @@ var canvas_IESI = {
}
# Airspeed
# Subtract 30, since the scale starts at 30, but don"t allow less than 0, or more than 420 situations
# Subtract 30, since the scale starts at 30, but don't allow less than 0, or more than 520 knots
airspeed_act = airspeed.getValue();
mach_act = mach.getValue();
if (airspeed_act <= 30) {
ASI = 0;
} else if (airspeed_act >= 420) {
ASI = 390;
} else if (airspeed_act >= 520) {
ASI = 490;
} else {
ASI = airspeed_act - 30;
}
@ -177,11 +182,12 @@ var canvas_IESI = {
}
# Attitude
me._roll = pts.Orientation.roll.getValue();
me.AI_horizon_trans.setTranslation(0, pitch.getValue() * 16.74);
me.AI_horizon_rot.setRotation(-roll.getValue() * D2R, me["AI_center"].getCenter());
me.AI_horizon_rot.setRotation(me._roll * D2R, me["AI_center"].getCenter());
me["AI_slipskid"].setTranslation(skid.getValue(), 0);
me["AI_bank"].setRotation(-roll.getValue() * D2R);
me["AI_bank"].setRotation(me._roll * D2R);
# Altitude
me.altitude = altitude.getValue();
@ -190,6 +196,7 @@ var canvas_IESI = {
} elsif (me.altitude < -2000) {
me.altitude = -2000;
}
if (me.altitude < 0) {
me["negText"].show();
me["negText2"].show();
@ -197,6 +204,7 @@ var canvas_IESI = {
me["negText"].hide();
me["negText2"].hide();
}
me.altOffset = me.altitude / 500 - int(me.altitude / 500);
me.middleAltText = roundaboutAlt(me.altitude / 100);
me.middleAltOffset = nil;
@ -212,14 +220,16 @@ var canvas_IESI = {
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)));
me.altitudeText = altitude_ind.getValue();
if (me.altitude < 0 and me.altitudeText > 20) {
me.altitudeText = 20;
} elsif (me.altitude > 0 and me.altitudeText > 500) {
me.altitudeText = 500;
}
me["ALT_digits"].setText(sprintf("%s", me.altitudeText));
me["ALT_meters"].setText(sprintf("%5.0f", me.altitude * 0.3048));
me["ALT_meters"].setText(sprintf("%5.0f", math.round(me.altitude * 0.3048, 10)));
altTens = num(right(sprintf("%02d", me.altitude), 2));
me["ALT_tens"].setTranslation(0, altTens * 3.16);
},

File diff suppressed because it is too large Load diff

Before

Width:  |  Height:  |  Size: 107 KiB

After

Width:  |  Height:  |  Size: 113 KiB

View file

@ -466,7 +466,7 @@
</filter>
<filter>
<name>Slip/Skid Indicator</name>
<name>IESI Slip/Skid Indicator</name>
<debug>false</debug>
<type>gain</type>
<gain>1</gain>
@ -484,5 +484,25 @@
</input>
<output>/instrumentation/iesi/slip-skid</output>
</filter>
<filter>
<name>IESI Pitch</name>
<debug>false</debug>
<type>gain</type>
<gain>1</gain>
<input>
<expression>
<table>
<property>/orientation/pitch-deg</property>
<entry><ind>-80</ind><dep>-65</dep></entry>
<entry><ind>-50</ind><dep>-50</dep></entry>
<entry><ind> 0</ind><dep> 0</dep></entry>
<entry><ind> 50</ind><dep> 50</dep></entry>
<entry><ind> 80</ind><dep> 65</dep></entry>
</table>
</expression>
</input>
<output>/instrumentation/iesi/pitch-deg</output>
</filter>
</PropertyList>