PFD: Transition to props.nas

This commit is contained in:
Jonathan Redpath 2018-09-12 17:43:35 +01:00
parent 1134421fd7
commit 1a9771709d
7 changed files with 426 additions and 327 deletions

View file

@ -10,7 +10,7 @@
<sim> <sim>
<author>it0uchpods Design Group: Joshua Davidson (it0uchpods), Jonathan Redpath (legoboyvdlp), Thorsten Herrmann (TH-555)</author> <author>it0uchpods Design Group: Joshua Davidson (it0uchpods), Thorsten Herrmann (TH-555)</author>
<status>Pre V1.0</status> <status>Pre V1.0</status>

View file

@ -126,16 +126,18 @@ var canvas_IESI = {
# Airspeed # 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 420 situations
if (airspeed.getValue() <= 30) { airspeed_act = airspeed.getValue();
mach_act = mach.getValue();
if (airspeed_act <= 30) {
ASI = 0; ASI = 0;
} else if (airspeed.getValue() >= 420) { } else if (airspeed_act >= 420) {
ASI = 390; ASI = 390;
} else { } else {
ASI = airspeed.getValue() - 30; ASI = airspeed_act - 30;
} }
me["ASI_scale"].setTranslation(0, ASI * 8.295); me["ASI_scale"].setTranslation(0, ASI * 8.295);
if (mach.getValue() >= 0.5) { if (mach_act >= 0.5) {
me["ASI_mach_decimal"].show(); me["ASI_mach_decimal"].show();
me["ASI_mach"].show(); me["ASI_mach"].show();
} else { } else {
@ -143,10 +145,10 @@ var canvas_IESI = {
me["ASI_mach"].hide(); me["ASI_mach"].hide();
} }
if (mach.getValue() >= 0.999) { if (mach_act >= 0.999) {
me["ASI_mach"].setText("99"); me["ASI_mach"].setText("99");
} else { } else {
me["ASI_mach"].setText(sprintf("%2.0f", mach.getValue() * 100)); me["ASI_mach"].setText(sprintf("%2.0f", mach_act * 100));
} }
# Attitude # Attitude
@ -158,8 +160,9 @@ var canvas_IESI = {
me["AI_bank"].setRotation(-roll.getValue() * D2R); me["AI_bank"].setRotation(-roll.getValue() * D2R);
# Altitude # Altitude
me.altOffset = altitude.getValue() / 500 - int(altitude.getValue() / 500); me.altitude = altitude.getValue();
me.middleAltText = roundaboutAlt(altitude.getValue() / 100); me.altOffset = me.altitude / 500 - int(me.altitude / 500);
me.middleAltText = roundaboutAlt(me.altitude / 100);
me.middleAltOffset = nil; me.middleAltOffset = nil;
if (me.altOffset > 0.5) { if (me.altOffset > 0.5) {
me.middleAltOffset = -(me.altOffset - 1) * 258.5528; me.middleAltOffset = -(me.altOffset - 1) * 258.5528;
@ -175,7 +178,7 @@ var canvas_IESI = {
me["ALT_one"].setText(sprintf("%03d", abs(me.middleAltText-10))); me["ALT_one"].setText(sprintf("%03d", abs(me.middleAltText-10)));
me["ALT_digits"].setText(sprintf("%s", altitude_ind.getValue())); me["ALT_digits"].setText(sprintf("%s", altitude_ind.getValue()));
me["ALT_meters"].setText(sprintf("%5.0f", altitude.getValue() * 0.3048)); me["ALT_meters"].setText(sprintf("%5.0f", me.altitude * 0.3048));
altTens = num(right(sprintf("%02d", altitude_ind.getValue()), 2)); altTens = num(right(sprintf("%02d", altitude_ind.getValue()), 2));
me["ALT_tens"].setTranslation(0, altTens * 3.16); me["ALT_tens"].setTranslation(0, altTens * 3.16);

View file

@ -15,12 +15,20 @@ var ND_2 = nil;
var ND_1_test = nil; var ND_1_test = nil;
var ND_2_test = nil; var ND_2_test = nil;
var elapsedtime = 0; var elapsedtime = 0;
setprop("/instrumentation/du/du2-test", 0); var du1_test = props.globals.getNode("/instrumentation/du/du1-test", 1);
setprop("/instrumentation/du/du2-test-time", 0); var du1_test_time = props.globals.getNode("/instrumentation/du/du1-test-time", 1);
setprop("/instrumentation/du/du2-test-amount", 0); var du1_test_amount = props.globals.getNode("/instrumentation/du/du1-test-amount", 1);
setprop("/instrumentation/du/du5-test", 0); var du2_test = props.globals.getNode("/instrumentation/du/du2-test", 1);
setprop("/instrumentation/du/du5-test-time", 0); var du2_test_time = props.globals.getNode("/instrumentation/du/du2-test-time", 1);
setprop("/instrumentation/du/du5-test-amount", 0); var du2_test_amount = props.globals.getNode("/instrumentation/du/du2-test-amount", 1);
var du5_test = props.globals.getNode("/instrumentation/du/du5-test", 1);
var du5_test_time = props.globals.getNode("/instrumentation/du/du5-test-time", 1);
var du5_test_amount = props.globals.getNode("/instrumentation/du/du5-test-amount", 1);
var du6_test = props.globals.getNode("/instrumentation/du/du6-test", 1);
var du6_test_time = props.globals.getNode("/instrumentation/du/du6-test-time", 1);
var du6_test_amount = props.globals.getNode("/instrumentation/du/du6-test-amount", 1);
var cpt_du_xfr = props.globals.getNode("/modes/cpt-du-xfr");
var fo_du_xfr = props.globals.getNode("/modes/fo-du-xfr");
var nd_display = {}; var nd_display = {};
@ -79,38 +87,38 @@ var canvas_nd_base = {
update: func() { update: func() {
elapsedtime = getprop("/sim/time/elapsed-sec"); elapsedtime = getprop("/sim/time/elapsed-sec");
if (getprop("/systems/electrical/bus/ac-ess-shed") >= 110) { if (getprop("/systems/electrical/bus/ac-ess-shed") >= 110) {
if (getprop("/systems/acconfig/autoconfig-running") != 1 and getprop("/instrumentation/du/du2-test") != 1) { if (getprop("/systems/acconfig/autoconfig-running") != 1 and du2_test.getValue() != 1) {
setprop("/instrumentation/du/du2-test", 1); du2_test.setValue(1);
setprop("/instrumentation/du/du2-test-amount", math.round((rand() * 5 ) + 35, 0.1)); du2_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1));
setprop("/instrumentation/du/du2-test-time", getprop("/sim/time/elapsed-sec")); du2_test_time.setValue(getprop("/sim/time/elapsed-sec"));
} else if (getprop("/systems/acconfig/autoconfig-running") == 1 and getprop("/instrumentation/du/du2-test") != 1) { } else if (getprop("/systems/acconfig/autoconfig-running") == 1 and du2_test.getValue() != 1) {
setprop("/instrumentation/du/du2-test", 1); du2_test.setValue(1);
setprop("/instrumentation/du/du2-test-amount", math.round((rand() * 5 ) + 35, 0.1)); du2_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1));
setprop("/instrumentation/du/du2-test-time", getprop("/sim/time/elapsed-sec") - 30); du2_test_time.setValue(getprop("/sim/time/elapsed-sec") - 30);
} }
} else { } else {
setprop("/instrumentation/du/du2-test", 0); du2_test.setValue(0);
} }
if (getprop("/systems/electrical/bus/ac2") >= 110) { if (getprop("/systems/electrical/bus/ac2") >= 110) {
if (getprop("/systems/acconfig/autoconfig-running") != 1 and getprop("/instrumentation/du/du5-test") != 1) { if (getprop("/systems/acconfig/autoconfig-running") != 1 and du5_test.getValue() != 1) {
setprop("/instrumentation/du/du5-test", 1); du5_test.setValue(1);
setprop("/instrumentation/du/du5-test-amount", math.round((rand() * 5 ) + 35, 0.1)); du5_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1));
setprop("/instrumentation/du/du5-test-time", getprop("/sim/time/elapsed-sec")); du5_test_time.setValue(getprop("/sim/time/elapsed-sec"));
} else if (getprop("/systems/acconfig/autoconfig-running") == 1 and getprop("/instrumentation/du/du5-test") != 1) { } else if (getprop("/systems/acconfig/autoconfig-running") == 1 and du5_test.getValue() != 1) {
setprop("/instrumentation/du/du5-test", 1); du5_test.setValue(1);
setprop("/instrumentation/du/du5-test-amount", math.round((rand() * 5 ) + 35, 0.1)); du5_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1));
setprop("/instrumentation/du/du5-test-time", getprop("/sim/time/elapsed-sec") - 30); du5_test_time.setValue(getprop("/sim/time/elapsed-sec") - 30);
} }
} else { } else {
setprop("/instrumentation/du/du5-test", 0); du5_test.setValue(0);
} }
if (getprop("/systems/electrical/bus/ac-ess-shed") >= 110 and getprop("/controls/lighting/DU/du2") > 0) { if (getprop("/systems/electrical/bus/ac-ess-shed") >= 110 and getprop("/controls/lighting/DU/du2") > 0) {
if (getprop("/instrumentation/du/du2-test-time") + getprop("/instrumentation/du/du2-test-amount") >= elapsedtime and getprop("/modes/cpt-du-xfr") != 1) { if (du2_test_time.getValue() + du2_test_amount.getValue() >= elapsedtime and cpt_du_xfr.getValue() != 1) {
ND_1.page.hide(); ND_1.page.hide();
ND_1_test.page.show(); ND_1_test.page.show();
ND_1_test.update(); ND_1_test.update();
} else if (getprop("/instrumentation/du/du1-test-time") + getprop("/instrumentation/du/du1-test-amount") >= elapsedtime and getprop("/modes/cpt-du-xfr") == 1) { } else if (du1_test_time.getValue() + du1_test_amount.getValue() >= elapsedtime and cpt_du_xfr.getValue() == 1) {
ND_1.page.hide(); ND_1.page.hide();
ND_1_test.page.show(); ND_1_test.page.show();
ND_1_test.update(); ND_1_test.update();
@ -124,11 +132,11 @@ var canvas_nd_base = {
ND_1.page.hide(); ND_1.page.hide();
} }
if (getprop("/systems/electrical/bus/ac2") >= 110 and getprop("/controls/lighting/DU/du5") > 0) { if (getprop("/systems/electrical/bus/ac2") >= 110 and getprop("/controls/lighting/DU/du5") > 0) {
if (getprop("/instrumentation/du/du5-test-time") + getprop("/instrumentation/du/du6-test-amount") >= elapsedtime and getprop("/modes/fo-du-xfr") != 1) { if (du5_test_time.getValue() + du5_test_amount.getValue() >= elapsedtime and fo_du_xfr.getValue() != 1) {
ND_2.page.hide(); ND_2.page.hide();
ND_2_test.page.show(); ND_2_test.page.show();
ND_2_test.update(); ND_2_test.update();
} else if (getprop("/instrumentation/du/du6-test-time") + getprop("/instrumentation/du/du5-test-amount") >= elapsedtime and getprop("/modes/fo-du-xfr") == 1) { } else if (du6_test_time.getValue() + du6_test_amount.getValue() >= elapsedtime and fo_du_xfr.getValue() == 1) {
ND_2.page.hide(); ND_2.page.hide();
ND_2_test.page.show(); ND_2_test.page.show();
ND_2_test.update(); ND_2_test.update();
@ -211,10 +219,14 @@ var canvas_ND_1_test = {
return ["Test_white","Test_text"]; return ["Test_white","Test_text"];
}, },
update: func() { update: func() {
if (getprop("/instrumentation/du/du2-test-time") + 1 >= elapsedtime and getprop("/modes/cpt-du-xfr") != 1) { elapsedtime = getprop("/sim/time/elapsed-sec");
if (du2_test_time.getValue() + 1 >= elapsedtime and getprop("/modes/cpt-du-xfr") != 1) {
me["Test_white"].show(); me["Test_white"].show();
me["Test_text"].hide(); me["Test_text"].hide();
} else if (getprop("/instrumentation/du/du1-test-time") + 1 >= elapsedtime and getprop("/modes/cpt-du-xfr") == 1) { } else if (du1_test_time.getValue() + 1 >= elapsedtime and getprop("/modes/cpt-du-xfr") == 1) {
print(du1_test_time.getValue());
print(elapsedtime);
print(getprop("/modes/cpt-du-xfr"));
me["Test_white"].show(); me["Test_white"].show();
me["Test_text"].hide(); me["Test_text"].hide();
} else { } else {
@ -251,10 +263,11 @@ var canvas_ND_2_test = {
return ["Test_white","Test_text"]; return ["Test_white","Test_text"];
}, },
update: func() { update: func() {
if (getprop("/instrumentation/du/du5-test-time") + 1 >= elapsedtime and getprop("/modes/cpt-du-xfr") != 1) { elapsedtime = getprop("/sim/time/elapsed-sec");
if (du5_test_time.getValue() + 1 >= elapsedtime and getprop("/modes/cpt-du-xfr") != 1) {
me["Test_white"].show(); me["Test_white"].show();
me["Test_text"].hide(); me["Test_text"].hide();
} else if (getprop("/instrumentation/du/du6-test-time") + 1 >= elapsedtime and getprop("/modes/cpt-du-xfr") == 1) { } else if (du6_test_time.getValue() + 1 >= elapsedtime and getprop("/modes/cpt-du-xfr") == 1) {
me["Test_white"].show(); me["Test_white"].show();
me["Test_text"].hide(); me["Test_text"].hide();
} else { } else {

File diff suppressed because it is too large Load diff

View file

@ -60,7 +60,7 @@ var cutoff_one = func {
setprop("/systems/pneumatic/eng1-starter", 0); setprop("/systems/pneumatic/eng1-starter", 0);
setprop("/controls/engines/engine[0]/starter", 0); setprop("/controls/engines/engine[0]/starter", 0);
setprop("/controls/engines/engine[0]/cutoff", 1); setprop("/controls/engines/engine[0]/cutoff", 1);
setprop("/engines/engine[0]/state", 0); var engine0_state = props.globals.initNode("/engines/engine[0]/state", 0, "INT");
interpolate(engines[0].getNode("egt-actual"), 0, egt_shutdown_time); interpolate(engines[0].getNode("egt-actual"), 0, egt_shutdown_time);
eng_one_n2_check.stop(); eng_one_n2_check.stop();
} }
@ -144,7 +144,7 @@ var cutoff_two = func {
setprop("/systems/pneumatic/eng2-starter", 0); setprop("/systems/pneumatic/eng2-starter", 0);
setprop("/controls/engines/engine[1]/starter", 0); setprop("/controls/engines/engine[1]/starter", 0);
setprop("/controls/engines/engine[1]/cutoff", 1); setprop("/controls/engines/engine[1]/cutoff", 1);
setprop("/engines/engine[1]/state", 0); var engine1_state = props.globals.initNode("/engines/engine[0]/state", 0, "INT");
interpolate(engines[1].getNode("egt-actual"), 0, egt_shutdown_time); interpolate(engines[1].getNode("egt-actual"), 0, egt_shutdown_time);
} }

View file

@ -60,7 +60,7 @@ var cutoff_one = func {
setprop("/systems/pneumatic/eng1-starter", 0); setprop("/systems/pneumatic/eng1-starter", 0);
setprop("/controls/engines/engine[0]/starter", 0); setprop("/controls/engines/engine[0]/starter", 0);
setprop("/controls/engines/engine[0]/cutoff", 1); setprop("/controls/engines/engine[0]/cutoff", 1);
setprop("/engines/engine[0]/state", 0); var engine0_state = props.globals.initNode("/engines/engine[0]/state", 0, "INT");
interpolate(engines[0].getNode("egt-actual"), 0, egt_shutdown_time); interpolate(engines[0].getNode("egt-actual"), 0, egt_shutdown_time);
eng_one_n2_check.stop(); eng_one_n2_check.stop();
} }
@ -144,7 +144,7 @@ var cutoff_two = func {
setprop("/systems/pneumatic/eng2-starter", 0); setprop("/systems/pneumatic/eng2-starter", 0);
setprop("/controls/engines/engine[1]/starter", 0); setprop("/controls/engines/engine[1]/starter", 0);
setprop("/controls/engines/engine[1]/cutoff", 1); setprop("/controls/engines/engine[1]/cutoff", 1);
setprop("/engines/engine[1]/state", 0); var engine1_state = props.globals.initNode("/engines/engine[1]/state", 0, "INT");
interpolate(engines[1].getNode("egt-actual"), 0, egt_shutdown_time); interpolate(engines[1].getNode("egt-actual"), 0, egt_shutdown_time);
} }

View file

@ -1 +1 @@
4635 4636