diff --git a/A320-main.xml b/A320-main.xml index 35eec1c2..38d54c2f 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -1912,6 +1912,8 @@ Aircraft/A320-family/Nasal/MCDU/MCDU.nas Aircraft/A320-family/Nasal/MCDU/INITA.nas + Aircraft/A320-family/Nasal/MCDU/IRSINIT.nas + Aircraft/A320-family/Nasal/MCDU/ROUTESELECTION.nas Aircraft/A320-family/Nasal/MCDU/INITB.nas Aircraft/A320-family/Nasal/MCDU/FUELPRED.nas Aircraft/A320-family/Nasal/MCDU/PERFAPPR.nas diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 1ce55661..f348172d 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -37,6 +37,8 @@ var engType = props.globals.getNode("MCDUC/eng", 1); var database1 = props.globals.getNode("FMGC/internal/navdatabase", 1); var database2 = props.globals.getNode("FMGC/internal/navdatabase2", 1); var databaseCode = props.globals.getNode("FMGC/internal/navdatabasecode", 1); + +# RADNAV var vor1 = props.globals.getNode("FMGC/internal/vor1-mcdu", 1); var vor2 = props.globals.getNode("FMGC/internal/vor2-mcdu", 1); var ils1 = props.globals.getNode("FMGC/internal/ils1-mcdu", 1); @@ -53,6 +55,8 @@ var adf2FreqSet = props.globals.getNode("FMGC/internal/adf2freq-set", 1); var ils1CRS = props.globals.getNode("instrumentation/nav[0]/radials/selected-deg", 1); var vor1CRS = props.globals.getNode("instrumentation/nav[2]/radials/selected-deg", 1); var vor2CRS = props.globals.getNode("instrumentation/nav[3]/radials/selected-deg", 1); + +# INT-A variabless var flightNum = props.globals.getNode("MCDUC/flight-num", 1); var flightNumSet = props.globals.getNode("MCDUC/flight-num-set", 1); var depArpt = props.globals.getNode("FMGC/internal/dep-arpt", 1); @@ -66,6 +70,12 @@ var tropo = props.globals.getNode("FMGC/internal/tropo", 1); var tropoSet = props.globals.getNode("FMGC/internal/tropo-set", 1); var ADIRSMCDUBTN = props.globals.getNode("controls/adirs/mcducbtn", 1); +# IRSINIT variables +var align_set = props.globals.getNode("FMGC/internal/align-set", 1); + +# ROUTE SELECTION variables +var alt_selected = props.globals.getNode("FMGC/internal/alt-selected", 1); + # INT-B variables var zfwcg = props.globals.getNode("FMGC/internal/zfwcg", 1); var zfwcgSet = props.globals.getNode("FMGC/internal/zfwcg-set", 1); @@ -159,8 +169,6 @@ var min_speed = props.globals.getNode("FMGC/internal/minspeed", 1); # GA PERF -# INT-A variables - # Fetch nodes into vectors var pageProp = [props.globals.getNode("MCDU[0]/page", 1), props.globals.getNode("MCDU[1]/page", 1)]; var active = [props.globals.getNode("MCDU[0]/active", 1), props.globals.getNode("MCDU[1]/active", 1)]; @@ -733,6 +741,16 @@ var canvas_MCDU_base = { me.showRight(1, -1, 0, 0, 0, 0); me["Simple_R2S"].hide(); me["INITA_InitRequest"].hide(); + if (getprop("autopilot/route-manager/route/wp[0]/latitude-deg") > 0) { + me["Simple_L4"].setText(sprintf("%6.2fN", getprop("autopilot/route-manager/route/wp[0]/latitude-deg"))); + } else { + me["Simple_L4"].setText(sprintf("%6.2fS", getprop("autopilot/route-manager/route/wp[0]/latitude-deg") * -1)); + } + if (getprop("autopilot/route-manager/route/wp[0]/longitude-deg") > 0) { + me["Simple_R4"].setText(sprintf("%7.2fE", getprop("autopilot/route-manager/route/wp[0]/longitude-deg"))); + } else { + me["Simple_R4"].setText(sprintf("%7.2fW", getprop("autopilot/route-manager/route/wp[0]/longitude-deg") * -1)); + } } else { me["INITA_CoRoute"].show(); me["INITA_FromTo"].show(); @@ -742,13 +760,17 @@ var canvas_MCDU_base = { me.showRight(-1, 1, 0, 0, 0, 0); me["Simple_R2S"].show(); me["INITA_InitRequest"].show(); + me["Simple_L4"].setText("----.-"); + me["Simple_R4"].setText("-----.--"); } - if (toFromSet.getValue() == 1 and ADIRSMCDUBTN.getValue() != 1) { + if (ADIRSMCDUBTN.getValue() != 1) { me["INITA_AlignIRS"].show(); me["Simple_R3"].show(); + me.showRightArrow(0, 0, 1, 0, 0, 0); } else { me["INITA_AlignIRS"].hide(); me["Simple_R3"].hide(); + me.showRightArrow(0, 0, -1, 0, 0, 0); } if (tropoSet.getValue() == 1) { me["Simple_R6"].setFontSize(normal); @@ -764,17 +786,203 @@ var canvas_MCDU_base = { me["Simple_L6S"].setText("CRZ FL/TEMP"); me["Simple_L1"].setText("NONE"); me["Simple_L3"].setText(sprintf("%s", flightNum.getValue())); - me["Simple_L4"].setText("----.-"); me["Simple_R1S"].setText("FROM/TO "); me["Simple_R2S"].setText("INIT "); me["Simple_R4S"].setText("LONG"); me["Simple_R6S"].setText("TROPO"); me["Simple_R1"].setText(sprintf("%s", depArpt.getValue() ~ "/" ~ arrArpt.getValue())); me["Simple_R2"].setText("REQUEST "); - me["Simple_R3"].setText("IRS INIT >"); - me["Simple_R4"].setText("-----.--"); + me["Simple_R3"].setText("IRS INIT "); me["Simple_R5"].setText("WIND "); me["Simple_R6"].setText(sprintf("%5.0f", tropo.getValue())); + } else if (page == "IRSINIT") { + if (!pageSwitch[i].getBoolValue()) { + me["Simple"].show(); + me["Simple_Center"].show(); + me["INITA"].hide(); + me["INITB"].hide(); + me["FUELPRED"].hide(); + me["PERFTO"].hide(); + me["PERFAPPR"].hide(); + me["PERFGA"].hide(); + me["Simple_Title"].setText("IRS INIT"); + me["Simple_PageNum"].setText("X/X"); + me["Simple_PageNum"].hide(); + me["ArrowLeft"].hide(); + me["ArrowRight"].hide(); + + me.showLeft(1, 1, -1, -1, -1, 1); + me["Simple_L0S"].hide(); + me.showLeftS(1, 1, -1, -1, -1, -1); + me.showLeftArrow(-1, -1, -1, -1, -1, 1); + me.showRight(1, 1, -1, -1, -1, 1); + me.showRightS(1, 1, -1, -1, -1, -1); + me.showRightArrow(-1, -1, -1, -1, -1, 1); + me.showCenter(1, -1, 1, 1, 1, -1); + me.showCenterS(1, 1, 1, 1, 1, -1); + + me.fontLeft(default, default, 0, 0, 0, default); + me.fontLeftS(default, default, 0, 0, 0, 0); + me.fontRight(default, default, 0, 0, 0, default); + me.fontRightS(default, default, 0, 0, 0, 0); + + me.fontSizeLeft(small, small, 0, 0, 0, small); + me.fontSizeRight(small, small, 0, 0, 0, normal); + me.fontSizeCenter(normal, small, small, small, small, 0); + + me.colorLeft("blu", "blu", "ack", "ack", "ack", "wht"); + me.colorLeftS("wht", "wht", "ack", "ack", "ack", "ack"); + me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorRight("blu", "blu", "ack", "ack", "ack", "blu"); + me.colorRightS("wht", "wht", "ack", "ack", "ack", "ack"); + me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "blu"); + me.colorCenter("grn", "ack", "grn", "grn", "grn", "grn"); + me.colorCenterS("wht", "wht", "wht", "wht", "wht", "wht"); + + pageSwitch[i].setBoolValue(1); + } + + if (toFromSet.getValue() == 1) { + #need to convert lat/long format + if (getprop("autopilot/route-manager/route/wp[0]/latitude-deg") > 0) { + me["Simple_L1"].setText(sprintf("%6.2fN", getprop("autopilot/route-manager/route/wp[0]/latitude-deg"))); + } else { + me["Simple_L1"].setText(sprintf("%6.2fS", getprop("autopilot/route-manager/route/wp[0]/latitude-deg") * -1)); + } + if (getprop("autopilot/route-manager/route/wp[0]/longitude-deg") > 0) { + me["Simple_R1"].setText(sprintf("%7.2fE", getprop("autopilot/route-manager/route/wp[0]/longitude-deg"))); + } else { + me["Simple_R1"].setText(sprintf("%7.2fW", getprop("autopilot/route-manager/route/wp[0]/longitude-deg") * -1)); + } + me["Simple_C1"].setText(sprintf("%s", depArpt.getValue())); + } else { + me["Simple_L1"].setText("-----.--"); + me["Simple_R1"].setText("------.--"); + me["Simple_C1"].setText("----"); + } + + #need to convert lat/long format + gps_lat = getprop("position/latitude-deg"); + gps_lon = getprop("position/longitude-deg"); + if (gps_lat > 0) { + me["Simple_L2"].setText(sprintf("%6.2fN", gps_lat)); + } else { + me["Simple_L2"].setText(sprintf("%6.2fS", gps_lat * -1)); + } + if (gps_lon > 0) { + me["Simple_R2"].setText(sprintf("%7.2fE", gps_lon)); + } else { + me["Simple_R2"].setText(sprintf("%7.2fW", gps_lon * -1)); + } + if (getprop("systems/navigation/adr/operating-1")) { + #me["Simple_C3"].setText(getprop("position/latitude-string") ~ "/" ~ getprop("position/longitude-string")); + if (gps_lat > 0 and gps_lon > 0) { + me["Simple_C3"].setText(sprintf("%6.2fN", gps_lat) ~ "/" ~ sprintf("%7.2fE", gps_lon)); + } else if (gps_lat > 0) { + me["Simple_C3"].setText(sprintf("%6.2fN", gps_lat) ~ "/" ~ sprintf("%7.2fW", gps_lon * -1)); + } else if (gps_lon > 0) { + me["Simple_C3"].setText(sprintf("%6.2fS", gps_lat * -1) ~ "/" ~ sprintf("%7.2fE", gps_lon)); + } else { + me["Simple_C3"].setText(sprintf("%6.2fS", gps_lat * -1) ~ "/" ~ sprintf("%7.2fW", gps_lon * -1)); + } + } else { + me["Simple_C3"].setText("-----.--/-----.--"); + } + if (getprop("systems/navigation/adr/operating-2")) { + #me["Simple_C4"].setText(getprop("position/latitude-string") ~ "/" ~ getprop("position/longitude-string")); + if (gps_lat > 0 and gps_lon > 0) { + me["Simple_C4"].setText(sprintf("%6.2fN", gps_lat) ~ "/" ~ sprintf("%7.2fE", gps_lon)); + } else if (gps_lat > 0) { + me["Simple_C4"].setText(sprintf("%6.2fN", gps_lat) ~ "/" ~ sprintf("%7.2fW", gps_lon * -1)); + } else if (gps_lon > 0) { + me["Simple_C4"].setText(sprintf("%6.2fS", gps_lat * -1) ~ "/" ~ sprintf("%7.2fE", gps_lon)); + } else { + me["Simple_C4"].setText(sprintf("%6.2fS", gps_lat * -1) ~ "/" ~ sprintf("%7.2fW", gps_lon * -1)); + } + } else { + me["Simple_C4"].setText("-----.--/-----.--"); + } + if (getprop("systems/navigation/adr/operating-3")) { + #me["Simple_C5"].setText(getprop("position/latitude-string") ~ "/" ~ getprop("position/longitude-string")); + if (gps_lat > 0 and gps_lon > 0) { + me["Simple_C5"].setText(sprintf("%6.2fN", gps_lat) ~ "/" ~ sprintf("%7.2fE", gps_lon)); + } else if (gps_lat > 0) { + me["Simple_C5"].setText(sprintf("%6.2fN", gps_lat) ~ "/" ~ sprintf("%7.2fW", gps_lon * -1)); + } else if (gps_lon > 0) { + me["Simple_C5"].setText(sprintf("%6.2fS", gps_lat * -1) ~ "/" ~ sprintf("%7.2fE", gps_lon)); + } else { + me["Simple_C5"].setText(sprintf("%6.2fS", gps_lat * -1) ~ "/" ~ sprintf("%7.2fW", gps_lon * -1)); + } + } else { + me["Simple_C5"].setText("-----.--/-----.--"); + } + + if (align_set.getValue() == 1) { + #still need * to right of button instead of arrow + me["Simple_R6"].setText("CONFIRM ALIGN "); + me.colorRight("ack", "ack", "ack", "ack", "ack", "amb"); + me.colorRightArrow("ack", "ack", "ack", "ack", "ack", "amb"); + } else { + me["Simple_R6"].setText("ALIGN ON REF "); + } + + me["Simple_L1S"].setText("LAT"); + me["Simple_L2S"].setText("LAT"); + me["Simple_L6"].setText(" RETURN"); + me["Simple_R1S"].setText("LONG"); + me["Simple_R2S"].setText("LONG"); + me["Simple_C1S"].setText("REFERENCE"); + me["Simple_C2S"].setText("GPS POSITION"); + me["Simple_C3S"].setText("IRS1 ALIGNING ON GPS"); + me["Simple_C4S"].setText("IRS2 ALIGNING ON GPS"); + me["Simple_C5S"].setText("IRS3 ALIGNING ON GPS"); + + } else if (page == "ROUTESELECTION") { + if (!pageSwitch[i].getBoolValue()) { + me["Simple"].show(); + me["Simple_Center"].show(); + me["INITA"].hide(); + me["INITB"].hide(); + me["FUELPRED"].hide(); + me["PERFTO"].hide(); + me["PERFAPPR"].hide(); + me["PERFGA"].hide(); + me["Simple_Title"].setText("ROUTE SELECTION"); + me["Simple_PageNum"].setText("X/X"); + me["Simple_PageNum"].hide(); + me["ArrowLeft"].hide(); + me["ArrowRight"].hide(); + + me.showLeft(1, -1, -1, -1, -1, 1); + me["Simple_L0S"].hide(); + me.showLeftS(-1, -1, -1, -1, -1, -1); + me.showLeftArrow(-1, -1, -1, -1, -1, 1); + me.showRight(-1, -1, -1, -1, -1, -1); + me.showRightS(-1, -1, -1, -1, -1, -1); + me.showRightArrow(-1, -1, -1, -1, -1, -1); + me.showCenter(-1, -1, -1, -1, -1, -1); + me.showCenterS(-1, -1, -1, -1, -1, -1); + + me.fontLeft(default, 0, 0, 0, 0, default); + + me.fontSizeLeft(normal, 0, 0, 0, 0, normal); + + me.colorLeft("grn", "ack", "ack", "ack", "ack", "wht"); + + pageSwitch[i].setBoolValue(1); + } + + me["Simple_L1"].setText("NONE"); + me["Simple_L6"].setText(" RETURN"); + + if (toFromSet.getValue() == 1 and alt_selected.getValue() == 0) { + me["Simple_Title"].setText(sprintf("%s", depArpt.getValue() ~ "/" ~ arrArpt.getValue())); + } else if (alt_airport.getValue() != "" and alt_selected.getValue() == 1) { + me["Simple_Title"].setText(sprintf("%s", alt_airport.getValue())); + } else { + me["Simple_Title"].setText("ROUTE SELECTION"); + } + } else if (page == "INITB") { if (!pageSwitch[i].getBoolValue()) { me["Simple"].show(); @@ -2167,6 +2375,26 @@ var canvas_MCDU_base = { me["Simple_L6"].setFontSize(f); } }, + fontSizeLeftS: func (a, b, c, d, e, f) { + if (a != 0) { + me["Simple_L1S"].setFontSize(a); + } + if (b != 0) { + me["Simple_L2S"].setFontSize(b); + } + if (c != 0) { + me["Simple_L3S"].setFontSize(c); + } + if (d != 0) { + me["Simple_L4S"].setFontSize(d); + } + if (e != 0) { + me["Simple_L5S"].setFontSize(e); + } + if (f != 0) { + me["Simple_L6S"].setFontSize(f); + } + }, fontSizeRight: func (a, b, c, d, e, f) { if (a != 0) { me["Simple_R1"].setFontSize(a); @@ -2187,6 +2415,26 @@ var canvas_MCDU_base = { me["Simple_R6"].setFontSize(f); } }, + fontSizeRightS: func (a, b, c, d, e, f) { + if (a != 0) { + me["Simple_R1S"].setFontSize(a); + } + if (b != 0) { + me["Simple_R2S"].setFontSize(b); + } + if (c != 0) { + me["Simple_R3S"].setFontSize(c); + } + if (d != 0) { + me["Simple_R4S"].setFontSize(d); + } + if (e != 0) { + me["Simple_R5S"].setFontSize(e); + } + if (f != 0) { + me["Simple_R6S"].setFontSize(f); + } + }, fontSizeCenter: func (a, b, c, d, e, f) { if (a != 0) { me["Simple_C1"].setFontSize(a); @@ -2207,6 +2455,26 @@ var canvas_MCDU_base = { me["Simple_C6"].setFontSize(f); } }, + fontSizeCenterS: func (a, b, c, d, e, f) { + if (a != 0) { + me["Simple_C1S"].setFontSize(a); + } + if (b != 0) { + me["Simple_C2S"].setFontSize(b); + } + if (c != 0) { + me["Simple_C3S"].setFontSize(c); + } + if (d != 0) { + me["Simple_C4S"].setFontSize(d); + } + if (e != 0) { + me["Simple_C5S"].setFontSize(e); + } + if (f != 0) { + me["Simple_C6S"].setFontSize(f); + } + }, }; var canvas_MCDU_1 = { diff --git a/Nasal/MCDU/INITA.nas b/Nasal/MCDU/INITA.nas index ad4f9224..e1f9be4a 100644 --- a/Nasal/MCDU/INITA.nas +++ b/Nasal/MCDU/INITA.nas @@ -11,12 +11,17 @@ var initInputA = func(key, i) { setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad", ""); fmgc.updateARPT(); + } else if (scratchpad == "") { + setprop("FMGC/internal/alt-selected", 1); + setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION"); } else if (getprop("FMGC/internal/tofrom-set") == 1) { var tfs = size(scratchpad); if (tfs == 4) { setprop("FMGC/internal/alt-airport", scratchpad); setprop("MCDU[" ~ i ~ "]/scratchpad", ""); fmgc.updateARPT(); + setprop("FMGC/internal/alt-selected", 1); + setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION"); } else { notAllowed(i); } @@ -95,6 +100,9 @@ var initInputA = func(key, i) { fmgc.updateARPT(); setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("MCDU[" ~ i ~ "]/scratchpad", ""); + } else if (scratchpad == "") { + setprop("FMGC/internal/alt-selected", 0); + setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION"); } else { var tfs = size(scratchpad); if (tfs == 9 and find("/", scratchpad) != -1) { @@ -107,6 +115,8 @@ var initInputA = func(key, i) { setprop("FMGC/internal/tofrom-set", 1); setprop("MCDU[" ~ i ~ "]/scratchpad", ""); fmgc.updateARPT(); + setprop("FMGC/internal/alt-selected", 0); + setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION"); } else { notAllowed(i); } @@ -115,9 +125,7 @@ var initInputA = func(key, i) { } } } else if (key == "R3") { - #if (getprop("controls/adirs/mcducbtn") == 0) { - # setprop("controls/adirs/mcducbtn", 1); - #} + setprop("MCDU[" ~ i ~ "]/page", "IRSINIT"); } else if (key == "R6") { if (scratchpad == "CLR") { setprop("FMGC/internal/tropo", 36090); @@ -126,7 +134,7 @@ var initInputA = func(key, i) { setprop("MCDU[" ~ i ~ "]/scratchpad", ""); } else { var tropo = size(scratchpad); - if (tropo == 5) { + if (tropo == 5 and scratchpad <= 99990) { setprop("FMGC/internal/tropo-set", 1); setprop("FMGC/internal/tropo", scratchpad); setprop("MCDU[" ~ i ~ "]/scratchpad", ""); diff --git a/Nasal/MCDU/IRSINIT.nas b/Nasal/MCDU/IRSINIT.nas new file mode 100644 index 00000000..5c8b23a1 --- /dev/null +++ b/Nasal/MCDU/IRSINIT.nas @@ -0,0 +1,38 @@ +# Copyright (c) 2020 Matthew Maring (hayden2000) + +var initInputIRS = func(key, i) { + if (key == "L6") { + setprop("MCDU[" ~ i ~ "]/page", "INITA"); + } else if (key == "R6") { + if (getprop("FMGC/internal/tofrom-set") == 1 and getprop("systems/navigation/adr/any-adr-on") == 1) { + if (getprop("FMGC/internal/align-set") == 0) { + setprop("FMGC/internal/align-set", 1); + } else { + setprop("controls/adirs/mcducbtn", 1); + setprop("MCDU[" ~ i ~ "]/page", "INITA"); + } + } else if (getprop("FMGC/internal/tofrom-set") == 0) { + if (getprop("MCDU[" ~ i ~ "]/scratchpad") != "SELECT REFERENCE") { + if (getprop("MCDU[" ~ i ~ "]/scratchpad-msg") == 1) { + setprop("MCDU[" ~ i ~ "]/last-scratchpad", ""); + } else { + setprop("MCDU[" ~ i ~ "]/last-scratchpad", getprop("MCDU[" ~ i ~ "]/scratchpad")); + } + } + setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1); + setprop("MCDU[" ~ i ~ "]/scratchpad", "SELECT REFERENCE"); + } else if (getprop("systems/navigation/adr/any-adr-on") == 0) { + if (getprop("MCDU[" ~ i ~ "]/scratchpad") != "IRS NOT ALIGNED") { + if (getprop("MCDU[" ~ i ~ "]/scratchpad-msg") == 1) { + setprop("MCDU[" ~ i ~ "]/last-scratchpad", ""); + } else { + setprop("MCDU[" ~ i ~ "]/last-scratchpad", getprop("MCDU[" ~ i ~ "]/scratchpad")); + } + } + setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1); + setprop("MCDU[" ~ i ~ "]/scratchpad", "IRS NOT ALIGNED"); + } else { + notAllowed(i); + } + } +} diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index d4a1adc9..66851a2a 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -40,6 +40,12 @@ var MCDU_reset = func(i) { setprop("FMGC/internal/vr", 0); setprop("FMGC/internal/v2", 0); + # IRSINIT variables + setprop("FMGC/internal/align-set", 0); + + # ROUTE SELECTION variables + setprop("FMGC/internal/alt-selected", 0); + # INT-B setprop("FMGC/internal/block", 0.0); setprop("FMGC/internal/block-set", 0); @@ -179,11 +185,11 @@ var lskbutton = func(btn, i) { } else if (getprop("MCDU[" ~ i ~ "]/page") == "RADNAV") { radnavInput("L2",i); } else if (getprop("MCDU[" ~ i ~ "]/page") == "CLB") { - initInputA("L5",i); # Does the same thing as on the INIT page + perfCLBInput("L2",i); } else if (getprop("MCDU[" ~ i ~ "]/page") == "CRZ") { - initInputA("L5",i); + perfCRZInput("L2",i); } else if (getprop("MCDU[" ~ i ~ "]/page") == "DES") { - initInputA("L5",i); + perfDESInput("L2",i); } else if (getprop("MCDU[" ~ i ~ "]/page") == "DATA") { dataInput("L2",i); } else if (getprop("MCDU[" ~ i ~ "]/page") == "PRINTFUNC") { @@ -264,6 +270,10 @@ var lskbutton = func(btn, i) { } else if (btn == "6") { if (getprop("MCDU[" ~ i ~ "]/page") == "INITA") { initInputA("L6",i); + } else if (getprop("MCDU[" ~ i ~ "]/page") == "IRSINIT") { + initInputIRS("L6",i); + } else if (getprop("MCDU[" ~ i ~ "]/page") == "ROUTESELECTION") { + initInputROUTESEL("L6",i); } else if (getprop("MCDU[" ~ i ~ "]/page") == "CLB") { perfCLBInput("L6",i); } else if (getprop("MCDU[" ~ i ~ "]/page") == "CRZ") { @@ -370,6 +380,8 @@ var rskbutton = func(btn, i) { } else { notAllowed(i); } + } else if (getprop("MCDU[" ~ i ~ "]/page") == "IRSINIT") { + initInputIRS("R6",i); } else if (getprop("MCDU[" ~ i ~ "]/page") == "TO") { perfTOInput("R6",i); } else if (getprop("MCDU[" ~ i ~ "]/page") == "CLB") { diff --git a/Nasal/MCDU/PERFCLB.nas b/Nasal/MCDU/PERFCLB.nas index 4120cf38..38b91389 100644 --- a/Nasal/MCDU/PERFCLB.nas +++ b/Nasal/MCDU/PERFCLB.nas @@ -1,10 +1,10 @@ # A3XX mCDU by Joshua Davidson (Octal450), Jonathan Redpath, and Matthew Maring (hayden2000) -# Copyright (c) 2019 Joshua Davidson (Octal450) +# Copyright (c) 2020 Matthew Maring (hayden2000) var perfCLBInput = func(key, i) { var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad"); - if (key == "L5") { + if (key == "L2") { if (scratchpad == "CLR") { setprop("FMGC/internal/cost-index", 0); setprop("FMGC/internal/cost-index-set", 0); diff --git a/Nasal/MCDU/PERFCRZ.nas b/Nasal/MCDU/PERFCRZ.nas index 419fe2e6..f84b16f8 100644 --- a/Nasal/MCDU/PERFCRZ.nas +++ b/Nasal/MCDU/PERFCRZ.nas @@ -1,9 +1,33 @@ # A3XX mCDU by Joshua Davidson (Octal450), Jonathan Redpath, and Matthew Maring (hayden2000) -# Copyright (c) 2019 Joshua Davidson (Octal450) +# Copyright (c) 2020 Matthew Maring (hayden2000) var perfCRZInput = func(key, i) { - if (key == "L6") { + var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad"); + if (key == "L2") { + if (scratchpad == "CLR") { + setprop("FMGC/internal/cost-index", 0); + setprop("FMGC/internal/cost-index-set", 0); + setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); + setprop("MCDU[" ~ i ~ "]/scratchpad", ""); + } else { + var ci = int(scratchpad); + var cis = size(scratchpad); + if (cis >= 1 and cis <= 3) { + if (ci == nil) { + notAllowed(i); + } else if (ci >= 0 and ci <= 999) { + setprop("FMGC/internal/cost-index", ci); + setprop("FMGC/internal/cost-index-set", 1); + setprop("MCDU[" ~ i ~ "]/scratchpad", ""); + } else { + notAllowed(i); + } + } else { + notAllowed(i); + } + } + } else if (key == "L6") { setprop("MCDU[" ~ i ~ "]/page", "CLB"); } if (key == "R6") { diff --git a/Nasal/MCDU/PERFDES.nas b/Nasal/MCDU/PERFDES.nas index f4bd1268..e24b851c 100644 --- a/Nasal/MCDU/PERFDES.nas +++ b/Nasal/MCDU/PERFDES.nas @@ -1,9 +1,33 @@ # A3XX mCDU by Joshua Davidson (Octal450), Jonathan Redpath, and Matthew Maring (hayden2000) -# Copyright (c) 2019 Joshua Davidson (Octal450) +# Copyright (c) 2020 Matthew Maring (hayden2000) var perfDESInput = func(key, i) { - if (key == "L6") { + var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad"); + if (key == "L2") { + if (scratchpad == "CLR") { + setprop("FMGC/internal/cost-index", 0); + setprop("FMGC/internal/cost-index-set", 0); + setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); + setprop("MCDU[" ~ i ~ "]/scratchpad", ""); + } else { + var ci = int(scratchpad); + var cis = size(scratchpad); + if (cis >= 1 and cis <= 3) { + if (ci == nil) { + notAllowed(i); + } else if (ci >= 0 and ci <= 999) { + setprop("FMGC/internal/cost-index", ci); + setprop("FMGC/internal/cost-index-set", 1); + setprop("MCDU[" ~ i ~ "]/scratchpad", ""); + } else { + notAllowed(i); + } + } else { + notAllowed(i); + } + } + } else if (key == "L6") { setprop("MCDU[" ~ i ~ "]/page", "CRZ"); } else if (key == "R6") { setprop("MCDU[" ~ i ~ "]/page", "APPR"); diff --git a/Nasal/MCDU/ROUTESELECTION.nas b/Nasal/MCDU/ROUTESELECTION.nas new file mode 100644 index 00000000..98460126 --- /dev/null +++ b/Nasal/MCDU/ROUTESELECTION.nas @@ -0,0 +1,7 @@ +# Copyright (c) 2020 Matthew Maring (hayden2000) + +var initInputROUTESEL = func(key, i) { + if (key == "L6") { + setprop("MCDU[" ~ i ~ "]/page", "INITA"); + } +}