1
0
Fork 0

Proof of concept for using nodes rather than property IO in FMGC; also re-add forward slash in various places, and correct format of transition altitude on PERF APPR page

This commit is contained in:
legoboyvdlp R 2020-05-16 15:48:26 +01:00
parent aa31623021
commit b792a1b472
19 changed files with 189 additions and 153 deletions

View file

@ -179,7 +179,6 @@ var flex = props.globals.getNode("/FMGC/internal/flex", 1);
var flexSet = props.globals.getNode("/FMGC/internal/flex-set", 1); var flexSet = props.globals.getNode("/FMGC/internal/flex-set", 1);
var engOutAcc = props.globals.getNode("/FMGC/internal/eng-out-reduc", 1); var engOutAcc = props.globals.getNode("/FMGC/internal/eng-out-reduc", 1);
var engOutAccSet = props.globals.getNode("/MCDUC/reducacc-set", 1); var engOutAccSet = props.globals.getNode("/MCDUC/reducacc-set", 1);
var transAlt = props.globals.getNode("/FMGC/internal/trans-alt", 1);
var managedSpeed = props.globals.getNode("/it-autoflight/input/spd-managed", 1); var managedSpeed = props.globals.getNode("/it-autoflight/input/spd-managed", 1);
# CLB PERF # CLB PERF
@ -1949,7 +1948,7 @@ var canvas_MCDU_base = {
me["Simple_L1"].setText(sprintf("%3.0f", v1.getValue())); me["Simple_L1"].setText(sprintf("%3.0f", v1.getValue()));
me["Simple_L2"].setText(sprintf("%3.0f", vr.getValue())); me["Simple_L2"].setText(sprintf("%3.0f", vr.getValue()));
me["Simple_L3"].setText(sprintf("%3.0f", v2.getValue())); me["Simple_L3"].setText(sprintf("%3.0f", v2.getValue()));
me["Simple_L4"].setText(sprintf("%3.0f", transAlt.getValue())); me["Simple_L4"].setText(sprintf("%3.0f", fmgc.FMGCInternal.transAlt));
me["Simple_L5"].setText(sprintf("%3.0f", clbReducFt.getValue()) ~ sprintf("/%3.0f", reducFt.getValue())); me["Simple_L5"].setText(sprintf("%3.0f", clbReducFt.getValue()) ~ sprintf("/%3.0f", reducFt.getValue()));
me["Simple_L6"].setText(" TO DATA"); me["Simple_L6"].setText(" TO DATA");
me["Simple_L1S"].setText(" V1"); me["Simple_L1S"].setText(" V1");
@ -1968,6 +1967,12 @@ var canvas_MCDU_base = {
me["Simple_R5S"].setText("ENG OUT ACC"); me["Simple_R5S"].setText("ENG OUT ACC");
me["Simple_R6S"].setText("NEXT "); me["Simple_R6S"].setText("NEXT ");
if (fmgc.FMGCInternal.transAltSet) {
me["Simple_L4"].setFontSize(normal);
} else {
me["Simple_L4"].setFontSize(small);
}
if (getprop("/FMGC/status/phase") == 0 or getprop("/FMGC/status/phase") == 7) { if (getprop("/FMGC/status/phase") == 0 or getprop("/FMGC/status/phase") == 7) {
me["Simple_L6_Arrow"].show(); me["Simple_L6_Arrow"].show();
me["Simple_L6"].show(); me["Simple_L6"].show();
@ -2628,8 +2633,14 @@ var canvas_MCDU_base = {
me["Simple_L3"].setText("---g/---");; me["Simple_L3"].setText("---g/---");;
} }
me["Simple_L4S"].setText("TRANS ALT"); me["Simple_L4S"].setText("TRANS FL");
me["Simple_L4"].setText(sprintf("%3.0f", transAlt.getValue())); me["Simple_L4"].setText("FL" ~ sprintf("%2.0f", (fmgc.FMGCInternal.transAlt / 100)));
if (fmgc.FMGCInternal.transAltSet) {
me["Simple_L4"].setFontSize(normal);
} else {
me["Simple_L4"].setFontSize(small);
}
me["Simple_R1S"].setText("FINAL"); me["Simple_R1S"].setText("FINAL");
if (fmgc.flightPlanController.flightplans[2].destination_runway != nil) { if (fmgc.flightPlanController.flightplans[2].destination_runway != nil) {

View file

@ -69,7 +69,6 @@ var alt_inhg = props.globals.getNode("/instrumentation/altimeter/setting-inhg",
var target_altitude = props.globals.getNode("/autopilot/settings/target-altitude-ft", 1); var target_altitude = props.globals.getNode("/autopilot/settings/target-altitude-ft", 1);
var altitude = props.globals.getNode("/instrumentation/altimeter/indicated-altitude-ft", 1); var altitude = props.globals.getNode("/instrumentation/altimeter/indicated-altitude-ft", 1);
var altitude_pfd = props.globals.getNode("/instrumentation/altimeter/indicated-altitude-ft-pfd", 1); var altitude_pfd = props.globals.getNode("/instrumentation/altimeter/indicated-altitude-ft-pfd", 1);
var trans_alt = props.globals.getNode("/FMGC/internal/trans-alt", 1);
var alt_diff = props.globals.getNode("/instrumentation/pfd/alt-diff", 1); var alt_diff = props.globals.getNode("/instrumentation/pfd/alt-diff", 1);
var ground_diff = props.globals.getNode("/instrumentation/pfd/ground-diff", 1); var ground_diff = props.globals.getNode("/instrumentation/pfd/ground-diff", 1);
var landing_diff = props.globals.getNode("/instrumentation/pfd/landing-diff", 1); var landing_diff = props.globals.getNode("/instrumentation/pfd/landing-diff", 1);
@ -645,7 +644,7 @@ var canvas_PFD_base = {
me["QNH"].hide(); me["QNH"].hide();
me["QNH_setting"].hide(); me["QNH_setting"].hide();
if (altitude.getValue() < trans_alt.getValue() and FMGCphase.getValue() == '4') { if (altitude.getValue() < fmgc.FMGCInternal.transAlt and FMGCphase.getValue() == '4') {
if (qnh_going == 0) { if (qnh_going == 0) {
qnh_going = 1; qnh_going = 1;
} }
@ -670,7 +669,7 @@ var canvas_PFD_base = {
me["QNH_std"].hide(); me["QNH_std"].hide();
me["QNH_box"].hide(); me["QNH_box"].hide();
if (altitude.getValue() >= trans_alt.getValue() and FMGCphase.getValue() == '2') { if (altitude.getValue() >= fmgc.FMGCInternal.transAlt and FMGCphase.getValue() == '2') {
if (qnh_going == 0) { if (qnh_going == 0) {
qnh_going = 1; qnh_going = 1;
} }
@ -695,7 +694,7 @@ var canvas_PFD_base = {
} else if (alt_inhg_mode.getValue() == 1) { } else if (alt_inhg_mode.getValue() == 1) {
if (altitude.getValue() >= trans_alt.getValue() and FMGCphase.getValue() == '2') { if (altitude.getValue() >= fmgc.FMGCInternal.transAlt and FMGCphase.getValue() == '2') {
if (qnh_going == 0) { if (qnh_going == 0) {
qnh_going = 1; qnh_going = 1;
} }

View file

@ -138,6 +138,11 @@ var FMGCinit = func {
various2.start(); various2.start();
} }
var FMGCInternal = {
transAlt: 18000,
transAltSet: 0,
};
############ ############
# FBW Trim # # FBW Trim #
############ ############
@ -799,7 +804,7 @@ var switchDatabase = func {
} }
# Landing to phase 7 # Landing to phase 7
getlistener("/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);
@ -812,7 +817,7 @@ getlistener("/gear/gear[1]/wow", func() {
}, 0, 0); }, 0, 0);
# Align IRS 1 # Align IRS 1
getlistener("/systems/navigation/adr/operating-1", func() { setlistener("/systems/navigation/adr/operating-1", func() {
if (timer48gpsAlign1.isRunning) { if (timer48gpsAlign1.isRunning) {
timer48gpsAlign1.stop(); timer48gpsAlign1.stop();
} }
@ -824,7 +829,7 @@ getlistener("/systems/navigation/adr/operating-1", func() {
}, 0, 0); }, 0, 0);
# Align IRS 2 # Align IRS 2
getlistener("/systems/navigation/adr/operating-2", func() { setlistener("/systems/navigation/adr/operating-2", func() {
if (timer48gpsAlign2.isRunning) { if (timer48gpsAlign2.isRunning) {
timer48gpsAlign2.stop(); timer48gpsAlign2.stop();
} }
@ -836,7 +841,7 @@ getlistener("/systems/navigation/adr/operating-2", func() {
}, 0, 0); }, 0, 0);
# Align IRS 3 # Align IRS 3
getlistener("/systems/navigation/adr/operating-3", func() { setlistener("/systems/navigation/adr/operating-3", func() {
if (timer48gpsAlign3.isRunning) { if (timer48gpsAlign3.isRunning) {
timer48gpsAlign3.stop(); timer48gpsAlign3.stop();
} }

View file

@ -93,7 +93,7 @@ var flightPlanController = {
print("Load failed."); print("Load failed.");
} }
# try to fix fgfp # try to fix fgfp
me.flightplans[3].destination = airportinfo(getprop("FMGC/internal/arr-arpt")); me.flightplans[3].destination = airportinfo(getprop("/FMGC/internal/arr-arpt"));
me.destroyTemporaryFlightPlan(3, 1); me.destroyTemporaryFlightPlan(3, 1);
}, },
@ -135,7 +135,7 @@ var flightPlanController = {
me.flightPlanChanged(plan); me.flightPlanChanged(plan);
}, },
autoSequencing: func() { calculateTimeAltitudeOnSequence: func() {
me._timeTemp = math.round(getprop("/sim/time/utc/minute") + (getprop("/sim/time/utc/second") / 60)); me._timeTemp = math.round(getprop("/sim/time/utc/minute") + (getprop("/sim/time/utc/second") / 60));
if (me._timeTemp < 10) { if (me._timeTemp < 10) {
me._timeTemp = "0" ~ me._timeTemp; me._timeTemp = "0" ~ me._timeTemp;
@ -143,7 +143,7 @@ var flightPlanController = {
me.fromWptTime = getprop("/sim/time/utc/hour") ~ me._timeTemp; me.fromWptTime = getprop("/sim/time/utc/hour") ~ me._timeTemp;
me._altTemp = getprop("/systems/navigation/adr/output/baro-alt-corrected-1-capt"); me._altTemp = getprop("/systems/navigation/adr/output/baro-alt-corrected-1-capt");
if (me._altTemp > getprop("FMGC/internal/trans-alt")) { if (me._altTemp > fmgc.FMGCInternal.transAlt) {
me.fromWptAlt = "FL" ~ math.round(me._altTemp / 100); me.fromWptAlt = "FL" ~ math.round(me._altTemp / 100);
} else { } else {
if (me._altTemp > 0) { if (me._altTemp > 0) {
@ -152,6 +152,10 @@ var flightPlanController = {
me.fromWptAlt = "M" ~ math.round(me._altTemp); me.fromWptAlt = "M" ~ math.round(me._altTemp);
} }
} }
},
autoSequencing: func() {
me.calculateTimeAltitudeOnSequence();
# todo setlistener on sim/time/warp to recompute predictions # todo setlistener on sim/time/warp to recompute predictions

View file

@ -34,7 +34,7 @@ var fuelPredInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue())); setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue()));
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/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
@ -49,12 +49,12 @@ var fuelPredInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} }
} 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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -66,7 +66,7 @@ var fuelPredInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue())); setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue()));
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/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
@ -78,7 +78,7 @@ var fuelPredInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue())); setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue()));
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/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
@ -93,7 +93,7 @@ var fuelPredInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -103,7 +103,7 @@ var fuelPredInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue())); setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue()));
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/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
@ -115,7 +115,7 @@ var fuelPredInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue())); setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue()));
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/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
@ -130,7 +130,7 @@ var fuelPredInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -166,7 +166,7 @@ var fuelPredInput = func(key, i) {
} }
} }
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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -179,7 +179,7 @@ var fuelPredInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -191,12 +191,12 @@ var fuelPredInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} 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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }

