1
0
Fork 0

Implement relistic fuel pred button action (no calcs yet), add delay timers to INITB, add leading slash for FMGC variables

This commit is contained in:
Matthew Maring 2020-05-01 20:26:05 -04:00
parent 6e737cc8c8
commit 7c21f214e7
17 changed files with 860 additions and 714 deletions

View file

@ -139,6 +139,12 @@ var lw = props.globals.getNode("/FMGC/internal/lw", 1);
var trip_wind = props.globals.getNode("/FMGC/internal/trip-wind", 1); var trip_wind = props.globals.getNode("/FMGC/internal/trip-wind", 1);
var extra_fuel = props.globals.getNode("/FMGC/internal/extra-fuel", 1); var extra_fuel = props.globals.getNode("/FMGC/internal/extra-fuel", 1);
var extra_time = props.globals.getNode("/FMGC/internal/extra-time", 1); var extra_time = props.globals.getNode("/FMGC/internal/extra-time", 1);
var taxi_fuel_set = props.globals.getNode("/FMGC/internal/taxi-fuel-set", 1);
var rte_set = props.globals.getNode("/FMGC/internal/rte-set", 1);
var alt_fuel_set = props.globals.getNode("/FMGC/internal/alt-fuel-set", 1);
var final_fuel_set = props.globals.getNode("/FMGC/internal/final-fuel-set", 1);
var final_time_set = props.globals.getNode("/FMGC/internal/final-time-set", 1);
var min_dest_fob_set = props.globals.getNode("/FMGC/internal/min-dest-fob-set", 1);
# FUELPRED # FUELPRED
var state1 = props.globals.getNode("/engines/engine[0]/state", 1); var state1 = props.globals.getNode("/engines/engine[0]/state", 1);
@ -1532,51 +1538,127 @@ var canvas_MCDU_base = {
me["Simple_L5S"].setText("FINAL/TIME"); me["Simple_L5S"].setText("FINAL/TIME");
me["Simple_L6S"].setText("MIN DEST FOB"); me["Simple_L6S"].setText("MIN DEST FOB");
me["Simple_R2S"].setText("BLOCK"); me["Simple_R2S"].setText("BLOCK");
me["Simple_R2"].setText(sprintf("%3.1f", block.getValue()));
me["Simple_R3S"].setText("FUEL");
me["Simple_R3"].setText("PLANNING ");
me["Simple_R4S"].setText("TOW/ LW"); me["Simple_R4S"].setText("TOW/ LW");
me["Simple_R5S"].setText("TRIP WIND"); me["Simple_R5S"].setText("TRIP WIND");
me["Simple_R5"].setText(trip_wind.getValue()); me["Simple_R5"].setText(trip_wind.getValue());
me["Simple_R6S"].setText("EXTRA/TIME"); me["Simple_R6S"].setText("EXTRA/TIME");
if (blockSet.getValue() == 1 and zfwSet.getValue() == 1) { me["Simple_Title"].setColor(1, 1, 1);
setprop("/FMGC/internal/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
setprop("/FMGC/internal/trip-fuel", num(block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue())); if (!getprop("/FMGC/internal/fuel-request-set")) {
setprop("/FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue()));
setprop("/FMGC/internal/lw", num(tow.getValue() - trip_fuel.getValue()));
me["Simple_L2"].setText(sprintf("%4.1f/" ~ trip_time.getValue(), trip_fuel.getValue()));
me["Simple_L3"].setText(sprintf("%4.1f/", rte_rsv.getValue()) ~ sprintf("%4.1f", rte_percent.getValue()));
me["Simple_L4"].setText(sprintf("%4.1f/" ~ alt_time.getValue(), alt_fuel.getValue()));
me["Simple_L5"].setText(sprintf("%4.1f/" ~ final_time.getValue(), final_fuel.getValue()));
me["Simple_L6"].setText(sprintf("%2.1f", min_dest_fob.getValue()));
me["Simple_R3S"].hide();
me["Simple_R3"].hide();
me["Simple_R3_Arrow"].hide();
me["Simple_C4"].hide();
me["Simple_R4"].setText(sprintf("%4.1f/", tow.getValue()) ~ sprintf("%4.1f", lw.getValue()));
me["Simple_R6"].setText(sprintf("%4.1f/" ~ extra_time.getValue(), extra_fuel.getValue()));
me["Simple_Title"].setText("INIT FUEL PREDICTION ");
me["Simple_Title"].setColor(1, 1, 1);
me.colorLeft("ack", "grn", "blu", "blu", "blu", "blu");
me.colorRight("ack", "ack", "ack", "grn", "ack", "grn");
} else {
me["Simple_L2"].setText("---.-/----"); me["Simple_L2"].setText("---.-/----");
me["Simple_L3"].setText("---.-/---.-"); me["Simple_L3"].setText(sprintf("---.-/%4.1f", rte_percent.getValue()));
me["Simple_L4"].setText("---.-/----"); me["Simple_L4"].setText("---.-/----");
me["Simple_L5"].setText("---.-/0030"); me["Simple_L5"].setText("---.-/" ~ final_time.getValue());
me["Simple_L6"].setText("---.-"); me["Simple_L6"].setText("---.-");
me["Simple_R2"].hide();
me["INITB_Block"].show();
me["Simple_R3S"].show(); me["Simple_R3S"].show();
me["Simple_R3"].show(); me["Simple_R3"].show();
me["Simple_R3S"].setText("FUEL");
me["Simple_R3"].setText("PLANNING ");
me["Simple_R3_Arrow"].show(); me["Simple_R3_Arrow"].show();
me["Simple_R3_Arrow"].setColor(AMBER);
me["Simple_R4"].setText("---.-/---.-"); me["Simple_R4"].setText("---.-/---.-");
me["Simple_R6"].setText("---.-/----"); me["Simple_R6"].setText("---.-/----");
me["Simple_Title"].setText("INIT"); me["Simple_Title"].setText("INIT");
me["Simple_Title"].setColor(1, 1, 1); me["Simple_Title"].setColor(1, 1, 1);
me.colorLeft("ack", "wht", "wht", "wht", "wht", "wht");
me.colorRight("ack", "blu", "amb", "wht", "ack", "wht");
me["Simple_R3S"].setColor(AMBER);
} else {
me["Simple_Title"].setText("INIT FUEL PREDICTION ");
if (getprop("/FMGC/internal/block-calculating")) {
me["Simple_L2"].setText("---.-/----");
me["Simple_L3"].setText(sprintf("---.-/%4.1f", rte_percent.getValue()));
me["Simple_L4"].setText("---.-/----");
me["Simple_L5"].setText("---.-/" ~ final_time.getValue());
me["Simple_L6"].setText("---.-");
me["Simple_R2"].show();
me["Simple_R2"].setText("---.-");
me["INITB_Block"].hide();
me["Simple_R3S"].show();
me["Simple_R3"].show();
me["Simple_R3S"].setText("FUEL");
me["Simple_R3"].setText("PLANNING ");
me["Simple_R3_Arrow"].show();
me["Simple_R3_Arrow"].setColor(GREEN);
me["Simple_R4"].setText("---.-/---.-");
me["Simple_R6"].setText("---.-/----");
me.colorLeft("ack", "wht", "wht", "wht", "wht", "wht");
me.colorRight("ack", "wht", "grn", "wht", "ack", "wht");
me["Simple_R3S"].setColor(GREEN);
} else {
if (!getprop("/FMGC/internal/block-confirmed")) {
me["Simple_L2"].setText("---.-/----");
me["Simple_L3"].setText(sprintf("---.-/%4.1f", rte_percent.getValue()));
me["Simple_L4"].setText("---.-/----");
me["Simple_L5"].setText("---.-/" ~ final_time.getValue());
me["Simple_L6"].setText("---.-");
me["Simple_R2"].show();
me["INITB_Block"].hide();
me["Simple_R2"].setText(sprintf("%3.1f", block.getValue()));
me["Simple_R3S"].show();
me["Simple_R3"].show();
me["Simple_R3S"].setText("BLOCK");
me["Simple_R3"].setText("CONFIRM ");
me["Simple_R3_Arrow"].show();
me["Simple_R3_Arrow"].setColor(AMBER);
me["Simple_R4"].setText("---.-/---.-");
me["Simple_R6"].setText("---.-/----");
me.colorLeft("ack", "wht", "wht", "wht", "wht", "wht");
me.colorRight("ack", "blu", "amb", "wht", "ack", "wht");
me["Simple_R3S"].setColor(AMBER);
} else {
if (getprop("/FMGC/internal/fuel-calculating")) {
me["Simple_L2"].setText("---.-/----");
me["Simple_L3"].setText(sprintf("---.-/%4.1f", rte_percent.getValue()));
me["Simple_L4"].setText("---.-/----");
me["Simple_L5"].setText("---.-/" ~ final_time.getValue());
me["Simple_L6"].setText("---.-");
me["Simple_R2"].show();
me["INITB_Block"].hide();
me["Simple_R2"].setText(sprintf("%3.1f", block.getValue()));
me["Simple_R3S"].hide();
me["Simple_R3"].hide();
me["Simple_R3_Arrow"].hide();
me["Simple_R4"].setText("---.-/---.-");
me["Simple_R6"].setText("---.-/----");
me.colorLeft("ack", "wht", "wht", "wht", "wht", "wht");
me.colorRight("ack", "blu", "ack", "wht", "ack", "wht");
} else {
#setprop("/FMGC/internal/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
#setprop("/FMGC/internal/trip-fuel", num(block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue()));
#setprop("/FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue()));
#setprop("/FMGC/internal/lw", num(tow.getValue() - trip_fuel.getValue()));
me["Simple_L2"].setText(sprintf("%4.1f/" ~ trip_time.getValue(), trip_fuel.getValue()));
me["Simple_L3"].setText(sprintf("%4.1f/", rte_rsv.getValue()) ~ sprintf("%4.1f", rte_percent.getValue()));
me["Simple_L4"].setText(sprintf("%4.1f/" ~ alt_time.getValue(), alt_fuel.getValue()));
me["Simple_L5"].setText(sprintf("%4.1f/" ~ final_time.getValue(), final_fuel.getValue()));
me["Simple_L6"].setText(sprintf("%2.1f", min_dest_fob.getValue()));
me["Simple_R2"].show();
me["INITB_Block"].hide();
me["Simple_R2"].setText(sprintf("%3.1f", block.getValue()));
me["Simple_R3S"].hide();
me["Simple_R3"].hide();
me["Simple_R3_Arrow"].hide();
me["Simple_C4"].hide();
me["Simple_R4"].setText(sprintf("%4.1f/", tow.getValue()) ~ sprintf("%4.1f", lw.getValue()));
me["Simple_R6"].setText(sprintf("%4.1f/" ~ extra_time.getValue(), extra_fuel.getValue()));
me.colorLeft("ack", "grn", "blu", "blu", "blu", "blu");
me.colorRight("ack", "blu", "ack", "grn", "ack", "grn");
}
}
}
} }
me["Simple_R1S"].setText("ZFWCG/ ZFW"); me["Simple_R1S"].setText("ZFWCG/ ZFW");
@ -1601,12 +1683,34 @@ var canvas_MCDU_base = {
me["Simple_R1"].hide(); me["Simple_R1"].hide();
} }
if (blockSet.getValue() == 1) { if (taxi_fuel_set.getValue() == 1) {
me["Simple_R2"].show(); me["Simple_L1"].setFontSize(normal);
me["INITB_Block"].hide();
} else { } else {
me["Simple_R2"].hide(); me["Simple_L1"].setFontSize(small);
me["INITB_Block"].show(); }
if (rte_set.getValue() == 1) {
me["Simple_L3"].setFontSize(normal);
} else {
me["Simple_L3"].setFontSize(small);
}
if (alt_fuel_set.getValue() == 1) {
me["Simple_L4"].setFontSize(normal);
} else {
me["Simple_L4"].setFontSize(small);
}
if (final_fuel_set.getValue() == 1 or final_time_set.getValue() == 1) {
me["Simple_L5"].setFontSize(normal);
} else {
me["Simple_L5"].setFontSize(small);
}
if (min_dest_fob_set.getValue() == 1) {
me["Simple_L6"].setFontSize(normal);
} else {
me["Simple_L6"].setFontSize(small);
} }
} else if (page == "FUELPRED") { } else if (page == "FUELPRED") {

View file

@ -97,42 +97,44 @@ var thr1 = 0;
var thr2 = 0; var thr2 = 0;
var altsel = 0; var altsel = 0;
var crzFl = 0; var crzFl = 0;
setprop("FMGC/internal/maxspeed", 0); setprop("/FMGC/internal/maxspeed", 0);
setprop("FMGC/internal/minspeed", 0); setprop("/FMGC/internal/minspeed", 0);
setprop("position/gear-agl-ft", 0); setprop("position/gear-agl-ft", 0);
setprop("FMGC/internal/mng-spd", 157); setprop("/FMGC/internal/mng-spd", 157);
setprop("FMGC/internal/mng-spd-cmd", 157); setprop("/FMGC/internal/mng-spd-cmd", 157);
setprop("FMGC/internal/mng-kts-mach", 0); setprop("/FMGC/internal/mng-kts-mach", 0);
setprop("FMGC/internal/mach-switchover", 0); setprop("/FMGC/internal/mach-switchover", 0);
setprop("it-autoflight/settings/accel-agl-ft", 1500); #eventually set to 1500 above runway setprop("it-autoflight/settings/accel-agl-ft", 1500); #eventually set to 1500 above runway
setprop("it-autoflight/internal/vert-speed-fpm", 0); setprop("it-autoflight/internal/vert-speed-fpm", 0);
setprop("it-autoflight/output/fma-pwr", 0); setprop("it-autoflight/output/fma-pwr", 0);
setprop("instrumentation/nav[0]/nav-id", "XXX"); setprop("instrumentation/nav[0]/nav-id", "XXX");
setprop("instrumentation/nav[1]/nav-id", "XXX"); setprop("instrumentation/nav[1]/nav-id", "XXX");
setprop("FMGC/internal/ils1-mcdu", "XXX/999.99"); setprop("/FMGC/internal/ils1-mcdu", "XXX/999.99");
setprop("FMGC/internal/ils2-mcdu", "XXX/999.99"); setprop("/FMGC/internal/ils2-mcdu", "XXX/999.99");
setprop("FMGC/internal/vor1-mcdu", "XXX/999.99"); setprop("/FMGC/internal/vor1-mcdu", "XXX/999.99");
setprop("FMGC/internal/vor2-mcdu", "999.99/XXX"); setprop("/FMGC/internal/vor2-mcdu", "999.99/XXX");
setprop("FMGC/internal/adf1-mcdu", "XXX/999.99"); setprop("/FMGC/internal/adf1-mcdu", "XXX/999.99");
setprop("FMGC/internal/adf2-mcdu", "999.99/XXX"); setprop("/FMGC/internal/adf2-mcdu", "999.99/XXX");
setprop("gear/gear[0]/wow-fmgc", 1); setprop("gear/gear[0]/wow-fmgc", 1);
var FMGCinit = func { var FMGCinit = func {
setprop("FMGC/status/to-state", 0); setprop("/FMGC/status/to-state", 0);
setprop("FMGC/status/phase", "0"); # 0 is Preflight 1 is Takeoff 2 is Climb 3 is Cruise 4 is Descent 5 is Decel/Approach 6 is Go Around 7 is Done setprop("/FMGC/status/phase", "0"); # 0 is Preflight 1 is Takeoff 2 is Climb 3 is Cruise 4 is Descent 5 is Decel/Approach 6 is Go Around 7 is Done
setprop("FMGC/internal/maxspeed", 338); setprop("/FMGC/internal/maxspeed", 338);
setprop("FMGC/internal/mng-spd", 157); setprop("/FMGC/internal/mng-spd", 157);
setprop("FMGC/internal/mng-spd-cmd", 157); setprop("/FMGC/internal/mng-spd-cmd", 157);
setprop("FMGC/internal/mng-kts-mach", 0); setprop("/FMGC/internal/mng-kts-mach", 0);
setprop("FMGC/internal/mach-switchover", 0); setprop("/FMGC/internal/mach-switchover", 0);
setprop("it-autoflight/settings/accel-agl-ft", 1500); #eventually set to 1500 above runway setprop("it-autoflight/settings/accel-agl-ft", 1500); #eventually set to 1500 above runway
setprop("FMGC/internal/decel", 0); setprop("/FMGC/internal/decel", 0);
setprop("FMGC/internal/loc-source", "NAV0"); setprop("/FMGC/internal/loc-source", "NAV0");
setprop("FMGC/internal/optalt", 0); setprop("/FMGC/internal/optalt", 0);
setprop("FMGC/internal/landing-time", -99); setprop("/FMGC/internal/landing-time", -99);
setprop("FMGC/internal/align1-time", -99); setprop("/FMGC/internal/align1-time", -99);
setprop("FMGC/internal/align2-time", -99); setprop("/FMGC/internal/align2-time", -99);
setprop("FMGC/internal/align3-time", -99); setprop("/FMGC/internal/align3-time", -99);
setprop("/FMGC/internal/block-fuel-time", -99);
setprop("/FMGC/internal/fuel-pred-time", -99);
masterFMGC.start(); masterFMGC.start();
various.start(); various.start();
various2.start(); various2.start();
@ -280,39 +282,39 @@ var masterFMGC = maketimer(0.2, func {
} }
if ((n1_left < 85 or n1_right < 85) and gs < 90 and mode == " " and gear0 == 1 and phase == 1) { # rejected takeoff if ((n1_left < 85 or n1_right < 85) and gs < 90 and mode == " " and gear0 == 1 and phase == 1) { # rejected takeoff
setprop("FMGC/status/phase", 0); setprop("/FMGC/status/phase", 0);
setprop("systems/pressurization/mode", "GN"); setprop("systems/pressurization/mode", "GN");
} }
if (gear0 == 1 and phase == 0 and ((n1_left >= 85 and n1_right >= 85 and mode == "SRS") or gs >= 90)) { if (gear0 == 1 and phase == 0 and ((n1_left >= 85 and n1_right >= 85 and mode == "SRS") or gs >= 90)) {
setprop("FMGC/status/phase", 1); setprop("/FMGC/status/phase", 1);
setprop("systems/pressurization/mode", "TO"); setprop("systems/pressurization/mode", "TO");
} }
if (phase == 1 and ((mode != "SRS" and mode != " ") or alt >= accel_agl_ft)) { if (phase == 1 and ((mode != "SRS" and mode != " ") or alt >= accel_agl_ft)) {
setprop("FMGC/status/phase", 2); setprop("/FMGC/status/phase", 2);
setprop("systems/pressurization/mode", "TO"); setprop("systems/pressurization/mode", "TO");
} }
if (phase == 2 and (mode == "ALT CRZ" or mode == "ALT CRZ*")) { if (phase == 2 and (mode == "ALT CRZ" or mode == "ALT CRZ*")) {
setprop("FMGC/status/phase", 3); setprop("/FMGC/status/phase", 3);
setprop("systems/pressurization/mode", "CR"); setprop("systems/pressurization/mode", "CR");
} }
if (crzFl >= 200) { if (crzFl >= 200) {
if (phase == 3 and (flightPlanController.arrivalDist <= 200 or altSel < 20000)) { if (phase == 3 and (flightPlanController.arrivalDist <= 200 or altSel < 20000)) {
setprop("FMGC/status/phase", 4); setprop("/FMGC/status/phase", 4);
setprop("systems/pressurization/mode", "DE"); setprop("systems/pressurization/mode", "DE");
} }
} else { } else {
if (phase == 3 and (flightPlanController.arrivalDist <= 200 or altSel < (crzFl * 100))) { # todo - not sure about crzFl condition, investigate what happens! if (phase == 3 and (flightPlanController.arrivalDist <= 200 or altSel < (crzFl * 100))) { # todo - not sure about crzFl condition, investigate what happens!
setprop("FMGC/status/phase", 4); setprop("/FMGC/status/phase", 4);
setprop("systems/pressurization/mode", "DE"); setprop("systems/pressurization/mode", "DE");
} }
} }
if (phase == 4 and getprop("/FMGC/internal/decel")) { if (phase == 4 and getprop("/FMGC/internal/decel")) {
setprop("FMGC/status/phase", 5); setprop("/FMGC/status/phase", 5);
} }
if (flightPlanController.num[2].getValue() > 0 and getprop("/FMGC/flightplan[2]/active") == 1 and flightPlanController.arrivalDist <= 15 and (modelat == "NAV" or modelat == "LOC" or modelat == "LOC*") and aglalt < 9500) { #todo decel pseudo waypoint if (flightPlanController.num[2].getValue() > 0 and getprop("/FMGC/flightplan[2]/active") == 1 and flightPlanController.arrivalDist <= 15 and (modelat == "NAV" or modelat == "LOC" or modelat == "LOC*") and aglalt < 9500) { #todo decel pseudo waypoint
@ -322,21 +324,21 @@ var masterFMGC = maketimer(0.2, func {
} }
if ((phase == "5") and state1 == "TOGA" and state2 == "TOGA") { if ((phase == "5") and state1 == "TOGA" and state2 == "TOGA") {
setprop("FMGC/status/phase", 6); setprop("/FMGC/status/phase", 6);
setprop("systems/pressurization/mode", "TO"); setprop("systems/pressurization/mode", "TO");
setprop("it-autoflight/input/toga", 1); setprop("it-autoflight/input/toga", 1);
} }
if (phase == "6" and alt >= accel_agl_ft) { # todo when insert altn or new dest if (phase == "6" and alt >= accel_agl_ft) { # todo when insert altn or new dest
setprop("FMGC/status/phase", 2); setprop("/FMGC/status/phase", 2);
} }
if (getprop("/systems/navigation/adr/computation/overspeed-vfe-spd") != 1024) { if (getprop("/systems/navigation/adr/computation/overspeed-vfe-spd") != 1024) {
setprop("FMGC/internal/maxspeed", getprop("/systems/navigation/adr/computation/overspeed-vfe-spd") - 4); setprop("/FMGC/internal/maxspeed", getprop("/systems/navigation/adr/computation/overspeed-vfe-spd") - 4);
} elsif (pts.Gear.position[0].getValue() != 0 or pts.Gear.position[1].getValue() != 0 or pts.Gear.position[2].getValue() != 0) { } elsif (pts.Gear.position[0].getValue() != 0 or pts.Gear.position[1].getValue() != 0 or pts.Gear.position[2].getValue() != 0) {
setprop("FMGC/internal/maxspeed", 284); setprop("/FMGC/internal/maxspeed", 284);
} else { } else {
setprop("FMGC/internal/maxspeed", getprop("/it-fbw/speeds/vmo-mmo")); setprop("/FMGC/internal/maxspeed", getprop("/it-fbw/speeds/vmo-mmo"));
} }
# calculate speeds # calculate speeds
@ -381,7 +383,7 @@ var masterFMGC = maketimer(0.2, func {
} else { } else {
vapp = vls + dest_wind; vapp = vls + dest_wind;
} }
setprop("FMGC/internal/computed-speeds/vapp", vapp); setprop("/FMGC/internal/computed-speeds/vapp", vapp);
} }
aoa_prot = 15; aoa_prot = 15;
@ -435,100 +437,100 @@ var masterFMGC = maketimer(0.2, func {
} else { } else {
vapp_appr = vls_appr + dest_wind; vapp_appr = vls_appr + dest_wind;
} }
setprop("FMGC/internal/computed-speeds/vapp_appr", vapp_appr); setprop("/FMGC/internal/computed-speeds/vapp_appr", vapp_appr);
} }
# set the values globally # set the values globally
setprop("FMGC/internal/computed-speeds/clean", clean); setprop("/FMGC/internal/computed-speeds/clean", clean);
setprop("FMGC/internal/computed-speeds/vs1g_clean", vs1g_clean); setprop("/FMGC/internal/computed-speeds/vs1g_clean", vs1g_clean);
setprop("FMGC/internal/computed-speeds/vs1g_conf_1", vs1g_conf_1); setprop("/FMGC/internal/computed-speeds/vs1g_conf_1", vs1g_conf_1);
setprop("FMGC/internal/computed-speeds/vs1g_conf_1f", vs1g_conf_1f); setprop("/FMGC/internal/computed-speeds/vs1g_conf_1f", vs1g_conf_1f);
setprop("FMGC/internal/computed-speeds/vs1g_conf_2", vs1g_conf_2); setprop("/FMGC/internal/computed-speeds/vs1g_conf_2", vs1g_conf_2);
setprop("FMGC/internal/computed-speeds/vs1g_conf_3", vs1g_conf_3); setprop("/FMGC/internal/computed-speeds/vs1g_conf_3", vs1g_conf_3);
setprop("FMGC/internal/computed-speeds/vs1g_conf_full", vs1g_conf_full); setprop("/FMGC/internal/computed-speeds/vs1g_conf_full", vs1g_conf_full);
setprop("FMGC/internal/computed-speeds/slat", slat); setprop("/FMGC/internal/computed-speeds/slat", slat);
setprop("FMGC/internal/computed-speeds/flap2", flap2); setprop("/FMGC/internal/computed-speeds/flap2", flap2);
setprop("FMGC/internal/computed-speeds/flap3", flap3); setprop("/FMGC/internal/computed-speeds/flap3", flap3);
setprop("FMGC/internal/computed-speeds/vls", vls); setprop("/FMGC/internal/computed-speeds/vls", vls);
setprop("FMGC/internal/computed-speeds/alpha_prot", alpha_prot); setprop("/FMGC/internal/computed-speeds/alpha_prot", alpha_prot);
setprop("FMGC/internal/computed-speeds/alpha_max", alpha_max); setprop("/FMGC/internal/computed-speeds/alpha_max", alpha_max);
setprop("FMGC/internal/computed-speeds/vs1g_clean_to", vs1g_clean_to); setprop("/FMGC/internal/computed-speeds/vs1g_clean_to", vs1g_clean_to);
setprop("FMGC/internal/computed-speeds/vs1g_conf_2_to", vs1g_conf_2_to); setprop("/FMGC/internal/computed-speeds/vs1g_conf_2_to", vs1g_conf_2_to);
setprop("FMGC/internal/computed-speeds/vs1g_conf_3_to", vs1g_conf_3_to); setprop("/FMGC/internal/computed-speeds/vs1g_conf_3_to", vs1g_conf_3_to);
setprop("FMGC/internal/computed-speeds/vs1g_conf_full_to", vs1g_conf_full_to); setprop("/FMGC/internal/computed-speeds/vs1g_conf_full_to", vs1g_conf_full_to);
setprop("FMGC/internal/computed-speeds/slat_to", slat_to); setprop("/FMGC/internal/computed-speeds/slat_to", slat_to);
setprop("FMGC/internal/computed-speeds/flap2_to", flap2_to); setprop("/FMGC/internal/computed-speeds/flap2_to", flap2_to);
setprop("FMGC/internal/computed-speeds/clean_to", clean_to); setprop("/FMGC/internal/computed-speeds/clean_to", clean_to);
setprop("FMGC/internal/computed-speeds/vs1g_clean_appr", vs1g_clean_appr); setprop("/FMGC/internal/computed-speeds/vs1g_clean_appr", vs1g_clean_appr);
setprop("FMGC/internal/computed-speeds/vs1g_conf_2_appr", vs1g_conf_2_appr); setprop("/FMGC/internal/computed-speeds/vs1g_conf_2_appr", vs1g_conf_2_appr);
setprop("FMGC/internal/computed-speeds/vs1g_conf_3_appr", vs1g_conf_3_appr); setprop("/FMGC/internal/computed-speeds/vs1g_conf_3_appr", vs1g_conf_3_appr);
setprop("FMGC/internal/computed-speeds/vs1g_conf_full_appr", vs1g_conf_full_appr); setprop("/FMGC/internal/computed-speeds/vs1g_conf_full_appr", vs1g_conf_full_appr);
setprop("FMGC/internal/computed-speeds/slat_appr", slat_appr); setprop("/FMGC/internal/computed-speeds/slat_appr", slat_appr);
setprop("FMGC/internal/computed-speeds/flap2_appr", flap2_appr); setprop("/FMGC/internal/computed-speeds/flap2_appr", flap2_appr);
setprop("FMGC/internal/computed-speeds/clean_appr", clean_appr); setprop("/FMGC/internal/computed-speeds/clean_appr", clean_appr);
setprop("FMGC/internal/computed-speeds/vls_appr", vls_appr); setprop("/FMGC/internal/computed-speeds/vls_appr", vls_appr);
# Need info on these, also correct for height at altitude... # Need info on these, also correct for height at altitude...
# https://www.pprune.org/archive/index.php/t-587639.html # https://www.pprune.org/archive/index.php/t-587639.html
if (getprop("/FMGC/status/to-state") == 1) { if (getprop("/FMGC/status/to-state") == 1) {
if (flap == 0) { # 0 if (flap == 0) { # 0
setprop("FMGC/internal/computed-speeds/vls_min", vs1g_clean * 1.28); setprop("/FMGC/internal/computed-speeds/vls_min", vs1g_clean * 1.28);
} else if (flap == 1) { # 1 } else if (flap == 1) { # 1
setprop("FMGC/internal/computed-speeds/vls_min", vs1g_conf_1 * 1.23); setprop("/FMGC/internal/computed-speeds/vls_min", vs1g_conf_1 * 1.23);
} else { # 1+F } else { # 1+F
setprop("FMGC/internal/computed-speeds/vls_min", vs1g_clean * 1.13); setprop("/FMGC/internal/computed-speeds/vls_min", vs1g_clean * 1.13);
} }
} else { } else {
if (flap == 0) { # 0 if (flap == 0) { # 0
setprop("FMGC/internal/computed-speeds/vls_min", vs1g_clean * 1.23); setprop("/FMGC/internal/computed-speeds/vls_min", vs1g_clean * 1.23);
} else if (flap == 1) { # 1 } else if (flap == 1) { # 1
setprop("FMGC/internal/computed-speeds/vls_min", vs1g_conf_1 * 1.23); setprop("/FMGC/internal/computed-speeds/vls_min", vs1g_conf_1 * 1.23);
} else if (flap == 2) { # 1+F } else if (flap == 2) { # 1+F
setprop("FMGC/internal/computed-speeds/vls_min", vs1g_conf_1f * 1.23); setprop("/FMGC/internal/computed-speeds/vls_min", vs1g_conf_1f * 1.23);
} else if (flap == 3) { # 2 } else if (flap == 3) { # 2
setprop("FMGC/internal/computed-speeds/vls_min", vs1g_conf_2 * 1.23); setprop("/FMGC/internal/computed-speeds/vls_min", vs1g_conf_2 * 1.23);
} else if (flap == 4) { # 3 } else if (flap == 4) { # 3
setprop("FMGC/internal/computed-speeds/vls_min", vs1g_conf_3 * 1.23); setprop("/FMGC/internal/computed-speeds/vls_min", vs1g_conf_3 * 1.23);
} else if (flap == 5) { # FULL } else if (flap == 5) { # FULL
setprop("FMGC/internal/computed-speeds/vls_min", vs1g_conf_full * 1.23); setprop("/FMGC/internal/computed-speeds/vls_min", vs1g_conf_full * 1.23);
} }
} }
if (flap == 0) { # 0 if (flap == 0) { # 0
setprop("FMGC/internal/computed-speeds/vsw", vs1g_clean); setprop("/FMGC/internal/computed-speeds/vsw", vs1g_clean);
} else if (flap == 1) { # 1 } else if (flap == 1) { # 1
setprop("FMGC/internal/computed-speeds/vsw", vs1g_conf_1); setprop("/FMGC/internal/computed-speeds/vsw", vs1g_conf_1);
} else if (flap == 2) { # 1+F } else if (flap == 2) { # 1+F
setprop("FMGC/internal/computed-speeds/vsw", vs1g_conf_1f); setprop("/FMGC/internal/computed-speeds/vsw", vs1g_conf_1f);
} else if (flap == 3) { # 2 } else if (flap == 3) { # 2
setprop("FMGC/internal/computed-speeds/vsw", vs1g_conf_2); setprop("/FMGC/internal/computed-speeds/vsw", vs1g_conf_2);
} else if (flap == 4) { # 3 } else if (flap == 4) { # 3
setprop("FMGC/internal/computed-speeds/vsw", vs1g_conf_3); setprop("/FMGC/internal/computed-speeds/vsw", vs1g_conf_3);
} else if (flap == 5) { # FULL } else if (flap == 5) { # FULL
setprop("FMGC/internal/computed-speeds/vsw", vs1g_conf_full); setprop("/FMGC/internal/computed-speeds/vsw", vs1g_conf_full);
} }
if (flap == 0) { # 0 if (flap == 0) { # 0
setprop("FMGC/internal/minspeed", clean); setprop("/FMGC/internal/minspeed", clean);
} else if (flap == 1) { # 1 } else if (flap == 1) { # 1
setprop("FMGC/internal/minspeed", slat); setprop("/FMGC/internal/minspeed", slat);
} else if (flap == 2) { # 1+F } else if (flap == 2) { # 1+F
setprop("FMGC/internal/minspeed", slat); setprop("/FMGC/internal/minspeed", slat);
} else if (flap == 3) { # 2 } else if (flap == 3) { # 2
setprop("FMGC/internal/minspeed", flap2); setprop("/FMGC/internal/minspeed", flap2);
} else if (flap == 4) { # 3 } else if (flap == 4) { # 3
setprop("FMGC/internal/minspeed", flap3); setprop("/FMGC/internal/minspeed", flap3);
} else if (flap == 5) { # FULL } else if (flap == 5) { # FULL
setprop("FMGC/internal/minspeed", vapp); setprop("/FMGC/internal/minspeed", vapp);
} }
if (gear0 == 1 and (state1 == "MCT" or state1 == "MAN THR" or state1 == "TOGA") and (state2 == "MCT" or state2 == "MAN THR" or state2 == "TOGA") and flaps < 5) { if (gear0 == 1 and (state1 == "MCT" or state1 == "MAN THR" or state1 == "TOGA") and (state2 == "MCT" or state2 == "MAN THR" or state2 == "TOGA") and flaps < 5) {
setprop("FMGC/status/to-state", 1); setprop("/FMGC/status/to-state", 1);
} }
if (pts.Position.gearAglFt.getValue() >= 55) { if (pts.Position.gearAglFt.getValue() >= 55) {
setprop("FMGC/status/to-state", 0); setprop("/FMGC/status/to-state", 0);
} }
#handle radios, runways, v1/vr/v2 #handle radios, runways, v1/vr/v2
@ -536,15 +538,15 @@ var masterFMGC = maketimer(0.2, func {
destination_rwy = fmgc.flightPlanController.flightplans[2].destination_runway; destination_rwy = fmgc.flightPlanController.flightplans[2].destination_runway;
if (destination_rwy != nil and phase >= 2) { if (destination_rwy != nil and phase >= 2) {
var airport = airportinfo(getprop("/FMGC/internal/arr-arpt")); var airport = airportinfo(getprop("/FMGC/internal/arr-arpt"));
setprop("FMGC/internal/ldg-elev", airport.elevation * M2FT); # eventually should be runway elevation setprop("/FMGC/internal/ldg-elev", airport.elevation * M2FT); # eventually should be runway elevation
magnetic_hdg = geo.normdeg(destination_rwy.heading - getprop("/environment/magnetic-variation-deg")); magnetic_hdg = geo.normdeg(destination_rwy.heading - getprop("/environment/magnetic-variation-deg"));
runway_ils = destination_rwy.ils_frequency_mhz; runway_ils = destination_rwy.ils_frequency_mhz;
if (runway_ils != nil and !getprop("/FMGC/internal/ils1freq-set") and !getprop("/FMGC/internal/ils1crs-set")) { if (runway_ils != nil and !getprop("/FMGC/internal/ils1freq-set") and !getprop("/FMGC/internal/ils1crs-set")) {
setprop("FMGC/internal/ils1freq-calculated", runway_ils); setprop("/FMGC/internal/ils1freq-calculated", runway_ils);
setprop("instrumentation/nav[0]/frequencies/selected-mhz", runway_ils); setprop("instrumentation/nav[0]/frequencies/selected-mhz", runway_ils);
setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg); setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
} else if (runway_ils != nil and !getprop("/FMGC/internal/ils1freq-set")) { } else if (runway_ils != nil and !getprop("/FMGC/internal/ils1freq-set")) {
setprop("FMGC/internal/ils1freq-calculated", runway_ils); setprop("/FMGC/internal/ils1freq-calculated", runway_ils);
setprop("instrumentation/nav[0]/frequencies/selected-mhz", runway_ils); setprop("instrumentation/nav[0]/frequencies/selected-mhz", runway_ils);
} else if (!getprop("/FMGC/internal/ils1crs-set")) { } else if (!getprop("/FMGC/internal/ils1crs-set")) {
setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg); setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
@ -553,11 +555,11 @@ var masterFMGC = maketimer(0.2, func {
magnetic_hdg = geo.normdeg(departure_rwy.heading - getprop("/environment/magnetic-variation-deg")); magnetic_hdg = geo.normdeg(departure_rwy.heading - getprop("/environment/magnetic-variation-deg"));
runway_ils = departure_rwy.ils_frequency_mhz; runway_ils = departure_rwy.ils_frequency_mhz;
if (runway_ils != nil and !getprop("/FMGC/internal/ils1freq-set") and !getprop("/FMGC/internal/ils1crs-set")) { if (runway_ils != nil and !getprop("/FMGC/internal/ils1freq-set") and !getprop("/FMGC/internal/ils1crs-set")) {
setprop("FMGC/internal/ils1freq-calculated", runway_ils); setprop("/FMGC/internal/ils1freq-calculated", runway_ils);
setprop("instrumentation/nav[0]/frequencies/selected-mhz", runway_ils); setprop("instrumentation/nav[0]/frequencies/selected-mhz", runway_ils);
setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg); setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
} else if (runway_ils != nil and !getprop("/FMGC/internal/ils1freq-set")) { } else if (runway_ils != nil and !getprop("/FMGC/internal/ils1freq-set")) {
setprop("FMGC/internal/ils1freq-calculated", runway_ils); setprop("/FMGC/internal/ils1freq-calculated", runway_ils);
setprop("instrumentation/nav[0]/frequencies/selected-mhz", runway_ils); setprop("instrumentation/nav[0]/frequencies/selected-mhz", runway_ils);
} else if (!getprop("/FMGC/internal/ils1crs-set")) { } else if (!getprop("/FMGC/internal/ils1crs-set")) {
setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg); setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
@ -566,7 +568,7 @@ var masterFMGC = maketimer(0.2, func {
}); });
var reset_FMGC = func { var reset_FMGC = func {
setprop("FMGC/status/phase", "0"); setprop("/FMGC/status/phase", "0");
fd1 = getprop("/it-autoflight/input/fd1"); fd1 = getprop("/it-autoflight/input/fd1");
fd2 = getprop("/it-autoflight/input/fd2"); fd2 = getprop("/it-autoflight/input/fd2");
spd = getprop("/it-autoflight/input/spd-kts"); spd = getprop("/it-autoflight/input/spd-kts");
@ -616,7 +618,7 @@ var various = maketimer(1, func {
setprop("it-autoflight/settings/accel-agl-ft", getprop("/FMGC/internal/accel-agl-ft")); setprop("it-autoflight/settings/accel-agl-ft", getprop("/FMGC/internal/accel-agl-ft"));
} }
setprop("FMGC/internal/gw", math.round(getprop("/fdm/jsbsim/inertia/weight-lbs"), 100)); setprop("/FMGC/internal/gw", math.round(getprop("/fdm/jsbsim/inertia/weight-lbs"), 100));
}); });
var various2 = maketimer(0.5, func { var various2 = maketimer(0.5, func {
@ -634,9 +636,9 @@ var nav0 = func {
var namenav0 = getprop("/instrumentation/nav[0]/nav-id"); var namenav0 = getprop("/instrumentation/nav[0]/nav-id");
if (freqnav0 >= 108.10 and freqnav0 <= 111.95) { if (freqnav0 >= 108.10 and freqnav0 <= 111.95) {
if (namenav0 != "") { if (namenav0 != "") {
setprop("FMGC/internal/ils1-mcdu", namenav0 ~ "/" ~ freqnav0); setprop("/FMGC/internal/ils1-mcdu", namenav0 ~ "/" ~ freqnav0);
} else { } else {
setprop("FMGC/internal/ils1-mcdu", freqnav0); setprop("/FMGC/internal/ils1-mcdu", freqnav0);
} }
} }
} }
@ -647,9 +649,9 @@ var nav1 = func {
var namenav1 = getprop("/instrumentation/nav[1]/nav-id"); var namenav1 = getprop("/instrumentation/nav[1]/nav-id");
if (freqnav1 >= 108.10 and freqnav1 <= 111.95) { if (freqnav1 >= 108.10 and freqnav1 <= 111.95) {
if (namenav1 != "") { if (namenav1 != "") {
setprop("FMGC/internal/ils2-mcdu", freqnav1 ~ "/" ~ namenav1); setprop("/FMGC/internal/ils2-mcdu", freqnav1 ~ "/" ~ namenav1);
} else { } else {
setprop("FMGC/internal/ils2-mcdu", freqnav1); setprop("/FMGC/internal/ils2-mcdu", freqnav1);
} }
} }
} }
@ -660,9 +662,9 @@ var nav2 = func {
var namenav2 = getprop("/instrumentation/nav[2]/nav-id"); var namenav2 = getprop("/instrumentation/nav[2]/nav-id");
if (freqnav2 >= 108.00 and freqnav2 <= 117.95) { if (freqnav2 >= 108.00 and freqnav2 <= 117.95) {
if (namenav2 != "") { if (namenav2 != "") {
setprop("FMGC/internal/vor1-mcdu", namenav2 ~ "/" ~ freqnav2); setprop("/FMGC/internal/vor1-mcdu", namenav2 ~ "/" ~ freqnav2);
} else { } else {
setprop("FMGC/internal/vor1-mcdu", freqnav2); setprop("/FMGC/internal/vor1-mcdu", freqnav2);
} }
} }
} }
@ -673,9 +675,9 @@ var nav3 = func {
var namenav3 = getprop("/instrumentation/nav[3]/nav-id"); var namenav3 = getprop("/instrumentation/nav[3]/nav-id");
if (freqnav3 >= 108.00 and freqnav3 <= 117.95) { if (freqnav3 >= 108.00 and freqnav3 <= 117.95) {
if (namenav3 != "") { if (namenav3 != "") {
setprop("FMGC/internal/vor2-mcdu", freqnav3 ~ "/" ~ namenav3); setprop("/FMGC/internal/vor2-mcdu", freqnav3 ~ "/" ~ namenav3);
} else { } else {
setprop("FMGC/internal/vor2-mcdu", freqnav3); setprop("/FMGC/internal/vor2-mcdu", freqnav3);
} }
} }
} }
@ -686,9 +688,9 @@ var adf0 = func {
var nameadf0 = getprop("/instrumentation/adf[0]/ident"); var nameadf0 = getprop("/instrumentation/adf[0]/ident");
if (freqadf0 >= 190 and freqadf0 <= 1750) { if (freqadf0 >= 190 and freqadf0 <= 1750) {
if (nameadf0 != "") { if (nameadf0 != "") {
setprop("FMGC/internal/adf1-mcdu", nameadf0 ~ "/" ~ freqadf0); setprop("/FMGC/internal/adf1-mcdu", nameadf0 ~ "/" ~ freqadf0);
} else { } else {
setprop("FMGC/internal/adf1-mcdu", freqadf0); setprop("/FMGC/internal/adf1-mcdu", freqadf0);
} }
} }
} }
@ -699,9 +701,9 @@ var adf1 = func {
var nameadf1 = getprop("/instrumentation/adf[1]/ident"); var nameadf1 = getprop("/instrumentation/adf[1]/ident");
if (freqadf1 >= 190 and freqadf1 <= 1750) { if (freqadf1 >= 190 and freqadf1 <= 1750) {
if (nameadf1 != "") { if (nameadf1 != "") {
setprop("FMGC/internal/adf2-mcdu", freqadf1 ~ "/" ~ nameadf1); setprop("/FMGC/internal/adf2-mcdu", freqadf1 ~ "/" ~ nameadf1);
} else { } else {
setprop("FMGC/internal/adf2-mcdu", freqadf1); setprop("/FMGC/internal/adf2-mcdu", freqadf1);
} }
} }
} }
@ -738,83 +740,83 @@ var ManagedSPD = maketimer(0.25, func {
mng_alt_mach = math.round(mng_alt_mach_cmd, 0.001); mng_alt_mach = math.round(mng_alt_mach_cmd, 0.001);
if (mach > mng_alt_mach and (phase == 2 or phase == 3)) { if (mach > mng_alt_mach and (phase == 2 or phase == 3)) {
setprop("FMGC/internal/mach-switchover", 1); setprop("/FMGC/internal/mach-switchover", 1);
} }
if (ias > mng_alt_spd and (phase == 4 or phase == 5)) { if (ias > mng_alt_spd and (phase == 4 or phase == 5)) {
setprop("FMGC/internal/mach-switchover", 0); setprop("/FMGC/internal/mach-switchover", 0);
} }
if ((mode == " " or mode == "SRS") and (phase == 0 or phase == 1)) { if ((mode == " " or mode == "SRS") and (phase == 0 or phase == 1)) {
if (mngktsmach) { if (mngktsmach) {
setprop("FMGC/internal/mng-kts-mach", 0); setprop("/FMGC/internal/mng-kts-mach", 0);
} }
if (mng_spd_cmd != srsSPD) { if (mng_spd_cmd != srsSPD) {
setprop("FMGC/internal/mng-spd-cmd", srsSPD); setprop("/FMGC/internal/mng-spd-cmd", srsSPD);
} }
} else if ((phase == 2 or phase == 3) and altitude <= 10050) { } else if ((phase == 2 or phase == 3) and altitude <= 10050) {
if (mngktsmach) { if (mngktsmach) {
setprop("FMGC/internal/mng-kts-mach", 0); setprop("/FMGC/internal/mng-kts-mach", 0);
} }
if (mng_spd_cmd != 250 and !decel) { if (mng_spd_cmd != 250 and !decel) {
setprop("FMGC/internal/mng-spd-cmd", 250); setprop("/FMGC/internal/mng-spd-cmd", 250);
} else if (mng_spd_cmd != minspeed and decel) { } else if (mng_spd_cmd != minspeed and decel) {
setprop("FMGC/internal/mng-spd-cmd", minspeed); setprop("/FMGC/internal/mng-spd-cmd", minspeed);
} }
} else if ((phase == 2 or phase == 3) and altitude > 10070 and !mach_switchover) { } else if ((phase == 2 or phase == 3) and altitude > 10070 and !mach_switchover) {
if (mngktsmach) { if (mngktsmach) {
setprop("FMGC/internal/mng-kts-mach", 0); setprop("/FMGC/internal/mng-kts-mach", 0);
} }
if (mng_spd_cmd != mng_alt_spd) { if (mng_spd_cmd != mng_alt_spd) {
setprop("FMGC/internal/mng-spd-cmd", mng_alt_spd); setprop("/FMGC/internal/mng-spd-cmd", mng_alt_spd);
} }
} else if ((phase == 2 or phase == 3) and altitude > 10070 and mach_switchover) { } else if ((phase == 2 or phase == 3) and altitude > 10070 and mach_switchover) {
if (!mngktsmach) { if (!mngktsmach) {
setprop("FMGC/internal/mng-kts-mach", 1); setprop("/FMGC/internal/mng-kts-mach", 1);
} }
if (mng_spd_cmd != mng_alt_mach) { if (mng_spd_cmd != mng_alt_mach) {
setprop("FMGC/internal/mng-spd-cmd", mng_alt_mach); setprop("/FMGC/internal/mng-spd-cmd", mng_alt_mach);
} }
} else if (phase == 4 and altitude > 11000 and !mach_switchover) { } else if (phase == 4 and altitude > 11000 and !mach_switchover) {
if (mngktsmach) { if (mngktsmach) {
setprop("FMGC/internal/mng-kts-mach", 0); setprop("/FMGC/internal/mng-kts-mach", 0);
} }
if (mng_spd_cmd != mng_alt_spd) { if (mng_spd_cmd != mng_alt_spd) {
setprop("FMGC/internal/mng-spd-cmd", mng_alt_spd); setprop("/FMGC/internal/mng-spd-cmd", mng_alt_spd);
} }
} else if (phase == 4 and altitude > 11000 and mach_switchover) { } else if (phase == 4 and altitude > 11000 and mach_switchover) {
if (!mngktsmach) { if (!mngktsmach) {
setprop("FMGC/internal/mng-kts-mach", 1); setprop("/FMGC/internal/mng-kts-mach", 1);
} }
if (mng_spd_cmd != mng_alt_mach) { if (mng_spd_cmd != mng_alt_mach) {
setprop("FMGC/internal/mng-spd-cmd", mng_alt_mach); setprop("/FMGC/internal/mng-spd-cmd", mng_alt_mach);
} }
} else if ((phase == 4 or phase == 5 or phase == 6) and altitude > 11000 and !mach_switchover) { } else if ((phase == 4 or phase == 5 or phase == 6) and altitude > 11000 and !mach_switchover) {
if (mngktsmach) { if (mngktsmach) {
setprop("FMGC/internal/mng-kts-mach", 0); setprop("/FMGC/internal/mng-kts-mach", 0);
} }
if (mng_spd_cmd != mng_alt_spd and !decel) { if (mng_spd_cmd != mng_alt_spd and !decel) {
setprop("FMGC/internal/mng-spd-cmd", mng_alt_spd); setprop("/FMGC/internal/mng-spd-cmd", mng_alt_spd);
} else if (mng_spd_cmd != minspeed and decel) { } else if (mng_spd_cmd != minspeed and decel) {
setprop("FMGC/internal/mng-spd-cmd", minspeed); setprop("/FMGC/internal/mng-spd-cmd", minspeed);
} }
} else if ((phase == 4 or phase == 5 or phase == 6) and altitude <= 10980) { } else if ((phase == 4 or phase == 5 or phase == 6) and altitude <= 10980) {
if (mngktsmach) { if (mngktsmach) {
setprop("FMGC/internal/mng-kts-mach", 0); setprop("/FMGC/internal/mng-kts-mach", 0);
} }
if (mng_spd_cmd != 250 and !decel) { if (mng_spd_cmd != 250 and !decel) {
setprop("FMGC/internal/mng-spd-cmd", 250); setprop("/FMGC/internal/mng-spd-cmd", 250);
} else if (mng_spd_cmd != minspeed and decel) { } else if (mng_spd_cmd != minspeed and decel) {
setprop("FMGC/internal/mng-spd-cmd", minspeed); setprop("/FMGC/internal/mng-spd-cmd", minspeed);
} }
} }
mng_spd_cmd = getprop("/FMGC/internal/mng-spd-cmd"); mng_spd_cmd = getprop("/FMGC/internal/mng-spd-cmd");
if (mng_spd_cmd > maxspeed -5) { if (mng_spd_cmd > maxspeed -5) {
setprop("FMGC/internal/mng-spd", maxspeed -5); setprop("/FMGC/internal/mng-spd", maxspeed -5);
} else { } else {
setprop("FMGC/internal/mng-spd", mng_spd_cmd); setprop("/FMGC/internal/mng-spd", mng_spd_cmd);
} }
if (ktsmach and !mngktsmach) { if (ktsmach and !mngktsmach) {
@ -844,22 +846,22 @@ var switchDatabase = func {
database2 = getprop("/FMGC/internal/navdatabase2"); database2 = getprop("/FMGC/internal/navdatabase2");
code1 = getprop("/FMGC/internal/navdatabasecode"); code1 = getprop("/FMGC/internal/navdatabasecode");
code2 = getprop("/FMGC/internal/navdatabasecode2"); code2 = getprop("/FMGC/internal/navdatabasecode2");
setprop("FMGC/internal/navdatabase", database2); setprop("/FMGC/internal/navdatabase", database2);
setprop("FMGC/internal/navdatabase2", database1); setprop("/FMGC/internal/navdatabase2", database1);
setprop("FMGC/internal/navdatabasecode", code2); setprop("/FMGC/internal/navdatabasecode", code2);
setprop("FMGC/internal/navdatabasecode2", code1); setprop("/FMGC/internal/navdatabasecode2", code1);
} }
# Landing to phase 7 # Landing to phase 7
setlistener("gear/gear[1]/wow", func() { setlistener("gear/gear[1]/wow", func() {
if (getprop("/gear/gear[1]/wow") == 0 and timer30secLanding.isRunning) { if (getprop("/gear/gear[1]/wow") == 0 and timer30secLanding.isRunning) {
timer30secLanding.stop(); timer30secLanding.stop();
setprop("FMGC/internal/landing-time", -99); setprop("/FMGC/internal/landing-time", -99);
} }
if (getprop("/gear/gear[1]/wow") == 1 and getprop("/FMGC/internal/landing-time") == -99) { if (getprop("/gear/gear[1]/wow") == 1 and getprop("/FMGC/internal/landing-time") == -99) {
timer30secLanding.start(); timer30secLanding.start();
setprop("FMGC/internal/landing-time", pts.Sim.Time.elapsedSec.getValue()); setprop("/FMGC/internal/landing-time", pts.Sim.Time.elapsedSec.getValue());
} }
}, 0, 0); }, 0, 0);
@ -871,7 +873,7 @@ setlistener("systems/navigation/adr/operating-1", func() {
if (getprop("/FMGC/internal/align1-time") == -99) { if (getprop("/FMGC/internal/align1-time") == -99) {
timer48gpsAlign1.start(); timer48gpsAlign1.start();
setprop("FMGC/internal/align1-time", pts.Sim.Time.elapsedSec.getValue()); setprop("/FMGC/internal/align1-time", pts.Sim.Time.elapsedSec.getValue());
} }
}, 0, 0); }, 0, 0);
@ -883,7 +885,7 @@ setlistener("systems/navigation/adr/operating-2", func() {
if (getprop("/FMGC/internal/align2-time") == -99) { if (getprop("/FMGC/internal/align2-time") == -99) {
timer48gpsAlign2.start(); timer48gpsAlign2.start();
setprop("FMGC/internal/align2-time", pts.Sim.Time.elapsedSec.getValue()); setprop("/FMGC/internal/align2-time", pts.Sim.Time.elapsedSec.getValue());
} }
}, 0, 0); }, 0, 0);
@ -895,40 +897,84 @@ setlistener("systems/navigation/adr/operating-3", func() {
if (getprop("/FMGC/internal/align3-time") == -99) { if (getprop("/FMGC/internal/align3-time") == -99) {
timer48gpsAlign3.start(); timer48gpsAlign3.start();
setprop("FMGC/internal/align3-time", pts.Sim.Time.elapsedSec.getValue()); setprop("/FMGC/internal/align3-time", pts.Sim.Time.elapsedSec.getValue());
}
}, 0, 0);
# Calculate Block Fuel
setlistener("/FMGC/internal/block-calculating", func() {
if (timer3blockFuel.isRunning) {
timer3blockFuel.stop();
}
if (getprop("/FMGC/internal/block-fuel-time") == -99) {
timer3blockFuel.start();
setprop("/FMGC/internal/block-fuel-time", pts.Sim.Time.elapsedSec.getValue());
}
}, 0, 0);
# Calculate Fuel Prediction
setlistener("/FMGC/internal/fuel-calculating", func() {
if (timer5fuelPred.isRunning) {
setprop("/FMGC/internal/fuel-pred-time", -99);
timer5fuelPred.start();
setprop("/FMGC/internal/fuel-pred-time", pts.Sim.Time.elapsedSec.getValue());
}
if (getprop("/FMGC/internal/fuel-pred-time") == -99) {
timer5fuelPred.start();
setprop("/FMGC/internal/fuel-pred-time", pts.Sim.Time.elapsedSec.getValue());
} }
}, 0, 0); }, 0, 0);
# Maketimers # Maketimers
var timer30secLanding = maketimer(1, func() { var timer30secLanding = maketimer(1, func() {
if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/landing-time") + 30) { if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/landing-time") + 30) {
setprop("FMGC/status/phase", 7); setprop("/FMGC/status/phase", 7);
setprop("FMGC/internal/landing-time", -99); setprop("/FMGC/internal/landing-time", -99);
timer30secLanding.stop(); timer30secLanding.stop();
} }
}); });
var timer48gpsAlign1 = maketimer(1, func() { var timer48gpsAlign1 = maketimer(1, func() {
if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/align1-time") + 48 or getprop("/systems/acconfig/options/adirs-skip")) { if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/align1-time") + 48 or getprop("/systems/acconfig/options/adirs-skip")) {
setprop("FMGC/internal/align1-done", 1); setprop("/FMGC/internal/align1-done", 1);
setprop("FMGC/internal/align1-time", -99); setprop("/FMGC/internal/align1-time", -99);
timer48gpsAlign1.stop(); timer48gpsAlign1.stop();
} }
}); });
var timer48gpsAlign2 = maketimer(1, func() { var timer48gpsAlign2 = maketimer(1, func() {
if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/align2-time") + 48 or getprop("/systems/acconfig/options/adirs-skip")) { if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/align2-time") + 48 or getprop("/systems/acconfig/options/adirs-skip")) {
setprop("FMGC/internal/align2-done", 1); setprop("/FMGC/internal/align2-done", 1);
setprop("FMGC/internal/align2-time", -99); setprop("/FMGC/internal/align2-time", -99);
timer48gpsAlign2.stop(); timer48gpsAlign2.stop();
} }
}); });
var timer48gpsAlign3 = maketimer(1, func() { var timer48gpsAlign3 = maketimer(1, func() {
if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/align3-time") + 48 or getprop("/systems/acconfig/options/adirs-skip")) { if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/align3-time") + 48 or getprop("/systems/acconfig/options/adirs-skip")) {
setprop("FMGC/internal/align3-done", 1); setprop("/FMGC/internal/align3-done", 1);
setprop("FMGC/internal/align3-time", -99); setprop("/FMGC/internal/align3-time", -99);
timer48gpsAlign3.stop(); timer48gpsAlign3.stop();
} }
});
var timer3blockFuel = maketimer(1, func() {
if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/block-fuel-time") + 3) {
setprop("/FMGC/internal/block", sprintf("%3.1f", math.round(getprop("/consumables/fuel/total-fuel-lbs") / 1000, 0.1)));
setprop("/FMGC/internal/block-set", 1);
setprop("/FMGC/internal/block-calculating", 0);
setprop("/FMGC/internal/block-fuel-time", -99);
timer3blockFuel.stop();
}
});
var timer5fuelPred = maketimer(1, func() {
if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/fuel-pred-time") + 5) {
# calcuate fuel here
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-pred-time", -99);
timer5fuelPred.stop();
}
}); });

