From 16622a4a551d6e9ebca26fe6cf084ceb15261152 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Tue, 14 Apr 2020 18:12:38 -0400 Subject: [PATCH] Clean-up INITB/FUELPRED, fix formatting for entries --- Models/Instruments/MCDU/MCDU.nas | 9 +- Nasal/MCDU/FUELPRED.nas | 117 +++++++++++++++++--------- Nasal/MCDU/INITA.nas | 1 - Nasal/MCDU/INITB.nas | 140 +++++++++++++++++++++---------- Nasal/MCDU/MCDU.nas | 7 +- 5 files changed, 182 insertions(+), 92 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 2f705802..30a77a8b 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -147,6 +147,7 @@ var alt_utc = props.globals.getNode("FMGC/internal/alt-utc", 1); var pri_efob = props.globals.getNode("FMGC/internal/pri-efob", 1); var alt_efob = props.globals.getNode("FMGC/internal/alt-efob", 1); var fob = props.globals.getNode("FMGC/internal/fob", 1); +var fffq_sensor = props.globals.getNode("FMGC/internal/fffq-sensor", 1); var gw = props.globals.getNode("FMGC/internal/gw", 1); var cg = props.globals.getNode("FMGC/internal/cg", 1); @@ -1472,7 +1473,7 @@ var canvas_MCDU_base = { me["Simple_L2"].setText("---.-/----"); me["Simple_L3"].setText("---.-/---.-"); me["Simple_L4"].setText("---.-/----"); - me["Simple_L5"].setText("---.-/----"); + me["Simple_L5"].setText("---.-/0030"); me["Simple_L6"].setText("---.-"); me["Simple_R3S"].show(); me["Simple_R3"].show(); @@ -1610,7 +1611,7 @@ var canvas_MCDU_base = { setprop("FMGC/internal/fob", num(getprop("consumables/fuel/total-fuel-lbs") / 1000)); setprop("FMGC/internal/gw", num(getprop("fdm/jsbsim/inertia/weight-lbs") / 1000)); setprop("FMGC/internal/cg", num(getprop("FMGC/internal/zfwcg"))); - me["Simple_R4"].setText(sprintf("%4.1f/FF+FQ", fob.getValue())); + me["Simple_R4"].setText(sprintf("%4.1f/" ~ fffq_sensor.getValue(), fob.getValue())); me["Simple_R5"].setText(sprintf("%4.1f/", gw.getValue()) ~ sprintf("%4.1f", cg.getValue())); me["Simple_R6"].setText(sprintf("%4.1f/" ~ extra_time.getValue(), extra_fuel.getValue())); @@ -1619,7 +1620,7 @@ var canvas_MCDU_base = { } else { me["Simple_L3"].setText("---.-/---.-"); me["Simple_L4"].setText("---.-/----"); - me["Simple_L5"].setText("---.-/----"); + me["Simple_L5"].setText("---.-/0030"); me["Simple_L6"].setText("---.-"); me["Simple_R4"].setText("---.-/FF+FQ"); @@ -2514,7 +2515,7 @@ var canvas_MCDU_base = { me["Simple_L4"].setText(sprintf("%3.0f", transAlt.getValue())); me["Simple_R1S"].setText("FINAL"); - if (fmgc.flightPlanController.flightplans[2].approach.id != nil) { + if (fmgc.flightPlanController.flightplans[2].approach != nil) { me["Simple_R1"].setText(sprintf("%s",fmgc.flightPlanController.flightplans[2].approach.id)); } else { me["Simple_R1"].setText("--- "); diff --git a/Nasal/MCDU/FUELPRED.nas b/Nasal/MCDU/FUELPRED.nas index 6637a0d0..0c9194db 100644 --- a/Nasal/MCDU/FUELPRED.nas +++ b/Nasal/MCDU/FUELPRED.nas @@ -3,8 +3,12 @@ # Copyright (c) 2020 Matthew Maring (hayden2000) # From INIT-B +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); @@ -18,76 +22,94 @@ 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 fob = props.globals.getNode("FMGC/internal/fob", 1); +var fffq_sensor = props.globals.getNode("FMGC/internal/fffq-sensor", 1); var extra_fuel = props.globals.getNode("FMGC/internal/extra-fuel", 1); var extra_time = props.globals.getNode("FMGC/internal/extra-time", 1); var fuelPredInput = func(key, i) { var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad"); - if (key == "L3") { + if (key == "L3" and blockSet.getValue() == 1 and zfwSet.getValue() == 1) { if (scratchpad == "CLR") { - notAllowed(i); + setprop("FMGC/internal/rte-rsv", 0.05 * num(trip_fuel.getValue())); + setprop("FMGC/internal/rte-percent", 5.0); + setprop("MCDU[" ~ i ~ "]/scratchpad", ""); } else if (getprop("FMGC/internal/trip-fuel") != 0) { + var tf = num(scratchpad); var tfs = size(scratchpad); if (tfs >= 2 and tfs <= 5 and find("/", scratchpad) == 0) { var perc = num(split("/", scratchpad)[1]); - if (perc != nil and perc >= 0.0 and perc <= 100.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-percent", perc); setprop("MCDU[" ~ i ~ "]/scratchpad", ""); } - } else if (tfs >= 1 and tfs <= 4) { - if (num(scratchpad) != nil and scratchpad >= 0.0 and scratchpad <= trip_fuel.getValue()) { + } 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-percent", scratchpad / num(trip_fuel.getValue()) * 100); setprop("MCDU[" ~ i ~ "]/scratchpad", ""); - } else { - notAllowed(i); - } } else { notAllowed(i); } } else { notAllowed(i); } - } else if (key == "L4") { + } else if (key == "L4" and blockSet.getValue() == 1 and zfwSet.getValue() == 1) { if (scratchpad == "CLR") { - notAllowed(i); - } else { + setprop("FMGC/internal/alt-fuel", 0.0); + setprop("FMGC/internal/alt-time", "0000"); + setprop("MCDU[" ~ i ~ "]/scratchpad", ""); + } else if (find(".", scratchpad) != -1) { + var tf = num(scratchpad); var tfs = size(scratchpad); - if (tfs >= 1 and tfs <= 3) { - if (num(scratchpad) != nil and scratchpad >= 0.0 and scratchpad <= 99.9) { - setprop("FMGC/internal/alt-fuel", scratchpad); - setprop("MCDU[" ~ i ~ "]/scratchpad", ""); - 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/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())); - - } else { - notAllowed(i); - } + if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0 and scratchpad < trip_fuel.getValue()) { + setprop("FMGC/internal/alt-fuel", tf); + setprop("MCDU[" ~ i ~ "]/scratchpad", ""); + + 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/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())); + } 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/alt-time", scratchpad); + setprop("MCDU[" ~ i ~ "]/scratchpad", ""); } else { notAllowed(i); } } - } else if (key == "L5") { + } else if (key == "L5" and blockSet.getValue() == 1 and zfwSet.getValue() == 1) { if (scratchpad == "CLR") { - notAllowed(i); - } else { + setprop("FMGC/internal/final-fuel", 0.0); + setprop("FMGC/internal/final-time", "0030"); + setprop("MCDU[" ~ i ~ "]/scratchpad", ""); + } else if (find(".", scratchpad) != -1) { + var tf = num(scratchpad); var tfs = size(scratchpad); - if (tfs >= 1 and tfs <= 3) { - if (num(scratchpad) != nil and scratchpad >= 0.0 and scratchpad <= 99.9) { - setprop("FMGC/internal/final-fuel", scratchpad); - setprop("MCDU[" ~ i ~ "]/scratchpad", ""); - 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/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())); - } else { - notAllowed(i); - } + if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0 and scratchpad < trip_fuel.getValue()) { + setprop("FMGC/internal/final-fuel", tf); + setprop("MCDU[" ~ i ~ "]/scratchpad", ""); + + 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/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())); + } 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); } @@ -144,5 +166,22 @@ var fuelPredInput = func(key, i) { notAllowed(i); } } + } else if (key == "R4") { + if (scratchpad == "CLR") { + setprop("FMGC/internal/fffq-sensor", "FF+FQ"); + setprop("MCDU[" ~ i ~ "]/scratchpad", ""); + } else if (find("/", scratchpad) == 0) { + var sensor = substr(scratchpad, 1); + if (sensor == "FF+FQ" or sensor == "FQ+FF" or sensor == "FF" or sensor == "FQ") { + setprop("FMGC/internal/fffq-sensor", sensor); + setprop("MCDU[" ~ i ~ "]/scratchpad", ""); + } else { + notAllowed(i); + } + } else { + notAllowed(i); + } + } else { + notAllowed(i); } } diff --git a/Nasal/MCDU/INITA.nas b/Nasal/MCDU/INITA.nas index de7370b2..02e98f11 100644 --- a/Nasal/MCDU/INITA.nas +++ b/Nasal/MCDU/INITA.nas @@ -87,7 +87,6 @@ var initInputA = func(key, i) { } var temp = int(crztemp[1]); var temps = size(crztemp[1]); - print(crzs); 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) { setprop("FMGC/internal/cruise-temp", temp); diff --git a/Nasal/MCDU/INITB.nas b/Nasal/MCDU/INITB.nas index acaee1b8..af8b74b1 100644 --- a/Nasal/MCDU/INITB.nas +++ b/Nasal/MCDU/INITB.nas @@ -2,8 +2,12 @@ # Copyright (c) 2020 Matthew Maring (hayden2000) +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); @@ -28,7 +32,7 @@ var initInputB = func(key, i) { } else { var tfs = size(scratchpad); if (tfs >= 1 and tfs <= 4) { - if (num(scratchpad) != nil and scratchpad >= 0.0 and scratchpad <= 10.0) { + if (num(scratchpad) != nil and scratchpad >= 0.0 and scratchpad <= 9.9) { setprop("FMGC/internal/taxi-fuel", scratchpad); setprop("MCDU[" ~ i ~ "]/scratchpad", ""); @@ -44,8 +48,8 @@ var initInputB = func(key, i) { notAllowed(i); } } - } - # else if (key == "L2") { +# } +# else if (key == "L2") { # if (scratchpad == "CLR") { # notAllowed(i); # } else if (getprop("FMGC/internal/trip-fuel") != 0) { @@ -69,75 +73,87 @@ var initInputB = func(key, i) { # notAllowed(i); # } # -# } - else if (key == "L3") { + } else if (key == "L3" and blockSet.getValue() == 1 and zfwSet.getValue() == 1) { if (scratchpad == "CLR") { - notAllowed(i); + setprop("FMGC/internal/rte-rsv", 0.05 * num(trip_fuel.getValue())); + setprop("FMGC/internal/rte-percent", 5.0); + setprop("MCDU[" ~ i ~ "]/scratchpad", ""); } else if (getprop("FMGC/internal/trip-fuel") != 0) { + var tf = num(scratchpad); var tfs = size(scratchpad); if (tfs >= 2 and tfs <= 5 and find("/", scratchpad) == 0) { var perc = num(split("/", scratchpad)[1]); - if (perc != nil and perc >= 0.0 and perc <= 100.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-percent", perc); setprop("MCDU[" ~ i ~ "]/scratchpad", ""); } - } else if (tfs >= 1 and tfs <= 4) { - if (num(scratchpad) != nil and scratchpad >= 0.0 and scratchpad <= trip_fuel.getValue()) { + } 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-percent", scratchpad / num(trip_fuel.getValue()) * 100); setprop("MCDU[" ~ i ~ "]/scratchpad", ""); - } else { - notAllowed(i); - } } else { notAllowed(i); } } else { notAllowed(i); } - } else if (key == "L4") { + } else if (key == "L4" and blockSet.getValue() == 1 and zfwSet.getValue() == 1) { if (scratchpad == "CLR") { - notAllowed(i); - } else { + setprop("FMGC/internal/alt-fuel", 0.0); + setprop("FMGC/internal/alt-time", "0000"); + setprop("MCDU[" ~ i ~ "]/scratchpad", ""); + } else if (find(".", scratchpad) != -1) { + var tf = num(scratchpad); var tfs = size(scratchpad); - if (tfs >= 1 and tfs <= 3) { - if (num(scratchpad) != nil and scratchpad >= 0.0 and scratchpad <= 99.9) { - setprop("FMGC/internal/alt-fuel", scratchpad); - setprop("MCDU[" ~ i ~ "]/scratchpad", ""); - - 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/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())); - - } else { - notAllowed(i); - } + if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0 and scratchpad < trip_fuel.getValue()) { + setprop("FMGC/internal/alt-fuel", tf); + setprop("MCDU[" ~ i ~ "]/scratchpad", ""); + + 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/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())); + } 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/alt-time", scratchpad); + setprop("MCDU[" ~ i ~ "]/scratchpad", ""); } else { notAllowed(i); } } - } else if (key == "L5") { + } else if (key == "L5" and blockSet.getValue() == 1 and zfwSet.getValue() == 1) { if (scratchpad == "CLR") { - notAllowed(i); - } else { + setprop("FMGC/internal/final-fuel", 0.0); + setprop("FMGC/internal/final-time", "0030"); + setprop("MCDU[" ~ i ~ "]/scratchpad", ""); + } else if (find(".", scratchpad) != -1) { + var tf = num(scratchpad); var tfs = size(scratchpad); - if (tfs >= 1 and tfs <= 3) { - if (num(scratchpad) != nil and scratchpad >= 0.0 and scratchpad <= 99.9) { - setprop("FMGC/internal/final-fuel", scratchpad); - setprop("MCDU[" ~ i ~ "]/scratchpad", ""); - - 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/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())); - - } else { - notAllowed(i); - } + if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0 and scratchpad < trip_fuel.getValue()) { + setprop("FMGC/internal/final-fuel", tf); + setprop("MCDU[" ~ i ~ "]/scratchpad", ""); + + 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/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())); + } 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); } @@ -214,5 +230,37 @@ var initInputB = func(key, i) { setprop("FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000)); setprop("FMGC/internal/block-set", 1); } + } else if (key == "R5") { + if (scratchpad == "CLR") { + setprop("FMGC/internal/trip-wind", "HD000"); + setprop("MCDU[" ~ i ~ "]/scratchpad", ""); + } else { + if (find("TL", scratchpad) != -1 or find("HD", scratchpad) != -1) { + var effwind = substr(scratchpad, 2); + if (int(effwind) != nil and effwind >= 0 and effwind <= 500) { + setprop("FMGC/internal/trip-wind", scratchpad); + setprop("MCDU[" ~ i ~ "]/scratchpad", ""); + } else { + notAllowed(i); + } + } else if (find("-", scratchpad) != -1 or find("+", scratchpad) != -1 or find("T", scratchpad) != -1 or find("H", scratchpad) != -1) { + var effwind = substr(scratchpad, 1); + if (int(effwind) != nil and effwind >= 0 and effwind <= 500) { + setprop("FMGC/internal/trip-wind", scratchpad); + setprop("MCDU[" ~ i ~ "]/scratchpad", ""); + } else { + notAllowed(i); + } + } else { + if (num(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 500) { + setprop("FMGC/internal/trip-wind", scratchpad); + setprop("MCDU[" ~ i ~ "]/scratchpad", ""); + } else { + notAllowed(i); + } + } + } + } else { + notAllowed(i); } } diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 81910609..71aea80c 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -89,11 +89,12 @@ var MCDU_reset = func(i) { setprop("FMGC/internal/alt-fuel", 0); setprop("FMGC/internal/alt-time", "0000"); setprop("FMGC/internal/final-fuel", 0); - setprop("FMGC/internal/final-time", "0000"); + setprop("FMGC/internal/final-time", "0030"); setprop("FMGC/internal/min-dest-fob", 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"); @@ -488,7 +489,9 @@ var rskbutton = func(btn, i) { notAllowed(i); } } else if (btn == "4") { - if (getprop("MCDU[" ~ i ~ "]/page") == "PERFTO") { + if (getprop("MCDU[" ~ i ~ "]/page") == "FUELPRED") { + fuelPredInput("R4",i); + } else if (getprop("MCDU[" ~ i ~ "]/page") == "PERFTO") { perfTOInput("R4",i); } else if (getprop("MCDU[" ~ i ~ "]/page") == "PERFAPPR") { perfAPPRInput("R4",i);