View file

@ -10,7 +10,7 @@ var initInputA = func(key, i) {
setprop("FMGC/internal/alt-airport", ""); setprop("FMGC/internal/alt-airport", "");
setprop("FMGC/internal/alt-set", 0); setprop("FMGC/internal/alt-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
fmgc.updateARPT(); fmgc.updateARPT();
#} else if (scratchpad == "") { #} else if (scratchpad == "") {
#setprop("FMGC/internal/alt-selected", 1); #setprop("FMGC/internal/alt-selected", 1);
@ -20,7 +20,7 @@ var initInputA = func(key, i) {
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);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
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");
@ -35,13 +35,13 @@ var initInputA = func(key, i) {
setprop("MCDUC/flight-num", ""); setprop("MCDUC/flight-num", "");
setprop("MCDUC/flight-num-set", 0); setprop("MCDUC/flight-num-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
} else { } else {
var flts = size(scratchpad); var flts = size(scratchpad);
if (flts >= 1 and flts <= 8) { if (flts >= 1 and flts <= 8) {
setprop("MCDUC/flight-num", scratchpad); setprop("MCDUC/flight-num", scratchpad);
setprop("MCDUC/flight-num-set", 1); setprop("MCDUC/flight-num-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -51,7 +51,7 @@ var initInputA = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
var ci = int(scratchpad); var ci = int(scratchpad);
var cis = size(scratchpad); var cis = size(scratchpad);
@ -59,7 +59,7 @@ var initInputA = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -75,7 +75,7 @@ var initInputA = func(key, i) {
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);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
} else if (find("/", scratchpad) != -1) { } else if (find("/", scratchpad) != -1) {
var crztemp = split("/", scratchpad); var crztemp = split("/", scratchpad);
if (find("FL", crztemp[0]) != -1) { if (find("FL", crztemp[0]) != -1) {
@ -90,7 +90,7 @@ var initInputA = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -102,7 +102,7 @@ var initInputA = func(key, i) {
setprop("FMGC/internal/cruise-lvl-set", 1); setprop("FMGC/internal/cruise-lvl-set", 1);
setprop("FMGC/internal/cruise-temp", temp); setprop("FMGC/internal/cruise-temp", temp);
setprop("FMGC/internal/cruise-temp-set", 1); setprop("FMGC/internal/cruise-temp-set", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -123,7 +123,7 @@ var initInputA = func(key, i) {
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("MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -142,7 +142,7 @@ var initInputA = func(key, i) {
setprop("FMGC/internal/align-ref-long-edit", 0); setprop("FMGC/internal/align-ref-long-edit", 0);
fmgc.flightPlanController.reset(); fmgc.flightPlanController.reset();
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
#} 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");
@ -158,7 +158,7 @@ var initInputA = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
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
@ -195,13 +195,13 @@ var initInputA = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} 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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -210,11 +210,11 @@ var initInputA = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} 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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }

View file

@ -30,13 +30,13 @@ var initInputB = func(key, i) {
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("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
} 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", ""); mcdu.clearScratchpad(i);
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/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/trip-fuel", num(block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue()));
@ -60,7 +60,7 @@ var initInputB = func(key, i) {
# var temp_rte = num(scratchpad * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)); # 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) { # if (scratchpad >= 0.0 and scratchpad <= block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - temp_rte) {
# setprop("FMGC/internal/trip-fuel", scratchpad); # setprop("FMGC/internal/trip-fuel", scratchpad);
# setprop("MCDU[" ~ i ~ "]/scratchpad", ""); # mcdu.clearScratchpad(i);
# #
# setprop("FMGC/internal/rte-rsv", temp_rte); # setprop("FMGC/internal/rte-rsv", temp_rte);
# setprop("FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue())); # setprop("FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue()));
@ -80,7 +80,7 @@ var initInputB = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue())); setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue()));
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/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
@ -95,12 +95,12 @@ var initInputB = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} }
} 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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -112,7 +112,7 @@ var initInputB = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue())); setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue()));
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/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
@ -124,7 +124,7 @@ var initInputB = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue())); setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue()));
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/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
@ -139,7 +139,7 @@ var initInputB = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -149,7 +149,7 @@ var initInputB = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue())); setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue()));
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/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
@ -161,7 +161,7 @@ var initInputB = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue())); setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue()));
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/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
@ -176,7 +176,7 @@ var initInputB = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -204,7 +204,7 @@ var initInputB = func(key, i) {
setprop("FMGC/internal/zfw-set", 1); setprop("FMGC/internal/zfw-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)) {
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -213,7 +213,7 @@ var initInputB = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -236,7 +236,7 @@ var initInputB = func(key, i) {
setprop("FMGC/internal/extra-time", "0000"); setprop("FMGC/internal/extra-time", "0000");
setprop("FMGC/internal/min-dest-fob", 0.0); setprop("FMGC/internal/min-dest-fob", 0.0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
var maxblock = getprop("options/maxblock"); var maxblock = getprop("options/maxblock");
@ -256,7 +256,7 @@ var initInputB = func(key, i) {
setprop("FMGC/internal/extra-fuel", 0.0); setprop("FMGC/internal/extra-fuel", 0.0);
setprop("FMGC/internal/extra-time", "0000"); setprop("FMGC/internal/extra-time", "0000");
setprop("FMGC/internal/min-dest-fob", 0.0); setprop("FMGC/internal/min-dest-fob", 0.0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -277,13 +277,13 @@ var initInputB = func(key, i) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("FMGC/internal/trip-wind", "HD000"); setprop("FMGC/internal/trip-wind", "HD000");
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
} 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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -291,14 +291,14 @@ var initInputB = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} 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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }

View file

@ -3,7 +3,9 @@
# Copyright (c) 2020 Josh Davidson (Octal450) # Copyright (c) 2020 Josh Davidson (Octal450)
# Copyright (c) 2020 Matthew Maring (mattmaring) # Copyright (c) 2020 Matthew Maring (mattmaring)
var scratchpadNode = [nil, nil];
var MCDU_init = func(i) { var MCDU_init = func(i) {
scratchpadNode = [props.globals.initNode("/MCDU[0]/scratchpad", "", "STRING"), props.globals.initNode("/MCDU[1]/scratchpad", "", "STRING")];
MCDU_reset(i); # Reset MCDU, clears data MCDU_reset(i); # Reset MCDU, clears data
setprop("/MCDU[" ~ i ~ "]/scratchpad", "SELECT DESIRED SYSTEM"); setprop("/MCDU[" ~ i ~ "]/scratchpad", "SELECT DESIRED SYSTEM");
} }
@ -15,7 +17,7 @@ var MCDU_reset = func(i) {
setprop("/MCDU[" ~ i ~ "]/last-page", "NONE"); setprop("/MCDU[" ~ i ~ "]/last-page", "NONE");
setprop("/MCDU[" ~ i ~ "]/last-fmgc-page", "STATUS"); setprop("/MCDU[" ~ i ~ "]/last-fmgc-page", "STATUS");
setprop("/MCDU[" ~ i ~ "]/page", "MCDU"); setprop("/MCDU[" ~ i ~ "]/page", "MCDU");
setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(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);
@ -144,7 +146,7 @@ var MCDU_reset = func(i) {
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); fmgc.FMGCInternal.transAlt = 18000;
# CLB PERF # CLB PERF
setprop("FMGC/internal/activate-once", 0); setprop("FMGC/internal/activate-once", 0);
@ -189,13 +191,13 @@ var lskbutton = func(btn, i) {
setprop("/MCDU[" ~ i ~ "]/active", 1); setprop("/MCDU[" ~ i ~ "]/active", 1);
settimer(func(){ settimer(func(){
setprop("/MCDU[" ~ i ~ "]/page", getprop("/MCDU[" ~ i ~ "]/last-fmgc-page")); setprop("/MCDU[" ~ i ~ "]/page", getprop("/MCDU[" ~ i ~ "]/last-fmgc-page"));
setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("/MCDU[" ~ i ~ "]/active", 2); setprop("/MCDU[" ~ i ~ "]/active", 2);
}, 2); }, 2);
} else { } else {
setprop("/MCDU[" ~ i ~ "]/page", getprop("/MCDU[" ~ i ~ "]/last-fmgc-page")); setprop("/MCDU[" ~ i ~ "]/page", getprop("/MCDU[" ~ i ~ "]/last-fmgc-page"));
setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
} }
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "IRSINIT") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "IRSINIT") {
@ -570,7 +572,7 @@ var rskbutton = func(btn, i) {
if (getprop("/MCDU[" ~ i ~ "]/page") == "MCDU") { if (getprop("/MCDU[" ~ i ~ "]/page") == "MCDU") {
if (getprop("/MCDU[" ~ i ~ "]/last-page") != "NONE") { if (getprop("/MCDU[" ~ i ~ "]/last-page") != "NONE") {
setprop("/MCDU[" ~ i ~ "]/page", getprop("/MCDU[" ~ i ~ "]/last-page")); setprop("/MCDU[" ~ i ~ "]/page", getprop("/MCDU[" ~ i ~ "]/last-page"));
setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
} else { } else {
notAllowed(i); notAllowed(i);
@ -784,7 +786,7 @@ var button = func(btn, i) {
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 1); setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "CLR"); setprop("/MCDU[" ~ i ~ "]/scratchpad", "CLR");
} else if (getprop("/MCDU[" ~ i ~ "]/scratchpad-msg") == 1) { } else if (getprop("/MCDU[" ~ i ~ "]/scratchpad-msg") == 1) {
setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
} else if (size(scratchpad) > 0) { } else if (size(scratchpad) > 0) {
setprop("/MCDU[" ~ i ~ "]/last-scratchpad", ""); setprop("/MCDU[" ~ i ~ "]/last-scratchpad", "");
@ -856,6 +858,10 @@ var formatError = func(i) {
setprop("/MCDU[" ~ i ~ "]/scratchpad", "FORMAT ERROR"); setprop("/MCDU[" ~ i ~ "]/scratchpad", "FORMAT ERROR");
} }
var clearScratchpad = func(i) {
scratchpadNode[i].setValue("");
}
var screenFlash = func(time, i) { var screenFlash = func(time, i) {
var page = getprop("/MCDU[" ~ i ~ "]/page"); var page = getprop("/MCDU[" ~ i ~ "]/page");
setprop("/MCDU[" ~ i ~ "]/page", "NONE"); setprop("/MCDU[" ~ i ~ "]/page", "NONE");

View file

@ -10,11 +10,11 @@ var perfAPPRInput = func(key, i) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/dest-qnh", -1); setprop("/FMGC/internal/dest-qnh", -1);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
} else if (num(scratchpad) != nil and (scratchpad >= 28.06 and scratchpad <= 31.01) or (scratchpad >= 745 and scratchpad <= 1050)) { } else if (num(scratchpad) != nil and (scratchpad >= 28.06 and scratchpad <= 31.01) or (scratchpad >= 745 and scratchpad <= 1050)) {
# doesn't support accidental temp input yet # doesn't support accidental temp input yet
setprop("/FMGC/internal/dest-qnh", scratchpad); setprop("/FMGC/internal/dest-qnh", scratchpad);
setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -22,10 +22,10 @@ var perfAPPRInput = func(key, i) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/dest-temp", -999); setprop("/FMGC/internal/dest-temp", -999);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
} else if (num(scratchpad) != nil and scratchpad >= -99 and scratchpad < 99) { } else if (num(scratchpad) != nil and scratchpad >= -99 and scratchpad < 99) {
setprop("/FMGC/internal/dest-temp", scratchpad); setprop("/FMGC/internal/dest-temp", scratchpad);
setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -35,7 +35,7 @@ var perfAPPRInput = func(key, i) {
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("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
} else if (tfs >= 3 and tfs <= 7 and find("/", scratchpad) != -1) { } else if (tfs >= 3 and tfs <= 7 and find("/", scratchpad) != -1) {
var weather = split("/", scratchpad); var weather = split("/", scratchpad);
var mag = int(weather[0]); var mag = int(weather[0]);
@ -46,7 +46,7 @@ var perfAPPRInput = func(key, i) {
if (mag != nil and wind != nil and mag >= 0 and mag <= 360 and wind >= 0 and wind <= 200) { if (mag != nil and wind != nil and mag >= 0 and mag <= 360 and wind >= 0 and wind <= 200) {
setprop("/FMGC/internal/dest-mag", weather[0]); setprop("/FMGC/internal/dest-mag", weather[0]);
setprop("/FMGC/internal/dest-wind", weather[1]); setprop("/FMGC/internal/dest-wind", weather[1]);
setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
fmgc.updateARPT(); fmgc.updateARPT();
} else { } else {
notAllowed(i); notAllowed(i);
@ -59,24 +59,33 @@ var perfAPPRInput = func(key, i) {
} }
} else if (key == "L4") { } else if (key == "L4") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/trans-alt", 18000); fmgc.FMGCInternal.transAlt = 18000;
fmgc.FMGCInternal.transAltSet = 0;
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
} else if (int(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 50000) { } else {
setprop("/FMGC/internal/trans-alt", scratchpad); var tfs = size(scratchpad);
setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); if (int(scratchpad) != nil and (tfs == 4 or tfs == 5) and scratchpad >= 1000 and scratchpad <= 39000) {
fmgc.FMGCInternal.transAlt = math.round(scratchpad, 500);
fmgc.FMGCInternal.transAltSet = 1;
mcdu.clearScratchpad(i);
} elsif (int(scratchpad) != nil and (tfs == 2 or tfs == 3) and scratchpad >= 10 and scratchpad <= 390) {
fmgc.FMGCInternal.transAlt = math.round(scratchpad * 100, 5);
fmgc.FMGCInternal.transAltSet = 1;
mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
}
} else if (key == "L5") { } else if (key == "L5") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/vapp-speed-set", 0); setprop("/FMGC/internal/vapp-speed-set", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
} else if (int(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 200) { } else if (int(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 200) {
setprop("/FMGC/internal/vapp-speed-set", 1); setprop("/FMGC/internal/vapp-speed-set", 1);
setprop("/FMGC/internal/computed-speeds/vapp_appr", scratchpad); setprop("/FMGC/internal/computed-speeds/vapp_appr", scratchpad);
setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -86,13 +95,13 @@ var perfAPPRInput = func(key, i) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/baro", 99999); setprop("/FMGC/internal/baro", 99999);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
} else if (int(scratchpad) != nil and scratchpad >= getprop("/FMGC/internal/ldg-elev") and scratchpad <= 5000 + getprop("/FMGC/internal/ldg-elev")) { } else if (int(scratchpad) != nil and scratchpad >= getprop("/FMGC/internal/ldg-elev") and scratchpad <= 5000 + getprop("/FMGC/internal/ldg-elev")) {
if (getprop("/FMGC/internal/radio-no") == 0) { if (getprop("/FMGC/internal/radio-no") == 0) {
setprop("/FMGC/internal/radio", 99999); setprop("/FMGC/internal/radio", 99999);
} }
setprop("/FMGC/internal/baro", scratchpad); setprop("/FMGC/internal/baro", scratchpad);
setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -101,16 +110,16 @@ var perfAPPRInput = func(key, i) {
setprop("/FMGC/internal/radio", 99999); setprop("/FMGC/internal/radio", 99999);
setprop("/FMGC/internal/radio-no", 0); setprop("/FMGC/internal/radio-no", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
} else if (scratchpad == "NO") { } else if (scratchpad == "NO") {
setprop("/FMGC/internal/radio", 99999); setprop("/FMGC/internal/radio", 99999);
setprop("/FMGC/internal/radio-no", 1); setprop("/FMGC/internal/radio-no", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
} else if (int(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 700) { } else if (int(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 700) {
setprop("/FMGC/internal/baro", 99999); setprop("/FMGC/internal/baro", 99999);
setprop("/FMGC/internal/radio-no", 0); setprop("/FMGC/internal/radio-no", 0);
setprop("/FMGC/internal/radio", scratchpad); setprop("/FMGC/internal/radio", scratchpad);
setprop("/MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }

View file

@ -9,7 +9,7 @@ var perfCLBInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
var ci = int(scratchpad); var ci = int(scratchpad);
var cis = size(scratchpad); var cis = size(scratchpad);
@ -17,7 +17,7 @@ var perfCLBInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }

View file

@ -9,7 +9,7 @@ var perfCRZInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
var ci = int(scratchpad); var ci = int(scratchpad);
var cis = size(scratchpad); var cis = size(scratchpad);
@ -17,7 +17,7 @@ var perfCRZInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }

View file

@ -9,7 +9,7 @@ var perfDESInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
var ci = int(scratchpad); var ci = int(scratchpad);
var cis = size(scratchpad); var cis = size(scratchpad);
@ -17,7 +17,7 @@ var perfDESInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }

View file

@ -10,7 +10,7 @@ var perfGAInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs >= 7 and tfs <= 9 and find("/", scratchpad) != -1) { if (tfs >= 7 and tfs <= 9 and find("/", scratchpad) != -1) {
@ -21,7 +21,7 @@ var perfGAInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -36,13 +36,13 @@ var perfGAInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} 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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }

View file

@ -11,14 +11,14 @@ var perfTOInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} 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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -35,14 +35,14 @@ var perfTOInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} 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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -60,7 +60,7 @@ var perfTOInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs == 3) { if (tfs == 3) {
@ -68,7 +68,7 @@ var perfTOInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -81,14 +81,16 @@ 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); fmgc.FMGCInternal.transAlt = 18000;
fmgc.FMGCInternal.transAltSet = 0;
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
} 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); fmgc.FMGCInternal.transAlt = int(scratchpad / 10) * 10;
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); fmgc.FMGCInternal.transAltSet = 1;
mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -99,7 +101,7 @@ var perfTOInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (find("/", scratchpad) != -1) { if (find("/", scratchpad) != -1) {
@ -112,16 +114,16 @@ var perfTOInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} 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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
} else if (num(scratchpad) != nil and (tfs >= 3 and tfs <= 5) and scratchpad >= 400 and scratchpad <= 39000) { } else if (num(scratchpad) != nil and (tfs >= 3 and tfs <= 5) and scratchpad >= 400 and scratchpad <= 39000) {
setprop("systems/thrust/clbreduc-ft", int(scratchpad / 10) * 10); setprop("systems/thrust/clbreduc-ft", int(scratchpad / 10) * 10);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -132,7 +134,7 @@ var perfTOInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
if (find("/", scratchpad) != -1) { if (find("/", scratchpad) != -1) {
var flapths = split("/", scratchpad); var flapths = split("/", scratchpad);
@ -147,16 +149,16 @@ var perfTOInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} 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", ""); mcdu.clearScratchpad(i);
} 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", ""); mcdu.clearScratchpad(i);
} 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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -165,22 +167,22 @@ var perfTOInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} 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", ""); mcdu.clearScratchpad(i);
} 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", ""); mcdu.clearScratchpad(i);
} 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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -192,7 +194,7 @@ var perfTOInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -202,7 +204,7 @@ var perfTOInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs == 1 or tfs == 2) { if (tfs == 1 or tfs == 2) {
@ -211,7 +213,7 @@ var perfTOInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -224,13 +226,13 @@ var perfTOInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} 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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }

View file

@ -12,12 +12,12 @@ var progCLBInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} 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", ""); mcdu.clearScratchpad(i);
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);

View file

@ -12,12 +12,12 @@ var progCRZInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} 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", ""); mcdu.clearScratchpad(i);
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);

