diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 70c6d491..9b8a1ad6 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -1647,7 +1647,14 @@ var canvas_MCDU_base = { me.showRightS(0, 0, 0, 0, 1, 0); me.showCenterS(0, 0, 0, 0, 1, 0); - me["Simple_L4S"].setText(" SELECTED"); + if (managedSpeed.getValue() == 1) { + me.showLeft(0, 0, 0, -1, 0, 0); + me.showLeftS(0, 0, 0, -1, 0, 0); + } else { + me["Simple_L4S"].setText(" SELECTED"); + me.showLeft(0, 0, 0, 1, 0, 0); + me.showLeftS(0, 0, 0, 1, 0, 0); + } if (activate_once.getValue() == 0 and activate_twice.getValue() == 0) { me["Simple_L6S"].setText(" ACTIVATE"); @@ -1687,8 +1694,7 @@ var canvas_MCDU_base = { me["Simple_L4S"].setText(" PRESEL"); me["Simple_L6S"].setText(" PREV"); - me["Simple_L6"].setText(" PHASE"); - + me["Simple_L6"].setText(" PHASE"); } me["Simple_L1S"].setText("ACT MODE"); @@ -1755,14 +1761,14 @@ var canvas_MCDU_base = { me["ArrowLeft"].hide(); me["ArrowRight"].hide(); - me.showLeft(1, 1, 1, -1, -1, 1); + me.showLeft(1, 1, 1, 1, -1, 1); me["Simple_L0S"].hide(); - me.showLeftS(1, 1, 1, -1, -1, 1); + me.showLeftS(1, 1, 1, 1, -1, 1); me.showLeftArrow(-1, -1, -1, -1, -1, 1); - me.showRight(1, -1, -1, -1, 0, 1); - me.showRightS(1, -1, -1, -1, 0, 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.showCenter(1, -1, -1, -1, 1, -1); me.showCenterS(1, -1, -1, -1, -1, -1); me.fontLeft(default, default, default, symbol, default, default); @@ -1772,67 +1778,108 @@ var canvas_MCDU_base = { me.fontSizeLeft(normal, normal, small, small, normal, normal); me.fontSizeRight(normal, normal, normal, normal, small, normal); - me.fontSizeCenter(normal, normal, normal, normal, small, normal); - me.colorLeft("grn", "ack", "grn", "blu", "wht", "wht"); - me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorLeft("grn", "blu", "grn", "blu", "wht", "blu"); + me.colorLeftS("wht", "wht", "wht", "wht", "grn", "blu"); me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorRight("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorRight("wht", "blu", "grn", "grn", "wht", "wht"); + me.colorRightS("wht", "wht", "wht", "wht", "grn", "wht"); me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorCenter("wht", "wht", "wht", "wht", "blu", "wht"); - me.colorCenterS("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorCenter("wht", "wht", "grn", "grn", "wht", "wht"); + me.colorCenterS("wht", "wht", "wht", "wht", "grn", "wht"); pageSwitch[i].setBoolValue(1); } if (getprop("FMGC/status/phase") == 3) { me["Simple_Title"].setColor(0.0509,0.7529,0.2941); + + if (managedSpeed.getValue() == 1) { + me.showLeft(0, 0, 0, -1, 0, 0); + me.showLeftS(0, 0, 0, -1, 0, 0); + } else { + me["Simple_L4S"].setText(" SELECTED"); + me.showLeft(0, 0, 0, 1, 0, 0); + me.showLeftS(0, 0, 0, 1, 0, 0); + } + + if (activate_once.getValue() == 0 and activate_twice.getValue() == 0) { + me["Simple_L6S"].setText(" ACTIVATE"); + me["Simple_L6"].setText(" APPR PHASE"); + me.colorLeft("ack", "ack", "ack", "ack", "ack", "blu"); + me.colorLeftS("ack", "ack", "ack", "ack", "ack", "blu"); + me.colorLeftArrow("ack", "ack", "ack", "ack", "ack", "blu"); + } else if (activate_once.getValue() == 1 and activate_twice.getValue() == 0) { + me["Simple_L6S"].setText(" CONFIRM"); + me["Simple_L6"].setText(" APPR PHASE"); + me.colorLeft("ack", "ack", "ack", "ack", "ack", "amb"); + me.colorLeftS("ack", "ack", "ack", "ack", "ack", "amb"); + me.colorLeftArrow("ack", "ack", "ack", "ack", "ack", "amb"); + } else if (getprop("FMGC/status/phase") == 5) { + me["Simple_L6S"].setText(""); + me["Simple_L6"].setText(""); + me.colorLeft("ack", "ack", "ack", "ack", "ack", "blu"); + me.colorLeftS("ack", "ack", "ack", "ack", "ack", "blu"); + me.colorLeftArrow("ack", "ack", "ack", "ack", "ack", "blu"); + me.showLeftArrow(0, 0, 0, 0, 0, -1); + } else { + setprop("FMGC/internal/activate-once", 0); + setprop("FMGC/internal/activate-twice", 0); + } } else { me["Simple_Title"].setColor(1, 1, 1); + + me.colorLeft("ack", "ack", "ack", "ack", "ack", "wht"); + me.colorLeftS("ack", "ack", "ack", "ack", "ack", "wht"); + me.colorLeftArrow("ack", "ack", "ack", "ack", "ack", "wht"); + + me["Simple_L4S"].setText(" PRESEL"); + me["Simple_L6S"].setText(" PREV"); + me["Simple_L6"].setText(" PHASE"); } + me["Simple_L1S"].setText("ACT MODE"); if (managedSpeed.getValue() == 1) { me["Simple_L1"].setText("MANAGED"); + me["Simple_L4"].setText(" [ ]"); + me.fontLeft(0, 0, 0, symbol, 0, 0); } else { me["Simple_L1"].setText("SELECTED"); + if (getprop("it-autoflight/input/kts-mach")) { + me["Simple_L4"].setText(sprintf(" %s", getprop("it-autoflight/input/spd-mach"))); + } else { + me["Simple_L4"].setText(sprintf(" %s", getprop("it-autoflight/input/spd-kts"))); + } + me.fontLeft(0, 0, 0, default, 0, 0); } if (costIndexSet.getValue() == 1) { me["Simple_L2"].setColor(0.0901,0.6039,0.7176); - me["Simple_L2"].setText(sprintf("%s", costIndex.getValue())); + me["Simple_L2"].setText(sprintf(" %s", costIndex.getValue())); } else { me["Simple_L2"].setColor(1,1,1); - me["Simple_L2"].setText("---"); + me["Simple_L2"].setText(" ---"); } - if (page == "PERFCRZ") { - me["Simple_R5"].show(); - me["Simple_R5S"].show(); - me["Simple_C5"].show(); - } else { - me["Simple_R5"].hide(); - me["Simple_R5S"].hide(); - me["Simple_C5"].hide(); - } - - me["Simple_L3"].setText(""); - me["Simple_L4"].setText(" [ ]"); - me["Simple_L6"].setText(" PHASE"); me["Simple_L1S"].setText("ACT MODE"); me["Simple_L2S"].setText(" CI"); + me["Simple_L3S"].setText(" MANAGED"); - me["Simple_L4S"].setText(" PRESEL"); - me["Simple_L6S"].setText(" PREV"); - me["Simple_R1"].setText("---"); - me["Simple_R5"].setText("FT/MIN"); - me["Simple_R6"].setText("PHASE "); + me["Simple_L3"].setText(sprintf(" %s", getprop("FMGC/internal/mng-spd"))); + me["Simple_R1S"].setText("DES EFOB"); - me["Simple_R5S"].setText("DES CABIN RATE"); - me["Simple_R6S"].setText("NEXT "); - me["Simple_C1"].setText("--- "); + me["Simple_R1"].setText("---"); + + me["Simple_R5S"].setText("DEST CABIN RATE"); me["Simple_C5"].setText(" -350"); - me["Simple_C1S"].setText("TIME "); + me["Simple_R5"].setText("FT/MIN"); + + me["Simple_C1S"].setText("UTC"); + me["Simple_C1"].setText("---"); + + me["Simple_R6S"].setText("NEXT "); + me["Simple_R6"].setText("PHASE "); + } else if (page == "PERFDES") { if (!pageSwitch[i].getBoolValue()) { me["Simple"].show(); @@ -1851,84 +1898,148 @@ var canvas_MCDU_base = { me["ArrowLeft"].hide(); me["ArrowRight"].hide(); - me.showLeft(1, 1, 1, -1, -1, 1); + me.showLeft(1, 1, 1, 1, 1, 1); me["Simple_L0S"].hide(); - me.showLeftS(1, 1, 1, -1, -1, 1); + me.showLeftS(1, 1, 1, 1, -1, 1); me.showLeftArrow(-1, -1, -1, -1, -1, 1); - me.showRight(1, -1, -1, -1, 0, 1); - me.showRightS(1, -1, -1, -1, 0, 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.showCenter(1, 1, -1, 1, 1, -1); + me.showCenterS(1, -1, 1, -1, -1, -1); me.fontLeft(default, default, default, symbol, default, default); me.fontLeftS(default, default, default, default, default, default); me.fontRight(default, default, default, default, default, default); me.fontRightS(default, default, default, default, default, default); - me.fontSizeLeft(normal, normal, small, small, normal, normal); - me.fontSizeRight(normal, normal, normal, normal, small, normal); - me.fontSizeCenter(normal, normal, normal, normal, small, normal); + me.fontSizeLeft(normal, normal, small, small, small, normal); + me.fontSizeLeftS(0, 0, 0, 0, small, 0); + me.fontSizeRight(normal, normal, normal, normal, normal, normal); + me.fontSizeCenterS(small, small, small, small, small, small); + me.fontSizeCenter(normal, small, normal, normal, small, normal); - me.colorLeft("grn", "ack", "grn", "blu", "wht", "wht"); - me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorLeft("grn", "blu", "grn", "blu", "grn", "blu"); + me.colorLeftS("wht", "wht", "wht", "wht", "grn", "blu"); me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorRight("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorRight("wht", "blu", "grn", "grn", "wht", "wht"); + me.colorRightS("wht", "wht", "wht", "wht", "grn", "wht"); me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorCenter("wht", "wht", "wht", "wht", "blu", "wht"); - me.colorCenterS("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorCenter("wht", "wht", "grn", "grn", "grn", "wht"); + me.colorCenterS("wht", "wht", "wht", "wht", "grn", "wht"); pageSwitch[i].setBoolValue(1); } if (getprop("FMGC/status/phase") == 4) { me["Simple_Title"].setColor(0.0509,0.7529,0.2941); + me.showLeft(0, 0, 0, 0, 1, 0); + me.showRight(0, 1, 0, 1, 0, 0); + me.showRightS(0, 0, 1, 0, 0, 0); + me.showCenter(0, 1, 0, 1, 1, 0); + me.showCenterS(0, 0, 1, 0, 0, 0); + + if (managedSpeed.getValue() == 1) { + me.showLeft(0, 0, 0, -1, 0, 0); + me.showLeftS(0, 0, 0, -1, 0, 0); + } else { + me["Simple_L4S"].setText(" SELECTED"); + me.showLeft(0, 0, 0, 1, 0, 0); + me.showLeftS(0, 0, 0, 1, 0, 0); + } + + if (activate_once.getValue() == 0 and activate_twice.getValue() == 0) { + me["Simple_L6S"].setText(" ACTIVATE"); + me["Simple_L6"].setText(" APPR PHASE"); + me.colorLeft("ack", "ack", "ack", "ack", "ack", "blu"); + me.colorLeftS("ack", "ack", "ack", "ack", "ack", "blu"); + me.colorLeftArrow("ack", "ack", "ack", "ack", "ack", "blu"); + } else if (activate_once.getValue() == 1 and activate_twice.getValue() == 0) { + me["Simple_L6S"].setText(" CONFIRM"); + me["Simple_L6"].setText(" APPR PHASE"); + me.colorLeft("ack", "ack", "ack", "ack", "ack", "amb"); + me.colorLeftS("ack", "ack", "ack", "ack", "ack", "amb"); + me.colorLeftArrow("ack", "ack", "ack", "ack", "ack", "amb"); + } else if (getprop("FMGC/status/phase") == 5) { + me["Simple_L6S"].setText(""); + me["Simple_L6"].setText(""); + me.colorLeft("ack", "ack", "ack", "ack", "ack", "blu"); + me.colorLeftS("ack", "ack", "ack", "ack", "ack", "blu"); + me.colorLeftArrow("ack", "ack", "ack", "ack", "ack", "blu"); + me.showLeftArrow(0, 0, 0, 0, 0, -1); + } else { + setprop("FMGC/internal/activate-once", 0); + setprop("FMGC/internal/activate-twice", 0); + } } else { me["Simple_Title"].setColor(1, 1, 1); + me.showLeft(0, 0, 0, 0, -1, 0); + me.showRight(0, -1, 0, -1, 0, 0); + me.showRightS(0, 0, -1, 0, 0, 0); + me.showCenter(0, -1, 0, -1, -1, 0); + me.showCenterS(0, 0, -1, 0, 0, 0); + + me.colorLeft("ack", "ack", "ack", "ack", "ack", "wht"); + me.colorLeftS("ack", "ack", "ack", "ack", "ack", "wht"); + me.colorLeftArrow("ack", "ack", "ack", "ack", "ack", "wht"); + + me["Simple_L4S"].setText(" PRESEL"); + me["Simple_L6S"].setText(" PREV"); + me["Simple_L6"].setText(" PHASE"); } + me["Simple_L1S"].setText("ACT MODE"); if (managedSpeed.getValue() == 1) { me["Simple_L1"].setText("MANAGED"); + me["Simple_L4"].setText(" [ ]"); + me.fontLeft(0, 0, 0, symbol, 0, 0); } else { me["Simple_L1"].setText("SELECTED"); + if (getprop("it-autoflight/input/kts-mach")) { + me["Simple_L4"].setText(sprintf(" %s", getprop("it-autoflight/input/spd-mach"))); + } else { + me["Simple_L4"].setText(sprintf(" %s", getprop("it-autoflight/input/spd-kts"))); + } + me.fontLeft(0, 0, 0, default, 0, 0); } if (costIndexSet.getValue() == 1) { me["Simple_L2"].setColor(0.0901,0.6039,0.7176); - me["Simple_L2"].setText(sprintf("%s", costIndex.getValue())); + me["Simple_L2"].setText(sprintf(" %s", costIndex.getValue())); } else { me["Simple_L2"].setColor(1,1,1); - me["Simple_L2"].setText("---"); + me["Simple_L2"].setText(" ---"); } - if (page == "PERFCRZ") { - me["Simple_R5"].show(); - me["Simple_R5S"].show(); - me["Simple_C5"].show(); - } else { - me["Simple_R5"].hide(); - me["Simple_R5S"].hide(); - me["Simple_C5"].hide(); - } - - me["Simple_L3"].setText(""); - me["Simple_L4"].setText(" [ ]"); - me["Simple_L6"].setText(" PHASE"); me["Simple_L1S"].setText("ACT MODE"); me["Simple_L2S"].setText(" CI"); + me["Simple_L3S"].setText(" MANAGED"); - me["Simple_L4S"].setText(" PRESEL"); - me["Simple_L6S"].setText(" PREV"); - me["Simple_R1"].setText("---"); - me["Simple_R5"].setText("FT/MIN"); - me["Simple_R6"].setText("PHASE "); + me["Simple_L3"].setText(sprintf(" %s", getprop("FMGC/internal/mng-spd"))); + + me["Simple_L5"].setText(" EXPEDITE"); + me["Simple_R1S"].setText("DES EFOB"); - me["Simple_R5S"].setText("DES CABIN RATE"); + me["Simple_R1"].setText("---"); + + me["Simple_C2"].setText(" PRED TO"); + me["Simple_R2"].setText(sprintf("FL%s", getprop("it-autoflight/input/alt") / 100)); + + me["Simple_R3S"].setText("DIST"); + me["Simple_R3"].setText("---"); + + me["Simple_R4"].setText("---"); + me["Simple_R5S"].setText("---"); + + me["Simple_C1S"].setText("UTC"); + me["Simple_C1"].setText("---"); + me["Simple_C3S"].setText("UTC"); + me["Simple_C3"].setText("----"); + me["Simple_C4"].setText("----"); + me["Simple_C5"].setText("----"); + me["Simple_R6S"].setText("NEXT "); - me["Simple_C1"].setText("--- "); - me["Simple_C5"].setText(" -350"); - me["Simple_C1S"].setText("TIME "); + me["Simple_R6"].setText("PHASE "); } else if (page == "PERFAPPR") { if (!pageSwitch[i].getBoolValue()) { me["Simple"].show(); diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index 6608e2ed..0a9d85e4 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -220,38 +220,38 @@ var masterFMGC = maketimer(0.2, func { } if ((n1_left < 70 or n1_right < 70) and gs < 90 and mode == " " and gear0 == 1 and phase == 1) { - setprop("FMGC/status/phase", "0"); + setprop("FMGC/status/phase", 0); setprop("systems/pressurization/mode", "GN"); } if (gear0 == 1 and phase == 0 and ((n1_left >= 70 and n1_right >= 70) or gs >= 90) and (state1 == "TOGA" or state2 == "TOGA") or (flx == 1 and (state1 == "MCT" or state2 == "MCT")) or (flx == 1 and ((state1 == "MAN THR" and thr1 >= 0.83) or (state2 == "MAN THR" and thr2 >= 0.83)))) { - setprop("FMGC/status/phase", "1"); + setprop("FMGC/status/phase", 1); setprop("systems/pressurization/mode", "TO"); } - if (phase == 1 and mode != "SRS" and mode != " ") { - setprop("FMGC/status/phase", "2"); + if (phase == 1 and ((mode != "SRS" and mode != " ") or alt >= reduc_agl_ft)) { + setprop("FMGC/status/phase", 2); setprop("systems/pressurization/mode", "TO"); } if ((phase == 3 or phase == 4) and (mode == "OP CLB" or mode == "CLB" or (modeI == "V/S" and getprop("it-autoflight/input/vs") >= 100) or (modeI == "FPA" and getprop("it-autoflight/input/fpa") >= 0.1))) { - setprop("FMGC/status/phase", "2"); + setprop("FMGC/status/phase", 2); setprop("systems/pressurization/mode", "TO"); } if ((phase == 2 or phase == 4) and (mode == "ALT" or mode == "ALT CRZ" or mode == "ALT CST")) { - setprop("FMGC/status/phase", "3"); + setprop("FMGC/status/phase", 3); setprop("systems/pressurization/mode", "CR"); } if ((phase == 2 or phase == 3) and (mode == "OP DES" or mode == "DES" or (modeI == "V/S" and getprop("it-autoflight/input/vs") <= -100) or (modeI == "FPA" and getprop("it-autoflight/input/fpa") <= -0.1))) { - setprop("FMGC/status/phase", "4"); + setprop("FMGC/status/phase", 4); setprop("systems/pressurization/mode", "DE"); } if (getprop("FMGC/status/to-state") == 0 and flaps >= 3 and (phase == "4" or mode == "G/S" or mode == "LAND" or mode == "FLARE")) { - setprop("FMGC/status/phase", "5"); + setprop("FMGC/status/phase", 5); } if (getprop("autopilot/route-manager/route/num") > 0 and getprop("autopilot/route-manager/active") == 1 and getprop("autopilot/route-manager/distance-remaining-nm") <= 15) { @@ -261,11 +261,17 @@ var masterFMGC = maketimer(0.2, func { } if (phase == "5" and state1 == "TOGA" and state2 == "TOGA") { - setprop("FMGC/status/phase", "6"); + setprop("FMGC/status/phase", 6); + # set speed to green dot here setprop("systems/pressurization/mode", "TO"); setprop("it-autoflight/input/toga", 1); } + #handle go-around + if (phase == "6" and alt >= reduc_agl_ft) { + setprop("FMGC/status/phase", 2); + } + if (wowl and wowr and gs <= 40 and (phase == "2" or phase == "3" or phase == "4" or phase == "5" or phase == "6") and ap1 == 0 and ap2 == 0) { reset_FMGC(); } diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index b6a82b0d..0b116560 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -198,6 +198,8 @@ var lskbutton = func(btn, i) { progCLBInput("L1",i); } else if (getprop("MCDU[" ~ i ~ "]/page") == "PROGCRZ") { progCRZInput("L1",i); + } else if (getprop("MCDU[" ~ i ~ "]/page") == "PROGDES") { + progDESInput("L1",i); } else if (getprop("MCDU[" ~ i ~ "]/page") == "PERFTO") { perfTOInput("L1",i); } else if (getprop("MCDU[" ~ i ~ "]/page") == "PERFAPPR") { diff --git a/Nasal/MCDU/PERFCRZ.nas b/Nasal/MCDU/PERFCRZ.nas index b629d371..3aa8db45 100644 --- a/Nasal/MCDU/PERFCRZ.nas +++ b/Nasal/MCDU/PERFCRZ.nas @@ -26,9 +26,23 @@ var perfCRZInput = func(key, i) { } } } else if (key == "L6") { - setprop("MCDU[" ~ i ~ "]/page", "PERFCLB"); - } - if (key == "R6") { + if (getprop("FMGC/status/phase") == 3) { + if (getprop("FMGC/internal/activate-once") == 1) { + if (getprop("FMGC/internal/activate-twice") == 0) { + setprop("FMGC/internal/activate-twice", 1); + setprop("FMGC/status/phase", 5); + setprop("FMGC/internal/decel", 1); + setprop("MCDU[" ~ i ~ "]/page", "PERFAPPR"); + } else { + notAllowed(i); + } + } else { + setprop("FMGC/internal/activate-once", 1); + } + } else { + setprop("MCDU[" ~ i ~ "]/page", "PERFCLB"); + } + } else if (key == "R6") { setprop("MCDU[" ~ i ~ "]/page", "PERFDES"); } } diff --git a/Nasal/MCDU/PERFDES.nas b/Nasal/MCDU/PERFDES.nas index f961f3ee..4a184b68 100644 --- a/Nasal/MCDU/PERFDES.nas +++ b/Nasal/MCDU/PERFDES.nas @@ -26,7 +26,22 @@ var perfDESInput = func(key, i) { } } } else if (key == "L6") { - setprop("MCDU[" ~ i ~ "]/page", "PERFCRZ"); + if (getprop("FMGC/status/phase") == 4) { + if (getprop("FMGC/internal/activate-once") == 1) { + if (getprop("FMGC/internal/activate-twice") == 0) { + setprop("FMGC/internal/activate-twice", 1); + setprop("FMGC/status/phase", 5); + setprop("FMGC/internal/decel", 1); + setprop("MCDU[" ~ i ~ "]/page", "PERFAPPR"); + } else { + notAllowed(i); + } + } else { + setprop("FMGC/internal/activate-once", 1); + } + } else { + setprop("MCDU[" ~ i ~ "]/page", "PERFCRZ"); + } } else if (key == "R6") { setprop("MCDU[" ~ i ~ "]/page", "PERFAPPR"); } diff --git a/Nasal/MCDU/PROGCLB.nas b/Nasal/MCDU/PROGCLB.nas index 0ceb1042..0ba1c032 100644 --- a/Nasal/MCDU/PROGCLB.nas +++ b/Nasal/MCDU/PROGCLB.nas @@ -5,11 +5,23 @@ var progCLBInput = func(key, i) { if (key == "L1") { if (scratchpad == "CLR") { setprop("FMGC/internal/cruise-fl-prog", getprop("FMGC/internal/cruise-fl")); + if (getprop("FMGC/status/phase") == 5) { + setprop("FMGC/status/phase", 3); + setprop("FMGC/internal/activate-once", 0); + setprop("FMGC/internal/activate-twice", 0); + setprop("FMGC/internal/decel", 0); + } } else if (int(scratchpad) != nil) { var crzs = size(scratchpad); 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("MCDU[" ~ i ~ "]/scratchpad", ""); + if (getprop("FMGC/status/phase") == 5) { + setprop("FMGC/status/phase", 3); + setprop("FMGC/internal/activate-once", 0); + setprop("FMGC/internal/activate-twice", 0); + setprop("FMGC/internal/decel", 0); + } } else { notAllowed(i); } diff --git a/Nasal/MCDU/PROGCRZ.nas b/Nasal/MCDU/PROGCRZ.nas index a357a1b9..f99c371d 100644 --- a/Nasal/MCDU/PROGCRZ.nas +++ b/Nasal/MCDU/PROGCRZ.nas @@ -5,11 +5,23 @@ var progCRZInput = func(key, i) { if (key == "L1") { if (scratchpad == "CLR") { setprop("FMGC/internal/cruise-fl-prog", getprop("FMGC/internal/cruise-fl")); + if (getprop("FMGC/status/phase") == 5) { + setprop("FMGC/status/phase", 3); + setprop("FMGC/internal/activate-once", 0); + setprop("FMGC/internal/activate-twice", 0); + setprop("FMGC/internal/decel", 0); + } } else if (int(scratchpad) != nil) { var crzs = size(scratchpad); 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("MCDU[" ~ i ~ "]/scratchpad", ""); + if (getprop("FMGC/status/phase") == 5) { + setprop("FMGC/status/phase", 3); + setprop("FMGC/internal/activate-once", 0); + setprop("FMGC/internal/activate-twice", 0); + setprop("FMGC/internal/decel", 0); + } } else { notAllowed(i); } diff --git a/Nasal/MCDU/PROGDES.nas b/Nasal/MCDU/PROGDES.nas index d330ad7b..6af9365c 100644 --- a/Nasal/MCDU/PROGDES.nas +++ b/Nasal/MCDU/PROGDES.nas @@ -1,7 +1,32 @@ # Copyright (c) 2020 Matthew Maring (hayden2000) var progDESInput = func(key, i) { - if (key == "L6") { - setprop("MCDU[" ~ i ~ "]/page", "INITA"); + var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad"); + if (key == "L1") { + if (scratchpad == "CLR") { + setprop("FMGC/internal/cruise-fl-prog", getprop("FMGC/internal/cruise-fl")); + if (getprop("FMGC/status/phase") == 5 or getprop("FMGC/status/phase") == 6) { + setprop("FMGC/status/phase", 3); + setprop("FMGC/internal/activate-once", 0); + setprop("FMGC/internal/activate-twice", 0); + setprop("FMGC/internal/decel", 0); + } + } else if (int(scratchpad) != nil) { + var crzs = size(scratchpad); + 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("MCDU[" ~ i ~ "]/scratchpad", ""); + if (getprop("FMGC/status/phase") == 5 or getprop("FMGC/status/phase") == 6) { + setprop("FMGC/status/phase", 3); + setprop("FMGC/internal/activate-once", 0); + setprop("FMGC/internal/activate-twice", 0); + setprop("FMGC/internal/decel", 0); + } + } else { + notAllowed(i); + } + } else { + notAllowed(i); + } } }