View file

@ -401,6 +401,11 @@ var fplnPage = { # this one is only created once, and then updated - remember th
if (fmgc.flightPlanController.temporaryFlag[me.computer]) { if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (dirToFlag) { dirToFlag = 0; } if (dirToFlag) { dirToFlag = 0; }
fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 1); fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 1);
# push update to fuel
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
}
} else { } else {
notAllowed(me.computer); notAllowed(me.computer);
} }

View file

@ -31,24 +31,24 @@ var fuelPredInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad"); var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
if (key == "L3" and blockSet.getValue() == 1 and zfwSet.getValue() == 1) { if (key == "L3" and blockSet.getValue() == 1 and zfwSet.getValue() == 1) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/rte-rsv", 0.05 * num(trip_fuel.getValue())); setprop("/FMGC/internal/rte-rsv", 0.05 * num(trip_fuel.getValue()));
setprop("FMGC/internal/rte-percent", 5.0); setprop("/FMGC/internal/rte-percent", 5.0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
fmgc.updateFuel(); fmgc.updateFuel();
} else if (getprop("FMGC/internal/trip-fuel") != 0) { } else if (getprop("/FMGC/internal/trip-fuel") != 0) {
var tf = num(scratchpad); var tf = num(scratchpad);
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs >= 2 and tfs <= 5 and find("/", scratchpad) == 0) { if (tfs >= 2 and tfs <= 5 and find("/", scratchpad) == 0) {
var perc = num(split("/", scratchpad)[1]); var perc = num(split("/", scratchpad)[1]);
if (perc != nil and perc >= 0.0 and perc <= 15.0) { if (perc != nil and perc >= 0.0 and perc <= 15.0) {
setprop("FMGC/internal/rte-rsv", num(perc) / 100 * num(trip_fuel.getValue())); setprop("/FMGC/internal/rte-rsv", num(perc) / 100 * num(trip_fuel.getValue()));
setprop("FMGC/internal/rte-percent", perc); setprop("/FMGC/internal/rte-percent", perc);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} }
} else if (tfs >= 1 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 21.7 and tf / num(trip_fuel.getValue()) <= 0.15) { } else if (tfs >= 1 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 21.7 and tf / num(trip_fuel.getValue()) <= 0.15) {
setprop("FMGC/internal/rte-rsv", scratchpad); setprop("/FMGC/internal/rte-rsv", scratchpad);
setprop("FMGC/internal/rte-percent", scratchpad / num(trip_fuel.getValue()) * 100); setprop("/FMGC/internal/rte-percent", scratchpad / num(trip_fuel.getValue()) * 100);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
@ -58,8 +58,8 @@ var fuelPredInput = func(key, i) {
} }
} else if (key == "L4" and blockSet.getValue() == 1 and zfwSet.getValue() == 1) { } else if (key == "L4" and blockSet.getValue() == 1 and zfwSet.getValue() == 1) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/alt-fuel", 0.0); setprop("/FMGC/internal/alt-fuel", 0.0);
setprop("FMGC/internal/alt-time", "0000"); setprop("/FMGC/internal/alt-time", "0000");
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
fmgc.updateFuel(); fmgc.updateFuel();
@ -67,7 +67,7 @@ var fuelPredInput = func(key, i) {
var tf = num(scratchpad); var tf = num(scratchpad);
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0 and tf < trip_fuel.getValue() + alt_fuel.getValue()) { if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0 and tf < trip_fuel.getValue() + alt_fuel.getValue()) {
setprop("FMGC/internal/alt-fuel", tf); setprop("/FMGC/internal/alt-fuel", tf);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
fmgc.updateFuel(); fmgc.updateFuel();
} else { } else {
@ -77,7 +77,7 @@ var fuelPredInput = func(key, i) {
var tf = num(scratchpad); var tf = num(scratchpad);
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs == 4 and tf != nil and ((tf >= 0 and tf <= 59) or (tf >= 100 and tf <= 130))) { if (tfs == 4 and tf != nil and ((tf >= 0 and tf <= 59) or (tf >= 100 and tf <= 130))) {
setprop("FMGC/internal/alt-time", scratchpad); setprop("/FMGC/internal/alt-time", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
@ -85,8 +85,8 @@ var fuelPredInput = func(key, i) {
} }
} else if (key == "L5" and blockSet.getValue() == 1 and zfwSet.getValue() == 1) { } else if (key == "L5" and blockSet.getValue() == 1 and zfwSet.getValue() == 1) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/final-fuel", 0.0); setprop("/FMGC/internal/final-fuel", 0.0);
setprop("FMGC/internal/final-time", "0030"); setprop("/FMGC/internal/final-time", "0030");
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
fmgc.updateFuel(); fmgc.updateFuel();
@ -94,7 +94,7 @@ var fuelPredInput = func(key, i) {
var tf = num(scratchpad); var tf = num(scratchpad);
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0 and tf < trip_fuel.getValue() + final_fuel.getValue()) { if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0 and tf < trip_fuel.getValue() + final_fuel.getValue()) {
setprop("FMGC/internal/final-fuel", tf); setprop("/FMGC/internal/final-fuel", tf);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
fmgc.updateFuel(); fmgc.updateFuel();
} else { } else {
@ -104,7 +104,7 @@ var fuelPredInput = func(key, i) {
var tf = num(scratchpad); var tf = num(scratchpad);
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs == 4 and tf != nil and ((tf >= 0 and tf <= 59) or (tf >= 100 and tf <= 130))) { if (tfs == 4 and tf != nil and ((tf >= 0 and tf <= 59) or (tf >= 100 and tf <= 130))) {
setprop("FMGC/internal/final-time", scratchpad); setprop("/FMGC/internal/final-time", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
@ -125,19 +125,19 @@ var fuelPredInput = func(key, i) {
var zfwcgs = size(zfwi[0]); var zfwcgs = size(zfwi[0]);
var zfws = size(zfwi[1]); var zfws = size(zfwi[1]);
if (zfwcg != nil and zfwcgs >= 1 and zfwcgs <= 5 and zfwcg > 0 and zfwcg <= 99.9) { if (zfwcg != nil and zfwcgs >= 1 and zfwcgs <= 5 and zfwcg > 0 and zfwcg <= 99.9) {
setprop("FMGC/internal/zfwcg", zfwcg); setprop("/FMGC/internal/zfwcg", zfwcg);
setprop("FMGC/internal/zfwcg-set", 1); setprop("/FMGC/internal/zfwcg-set", 1);
if (getprop("FMGC/internal/block-set") != 1) { if (getprop("/FMGC/internal/block-set") != 1) {
setprop("FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000)); setprop("/FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000));
setprop("FMGC/internal/block-set", 1); setprop("/FMGC/internal/block-set", 1);
} }
} }
if (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9) { if (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9) {
setprop("FMGC/internal/zfw", zfw); setprop("/FMGC/internal/zfw", zfw);
setprop("FMGC/internal/zfw-set", 1); setprop("/FMGC/internal/zfw-set", 1);
if (getprop("FMGC/internal/block-set") != 1) { if (getprop("/FMGC/internal/block-set") != 1) {
setprop("FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000)); setprop("/FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000));
setprop("FMGC/internal/block-set", 1); setprop("/FMGC/internal/block-set", 1);
} }
} }
if ((zfwcg != nil and zfwcgs >= 1 and zfwcgs <= 5 and zfwcg > 0 and zfwcg <= 99.9) or (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9)) { if ((zfwcg != nil and zfwcgs >= 1 and zfwcgs <= 5 and zfwcg > 0 and zfwcg <= 99.9) or (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9)) {
@ -148,11 +148,11 @@ var fuelPredInput = func(key, i) {
} else if (tfs >= 1 and tfs <= 5) { } else if (tfs >= 1 and tfs <= 5) {
var zfwcg = size(scratchpad); var zfwcg = size(scratchpad);
if (num(scratchpad) != nil and zfwcg >= 1 and zfwcg <= 5 and scratchpad > 0 and scratchpad <= 99.9) { if (num(scratchpad) != nil and zfwcg >= 1 and zfwcg <= 5 and scratchpad > 0 and scratchpad <= 99.9) {
setprop("FMGC/internal/zfwcg", scratchpad); setprop("/FMGC/internal/zfwcg", scratchpad);
setprop("FMGC/internal/zfwcg-set", 1); setprop("/FMGC/internal/zfwcg-set", 1);
if (getprop("FMGC/internal/block-set") != 1) { if (getprop("/FMGC/internal/block-set") != 1) {
setprop("FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000)); setprop("/FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000));
setprop("FMGC/internal/block-set", 1); setprop("/FMGC/internal/block-set", 1);
} }
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
@ -164,13 +164,13 @@ var fuelPredInput = func(key, i) {
} }
} else if (key == "R4") { } else if (key == "R4") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/fffq-sensor", "FF+FQ"); setprop("/FMGC/internal/fffq-sensor", "FF+FQ");
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else if (find("/", scratchpad) == 0) { } else if (find("/", scratchpad) == 0) {
var sensor = substr(scratchpad, 1); var sensor = substr(scratchpad, 1);
if (sensor == "FF+FQ" or sensor == "FQ+FF" or sensor == "FF" or sensor == "FQ") { if (sensor == "FF+FQ" or sensor == "FQ+FF" or sensor == "FF" or sensor == "FQ") {
setprop("FMGC/internal/fffq-sensor", sensor); setprop("/FMGC/internal/fffq-sensor", sensor);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);

View file

@ -7,22 +7,30 @@ var initInputA = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad"); var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
if (key == "L2") { if (key == "L2") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/alt-airport", ""); setprop("/FMGC/internal/alt-airport", "");
setprop("FMGC/internal/alt-set", 0); setprop("/FMGC/internal/alt-set", 0);
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
}
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
fmgc.updateARPT(); fmgc.updateARPT();
#} else if (scratchpad == "") { #} else if (scratchpad == "") {
#setprop("FMGC/internal/alt-selected", 1); #setprop("/FMGC/internal/alt-selected", 1);
#setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION"); #setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION");
} else if (getprop("FMGC/internal/tofrom-set") == 1) { } else if (getprop("/FMGC/internal/tofrom-set") == 1) {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs == 4) { if (tfs == 4) {
setprop("FMGC/internal/alt-airport", scratchpad); setprop("/FMGC/internal/alt-airport", scratchpad);
setprop("FMGC/internal/alt-set", 1); setprop("/FMGC/internal/alt-set", 1);
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
}
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
fmgc.updateARPT(); fmgc.updateARPT();
#setprop("FMGC/internal/alt-selected", 1); #setprop("/FMGC/internal/alt-selected", 1);
#setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION"); #setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION");
} else { } else {
notAllowed(i); notAllowed(i);
@ -48,8 +56,8 @@ var initInputA = func(key, i) {
} }
} else if (key == "L5") { } else if (key == "L5") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/cost-index", 0); setprop("/FMGC/internal/cost-index", 0);
setprop("FMGC/internal/cost-index-set", 0); setprop("/FMGC/internal/cost-index-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
@ -57,8 +65,8 @@ var initInputA = func(key, i) {
var cis = size(scratchpad); var cis = size(scratchpad);
if (cis >= 1 and cis <= 3) { if (cis >= 1 and cis <= 3) {
if (ci != nil and ci >= 0 and ci <= 999) { if (ci != nil and ci >= 0 and ci <= 999) {
setprop("FMGC/internal/cost-index", ci); setprop("/FMGC/internal/cost-index", ci);
setprop("FMGC/internal/cost-index-set", 1); setprop("/FMGC/internal/cost-index-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
@ -69,11 +77,15 @@ var initInputA = func(key, i) {
} }
} else if (key == "L6") { } else if (key == "L6") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/cruise-ft", 10000); setprop("/FMGC/internal/cruise-ft", 10000);
setprop("FMGC/internal/cruise-fl", 100); setprop("/FMGC/internal/cruise-fl", 100);
setprop("FMGC/internal/cruise-lvl-set", 0); setprop("/FMGC/internal/cruise-lvl-set", 0);
setprop("FMGC/internal/cruise-temp", 15); setprop("/FMGC/internal/cruise-temp", 15);
setprop("FMGC/internal/cruise-temp-set", 0); setprop("/FMGC/internal/cruise-temp-set", 0);
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
}
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else if (find("/", scratchpad) != -1) { } else if (find("/", scratchpad) != -1) {
@ -87,21 +99,25 @@ var initInputA = func(key, i) {
} }
var temp = int(crztemp[1]); var temp = int(crztemp[1]);
var temps = size(crztemp[1]); var temps = size(crztemp[1]);
if (crzs == 0 and temps >= 1 and temps <= 3 and temp != nil and getprop("FMGC/internal/cruise-lvl-set")) { if (crzs == 0 and temps >= 1 and temps <= 3 and temp != nil and getprop("/FMGC/internal/cruise-lvl-set")) {
if (temp >= -99 and temp <= 99) { if (temp >= -99 and temp <= 99) {
setprop("FMGC/internal/cruise-temp", temp); setprop("/FMGC/internal/cruise-temp", temp);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
} }
} else if (crzs >= 1 and crzs <= 3 and crz != nil and temps >= 1 and temps <= 3 and temp != nil) { } else if (crzs >= 1 and crzs <= 3 and crz != nil and temps >= 1 and temps <= 3 and temp != nil) {
if (crz > 0 and crz <= 390 and temp >= -99 and temp <= 99) { if (crz > 0 and crz <= 390 and temp >= -99 and temp <= 99) {
setprop("FMGC/internal/cruise-ft", crz * 100); setprop("/FMGC/internal/cruise-ft", crz * 100);
setprop("FMGC/internal/cruise-fl", crz); setprop("/FMGC/internal/cruise-fl", crz);
setprop("FMGC/internal/cruise-fl-prog", crz); setprop("/FMGC/internal/cruise-fl-prog", crz);
setprop("FMGC/internal/cruise-lvl-set", 1); setprop("/FMGC/internal/cruise-lvl-set", 1);
setprop("FMGC/internal/cruise-temp", temp); if (getprop("/FMGC/internal/block-confirmed")) {
setprop("FMGC/internal/cruise-temp-set", 1); setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
}
setprop("/FMGC/internal/cruise-temp", temp);
setprop("/FMGC/internal/cruise-temp-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
@ -119,10 +135,14 @@ var initInputA = func(key, i) {
} }
if (crzs >= 1 and crzs <= 3 and crz != nil) { if (crzs >= 1 and crzs <= 3 and crz != nil) {
if (crz > 0 and crz <= 390) { if (crz > 0 and crz <= 390) {
setprop("FMGC/internal/cruise-ft", crz * 100); setprop("/FMGC/internal/cruise-ft", crz * 100);
setprop("FMGC/internal/cruise-fl", crz); setprop("/FMGC/internal/cruise-fl", crz);
setprop("FMGC/internal/cruise-fl-prog", crz); setprop("/FMGC/internal/cruise-fl-prog", crz);
setprop("FMGC/internal/cruise-lvl-set", 1); setprop("/FMGC/internal/cruise-lvl-set", 1);
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
}
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
@ -133,18 +153,22 @@ var initInputA = func(key, i) {
} }
} else if (key == "R1") { } else if (key == "R1") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/dep-arpt", ""); setprop("/FMGC/internal/dep-arpt", "");
setprop("FMGC/internal/arr-arpt", ""); setprop("/FMGC/internal/arr-arpt", "");
setprop("FMGC/internal/tofrom-set", 0); setprop("/FMGC/internal/tofrom-set", 0);
setprop("FMGC/internal/align-ref-lat", 0); setprop("/FMGC/internal/align-ref-lat", 0);
setprop("FMGC/internal/align-ref-long", 0); setprop("/FMGC/internal/align-ref-long", 0);
setprop("FMGC/internal/align-ref-lat-edit", 0); setprop("/FMGC/internal/align-ref-lat-edit", 0);
setprop("FMGC/internal/align-ref-long-edit", 0); setprop("/FMGC/internal/align-ref-long-edit", 0);
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
}
fmgc.flightPlanController.reset(); fmgc.flightPlanController.reset();
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
#} else if (scratchpad == "") { #} else if (scratchpad == "") {
#setprop("FMGC/internal/alt-selected", 0); #setprop("/FMGC/internal/alt-selected", 0);
#setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION"); #setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION");
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
@ -154,32 +178,32 @@ var initInputA = func(key, i) {
var tos = size(fromto[1]); var tos = size(fromto[1]);
if (froms == 4 and tos == 4) { if (froms == 4 and tos == 4) {
#route #route
setprop("FMGC/internal/dep-arpt", fromto[0]); setprop("/FMGC/internal/dep-arpt", fromto[0]);
setprop("FMGC/internal/arr-arpt", fromto[1]); setprop("/FMGC/internal/arr-arpt", fromto[1]);
setprop("FMGC/internal/tofrom-set", 1); setprop("/FMGC/internal/tofrom-set", 1);
#scratchpad #scratchpad
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
fmgc.flightPlanController.updateAirports(fromto[0], fromto[1], 2); fmgc.flightPlanController.updateAirports(fromto[0], fromto[1], 2);
setprop("FMGC/internal/alt-selected", 0); setprop("/FMGC/internal/alt-selected", 0);
#ref lat #ref lat
dms = getprop("FMGC/flightplan[2]/wp[0]/lat"); dms = getprop("/FMGC/flightplan[2]/wp[0]/lat");
degrees = int(dms); degrees = int(dms);
minutes = sprintf("%.1f",abs((dms - degrees) * 60)); minutes = sprintf("%.1f",abs((dms - degrees) * 60));
sign = degrees >= 0 ? "N" : "S"; sign = degrees >= 0 ? "N" : "S";
setprop("FMGC/internal/align-ref-lat-degrees", degrees); setprop("/FMGC/internal/align-ref-lat-degrees", degrees);
setprop("FMGC/internal/align-ref-lat-minutes", minutes); setprop("/FMGC/internal/align-ref-lat-minutes", minutes);
setprop("FMGC/internal/align-ref-lat-sign", sign); setprop("/FMGC/internal/align-ref-lat-sign", sign);
#ref long #ref long
dms = getprop("FMGC/flightplan[2]/wp[0]/lon"); dms = getprop("/FMGC/flightplan[2]/wp[0]/lon");
degrees = int(dms); degrees = int(dms);
minutes = sprintf("%.1f",abs((dms - degrees) * 60)); minutes = sprintf("%.1f",abs((dms - degrees) * 60));
sign = degrees >= 0 ? "E" : "W"; sign = degrees >= 0 ? "E" : "W";
setprop("FMGC/internal/align-ref-long-degrees", degrees); setprop("/FMGC/internal/align-ref-long-degrees", degrees);
setprop("FMGC/internal/align-ref-long-minutes", minutes); setprop("/FMGC/internal/align-ref-long-minutes", minutes);
setprop("FMGC/internal/align-ref-long-sign", sign); setprop("/FMGC/internal/align-ref-long-sign", sign);
#ref edit #ref edit
setprop("FMGC/internal/align-ref-lat-edit", 0); setprop("/FMGC/internal/align-ref-lat-edit", 0);
setprop("FMGC/internal/align-ref-long-edit", 0); setprop("/FMGC/internal/align-ref-long-edit", 0);
#setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION"); #setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION");
} else { } else {
notAllowed(i); notAllowed(i);
@ -192,15 +216,15 @@ var initInputA = func(key, i) {
setprop("MCDU[" ~ i ~ "]/page", "IRSINIT"); setprop("MCDU[" ~ i ~ "]/page", "IRSINIT");
} else if (key == "R5") { } else if (key == "R5") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/tropo", 36090); setprop("/FMGC/internal/tropo", 36090);
setprop("FMGC/internal/tropo-set", 0); setprop("/FMGC/internal/tropo-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
var tropo = size(scratchpad); var tropo = size(scratchpad);
if (tropo == 5 and scratchpad <= 99990) { if (tropo == 5 and scratchpad <= 99990) {
setprop("FMGC/internal/tropo-set", 1); setprop("/FMGC/internal/tropo-set", 1);
setprop("FMGC/internal/tropo", scratchpad); setprop("/FMGC/internal/tropo", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
@ -208,12 +232,12 @@ var initInputA = func(key, i) {
} }
} else if (key == "R6") { } else if (key == "R6") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/gndtemp-set", 0); setprop("/FMGC/internal/gndtemp-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else if (int(scratchpad) != nil and getprop("FMGC/status/phase") == 0 and size(scratchpad) >= 1 and size(scratchpad) <= 3 and scratchpad >= -99 and scratchpad <= 99) { } else if (int(scratchpad) != nil and getprop("/FMGC/status/phase") == 0 and size(scratchpad) >= 1 and size(scratchpad) <= 3 and scratchpad >= -99 and scratchpad <= 99) {
setprop("FMGC/internal/gndtemp", scratchpad); setprop("/FMGC/internal/gndtemp", scratchpad);
setprop("FMGC/internal/gndtemp-set", 1); setprop("/FMGC/internal/gndtemp-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);

View file

@ -2,41 +2,25 @@
# Copyright (c) 2020 Matthew Maring (mattmaring) # Copyright (c) 2020 Matthew Maring (mattmaring)
var zfwcg = props.globals.getNode("FMGC/internal/zfwcg", 1);
var zfwcgSet = props.globals.getNode("FMGC/internal/zfwcg-set", 1);
var zfw = props.globals.getNode("FMGC/internal/zfw", 1);
var zfwSet = props.globals.getNode("FMGC/internal/zfw-set", 1);
var block = props.globals.getNode("FMGC/internal/block", 1);
var blockSet = props.globals.getNode("FMGC/internal/block-set", 1);
var taxi_fuel = props.globals.getNode("FMGC/internal/taxi-fuel", 1);
var trip_fuel = props.globals.getNode("FMGC/internal/trip-fuel", 1);
var trip_time = props.globals.getNode("FMGC/internal/trip-time", 1);
var rte_rsv = props.globals.getNode("FMGC/internal/rte-rsv", 1);
var rte_percent = props.globals.getNode("FMGC/internal/rte-percent", 1);
var alt_fuel = props.globals.getNode("FMGC/internal/alt-fuel", 1);
var alt_time = props.globals.getNode("FMGC/internal/alt-time", 1);
var final_fuel = props.globals.getNode("FMGC/internal/final-fuel", 1);
var final_time = props.globals.getNode("FMGC/internal/final-time", 1);
var min_dest_fob = props.globals.getNode("FMGC/internal/min-dest-fob", 1);
var tow = props.globals.getNode("FMGC/internal/tow", 1);
var lw = props.globals.getNode("FMGC/internal/lw", 1);
var trip_wind = props.globals.getNode("FMGC/internal/trip-wind", 1);
var extra_fuel = props.globals.getNode("FMGC/internal/extra-fuel", 1);
var extra_time = props.globals.getNode("FMGC/internal/extra-time", 1);
var initInputB = func(key, i) { var initInputB = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad"); var scratchpad = getprop("/MCDU[" ~ i ~ "]/scratchpad");
if (key == "L1") { if (key == "L1" and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/taxi-fuel", 0.4); setprop("/FMGC/internal/taxi-fuel", 0.4);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("/FMGC/internal/taxi-fuel-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 1);
}
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs >= 1 and tfs <= 4) { if (tfs >= 1 and tfs <= 4) {
if (num(scratchpad) != nil and scratchpad >= 0.0 and scratchpad <= 9.9) { if (num(scratchpad) != nil and scratchpad >= 0.0 and scratchpad <= 9.9) {
setprop("FMGC/internal/taxi-fuel", scratchpad); setprop("/FMGC/internal/taxi-fuel", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("/FMGC/internal/taxi-fuel-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
fmgc.updateFuel(); fmgc.updateFuel();
} else { } else {
notAllowed(i); notAllowed(i);
@ -45,72 +29,75 @@ var initInputB = func(key, i) {
notAllowed(i); notAllowed(i);
} }
} }
# } } else if (key == "L3" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) {
# else if (key == "L2") {
# if (scratchpad == "CLR") {
# notAllowed(i);
# } else if (getprop("FMGC/internal/trip-fuel") != 0) {
# var tfs = size(scratchpad);
# if (tfs >= 1 and tfs <= 4) {
# var temp_rte = num(scratchpad * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100));
# if (scratchpad >= 0.0 and scratchpad <= block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - temp_rte) {
# setprop("FMGC/internal/trip-fuel", scratchpad);
# setprop("MCDU[" ~ i ~ "]/scratchpad", "");
#
# setprop("FMGC/internal/rte-rsv", temp_rte);
# setprop("FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue()));
# setprop("FMGC/internal/lw", num(tow.getValue() - trip_fuel.getValue()));
# } else {
# notAllowed(i);
# }
# } else {
# notAllowed(i);
# }
# } else {
# notAllowed(i);
# }
#
} else if (key == "L3" and blockSet.getValue() == 1 and zfwSet.getValue() == 1) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/rte-rsv", 0.05 * num(trip_fuel.getValue())); setprop("/FMGC/internal/rte-rsv", 0.05 * num(getprop("/FMGC/internal/trip-fuel")));
setprop("FMGC/internal/rte-percent", 5.0); setprop("/FMGC/internal/rte-percent", 5.0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("/FMGC/internal/fuel-calculating", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
fmgc.updateFuel(); setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else if (getprop("FMGC/internal/trip-fuel") != 0) { } else if (getprop("/FMGC/internal/trip-fuel") != 0) {
var tf = num(scratchpad); var tf = num(scratchpad);
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs >= 2 and tfs <= 5 and find("/", scratchpad) == 0) { if (tfs >= 2 and tfs <= 5 and find("/", scratchpad) == 0) {
var perc = num(split("/", scratchpad)[1]); var perc = num(split("/", scratchpad)[1]);
if (perc != nil and perc >= 0.0 and perc <= 15.0) { if (perc != nil and perc >= 0.0 and perc <= 15.0) {
setprop("FMGC/internal/rte-rsv", num(perc) / 100 * num(trip_fuel.getValue())); setprop("/FMGC/internal/rte-rsv", num(perc) / 100 * num(getprop("/FMGC/internal/trip-fuel")));
setprop("FMGC/internal/rte-percent", perc); setprop("/FMGC/internal/rte-percent", perc);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} }
} else if (tfs >= 1 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 21.7 and tf / num(trip_fuel.getValue()) <= 0.15) { } else if (tfs >= 1 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 21.7 and tf / num(getprop("/FMGC/internal/trip-fuel")) <= 0.15) {
setprop("FMGC/internal/rte-rsv", scratchpad); setprop("/FMGC/internal/rte-rsv", scratchpad);
setprop("FMGC/internal/rte-percent", scratchpad / num(trip_fuel.getValue()) * 100); setprop("/FMGC/internal/rte-percent", scratchpad / num(getprop("/FMGC/internal/trip-fuel")) * 100);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
} }
} else { } else {
notAllowed(i); notAllowed(i);
} }
} else if (key == "L4" and blockSet.getValue() == 1 and zfwSet.getValue() == 1) { } else if (key == "L4" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/alt-fuel", 0.0); setprop("/FMGC/internal/alt-fuel", 0.0);
setprop("FMGC/internal/alt-time", "0000"); setprop("/FMGC/internal/alt-time", "0000");
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("/FMGC/internal/alt-fuel-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("/FMGC/internal/fuel-calculating", 1);
fmgc.updateFuel(); setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else if (find(".", scratchpad) != -1) { } else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad); var tf = num(scratchpad);
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0 and tf < trip_fuel.getValue() + alt_fuel.getValue()) { if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0) {
setprop("FMGC/internal/alt-fuel", tf); setprop("/FMGC/internal/alt-fuel", tf);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("/FMGC/internal/alt-time", "0000");
fmgc.updateFuel(); setprop("/FMGC/internal/alt-fuel-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else {
notAllowed(i);
}
} else {
notAllowed(i);
}
} else if (key == "L5" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/final-fuel", 0.0);
setprop("/FMGC/internal/final-time", "0030");
setprop("/FMGC/internal/final-fuel-set", 0);
setprop("/FMGC/internal/final-time-set", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0) {
setprop("/FMGC/internal/final-fuel", tf);
setprop("/FMGC/internal/final-fuel-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -118,47 +105,22 @@ var initInputB = func(key, i) {
var tf = num(scratchpad); var tf = num(scratchpad);
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs == 4 and tf != nil and ((tf >= 0 and tf <= 59) or (tf >= 100 and tf <= 130))) { if (tfs == 4 and tf != nil and ((tf >= 0 and tf <= 59) or (tf >= 100 and tf <= 130))) {
setprop("FMGC/internal/alt-time", scratchpad); setprop("/FMGC/internal/final-time", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("/FMGC/internal/final-time-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
} }
} }
} else if (key == "L5" and blockSet.getValue() == 1 and zfwSet.getValue() == 1) { } else if (key == "R1" and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") {
setprop("FMGC/internal/final-fuel", 0.0);
setprop("FMGC/internal/final-time", "0030");
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
fmgc.updateFuel();
} else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0 and tf < trip_fuel.getValue() + final_fuel.getValue()) {
setprop("FMGC/internal/final-fuel", tf);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
fmgc.updateFuel();
} else {
notAllowed(i);
}
} else {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs == 4 and tf != nil and ((tf >= 0 and tf <= 59) or (tf >= 100 and tf <= 130))) {
setprop("FMGC/internal/final-time", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else {
notAllowed(i);
}
}
} else if (key == "R1") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
notAllowed(i); notAllowed(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs == 0) { if (tfs == 0) {
var zfw = getprop("fdm/jsbsim/inertia/weight-lbs") - getprop("consumables/fuel/total-fuel-lbs"); var zfw = getprop("/fdm/jsbsim/inertia/weight-lbs") - getprop("/consumables/fuel/total-fuel-lbs");
setprop("MCDU[" ~ i ~ "]/scratchpad", "/" ~ sprintf("%3.1f", math.round(zfw / 1000, 0.1))); setprop("/MCDU[" ~ i ~ "]/scratchpad", "/" ~ sprintf("%3.1f", math.round(zfw / 1000, 0.1)));
} else if (tfs >= 2 and tfs <= 11 and find("/", scratchpad) != -1) { } else if (tfs >= 2 and tfs <= 11 and find("/", scratchpad) != -1) {
var zfwi = split("/", scratchpad); var zfwi = split("/", scratchpad);
var zfwcg = num(zfwi[0]); var zfwcg = num(zfwi[0]);
@ -166,24 +128,27 @@ var initInputB = func(key, i) {
var zfwcgs = size(zfwi[0]); var zfwcgs = size(zfwi[0]);
var zfws = size(zfwi[1]); var zfws = size(zfwi[1]);
if (zfwcg != nil and zfwcgs >= 1 and zfwcgs <= 5 and zfwcg > 0 and zfwcg <= 99.9) { if (zfwcg != nil and zfwcgs >= 1 and zfwcgs <= 5 and zfwcg > 0 and zfwcg <= 99.9) {
setprop("FMGC/internal/zfwcg", zfwi[0]); setprop("/FMGC/internal/zfwcg", zfwi[0]);
setprop("FMGC/internal/zfwcg-set", 1); setprop("/FMGC/internal/zfwcg-set", 1);
} }
if (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9) { if (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9) {
setprop("FMGC/internal/zfw", zfwi[1]); setprop("/FMGC/internal/zfw", zfwi[1]);
setprop("FMGC/internal/zfw-set", 1); setprop("/FMGC/internal/zfw-set", 1);
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 1);
}
} }
if ((zfwcg != nil and zfwcgs >= 1 and zfwcgs <= 5 and zfwcg > 0 and zfwcg <= 99.9) or (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9)) { if ((zfwcg != nil and zfwcgs >= 1 and zfwcgs <= 5 and zfwcg > 0 and zfwcg <= 99.9) or (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9)) {
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
} }
} else if (tfs >= 1 and tfs <= 5) { } else if (tfs >= 1 and tfs <= 5) {
var zfwcg = size(scratchpad); var zfwcg = size(scratchpad);
if (num(scratchpad) != nil and zfwcg >= 1 and zfwcg <= 5 and scratchpad > 0 and scratchpad <= 99.9) { if (num(scratchpad) != nil and zfwcg >= 1 and zfwcg <= 5 and scratchpad > 0 and scratchpad <= 99.9) {
setprop("FMGC/internal/zfwcg", scratchpad); setprop("/FMGC/internal/zfwcg", scratchpad);
setprop("FMGC/internal/zfwcg-set", 1); setprop("/FMGC/internal/zfwcg-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -191,42 +156,23 @@ var initInputB = func(key, i) {
notAllowed(i); notAllowed(i);
} }
} }
} else if (key == "R2") { } else if (key == "R2" and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/block", 0.0); notAllowed(i);
setprop("FMGC/internal/block-set", 0);
setprop("FMGC/internal/taxi-fuel", 0.4);
setprop("FMGC/internal/rte-rsv", 0.05 * num(trip_fuel.getValue()));
setprop("FMGC/internal/rte-percent", 5.0);
setprop("FMGC/internal/alt-fuel", 0.0);
setprop("FMGC/internal/alt-time", "0000");
setprop("FMGC/internal/final-fuel", 0.0);
setprop("FMGC/internal/final-time", "0030");
setprop("FMGC/internal/extra-fuel", 0.0);
setprop("FMGC/internal/extra-time", "0000");
setprop("FMGC/internal/min-dest-fob", 0.0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
var maxblock = getprop("options/maxblock"); var maxblock = getprop("/options/maxblock");
if (tfs == 0) { if (tfs == 0) {
setprop("MCDU[" ~ i ~ "]/scratchpad", sprintf("%3.1f", math.round(getprop("consumables/fuel/total-fuel-lbs") / 1000, 0.1))); setprop("/MCDU[" ~ i ~ "]/scratchpad", sprintf("%3.1f", math.round(getprop("/consumables/fuel/total-fuel-lbs") / 1000, 0.1)));
} else if (tfs >= 1 and tfs <= 5) { } else if (tfs >= 1 and tfs <= 5) {
if (num(scratchpad) != nil and scratchpad >= 1.0 and scratchpad <= maxblock) { if (num(scratchpad) != nil and scratchpad >= 1.0 and scratchpad <= maxblock) {
setprop("FMGC/internal/block", scratchpad); setprop("/FMGC/internal/block", scratchpad);
setprop("FMGC/internal/block-set", 1); setprop("/FMGC/internal/block-set", 1);
setprop("FMGC/internal/taxi-fuel", 0.4); setprop("/FMGC/internal/fuel-request-set", 1);
setprop("FMGC/internal/rte-rsv", 0.05 * num(trip_fuel.getValue())); setprop("/FMGC/internal/fuel-calculating", 1);
setprop("FMGC/internal/rte-percent", 5.0); setprop("/FMGC/internal/block-calculating", 0);
setprop("FMGC/internal/alt-fuel", 0.0); setprop("/FMGC/internal/block-confirmed", 1);
setprop("FMGC/internal/alt-time", "0000"); setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
setprop("FMGC/internal/final-fuel", 0.0);
setprop("FMGC/internal/final-time", "0030");
setprop("FMGC/internal/extra-fuel", 0.0);
setprop("FMGC/internal/extra-time", "0000");
setprop("FMGC/internal/min-dest-fob", 0.0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -235,40 +181,53 @@ var initInputB = func(key, i) {
} }
} }
} else if (key == "R3") { } else if (key == "R3") {
if (scratchpad == "" and (!getprop("FMGC/internal/block-set") or !getprop("FMGC/internal/zfw-set"))) { if (scratchpad == "" and getprop("/FMGC/internal/zfw-set") and !getprop("/FMGC/internal/fuel-request-set")) {
setprop("FMGC/internal/zfw", num((getprop("fdm/jsbsim/inertia/weight-lbs") - getprop("consumables/fuel/total-fuel-lbs")) / 1000)); setprop("/FMGC/internal/fuel-request-set", 1);
setprop("FMGC/internal/zfw-set", 1); setprop("/FMGC/internal/block-calculating", 1);
setprop("FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000)); } else if (getprop("/FMGC/internal/fuel-request-set") and !getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/block-calculating")) {
setprop("FMGC/internal/block-set", 1); setprop("/FMGC/internal/block-confirmed", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
} else { } else {
notAllowed(i); notAllowed(i);
} }
} else if (key == "R5") { } else if (key == "R5" and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/trip-wind", "HD000"); setprop("/FMGC/internal/trip-wind", "HD000");
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); if (getprop("/FMGC/internal/block-confirmed")) {
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("/FMGC/internal/fuel-calculating", 1);
}
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
if (find("TL", scratchpad) != -1 or find("HD", scratchpad) != -1) { if (find("TL", scratchpad) != -1 or find("HD", scratchpad) != -1) {
var effwind = substr(scratchpad, 2); var effwind = substr(scratchpad, 2);
if (int(effwind) != nil and effwind >= 0 and effwind <= 500) { if (int(effwind) != nil and effwind >= 0 and effwind <= 500) {
setprop("FMGC/internal/trip-wind", scratchpad); setprop("/FMGC/internal/trip-wind", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 1);
}
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
} }
} else if (find("-", scratchpad) != -1 or find("+", scratchpad) != -1 or find("T", scratchpad) != -1 or find("H", scratchpad) != -1) { } else if (find("-", scratchpad) != -1 or find("+", scratchpad) != -1 or find("T", scratchpad) != -1 or find("H", scratchpad) != -1) {
var effwind = substr(scratchpad, 1); var effwind = substr(scratchpad, 1);
if (int(effwind) != nil and effwind >= 0 and effwind <= 500) { if (int(effwind) != nil and effwind >= 0 and effwind <= 500) {
setprop("FMGC/internal/trip-wind", scratchpad); setprop("/FMGC/internal/trip-wind", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 1);
}
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
} }
} else { } else {
if (num(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 500) { if (num(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 500) {
setprop("FMGC/internal/trip-wind", scratchpad); setprop("/FMGC/internal/trip-wind", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 1);
}
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
} }

View file

@ -18,154 +18,164 @@ var MCDU_reset = func(i) {
setprop("MCDU[" ~ i ~ "]/scratchpad-color", "wht"); setprop("MCDU[" ~ i ~ "]/scratchpad-color", "wht");
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("FMGC/keyboard-left", 0); setprop("/FMGC/keyboard-left", 0);
setprop("FMGC/keyboard-right", 0); setprop("/FMGC/keyboard-right", 0);
#ACCONFIG #ACCONFIG
setprop("FMGC/internal/navdatabase", "01JAN-28JAN"); setprop("/FMGC/internal/navdatabase", "01JAN-28JAN");
setprop("FMGC/internal/navdatabase2", "29JAN-26FEB"); setprop("/FMGC/internal/navdatabase2", "29JAN-26FEB");
setprop("FMGC/internal/navdatabasecode", "AB20170101"); setprop("/FMGC/internal/navdatabasecode", "AB20170101");
setprop("FMGC/internal/navdatabasecode2", "AB20170102"); setprop("/FMGC/internal/navdatabasecode2", "AB20170102");
setprop("FMGC/print/mcdu/page1/L1auto", 0); setprop("/FMGC/print/mcdu/page1/L1auto", 0);
setprop("FMGC/print/mcdu/page1/L2auto", 0); setprop("/FMGC/print/mcdu/page1/L2auto", 0);
setprop("FMGC/print/mcdu/page1/L3auto", 0); setprop("/FMGC/print/mcdu/page1/L3auto", 0);
setprop("FMGC/print/mcdu/page1/R1req", 0); setprop("/FMGC/print/mcdu/page1/R1req", 0);
setprop("FMGC/print/mcdu/page1/R2req", 0); setprop("/FMGC/print/mcdu/page1/R2req", 0);
setprop("FMGC/print/mcdu/page1/R3req", 0); setprop("/FMGC/print/mcdu/page1/R3req", 0);
setprop("FMGC/print/mcdu/page2/L1auto", 0); setprop("/FMGC/print/mcdu/page2/L1auto", 0);
setprop("FMGC/print/mcdu/page2/L2auto", 0); setprop("/FMGC/print/mcdu/page2/L2auto", 0);
setprop("FMGC/print/mcdu/page2/L3auto", 0); setprop("/FMGC/print/mcdu/page2/L3auto", 0);
setprop("FMGC/print/mcdu/page2/L4auto", 0); setprop("/FMGC/print/mcdu/page2/L4auto", 0);
setprop("FMGC/print/mcdu/page2/R1req", 0); setprop("/FMGC/print/mcdu/page2/R1req", 0);
setprop("FMGC/print/mcdu/page2/R2req", 0); setprop("/FMGC/print/mcdu/page2/R2req", 0);
setprop("FMGC/print/mcdu/page2/R3req", 0); setprop("/FMGC/print/mcdu/page2/R3req", 0);
setprop("FMGC/print/mcdu/page2/R4req", 0); setprop("/FMGC/print/mcdu/page2/R4req", 0);
#RADNAV #RADNAV
setprop("FMGC/internal/ils1freq-set", 0); setprop("/FMGC/internal/ils1freq-set", 0);
setprop("FMGC/internal/ils1crs-set", 0); setprop("/FMGC/internal/ils1crs-set", 0);
setprop("FMGC/internal/ils1freq-calculated", 0); setprop("/FMGC/internal/ils1freq-calculated", 0);
setprop("FMGC/internal/vor1freq-set", 0); setprop("/FMGC/internal/vor1freq-set", 0);
setprop("FMGC/internal/vor1crs-set", 0); setprop("/FMGC/internal/vor1crs-set", 0);
setprop("FMGC/internal/vor2freq-set", 0); setprop("/FMGC/internal/vor2freq-set", 0);
setprop("FMGC/internal/vor2crs-set", 0); setprop("/FMGC/internal/vor2crs-set", 0);
setprop("FMGC/internal/adf1freq-set", 0); setprop("/FMGC/internal/adf1freq-set", 0);
setprop("FMGC/internal/adf2freq-set", 0); setprop("/FMGC/internal/adf2freq-set", 0);
# INT-A # INT-A
setprop("MCDUC/flight-num", ""); setprop("MCDUC/flight-num", "");
setprop("MCDUC/flight-num-set", 0); setprop("MCDUC/flight-num-set", 0);
setprop("FMGC/internal/dep-arpt", ""); setprop("/FMGC/internal/dep-arpt", "");
setprop("FMGC/internal/arr-arpt", ""); setprop("/FMGC/internal/arr-arpt", "");
setprop("FMGC/internal/tofrom-set", 0); setprop("/FMGC/internal/tofrom-set", 0);
setprop("FMGC/internal/alt-airport", ""); setprop("/FMGC/internal/alt-airport", "");
setprop("FMGC/internal/alt-set", 0); setprop("/FMGC/internal/alt-set", 0);
setprop("FMGC/internal/cost-index", "0"); setprop("/FMGC/internal/cost-index", "0");
setprop("FMGC/internal/cost-index-set", 0); setprop("/FMGC/internal/cost-index-set", 0);
setprop("FMGC/internal/cruise-ft", 10000); setprop("/FMGC/internal/cruise-ft", 10000);
setprop("FMGC/internal/cruise-fl", 100); setprop("/FMGC/internal/cruise-fl", 100);
setprop("FMGC/internal/cruise-lvl-set", 0); setprop("/FMGC/internal/cruise-lvl-set", 0);
setprop("FMGC/internal/tropo", 36090); setprop("/FMGC/internal/tropo", 36090);
setprop("FMGC/internal/tropo-set", 0); setprop("/FMGC/internal/tropo-set", 0);
setprop("FMGC/internal/cruise-temp", 15); setprop("/FMGC/internal/cruise-temp", 15);
setprop("FMGC/internal/cruise-temp-set", 0); setprop("/FMGC/internal/cruise-temp-set", 0);
# IRSINIT # IRSINIT
setprop("FMGC/internal/align-set", 0); setprop("/FMGC/internal/align-set", 0);
setprop("FMGC/internal/align-ref-lat-degrees", 0); setprop("/FMGC/internal/align-ref-lat-degrees", 0);
setprop("FMGC/internal/align-ref-lat-minutes", 0); setprop("/FMGC/internal/align-ref-lat-minutes", 0);
setprop("FMGC/internal/align-ref-lat-sign", ""); setprop("/FMGC/internal/align-ref-lat-sign", "");
setprop("FMGC/internal/align-ref-long-degrees", 0); setprop("/FMGC/internal/align-ref-long-degrees", 0);
setprop("FMGC/internal/align-ref-long-minutes", 0); setprop("/FMGC/internal/align-ref-long-minutes", 0);
setprop("FMGC/internal/align-ref-long-sign", ""); setprop("/FMGC/internal/align-ref-long-sign", "");
setprop("FMGC/internal/align-ref-lat-edit", 0); setprop("/FMGC/internal/align-ref-lat-edit", 0);
setprop("FMGC/internal/align-ref-long-edit", 0); setprop("/FMGC/internal/align-ref-long-edit", 0);
setprop("FMGC/internal/align1-done", 0); setprop("/FMGC/internal/align1-done", 0);
setprop("FMGC/internal/align2-done", 0); setprop("/FMGC/internal/align2-done", 0);
setprop("FMGC/internal/align3-done", 0); setprop("/FMGC/internal/align3-done", 0);
# ROUTE SELECTION # ROUTE SELECTION
setprop("FMGC/internal/alt-selected", 0); setprop("/FMGC/internal/alt-selected", 0);
# INT-B # INT-B
setprop("FMGC/internal/zfw", 0); setprop("/FMGC/internal/zfw", 0);
setprop("FMGC/internal/zfw-set", 0); setprop("/FMGC/internal/zfw-set", 0);
setprop("FMGC/internal/zfwcg", 55.1); setprop("/FMGC/internal/zfwcg", 55.1);
setprop("FMGC/internal/zfwcg-set", 0); setprop("/FMGC/internal/zfwcg-set", 0);
setprop("FMGC/internal/block", 0.0); setprop("/FMGC/internal/block", 0.0);
setprop("FMGC/internal/block-set", 0); setprop("/FMGC/internal/block-set", 0);
setprop("FMGC/internal/taxi-fuel", 0.4); setprop("/FMGC/internal/taxi-fuel", 0.4);
setprop("FMGC/internal/trip-fuel", 0); setprop("/FMGC/internal/taxi-fuel-set", 0);
setprop("FMGC/internal/trip-time", "0000"); setprop("/FMGC/internal/trip-fuel", 0);
setprop("FMGC/internal/rte-rsv", 0); setprop("/FMGC/internal/trip-time", "0000");
setprop("FMGC/internal/rte-percent", 5.0); setprop("/FMGC/internal/rte-rsv", 0);
setprop("FMGC/internal/alt-fuel", 0); setprop("/FMGC/internal/rte-percent", 5.0);
setprop("FMGC/internal/alt-time", "0000"); setprop("/FMGC/internal/rte-set", 0);
setprop("FMGC/internal/final-fuel", 0); setprop("/FMGC/internal/alt-fuel", 0);
setprop("FMGC/internal/final-time", "0030"); setprop("/FMGC/internal/alt-fuel-set", 0);
setprop("FMGC/internal/min-dest-fob", 0); setprop("/FMGC/internal/alt-time", "0000");
setprop("FMGC/internal/tow", 0); setprop("/FMGC/internal/final-fuel", 0);
setprop("FMGC/internal/lw", 0); setprop("/FMGC/internal/final-fuel-set", 0);
setprop("FMGC/internal/trip-wind", "HD000"); setprop("/FMGC/internal/final-time", "0030");
setprop("FMGC/internal/fffq-sensor", "FF+FQ"); setprop("/FMGC/internal/final-time-set", 0);
setprop("FMGC/internal/extra-fuel", 0); setprop("/FMGC/internal/min-dest-fob", 0);
setprop("FMGC/internal/extra-time", "0000"); setprop("/FMGC/internal/min-dest-fob-set", 0);
setprop("/FMGC/internal/tow", 0);
setprop("/FMGC/internal/lw", 0);
setprop("/FMGC/internal/trip-wind", "HD000");
setprop("/FMGC/internal/fffq-sensor", "FF+FQ");
setprop("/FMGC/internal/extra-fuel", 0);
setprop("/FMGC/internal/extra-time", "0000");
setprop("/FMGC/internal/fuel-request-set", 0);
setprop("/FMGC/internal/block-calculating", 0);
setprop("/FMGC/internal/block-confirmed", 0);
setprop("/FMGC/internal/fuel-calculating", 0);
# FUELPRED # FUELPRED
setprop("FMGC/internal/alt-airport", ""); setprop("/FMGC/internal/alt-airport", "");
setprop("FMGC/internal/pri-utc", "0000"); setprop("/FMGC/internal/pri-utc", "0000");
setprop("FMGC/internal/alt-utc", "0000"); setprop("/FMGC/internal/alt-utc", "0000");
setprop("FMGC/internal/pri-efob", 0); setprop("/FMGC/internal/pri-efob", 0);
setprop("FMGC/internal/alt-efob", 0); setprop("/FMGC/internal/alt-efob", 0);
setprop("FMGC/internal/fob", 0); setprop("/FMGC/internal/fob", 0);
setprop("FMGC/internal/gw", 0); setprop("/FMGC/internal/gw", 0);
setprop("FMGC/internal/cg", 0); setprop("/FMGC/internal/cg", 0);
# PROG # PROG
setprop("FMGC/internal/cruise-fl-prog", 100); setprop("/FMGC/internal/cruise-fl-prog", 100);
# PERF # PERF
#PERF TO #PERF TO
setprop("FMGC/internal/v1", 0); setprop("/FMGC/internal/v1", 0);
setprop("FMGC/internal/v1-set", 0); setprop("/FMGC/internal/v1-set", 0);
setprop("FMGC/internal/vr", 0); setprop("/FMGC/internal/vr", 0);
setprop("FMGC/internal/vr-set", 0); setprop("/FMGC/internal/vr-set", 0);
setprop("FMGC/internal/v2", 0); setprop("/FMGC/internal/v2", 0);
setprop("FMGC/internal/v2-set", 0); setprop("/FMGC/internal/v2-set", 0);
setprop("FMGC/internal/accel-agl-ft", "1500"); #eventually set to 1500 above runway setprop("/FMGC/internal/accel-agl-ft", "1500"); #eventually set to 1500 above runway
setprop("MCDUC/thracc-set", 0); setprop("MCDUC/thracc-set", 0);
setprop("FMGC/internal/to-flap", 0); setprop("/FMGC/internal/to-flap", 0);
setprop("FMGC/internal/to-ths", "0.0"); setprop("/FMGC/internal/to-ths", "0.0");
setprop("FMGC/internal/flap-ths-set", 0); setprop("/FMGC/internal/flap-ths-set", 0);
setprop("FMGC/internal/flex", 0); setprop("/FMGC/internal/flex", 0);
setprop("FMGC/internal/flex-set", 0); setprop("/FMGC/internal/flex-set", 0);
setprop("FMGC/internal/eng-out-reduc", "1500"); setprop("/FMGC/internal/eng-out-reduc", "1500");
setprop("MCDUC/reducacc-set", 0); setprop("MCDUC/reducacc-set", 0);
setprop("FMGC/internal/trans-alt", 18000); setprop("/FMGC/internal/trans-alt", 18000);
# CLB PERF # CLB PERF
setprop("FMGC/internal/activate-once", 0); setprop("/FMGC/internal/activate-once", 0);
setprop("FMGC/internal/activate-twice", 0); setprop("/FMGC/internal/activate-twice", 0);
# CRZ PERF # CRZ PERF
# DES PERF # DES PERF
# APPR PERF # APPR PERF
setprop("FMGC/internal/dest-qnh", -1); setprop("/FMGC/internal/dest-qnh", -1);
setprop("FMGC/internal/dest-temp", -999); setprop("/FMGC/internal/dest-temp", -999);
setprop("FMGC/internal/dest-mag", -1); setprop("/FMGC/internal/dest-mag", -1);
setprop("FMGC/internal/dest-wind", -1); setprop("/FMGC/internal/dest-wind", -1);
setprop("FMGC/internal/vapp-speed-set", 0); setprop("/FMGC/internal/vapp-speed-set", 0);
setprop("FMGC/internal/final", ""); setprop("/FMGC/internal/final", "");
setprop("FMGC/internal/baro", 99999); setprop("/FMGC/internal/baro", 99999);
setprop("FMGC/internal/radio", 99999); setprop("/FMGC/internal/radio", 99999);
setprop("FMGC/internal/radio-no", 0); setprop("/FMGC/internal/radio-no", 0);
setprop("FMGC/internal/ldg-elev", 0); setprop("/FMGC/internal/ldg-elev", 0);
setprop("FMGC/internal/ldg-config-3-set", 0); setprop("/FMGC/internal/ldg-config-3-set", 0);
setprop("FMGC/internal/ldg-config-f-set", 1); setprop("/FMGC/internal/ldg-config-f-set", 1);
# GA PERF # GA PERF
} }
@ -244,8 +254,6 @@ var lskbutton = func(btn, i) {
} else if (btn == "2") { } else if (btn == "2") {
if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") { if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") {
initInputA("L2",i); initInputA("L2",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "INITB") {
initInputB("L2",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PERFTO") { } else if (getprop("MCDU[" ~ i ~ "]/page") == "PERFTO") {
perfTOInput("L2",i); perfTOInput("L2",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PERFAPPR") { } else if (getprop("MCDU[" ~ i ~ "]/page") == "PERFAPPR") {
@ -681,33 +689,33 @@ var pagebutton = func(btn, i) {
if (btn == "radnav") { if (btn == "radnav") {
setprop("MCDU[" ~ i ~ "]/page", "RADNAV"); setprop("MCDU[" ~ i ~ "]/page", "RADNAV");
} else if (btn == "prog") { } else if (btn == "prog") {
if (getprop("FMGC/status/phase") == 0 or getprop("FMGC/status/phase") == 1) { if (getprop("/FMGC/status/phase") == 0 or getprop("/FMGC/status/phase") == 1) {
setprop("MCDU[" ~ i ~ "]/page", "PROGTO"); setprop("MCDU[" ~ i ~ "]/page", "PROGTO");
} else if (getprop("FMGC/status/phase") == 2) { } else if (getprop("/FMGC/status/phase") == 2) {
setprop("MCDU[" ~ i ~ "]/page", "PROGCLB"); setprop("MCDU[" ~ i ~ "]/page", "PROGCLB");
} else if (getprop("FMGC/status/phase") == 3) { } else if (getprop("/FMGC/status/phase") == 3) {
setprop("MCDU[" ~ i ~ "]/page", "PROGCRZ"); setprop("MCDU[" ~ i ~ "]/page", "PROGCRZ");
} else if (getprop("FMGC/status/phase") == 4 or getprop("FMGC/status/phase") == 5 or getprop("FMGC/status/phase") == 6) { } else if (getprop("/FMGC/status/phase") == 4 or getprop("/FMGC/status/phase") == 5 or getprop("/FMGC/status/phase") == 6) {
setprop("MCDU[" ~ i ~ "]/page", "PROGDES"); setprop("MCDU[" ~ i ~ "]/page", "PROGDES");
} }
} else if (btn == "perf") { } else if (btn == "perf") {
if (getprop("FMGC/status/phase") == 0 or getprop("FMGC/status/phase") == 1) { if (getprop("/FMGC/status/phase") == 0 or getprop("/FMGC/status/phase") == 1) {
setprop("MCDU[" ~ i ~ "]/page", "PERFTO"); setprop("MCDU[" ~ i ~ "]/page", "PERFTO");
} else if (getprop("FMGC/status/phase") == 2) { } else if (getprop("/FMGC/status/phase") == 2) {
setprop("MCDU[" ~ i ~ "]/page", "PERFCLB"); setprop("MCDU[" ~ i ~ "]/page", "PERFCLB");
} else if (getprop("FMGC/status/phase") == 3) { } else if (getprop("/FMGC/status/phase") == 3) {
setprop("MCDU[" ~ i ~ "]/page", "PERFCRZ"); setprop("MCDU[" ~ i ~ "]/page", "PERFCRZ");
} else if (getprop("FMGC/status/phase") == 4) { } else if (getprop("/FMGC/status/phase") == 4) {
setprop("MCDU[" ~ i ~ "]/page", "PERFDES"); setprop("MCDU[" ~ i ~ "]/page", "PERFDES");
} else if (getprop("FMGC/status/phase") == 5) { } else if (getprop("/FMGC/status/phase") == 5) {
setprop("MCDU[" ~ i ~ "]/page", "PERFAPPR"); setprop("MCDU[" ~ i ~ "]/page", "PERFAPPR");
} else if (getprop("FMGC/status/phase") == 6) { } else if (getprop("/FMGC/status/phase") == 6) {
setprop("MCDU[" ~ i ~ "]/page", "PERFGA"); setprop("MCDU[" ~ i ~ "]/page", "PERFGA");
} else if (getprop("FMGC/status/phase") == 7) { } else if (getprop("/FMGC/status/phase") == 7) {
fmgc.reset_FMGC(); fmgc.reset_FMGC();
} }
} else if (btn == "init") { } else if (btn == "init") {
if (getprop("FMGC/status/phase") == 7) { if (getprop("/FMGC/status/phase") == 7) {
fmgc.reset_FMGC(); fmgc.reset_FMGC();
} }
setprop("MCDU[" ~ i ~ "]/page", "INITA"); setprop("MCDU[" ~ i ~ "]/page", "INITA");

View file

@ -6,8 +6,8 @@ var perfCLBInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad"); var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
if (key == "L2") { if (key == "L2") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/cost-index", 0); setprop("/FMGC/internal/cost-index", 0);
setprop("FMGC/internal/cost-index-set", 0); setprop("/FMGC/internal/cost-index-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
@ -15,8 +15,8 @@ var perfCLBInput = func(key, i) {
var cis = size(scratchpad); var cis = size(scratchpad);
if (cis >= 1 and cis <= 3) { if (cis >= 1 and cis <= 3) {
if (ci != nil and ci >= 0 and ci <= 999) { if (ci != nil and ci >= 0 and ci <= 999) {
setprop("FMGC/internal/cost-index", ci); setprop("/FMGC/internal/cost-index", ci);
setprop("FMGC/internal/cost-index-set", 1); setprop("/FMGC/internal/cost-index-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
@ -26,24 +26,24 @@ var perfCLBInput = func(key, i) {
} }
} }
} else if (key == "L5") { } else if (key == "L5") {
if (getprop("FMGC/status/phase") == 2) { if (getprop("/FMGC/status/phase") == 2) {
setprop("MCDU[" ~ i ~ "]/page", "PERFTO"); setprop("MCDU[" ~ i ~ "]/page", "PERFTO");
} else { } else {
notAllowed(i); notAllowed(i);
} }
} else if (key == "L6") { } else if (key == "L6") {
if (getprop("FMGC/status/phase") == 2) { if (getprop("/FMGC/status/phase") == 2) {
if (getprop("FMGC/internal/activate-once") == 1) { if (getprop("/FMGC/internal/activate-once") == 1) {
if (getprop("FMGC/internal/activate-twice") == 0) { if (getprop("/FMGC/internal/activate-twice") == 0) {
setprop("FMGC/internal/activate-twice", 1); setprop("/FMGC/internal/activate-twice", 1);
setprop("FMGC/status/phase", 5); setprop("/FMGC/status/phase", 5);
setprop("FMGC/internal/decel", 1); setprop("/FMGC/internal/decel", 1);
setprop("MCDU[" ~ i ~ "]/page", "PERFAPPR"); setprop("MCDU[" ~ i ~ "]/page", "PERFAPPR");
} else { } else {
notAllowed(i); notAllowed(i);
} }
} else { } else {
setprop("FMGC/internal/activate-once", 1); setprop("/FMGC/internal/activate-once", 1);
} }
} else { } else {
setprop("MCDU[" ~ i ~ "]/page", "PERFTO"); setprop("MCDU[" ~ i ~ "]/page", "PERFTO");

View file

@ -6,8 +6,8 @@ var perfCRZInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad"); var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
if (key == "L2") { if (key == "L2") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/cost-index", 0); setprop("/FMGC/internal/cost-index", 0);
setprop("FMGC/internal/cost-index-set", 0); setprop("/FMGC/internal/cost-index-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
@ -15,8 +15,8 @@ var perfCRZInput = func(key, i) {
var cis = size(scratchpad); var cis = size(scratchpad);
if (cis >= 1 and cis <= 3) { if (cis >= 1 and cis <= 3) {
if (ci != nil and ci >= 0 and ci <= 999) { if (ci != nil and ci >= 0 and ci <= 999) {
setprop("FMGC/internal/cost-index", ci); setprop("/FMGC/internal/cost-index", ci);
setprop("FMGC/internal/cost-index-set", 1); setprop("/FMGC/internal/cost-index-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
@ -26,18 +26,18 @@ var perfCRZInput = func(key, i) {
} }
} }
} else if (key == "L6") { } else if (key == "L6") {
if (getprop("FMGC/status/phase") == 3) { if (getprop("/FMGC/status/phase") == 3) {
if (getprop("FMGC/internal/activate-once") == 1) { if (getprop("/FMGC/internal/activate-once") == 1) {
if (getprop("FMGC/internal/activate-twice") == 0) { if (getprop("/FMGC/internal/activate-twice") == 0) {
setprop("FMGC/internal/activate-twice", 1); setprop("/FMGC/internal/activate-twice", 1);
setprop("FMGC/status/phase", 5); setprop("/FMGC/status/phase", 5);
setprop("FMGC/internal/decel", 1); setprop("/FMGC/internal/decel", 1);
setprop("MCDU[" ~ i ~ "]/page", "PERFAPPR"); setprop("MCDU[" ~ i ~ "]/page", "PERFAPPR");
} else { } else {
notAllowed(i); notAllowed(i);
} }
} else { } else {
setprop("FMGC/internal/activate-once", 1); setprop("/FMGC/internal/activate-once", 1);
} }
} else { } else {
setprop("MCDU[" ~ i ~ "]/page", "PERFCLB"); setprop("MCDU[" ~ i ~ "]/page", "PERFCLB");

View file

@ -6,8 +6,8 @@ var perfDESInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad"); var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
if (key == "L2") { if (key == "L2") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/cost-index", 0); setprop("/FMGC/internal/cost-index", 0);
setprop("FMGC/internal/cost-index-set", 0); setprop("/FMGC/internal/cost-index-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
@ -15,8 +15,8 @@ var perfDESInput = func(key, i) {
var cis = size(scratchpad); var cis = size(scratchpad);
if (cis >= 1 and cis <= 3) { if (cis >= 1 and cis <= 3) {
if (ci != nil and ci >= 0 and ci <= 999) { if (ci != nil and ci >= 0 and ci <= 999) {
setprop("FMGC/internal/cost-index", ci); setprop("/FMGC/internal/cost-index", ci);
setprop("FMGC/internal/cost-index-set", 1); setprop("/FMGC/internal/cost-index-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
@ -26,18 +26,18 @@ var perfDESInput = func(key, i) {
} }
} }
} else if (key == "L6") { } else if (key == "L6") {
if (getprop("FMGC/status/phase") == 4) { if (getprop("/FMGC/status/phase") == 4) {
if (getprop("FMGC/internal/activate-once") == 1) { if (getprop("/FMGC/internal/activate-once") == 1) {
if (getprop("FMGC/internal/activate-twice") == 0) { if (getprop("/FMGC/internal/activate-twice") == 0) {
setprop("FMGC/internal/activate-twice", 1); setprop("/FMGC/internal/activate-twice", 1);
setprop("FMGC/status/phase", 5); setprop("/FMGC/status/phase", 5);
setprop("FMGC/internal/decel", 1); setprop("/FMGC/internal/decel", 1);
setprop("MCDU[" ~ i ~ "]/page", "PERFAPPR"); setprop("MCDU[" ~ i ~ "]/page", "PERFAPPR");
} else { } else {
notAllowed(i); notAllowed(i);
} }
} else { } else {
setprop("FMGC/internal/activate-once", 1); setprop("/FMGC/internal/activate-once", 1);
} }
} else { } else {
setprop("MCDU[" ~ i ~ "]/page", "PERFCRZ"); setprop("MCDU[" ~ i ~ "]/page", "PERFCRZ");

View file

@ -7,7 +7,7 @@ var perfGAInput = func(key, i) {
if (key == "L5") { if (key == "L5") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("systems/thrust/clbreduc-ft", "1500"); setprop("systems/thrust/clbreduc-ft", "1500");
setprop("FMGC/internal/accel-agl-ft", "1500"); setprop("/FMGC/internal/accel-agl-ft", "1500");
setprop("MCDUC/thracc-set", 0); setprop("MCDUC/thracc-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
@ -19,7 +19,7 @@ var perfGAInput = func(key, i) {
var acc = size(thracc[1]); var acc = size(thracc[1]);
if (int(thrred) != nil and int(acc) != nil and (thrred >= 3 and thrred <= 5) and (acc >= 3 and acc <= 5)) { if (int(thrred) != nil and int(acc) != nil and (thrred >= 3 and thrred <= 5) and (acc >= 3 and acc <= 5)) {
setprop("systems/thrust/clbreduc-ft", thracc[0]); setprop("systems/thrust/clbreduc-ft", thracc[0]);
setprop("FMGC/internal/accel-agl-ft", thracc[1]); setprop("/FMGC/internal/accel-agl-ft", thracc[1]);
setprop("MCDUC/thracc-set", 1); setprop("MCDUC/thracc-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
@ -33,14 +33,14 @@ var perfGAInput = func(key, i) {
setprop("MCDU[" ~ i ~ "]/page", "PERFAPPR"); setprop("MCDU[" ~ i ~ "]/page", "PERFAPPR");
} else if (key == "R5") { } else if (key == "R5") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/eng-out-reduc", "1500"); setprop("/FMGC/internal/eng-out-reduc", "1500");
setprop("MCDUC/reducacc-set", 0); setprop("MCDUC/reducacc-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (int(scratchpad) != nil and tfs >= 3 and tfs <= 5) { if (int(scratchpad) != nil and tfs >= 3 and tfs <= 5) {
setprop("FMGC/internal/eng-out-reduc", scratchpad); setprop("/FMGC/internal/eng-out-reduc", scratchpad);
setprop("MCDUC/reducacc-set", 1); setprop("MCDUC/reducacc-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {

View file

@ -6,18 +6,18 @@
var perfTOInput = func(key, i) { var perfTOInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad"); var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
if (key == "L1") { if (key == "L1") {
if (getprop("FMGC/status/phase") != 1) { if (getprop("/FMGC/status/phase") != 1) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/v1", 0); setprop("/FMGC/internal/v1", 0);
setprop("FMGC/internal/v1-set", 0); setprop("/FMGC/internal/v1-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs == 3) { if (tfs == 3) {
if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 350) { if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 350) {
setprop("FMGC/internal/v1", scratchpad); setprop("/FMGC/internal/v1", scratchpad);
setprop("FMGC/internal/v1-set", 1); setprop("/FMGC/internal/v1-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
@ -30,18 +30,18 @@ var perfTOInput = func(key, i) {
notAllowed(i); notAllowed(i);
} }
} else if (key == "L2") { } else if (key == "L2") {
if (getprop("FMGC/status/phase") != 1) { if (getprop("/FMGC/status/phase") != 1) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/vr", 0); setprop("/FMGC/internal/vr", 0);
setprop("FMGC/internal/vr-set", 0); setprop("/FMGC/internal/vr-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs == 3) { if (tfs == 3) {
if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 350) { if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 350) {
setprop("FMGC/internal/vr", scratchpad); setprop("/FMGC/internal/vr", scratchpad);
setprop("FMGC/internal/vr-set", 1); setprop("/FMGC/internal/vr-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
@ -54,10 +54,10 @@ var perfTOInput = func(key, i) {
notAllowed(i); notAllowed(i);
} }
} else if (key == "L3") { } else if (key == "L3") {
if (getprop("FMGC/status/phase") != 1) { if (getprop("/FMGC/status/phase") != 1) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/v2", 0); setprop("/FMGC/internal/v2", 0);
setprop("FMGC/internal/v2-set", 0); setprop("/FMGC/internal/v2-set", 0);
setprop("it-autoflight/settings/togaspd", 157); setprop("it-autoflight/settings/togaspd", 157);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
@ -65,8 +65,8 @@ var perfTOInput = func(key, i) {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs == 3) { if (tfs == 3) {
if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 350) { if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 350) {
setprop("FMGC/internal/v2", scratchpad); setprop("/FMGC/internal/v2", scratchpad);
setprop("FMGC/internal/v2-set", 1); setprop("/FMGC/internal/v2-set", 1);
setprop("it-autoflight/settings/togaspd", scratchpad); setprop("it-autoflight/settings/togaspd", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
@ -81,13 +81,13 @@ var perfTOInput = func(key, i) {
} }
} else if (key == "L4") { } else if (key == "L4") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/trans-alt", 18000); setprop("/FMGC/internal/trans-alt", 18000);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (int(scratchpad) != nil and (tfs == 4 or tfs <= 5) and scratchpad >= 1000 and scratchpad <= 39000) { if (int(scratchpad) != nil and (tfs == 4 or tfs <= 5) and scratchpad >= 1000 and scratchpad <= 39000) {
setprop("FMGC/internal/trans-alt", int(scratchpad / 10) * 10); setprop("/FMGC/internal/trans-alt", int(scratchpad / 10) * 10);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
@ -96,7 +96,7 @@ var perfTOInput = func(key, i) {
} else if (key == "L5") { } else if (key == "L5") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("systems/thrust/clbreduc-ft", "1500"); setprop("systems/thrust/clbreduc-ft", "1500");
setprop("FMGC/internal/accel-agl-ft", "1500"); setprop("/FMGC/internal/accel-agl-ft", "1500");
setprop("MCDUC/thracc-set", 0); setprop("MCDUC/thracc-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
@ -110,11 +110,11 @@ var perfTOInput = func(key, i) {
var accs = size(acc); var accs = size(acc);
if (int(thrred) != nil and (thrreds >= 3 and thrreds <= 5) and thrred >= 400 and thrred <= 39000 and int(acc) != nil and (accs == 3 or accs == 4 or accs == 5) and acc >= 400 and acc <= 39000) { if (int(thrred) != nil and (thrreds >= 3 and thrreds <= 5) and thrred >= 400 and thrred <= 39000 and int(acc) != nil and (accs == 3 or accs == 4 or accs == 5) and acc >= 400 and acc <= 39000) {
setprop("systems/thrust/clbreduc-ft", int(thrred / 10) * 10); setprop("systems/thrust/clbreduc-ft", int(thrred / 10) * 10);
setprop("FMGC/internal/accel-agl-ft", int(acc / 10) * 10); setprop("/FMGC/internal/accel-agl-ft", int(acc / 10) * 10);
setprop("MCDUC/thracc-set", 1); setprop("MCDUC/thracc-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else if (thrreds == 0 and int(acc) != nil and (accs >= 3 and accs <= 5) and acc >= 400 and acc <= 39000) { } else if (thrreds == 0 and int(acc) != nil and (accs >= 3 and accs <= 5) and acc >= 400 and acc <= 39000) {
setprop("FMGC/internal/accel-agl-ft", int(acc / 10) * 10); setprop("/FMGC/internal/accel-agl-ft", int(acc / 10) * 10);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
@ -128,9 +128,9 @@ var perfTOInput = func(key, i) {
} }
} else if (key == "R3") { } else if (key == "R3") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/to-flap", 0); setprop("/FMGC/internal/to-flap", 0);
setprop("FMGC/internal/to-ths", "0.0"); setprop("/FMGC/internal/to-ths", "0.0");
setprop("FMGC/internal/flap-ths-set", 0); setprop("/FMGC/internal/flap-ths-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
@ -144,42 +144,42 @@ var perfTOInput = func(key, i) {
var trimb = substr(trim, 0, 3); var trimb = substr(trim, 0, 3);
var validtrima = num(trima) != nil and num(trima) >= 0 and num(trima) <= 7.0; var validtrima = num(trima) != nil and num(trima) >= 0 and num(trima) <= 7.0;
var validtrimb = num(trimb) != nil and num(trimb) >= 0 and num(trimb) <= 7.0; var validtrimb = num(trimb) != nil and num(trimb) >= 0 and num(trimb) <= 7.0;
if (flaps == 0 and getprop("FMGC/internal/flap-ths-set")) { if (flaps == 0 and getprop("/FMGC/internal/flap-ths-set")) {
if (trims == 5 and find("DN", trim) != -1 and validtrima) { if (trims == 5 and find("DN", trim) != -1 and validtrima) {
setprop("FMGC/internal/to-ths", -1 * trima); setprop("/FMGC/internal/to-ths", -1 * trima);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else if (trims == 5 and find("DN", trim) != -1 and validtrimb) { } else if (trims == 5 and find("DN", trim) != -1 and validtrimb) {
setprop("FMGC/internal/to-ths", -1 * trimb); setprop("/FMGC/internal/to-ths", -1 * trimb);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else if (trims == 5 and find("UP", trim) != -1 and validtrima) { } else if (trims == 5 and find("UP", trim) != -1 and validtrima) {
setprop("FMGC/internal/to-ths", trima); setprop("/FMGC/internal/to-ths", trima);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else if (trims == 5 and find("UP", trim) != -1 and validtrimb) { } else if (trims == 5 and find("UP", trim) != -1 and validtrimb) {
setprop("FMGC/internal/to-ths", trimb); setprop("/FMGC/internal/to-ths", trimb);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
} }
} else if (flaps == 1 and num(flap) != nil and flap >= 0 and flap <= 3) { } else if (flaps == 1 and num(flap) != nil and flap >= 0 and flap <= 3) {
if (trims == 5 and find("DN", trim) != -1 and validtrima) { if (trims == 5 and find("DN", trim) != -1 and validtrima) {
setprop("FMGC/internal/to-flap", flap); setprop("/FMGC/internal/to-flap", flap);
setprop("FMGC/internal/to-ths", -1 * trima); setprop("/FMGC/internal/to-ths", -1 * trima);
setprop("FMGC/internal/flap-ths-set", 1); setprop("/FMGC/internal/flap-ths-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else if (trims == 5 and find("DN", trim) != -1 and validtrimb) { } else if (trims == 5 and find("DN", trim) != -1 and validtrimb) {
setprop("FMGC/internal/to-flap", flap); setprop("/FMGC/internal/to-flap", flap);
setprop("FMGC/internal/to-ths", -1 * trimb); setprop("/FMGC/internal/to-ths", -1 * trimb);
setprop("FMGC/internal/flap-ths-set", 1); setprop("/FMGC/internal/flap-ths-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else if (trims == 5 and find("UP", trim) != -1 and validtrima) { } else if (trims == 5 and find("UP", trim) != -1 and validtrima) {
setprop("FMGC/internal/to-flap", flap); setprop("/FMGC/internal/to-flap", flap);
setprop("FMGC/internal/to-ths", trima); setprop("/FMGC/internal/to-ths", trima);
setprop("FMGC/internal/flap-ths-set", 1); setprop("/FMGC/internal/flap-ths-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else if (trims == 5 and find("UP", trim) != -1 and validtrimb) { } else if (trims == 5 and find("UP", trim) != -1 and validtrimb) {
setprop("FMGC/internal/to-flap", flap); setprop("/FMGC/internal/to-flap", flap);
setprop("FMGC/internal/to-ths", trimb); setprop("/FMGC/internal/to-ths", trimb);
setprop("FMGC/internal/flap-ths-set", 1); setprop("/FMGC/internal/flap-ths-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
@ -188,9 +188,9 @@ var perfTOInput = func(key, i) {
notAllowed(i); notAllowed(i);
} }
} else if (size(scratchpad) == 1 and num(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 3) { } else if (size(scratchpad) == 1 and num(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 3) {
setprop("FMGC/internal/to-flap", scratchpad); setprop("/FMGC/internal/to-flap", scratchpad);
if (!getprop("FMGC/internal/flap-ths-set")) { if (!getprop("/FMGC/internal/flap-ths-set")) {
setprop("FMGC/internal/flap-ths-set", 1); setprop("/FMGC/internal/flap-ths-set", 1);
} }
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
@ -199,18 +199,18 @@ var perfTOInput = func(key, i) {
} }
} else if (key == "R4") { } else if (key == "R4") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/flex", 0); setprop("/FMGC/internal/flex", 0);
setprop("FMGC/internal/flex-set", 0); setprop("/FMGC/internal/flex-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs == 1 or tfs == 2) { if (tfs == 1 or tfs == 2) {
if (int(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 99) { if (int(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 99) {
setprop("FMGC/internal/flex", scratchpad); setprop("/FMGC/internal/flex", scratchpad);
setprop("FMGC/internal/flex-set", 1); setprop("/FMGC/internal/flex-set", 1);
var flex_calc = getprop("FMGC/internal/flex") - getprop("environment/temperature-degc"); var flex_calc = getprop("/FMGC/internal/flex") - getprop("environment/temperature-degc");
setprop("FMGC/internal/flex-cmd", flex_calc); setprop("/FMGC/internal/flex-cmd", flex_calc);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
@ -221,14 +221,14 @@ var perfTOInput = func(key, i) {
} }
} else if (key == "R5") { } else if (key == "R5") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/eng-out-reduc", "1500"); setprop("/FMGC/internal/eng-out-reduc", "1500");
setprop("MCDUC/reducacc-set", 0); setprop("MCDUC/reducacc-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (int(scratchpad) != nil and (tfs == 4 or tfs == 5) and scratchpad >= 1000 and scratchpad <= 39000) { if (int(scratchpad) != nil and (tfs == 4 or tfs == 5) and scratchpad >= 1000 and scratchpad <= 39000) {
setprop("FMGC/internal/eng-out-reduc", scratchpad); setprop("/FMGC/internal/eng-out-reduc", scratchpad);
setprop("MCDUC/reducacc-set", 1); setprop("MCDUC/reducacc-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {

View file

@ -4,25 +4,25 @@ var progCLBInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad"); var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
if (key == "L1") { if (key == "L1") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/cruise-fl-prog", getprop("FMGC/internal/cruise-fl")); setprop("/FMGC/internal/cruise-fl-prog", getprop("/FMGC/internal/cruise-fl"));
if (getprop("FMGC/status/phase") == 5) { if (getprop("/FMGC/status/phase") == 5) {
setprop("FMGC/status/phase", 3); setprop("/FMGC/status/phase", 3);
setprop("FMGC/internal/activate-once", 0); setprop("/FMGC/internal/activate-once", 0);
setprop("FMGC/internal/activate-twice", 0); setprop("/FMGC/internal/activate-twice", 0);
setprop("FMGC/internal/decel", 0); setprop("/FMGC/internal/decel", 0);
} }
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else if (int(scratchpad) != nil) { } else if (int(scratchpad) != nil) {
var crzs = size(scratchpad); var crzs = size(scratchpad);
if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100) { if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100) {
setprop("FMGC/internal/cruise-fl-prog", scratchpad); setprop("/FMGC/internal/cruise-fl-prog", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
if (getprop("FMGC/status/phase") == 5) { if (getprop("/FMGC/status/phase") == 5) {
setprop("FMGC/status/phase", 3); setprop("/FMGC/status/phase", 3);
setprop("FMGC/internal/activate-once", 0); setprop("/FMGC/internal/activate-once", 0);
setprop("FMGC/internal/activate-twice", 0); setprop("/FMGC/internal/activate-twice", 0);
setprop("FMGC/internal/decel", 0); setprop("/FMGC/internal/decel", 0);
} }
} else { } else {
notAllowed(i); notAllowed(i);

View file

@ -4,25 +4,25 @@ var progCRZInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad"); var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
if (key == "L1") { if (key == "L1") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/cruise-fl-prog", getprop("FMGC/internal/cruise-fl")); setprop("/FMGC/internal/cruise-fl-prog", getprop("/FMGC/internal/cruise-fl"));
if (getprop("FMGC/status/phase") == 5) { if (getprop("/FMGC/status/phase") == 5) {
setprop("FMGC/status/phase", 3); setprop("/FMGC/status/phase", 3);
setprop("FMGC/internal/activate-once", 0); setprop("/FMGC/internal/activate-once", 0);
setprop("FMGC/internal/activate-twice", 0); setprop("/FMGC/internal/activate-twice", 0);
setprop("FMGC/internal/decel", 0); setprop("/FMGC/internal/decel", 0);
} }
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else if (int(scratchpad) != nil) { } else if (int(scratchpad) != nil) {
var crzs = size(scratchpad); var crzs = size(scratchpad);
if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100) { if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100) {
setprop("FMGC/internal/cruise-fl-prog", scratchpad); setprop("/FMGC/internal/cruise-fl-prog", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
if (getprop("FMGC/status/phase") == 5) { if (getprop("/FMGC/status/phase") == 5) {
setprop("FMGC/status/phase", 3); setprop("/FMGC/status/phase", 3);
setprop("FMGC/internal/activate-once", 0); setprop("/FMGC/internal/activate-once", 0);
setprop("FMGC/internal/activate-twice", 0); setprop("/FMGC/internal/activate-twice", 0);
setprop("FMGC/internal/decel", 0); setprop("/FMGC/internal/decel", 0);
} }
} else { } else {
notAllowed(i); notAllowed(i);

View file

@ -4,25 +4,25 @@ var progDESInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad"); var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
if (key == "L1") { if (key == "L1") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/cruise-fl-prog", getprop("FMGC/internal/cruise-fl")); setprop("/FMGC/internal/cruise-fl-prog", getprop("/FMGC/internal/cruise-fl"));
if (getprop("FMGC/status/phase") == 5 or getprop("FMGC/status/phase") == 6) { if (getprop("/FMGC/status/phase") == 5 or getprop("/FMGC/status/phase") == 6) {
setprop("FMGC/status/phase", 3); setprop("/FMGC/status/phase", 3);
setprop("FMGC/internal/activate-once", 0); setprop("/FMGC/internal/activate-once", 0);
setprop("FMGC/internal/activate-twice", 0); setprop("/FMGC/internal/activate-twice", 0);
setprop("FMGC/internal/decel", 0); setprop("/FMGC/internal/decel", 0);
} }
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else if (int(scratchpad) != nil) { } else if (int(scratchpad) != nil) {
var crzs = size(scratchpad); var crzs = size(scratchpad);
if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100) { if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100) {
setprop("FMGC/internal/cruise-fl-prog", scratchpad); setprop("/FMGC/internal/cruise-fl-prog", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
if (getprop("FMGC/status/phase") == 4 or getprop("FMGC/status/phase") == 5 or getprop("FMGC/status/phase") == 6) { if (getprop("/FMGC/status/phase") == 4 or getprop("/FMGC/status/phase") == 5 or getprop("/FMGC/status/phase") == 6) {
setprop("FMGC/status/phase", 3); setprop("/FMGC/status/phase", 3);
setprop("FMGC/internal/activate-once", 0); setprop("/FMGC/internal/activate-once", 0);
setprop("FMGC/internal/activate-twice", 0); setprop("/FMGC/internal/activate-twice", 0);
setprop("FMGC/internal/decel", 0); setprop("/FMGC/internal/decel", 0);
} }
} else { } else {
notAllowed(i); notAllowed(i);

View file

@ -6,13 +6,13 @@ var progTOInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad"); var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
if (key == "L1") { if (key == "L1") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/cruise-fl-prog", getprop("FMGC/internal/cruise-fl")); setprop("/FMGC/internal/cruise-fl-prog", getprop("/FMGC/internal/cruise-fl"));
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else if (int(scratchpad) != nil) { } else if (int(scratchpad) != nil) {
var crzs = size(scratchpad); var crzs = size(scratchpad);
if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100 and getprop("FMGC/internal/cruise-lvl-set")) { if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100 and getprop("/FMGC/internal/cruise-lvl-set")) {
setprop("FMGC/internal/cruise-fl-prog", scratchpad); setprop("/FMGC/internal/cruise-fl-prog", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);

View file

@ -6,7 +6,7 @@ var radnavInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad"); var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
if (key == "L1") { if (key == "L1") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/vor1freq-set", 0); setprop("/FMGC/internal/vor1freq-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
@ -20,12 +20,12 @@ var radnavInput = func(key, i) {
notAllowed(i); notAllowed(i);
} else { } else {
setprop("instrumentation/nav[2]/frequencies/selected-mhz", scratchpad); setprop("instrumentation/nav[2]/frequencies/selected-mhz", scratchpad);
setprop("FMGC/internal/vor1freq-set", 1); setprop("/FMGC/internal/vor1freq-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} }
} else if (scratchpad >= 112.00 and scratchpad <= 117.95) { } else if (scratchpad >= 112.00 and scratchpad <= 117.95) {
setprop("instrumentation/nav[2]/frequencies/selected-mhz", scratchpad); setprop("instrumentation/nav[2]/frequencies/selected-mhz", scratchpad);
setprop("FMGC/internal/vor1freq-set", 1); setprop("/FMGC/internal/vor1freq-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
@ -36,7 +36,7 @@ var radnavInput = func(key, i) {
} }
} else if (key == "L2") { } else if (key == "L2") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/vor1crs-set", 0); setprop("/FMGC/internal/vor1crs-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
@ -44,7 +44,7 @@ var radnavInput = func(key, i) {
if (tfs >= 1 and tfs <= 3) { if (tfs >= 1 and tfs <= 3) {
if (scratchpad >= 0 and scratchpad <= 360) { if (scratchpad >= 0 and scratchpad <= 360) {
setprop("instrumentation/nav[2]/radials/selected-deg", scratchpad); setprop("instrumentation/nav[2]/radials/selected-deg", scratchpad);
setprop("FMGC/internal/vor1crs-set", 1); setprop("/FMGC/internal/vor1crs-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
@ -55,7 +55,7 @@ var radnavInput = func(key, i) {
} }
} else if (key == "L3") { } else if (key == "L3") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/ils1freq-set", 0); setprop("/FMGC/internal/ils1freq-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
@ -67,9 +67,9 @@ var radnavInput = func(key, i) {
or scratchpad == 110.10 or scratchpad == 110.15 or scratchpad == 110.30 or scratchpad == 110.35 or scratchpad == 110.50 or scratchpad == 110.55 or scratchpad == 110.70 or scratchpad == 110.75 or scratchpad == 110.90 or scratchpad == 110.95 or scratchpad == 110.10 or scratchpad == 110.15 or scratchpad == 110.30 or scratchpad == 110.35 or scratchpad == 110.50 or scratchpad == 110.55 or scratchpad == 110.70 or scratchpad == 110.75 or scratchpad == 110.90 or scratchpad == 110.95
or scratchpad == 111.10 or scratchpad == 111.15 or scratchpad == 111.30 or scratchpad == 111.35 or scratchpad == 111.50 or scratchpad == 111.55 or scratchpad == 111.70 or scratchpad == 111.75 or scratchpad == 111.90 or scratchpad == 111.95) { or scratchpad == 111.10 or scratchpad == 111.15 or scratchpad == 111.30 or scratchpad == 111.35 or scratchpad == 111.50 or scratchpad == 111.55 or scratchpad == 111.70 or scratchpad == 111.75 or scratchpad == 111.90 or scratchpad == 111.95) {
setprop("instrumentation/nav[0]/frequencies/selected-mhz", scratchpad); setprop("instrumentation/nav[0]/frequencies/selected-mhz", scratchpad);
setprop("FMGC/internal/ils1freq-set", 1); setprop("/FMGC/internal/ils1freq-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
if (num(getprop("FMGC/internal/ils1freq-calculated")) != 0 and num(getprop("FMGC/internal/ils1freq-calculated")) != num(getprop("instrumentation/nav[0]/frequencies/selected-mhz"))) { if (num(getprop("/FMGC/internal/ils1freq-calculated")) != 0 and num(getprop("/FMGC/internal/ils1freq-calculated")) != num(getprop("instrumentation/nav[0]/frequencies/selected-mhz"))) {
genericMessage(i, "RWY/LS MISMATCH", "amb"); genericMessage(i, "RWY/LS MISMATCH", "amb");
} }
} else { } else {
@ -84,7 +84,7 @@ var radnavInput = func(key, i) {
} }
} else if (key == "L4") { } else if (key == "L4") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/ils1crs-set", 0); setprop("/FMGC/internal/ils1crs-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
@ -92,7 +92,7 @@ var radnavInput = func(key, i) {
if (tfs >= 1 and tfs <= 3) { if (tfs >= 1 and tfs <= 3) {
if (scratchpad >= 0 and scratchpad <= 360) { if (scratchpad >= 0 and scratchpad <= 360) {
setprop("instrumentation/nav[0]/radials/selected-deg", scratchpad); setprop("instrumentation/nav[0]/radials/selected-deg", scratchpad);
setprop("FMGC/internal/ils1crs-set", 1); setprop("/FMGC/internal/ils1crs-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
@ -103,7 +103,7 @@ var radnavInput = func(key, i) {
} }
} else if (key == "L5") { } else if (key == "L5") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/adf1freq-set", 0); setprop("/FMGC/internal/adf1freq-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
@ -111,7 +111,7 @@ var radnavInput = func(key, i) {
if (tfs == 3 or tfs == 4) { if (tfs == 3 or tfs == 4) {
if (scratchpad >= 190 and scratchpad <= 1750) { if (scratchpad >= 190 and scratchpad <= 1750) {
setprop("instrumentation/adf[0]/frequencies/selected-khz", scratchpad); setprop("instrumentation/adf[0]/frequencies/selected-khz", scratchpad);
setprop("FMGC/internal/adf1freq-set", 1); setprop("/FMGC/internal/adf1freq-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
@ -122,7 +122,7 @@ var radnavInput = func(key, i) {
} }
} else if (key == "R1") { } else if (key == "R1") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/vor2freq-set", 0); setprop("/FMGC/internal/vor2freq-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
@ -136,12 +136,12 @@ var radnavInput = func(key, i) {
notAllowed(i); notAllowed(i);
} else { } else {
setprop("instrumentation/nav[3]/frequencies/selected-mhz", scratchpad); setprop("instrumentation/nav[3]/frequencies/selected-mhz", scratchpad);
setprop("FMGC/internal/vor2freq-set", 1); setprop("/FMGC/internal/vor2freq-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} }
} else if (scratchpad >= 112.00 and scratchpad <= 117.95) { } else if (scratchpad >= 112.00 and scratchpad <= 117.95) {
setprop("instrumentation/nav[3]/frequencies/selected-mhz", scratchpad); setprop("instrumentation/nav[3]/frequencies/selected-mhz", scratchpad);
setprop("FMGC/internal/vor2freq-set", 1); setprop("/FMGC/internal/vor2freq-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
@ -152,7 +152,7 @@ var radnavInput = func(key, i) {
} }
} else if (key == "R2") { } else if (key == "R2") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/vor2crs-set", 0); setprop("/FMGC/internal/vor2crs-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
@ -160,7 +160,7 @@ var radnavInput = func(key, i) {
if (tfs >= 1 and tfs <= 3) { if (tfs >= 1 and tfs <= 3) {
if (scratchpad >= 0 and scratchpad <= 360) { if (scratchpad >= 0 and scratchpad <= 360) {
setprop("instrumentation/nav[3]/radials/selected-deg", scratchpad); setprop("instrumentation/nav[3]/radials/selected-deg", scratchpad);
setprop("FMGC/internal/vor2crs-set", 1); setprop("/FMGC/internal/vor2crs-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
@ -171,7 +171,7 @@ var radnavInput = func(key, i) {
} }
} else if (key == "R5") { } else if (key == "R5") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/adf2freq-set", 0); setprop("/FMGC/internal/adf2freq-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
@ -179,7 +179,7 @@ var radnavInput = func(key, i) {
if (tfs == 3 or tfs == 4) { if (tfs == 3 or tfs == 4) {
if (scratchpad >= 190 and scratchpad <= 1750) { if (scratchpad >= 190 and scratchpad <= 1750) {
setprop("instrumentation/adf[1]/frequencies/selected-khz", scratchpad); setprop("instrumentation/adf[1]/frequencies/selected-khz", scratchpad);
setprop("FMGC/internal/adf2freq-set", 1); setprop("/FMGC/internal/adf2freq-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);