View file

@ -12,12 +12,12 @@ var progDESInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} 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", ""); mcdu.clearScratchpad(i);
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);

View file

@ -8,12 +8,12 @@ var progTOInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} 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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }

View file

@ -8,7 +8,7 @@ var radnavInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs == 3 or tfs == 5 or tfs == 6) { if (tfs == 3 or tfs == 5 or tfs == 6) {
@ -21,12 +21,12 @@ var radnavInput = func(key, 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", ""); mcdu.clearScratchpad(i);
} }
} 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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -38,14 +38,14 @@ var radnavInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -57,7 +57,7 @@ var radnavInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs == 3 or tfs == 5 or tfs == 6) { if (tfs == 3 or tfs == 5 or tfs == 6) {
@ -68,7 +68,7 @@ var radnavInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
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");
} }
@ -86,14 +86,14 @@ var radnavInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -105,14 +105,14 @@ var radnavInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -124,7 +124,7 @@ var radnavInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs == 3 or tfs == 5 or tfs == 6) { if (tfs == 3 or tfs == 5 or tfs == 6) {
@ -137,12 +137,12 @@ var radnavInput = func(key, 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", ""); mcdu.clearScratchpad(i);
} }
} 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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -154,14 +154,14 @@ var radnavInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -173,14 +173,14 @@ var radnavInput = func(key, i) {
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", ""); mcdu.clearScratchpad(i);
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
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", ""); mcdu.clearScratchpad(i);
} else { } else {
notAllowed(i); notAllowed(i);
} }