diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index a35cd073..f2b8e01c 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -572,7 +572,7 @@ var canvas_MCDU_base = { me["arrow5R"].setColor(getprop("/MCDUC/colors/blu/r"),getprop("/MCDUC/colors/blu/g"),getprop("/MCDUC/colors/blu/b")); } - if (getprop("/FMGC/status/phase") == 0 or getprop("/FMGC/status/phase") == 7) { + if (fmgc.FMGCInternal.phase == 0 or fmgc.FMGCInternal.phase == 7) { me["Simple_L5"].show(); me["Simple_L5S"].show(); } else { @@ -1154,7 +1154,7 @@ var canvas_MCDU_base = { } me["Simple_R6S"].setText("GND TEMP"); - if (getprop("/FMGC/status/phase") == 0 and !fmgc.FMGCInternal.gndTempSet) { + if (fmgc.FMGCInternal.phase == 0 and !fmgc.FMGCInternal.gndTempSet) { fmgc.FMGCInternal.gndTemp = 15 - (2 * getprop("/position/gear-agl-ft") / 1000); me["Simple_R6"].setText(sprintf("%.0fg", fmgc.FMGCInternal.gndTemp)); me["Simple_R6"].setFontSize(small); @@ -2063,16 +2063,16 @@ var canvas_MCDU_base = { } } else if (page == "PROGTO" or page == "PROGCLB" or page == "PROGCRZ" or page == "PROGDES") { - if (getprop("/FMGC/status/phase") == 0 or getprop("/FMGC/status/phase") == 1) { + if (fmgc.FMGCInternal.phase == 0 or fmgc.FMGCInternal.phase == 1) { setprop("/MCDU[" ~ i ~ "]/page", "PROGTO"); page = "PROGTO"; - } else if (getprop("/FMGC/status/phase") == 2) { + } else if (fmgc.FMGCInternal.phase == 2) { setprop("/MCDU[" ~ i ~ "]/page", "PROGCLB"); page = "PROGCLB"; - } else if (getprop("/FMGC/status/phase") == 3) { + } else if (fmgc.FMGCInternal.phase == 3) { setprop("/MCDU[" ~ i ~ "]/page", "PROGCRZ"); page = "PROGCRZ"; - } else if (getprop("/FMGC/status/phase") == 4 or getprop("/FMGC/status/phase") == 5 or getprop("/FMGC/status/phase") == 6) { + } else if (fmgc.FMGCInternal.phase == 4 or fmgc.FMGCInternal.phase == 5 or fmgc.FMGCInternal.phase == 6) { setprop("/MCDU[" ~ i ~ "]/page", "PROGDES"); page = "PROGDES"; } @@ -2286,7 +2286,7 @@ var canvas_MCDU_base = { me["Simple_L4"].setFontSize(small); } - if (getprop("/FMGC/status/phase") == 0 or getprop("/FMGC/status/phase") == 7) { + if (fmgc.FMGCInternal.phase == 0 or fmgc.FMGCInternal.phase == 7) { me["Simple_L6_Arrow"].show(); me["Simple_L6"].show(); me["Simple_L6S"].show(); @@ -2296,7 +2296,7 @@ var canvas_MCDU_base = { me["Simple_L6S"].hide(); } - if (getprop("/FMGC/status/phase") == 1) { + if (fmgc.FMGCInternal.phase == 1) { me["Simple_Title"].setColor(0.0509,0.7529,0.2941); } else { me["Simple_Title"].setColor(1, 1, 1); @@ -2369,7 +2369,7 @@ var canvas_MCDU_base = { me["Simple_R5"].setFontSize(small); } - if ((zfwSet.getValue() == 1 and blockSet.getValue() == 1) or getprop("/FMGC/status/phase") == 1) { + if ((zfwSet.getValue() == 1 and blockSet.getValue() == 1) or fmgc.FMGCInternal.phase == 1) { me["Simple_C1"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/flap2_to"))); me["Simple_C2"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/slat_to"))); me["Simple_C3"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/clean_to"))); @@ -2440,7 +2440,7 @@ var canvas_MCDU_base = { pageSwitch[i].setBoolValue(1); } - if (getprop("/FMGC/status/phase") == 2) { + if (fmgc.FMGCInternal.phase == 2) { me["Simple_Title"].setColor(0.0509,0.7529,0.2941); me.showLeft(0, 0, 0, 0, 1, 0); me.showLeftS(0, 0, 0, 0, 1, 0); @@ -2470,7 +2470,7 @@ var canvas_MCDU_base = { 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) { + } else if (fmgc.FMGCInternal.phase == 5) { me["Simple_L6S"].setText(""); me["Simple_L6"].setText(""); me.colorLeft("ack", "ack", "ack", "ack", "ack", "blu"); @@ -2606,7 +2606,7 @@ var canvas_MCDU_base = { pageSwitch[i].setBoolValue(1); } - if (getprop("/FMGC/status/phase") == 3) { + if (fmgc.FMGCInternal.phase == 3) { me["Simple_Title"].setColor(0.0509,0.7529,0.2941); if (managedSpeed.getValue() == 1) { @@ -2630,7 +2630,7 @@ var canvas_MCDU_base = { 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) { + } else if (fmgc.FMGCInternal.phase == 5) { me["Simple_L6S"].setText(""); me["Simple_L6"].setText(""); me.colorLeft("ack", "ack", "ack", "ack", "ack", "blu"); @@ -2757,7 +2757,7 @@ var canvas_MCDU_base = { pageSwitch[i].setBoolValue(1); } - if (getprop("/FMGC/status/phase") == 4) { + if (fmgc.FMGCInternal.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); @@ -2786,7 +2786,7 @@ var canvas_MCDU_base = { 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) { + } else if (fmgc.FMGCInternal.phase == 5) { me["Simple_L6S"].setText(""); me["Simple_L6"].setText(""); me.colorLeft("ack", "ack", "ack", "ack", "ack", "blu"); @@ -2926,7 +2926,7 @@ var canvas_MCDU_base = { pageSwitch[i].setBoolValue(1); } - if (getprop("/FMGC/status/phase") == 5) { + if (fmgc.FMGCInternal.phase == 5) { me["Simple_Title"].setColor(0.0509,0.7529,0.2941); } else { me["Simple_Title"].setColor(1, 1, 1); @@ -3026,7 +3026,7 @@ var canvas_MCDU_base = { me["Simple_R6"].setText("PHASE "); me["Simple_L5S"].setText(" VAPP"); - if ((zfwSet.getValue() == 1 and blockSet.getValue() == 1) or getprop("/FMGC/status/phase") == 5) { + if ((zfwSet.getValue() == 1 and blockSet.getValue() == 1) or fmgc.FMGCInternal.phase == 5) { me["Simple_C1"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/flap2_appr"))); me["Simple_C2"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/slat_appr"))); me["Simple_C3"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/clean_appr"))); @@ -3114,7 +3114,7 @@ var canvas_MCDU_base = { pageSwitch[i].setBoolValue(1); } - if (getprop("/FMGC/status/phase") == 6) { + if (fmgc.FMGCInternal.phase == 6) { me["Simple_Title"].setColor(0.0509,0.7529,0.2941); } else { me["Simple_Title"].setColor(1, 1, 1); @@ -3138,7 +3138,7 @@ var canvas_MCDU_base = { me["Simple_R5"].setText(sprintf("%3.0f", engOutAcc.getValue())); me["Simple_R5S"].setText("ENG OUT ACC"); - if ((zfwSet.getValue() == 1 and blockSet.getValue() == 1) or getprop("/FMGC/status/phase") == 6) { + if ((zfwSet.getValue() == 1 and blockSet.getValue() == 1) or fmgc.FMGCInternal.phase == 6) { me["Simple_C1"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/flap2_appr"))); me["Simple_C2"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/slat_appr"))); me["Simple_C3"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/clean_appr"))); diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index a8f9b308..3604d36c 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -88,7 +88,6 @@ var fd_roll = props.globals.getNode("/it-autoflight/fd/roll-bar", 1); var fd_pitch = props.globals.getNode("/it-autoflight/fd/pitch-bar", 1); var decision = props.globals.getNode("/instrumentation/mk-viii/inputs/arinc429/decision-height", 1); var slip_skid = props.globals.getNode("/instrumentation/pfd/slip-skid", 1); -var FMGCphase = props.globals.getNode("/FMGC/status/phase", 1); var loc = props.globals.getNode("/instrumentation/nav[0]/heading-needle-deflection-norm", 1); var gs = props.globals.getNode("/instrumentation/nav[0]/gs-needle-deflection-norm", 1); var show_hdg = props.globals.getNode("/it-autoflight/custom/show-hdg", 1); @@ -638,7 +637,7 @@ var canvas_PFD_base = { me["QNH"].hide(); me["QNH_setting"].hide(); - if (altitude.getValue() < fmgc.FMGCInternal.transAlt and FMGCphase.getValue() == '4') { + if (altitude.getValue() < fmgc.FMGCInternal.transAlt and fmgc.FMGCInternal.phase == 4) { if (qnh_going == 0) { qnh_going = 1; } @@ -663,7 +662,7 @@ var canvas_PFD_base = { me["QNH_std"].hide(); me["QNH_box"].hide(); - if (altitude.getValue() >= fmgc.FMGCInternal.transAlt and FMGCphase.getValue() == '2') { + if (altitude.getValue() >= fmgc.FMGCInternal.transAlt and fmgc.FMGCInternal.phase == 2) { if (qnh_going == 0) { qnh_going = 1; } @@ -688,7 +687,7 @@ var canvas_PFD_base = { } else if (alt_inhg_mode.getValue() == 1) { - if (altitude.getValue() >= fmgc.FMGCInternal.transAlt and FMGCphase.getValue() == '2') { + if (altitude.getValue() >= fmgc.FMGCInternal.transAlt and fmgc.FMGCInternal.phase == 2) { if (qnh_going == 0) { qnh_going = 1; } @@ -755,7 +754,7 @@ var canvas_PFD_base = { me["AI_agl"].setText(sprintf("%s", math.round(math.clamp(gear_agl_cur, 0, 2500)))); - if (FMGCphase.getValue() < 3 or fmgc.flightPlanController.arrivalDist >= 250) { + if (fmgc.FMGCInternal.phase < 3 or fmgc.flightPlanController.arrivalDist >= 250) { me["FMA_dh_box"].hide(); me["FMA_dh"].hide(); me["FMA_dhn"].hide(); @@ -858,7 +857,7 @@ var canvas_PFD_base = { me["AI_agl_g"].setRotation(-roll_cur * D2R); - FMGCphase_act = FMGCphase.getValue(); + FMGCphase_act = fmgc.FMGCInternal.phase; if ((wow1.getValue() == 1 or wow2.getValue() == 1) and FMGCphase_act != 0 and FMGCphase_act != 1) { me["AI_stick"].show(); me["AI_stick_pos"].show(); @@ -1199,7 +1198,7 @@ var canvas_PFD_1 = { me["ASI_scale"].setTranslation(0, me.ASI * 6.6); me["ASI_max"].setTranslation(0, me.ASImax * -6.6); - if (!getprop("/FMGC/status/to-state") and FMGCphase.getValue() >= 1 and !wow1.getValue() and !wow2.getValue()) { + if (!getprop("/FMGC/status/to-state") and fmgc.FMGCInternal.phase >= 1 and !wow1.getValue() and !wow2.getValue()) { me.FMGC_vls = getprop("/FMGC/internal/computed-speeds/vls_min"); if (me.FMGC_vls <= 30) { me.VLSmin = 0 - me.ASI; @@ -1261,7 +1260,7 @@ var canvas_PFD_1 = { } tgt_ias = vapp; tgt_kts = vapp; - } else if (FMGCphase.getValue() == 6) { + } else if (fmgc.FMGCInternal.phase == 6) { clean = getprop("/FMGC/internal/computed-speeds/clean"); tgt_ias = clean; tgt_kts = clean; @@ -1337,11 +1336,11 @@ var canvas_PFD_1 = { me.SPDv1trgtdiff = tgt_v1 - ind_spd; - if (pts.Position.gearAglFt.getValue() < 55 and FMGCphase.getValue() <= 2 and me.SPDv1trgtdiff >= -42 and me.SPDv1trgtdiff <= 42) { + if (pts.Position.gearAglFt.getValue() < 55 and fmgc.FMGCInternal.phase <= 2 and me.SPDv1trgtdiff >= -42 and me.SPDv1trgtdiff <= 42) { me["v1_group"].show(); me["v1_text"].hide(); me["v1_group"].setTranslation(0, me.V1trgt * -6.6); - } else if (pts.Position.gearAglFt.getValue() < 55 and FMGCphase.getValue() <= 2) { + } else if (pts.Position.gearAglFt.getValue() < 55 and fmgc.FMGCInternal.phase <= 2) { me["v1_group"].hide(); me["v1_text"].show(); me["v1_text"].setText(sprintf("%3.0f", fmgc.FMGCInternal.v1)); @@ -1366,7 +1365,7 @@ var canvas_PFD_1 = { me.SPDvrtrgtdiff = tgt_vr - ind_spd; - if (pts.Position.gearAglFt.getValue() < 55 and FMGCphase.getValue() <= 2 and me.SPDvrtrgtdiff >= -42 and me.SPDvrtrgtdiff <= 42) { + if (pts.Position.gearAglFt.getValue() < 55 and fmgc.FMGCInternal.phase <= 2 and me.SPDvrtrgtdiff >= -42 and me.SPDvrtrgtdiff <= 42) { me["vr_speed"].show(); me["vr_speed"].setTranslation(0, me.VRtrgt * -6.6); } else { @@ -1388,11 +1387,11 @@ var canvas_PFD_1 = { me.SPDv2trgtdiff = tgt_v2 - ind_spd; - if (pts.Position.gearAglFt.getValue() < 55 and FMGCphase.getValue() <= 2 and me.SPDv2trgtdiff >= -42 and me.SPDv2trgtdiff <= 42) { + if (pts.Position.gearAglFt.getValue() < 55 and fmgc.FMGCInternal.phase <= 2 and me.SPDv2trgtdiff >= -42 and me.SPDv2trgtdiff <= 42) { me["ASI_target"].show(); me["ASI_target"].setTranslation(0, me.V2trgt * -6.6); me["ASI_digit_UP"].setText(sprintf("%3.0f", fmgc.FMGCInternal.v2)); - } else if (pts.Position.gearAglFt.getValue() < 55 and FMGCphase.getValue() <= 2) { + } else if (pts.Position.gearAglFt.getValue() < 55 and fmgc.FMGCInternal.phase <= 2) { me["ASI_target"].hide(); me["ASI_digit_UP"].setText(sprintf("%3.0f", fmgc.FMGCInternal.v2)); } @@ -1675,7 +1674,7 @@ var canvas_PFD_1 = { landing_diff_cur = landing_diff.getValue(); if (landing_diff_cur >= -565 and landing_diff_cur <= 565) { - if ((FMGCphase.getValue() == 5 or FMGCphase.getValue() == 6) and !wow1.getValue() and !wow2.getValue()) { #add std too + if ((fmgc.FMGCInternal.phase == 5 or fmgc.FMGCInternal.phase == 6) and !wow1.getValue() and !wow2.getValue()) { #add std too me["ground"].setTranslation(0, (landing_diff_cur / 100) * -48.66856); me["ground"].show(); } else { @@ -1937,7 +1936,7 @@ var canvas_PFD_2 = { me["ASI_scale"].setTranslation(0, me.ASI * 6.6); me["ASI_max"].setTranslation(0, me.ASImax * -6.6); - if (!getprop("/FMGC/status/to-state") and FMGCphase.getValue() >= 1 and !wow1.getValue() and !wow2.getValue()) { + if (!getprop("/FMGC/status/to-state") and fmgc.FMGCInternal.phase >= 1 and !wow1.getValue() and !wow2.getValue()) { me.FMGC_vls = getprop("/FMGC/internal/computed-speeds/vls_min"); if (me.FMGC_vls <= 30) { me.VLSmin = 0 - me.ASI; @@ -1999,7 +1998,7 @@ var canvas_PFD_2 = { } tgt_ias = vapp; tgt_kts = vapp; - } else if (FMGCphase.getValue() == 6) { + } else if (fmgc.FMGCInternal.phase == 6) { clean = getprop("/FMGC/internal/computed-speeds/clean"); tgt_ias = clean; tgt_kts = clean; @@ -2076,11 +2075,11 @@ var canvas_PFD_2 = { me.SPDv1trgtdiff = tgt_v1 - ind_spd; - if (pts.Position.gearAglFt.getValue() < 55 and FMGCphase.getValue() <= 2 and me.SPDv1trgtdiff >= -42 and me.SPDv1trgtdiff <= 42) { + if (pts.Position.gearAglFt.getValue() < 55 and fmgc.FMGCInternal.phase <= 2 and me.SPDv1trgtdiff >= -42 and me.SPDv1trgtdiff <= 42) { me["v1_group"].show(); me["v1_text"].hide(); me["v1_group"].setTranslation(0, me.V1trgt * -6.6); - } else if (pts.Position.gearAglFt.getValue() < 55 and FMGCphase.getValue() <= 2) { + } else if (pts.Position.gearAglFt.getValue() < 55 and fmgc.FMGCInternal.phase <= 2) { me["v1_group"].hide(); me["v1_text"].show(); me["v1_text"].setText(sprintf("%3.0f", fmgc.FMGCInternal.v1)); @@ -2105,7 +2104,7 @@ var canvas_PFD_2 = { me.SPDvrtrgtdiff = tgt_vr - ind_spd; - if (pts.Position.gearAglFt.getValue() < 55 and FMGCphase.getValue() <= 2 and me.SPDvrtrgtdiff >= -42 and me.SPDvrtrgtdiff <= 42) { + if (pts.Position.gearAglFt.getValue() < 55 and fmgc.FMGCInternal.phase <= 2 and me.SPDvrtrgtdiff >= -42 and me.SPDvrtrgtdiff <= 42) { me["vr_speed"].show(); me["vr_speed"].setTranslation(0, me.VRtrgt * -6.6); } else { @@ -2127,11 +2126,11 @@ var canvas_PFD_2 = { me.SPDv2trgtdiff = tgt_v2 - ind_spd; - if (pts.Position.gearAglFt.getValue() < 55 and FMGCphase.getValue() <= 2 and me.SPDv2trgtdiff >= -42 and me.SPDv2trgtdiff <= 42) { + if (pts.Position.gearAglFt.getValue() < 55 and fmgc.FMGCInternal.phase <= 2 and me.SPDv2trgtdiff >= -42 and me.SPDv2trgtdiff <= 42) { me["ASI_target"].show(); me["ASI_target"].setTranslation(0, me.V2trgt * -6.6); me["ASI_digit_UP"].setText(sprintf("%3.0f", fmgc.FMGCInternal.v2)); - } else if (pts.Position.gearAglFt.getValue() < 55 and FMGCphase.getValue() <= 2) { + } else if (pts.Position.gearAglFt.getValue() < 55 and fmgc.FMGCInternal.phase <= 2) { me["ASI_target"].hide(); me["ASI_digit_UP"].setText(sprintf("%3.0f", fmgc.FMGCInternal.v2)); } @@ -2413,7 +2412,7 @@ var canvas_PFD_2 = { landing_diff_cur = landing_diff.getValue(); if (landing_diff_cur >= -565 and landing_diff_cur <= 565) { - if ((FMGCphase.getValue() == 5 or FMGCphase.getValue() == 6) and !wow1.getValue() and !wow2.getValue()) { #add std too + if ((fmgc.FMGCInternal.phase == 5 or fmgc.FMGCInternal.phase == 6) and !wow1.getValue() and !wow2.getValue()) { #add std too me["ground"].setTranslation(0, (landing_diff_cur / 100) * -48.66856); me["ground"].show(); } else { diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index 87d34381..9d0bc95a 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -37,7 +37,6 @@ var targetfpa = 0; var accel_agl_ft = 0; var locarm = 0; var apprarm = 0; -var gear0 = 0; var fd1 = 0; var fd2 = 0; var spd = 0; @@ -112,7 +111,6 @@ setprop("/FMGC/internal/vor1-mcdu", "XXX/999.99"); setprop("/FMGC/internal/vor2-mcdu", "999.99/XXX"); setprop("/FMGC/internal/adf1-mcdu", "XXX/999.99"); setprop("/FMGC/internal/adf2-mcdu", "999.99/XXX"); -setprop("gear/gear[0]/wow-fmgc", 1); var FMGCinit = func { setprop("/FMGC/status/to-state", 0); @@ -137,6 +135,9 @@ var FMGCinit = func { } var FMGCInternal = { + # phase logic + phase: 0, + # PERF v1: 0, v1set: 0, @@ -187,14 +188,13 @@ var FMGCNodes = { # FBW Trim # ############ -setlistener("/gear/gear[0]/wow-fmgc", func { +setlistener("/gear/gear[0]/wow", func { trimReset(); -}); +}, 0, 0); var trimReset = func { - gear0 = getprop("/gear/gear[0]/wow"); flaps = getprop("/controls/flight/flaps-pos"); - if (gear0 == 1 and getprop("/FMGC/status/to-state") == 0 and (flaps >= 5 or (flaps >= 4 and getprop("/instrumentation/mk-viii/inputs/discretes/momentary-flap3-override") == 1))) { + if (pts.Gear.wow[0].getBoolValue() and getprop("/FMGC/status/to-state") == 0 and (flaps >= 5 or (flaps >= 4 and getprop("/instrumentation/mk-viii/inputs/discretes/momentary-flap3-override") == 1))) { interpolate("/controls/flight/elevator-trim", 0.0, 1.5); } } @@ -426,10 +426,9 @@ var masterFMGC = maketimer(0.2, func { # cruiseft = FMGCInternal.crzFt; # cruiseft_b = FMGCInternal.crzFt - 200; newcruise = getprop("/it-autoflight/internal/alt"); - phase = getprop("/FMGC/status/phase"); + phase = fmgc.FMGCInternal.phase; state1 = getprop("/systems/thrust/state1"); state2 = getprop("/systems/thrust/state2"); - gear0 = getprop("/gear/gear[0]/wow"); wowl = getprop("/gear/gear[1]/wow"); wowr = getprop("/gear/gear[2]/wow"); targetalt = getprop("/it-autoflight/internal/alt"); @@ -438,7 +437,7 @@ var masterFMGC = maketimer(0.2, func { accel_agl_ft = getprop("/it-autoflight/settings/accel-agl-ft"); locarm = getprop("/it-autopilot/output/loc-armed"); apprarm = getprop("/it-autopilot/output/appr-armed"); - gear0 = getprop("/gear/gear[0]/wow"); + gear0 = pts.Gear.wow[0].getBoolValue(); ap1 = getprop("/it-autoflight/output/ap1"); ap2 = getprop("/it-autoflight/output/ap2"); flx = getprop("/systems/thrust/lim-flex"); @@ -451,60 +450,56 @@ var masterFMGC = maketimer(0.2, func { thr2 = getprop("/controls/engines/engine[1]/throttle-pos"); altSel = getprop("/it-autoflight/input/alt"); - if (getprop("/gear/gear[0]/wow") != getprop("/gear/gear[0]/wow-fmgc")) { - setprop("gear/gear[0]/wow-fmgc", getprop("/gear/gear[0]/wow")); - } - - if ((n1_left < 85 or n1_right < 85) and gs < 90 and mode == " " and gear0 == 1 and phase == 1) { # rejected takeoff - setprop("/FMGC/status/phase", 0); + if ((n1_left < 85 or n1_right < 85) and gs < 90 and mode == " " and gear0 and FMGCInternal.FMGCInternal.phase == 1) { # rejected takeoff + FMGCInternal.phase = 0; setprop("systems/pressurization/mode", "GN"); } - if (gear0 == 1 and phase == 0 and ((n1_left >= 85 and n1_right >= 85 and mode == "SRS") or gs >= 90)) { - setprop("/FMGC/status/phase", 1); + if (gear0 and FMGCInternal.FMGCInternal.phase == 0 and ((n1_left >= 85 and n1_right >= 85 and mode == "SRS") or gs >= 90)) { + FMGCInternal.phase = 1; setprop("systems/pressurization/mode", "TO"); } - if (phase == 1 and ((mode != "SRS" and mode != " ") or alt >= accel_agl_ft)) { - setprop("/FMGC/status/phase", 2); + if (FMGCInternal.FMGCInternal.phase == 1 and ((mode != "SRS" and mode != " ") or alt >= accel_agl_ft)) { + FMGCInternal.phase = 2; setprop("systems/pressurization/mode", "TO"); } - if (phase == 2 and (mode == "ALT CRZ" or mode == "ALT CRZ*")) { - setprop("/FMGC/status/phase", 3); + if (FMGCInternal.FMGCInternal.phase == 2 and (mode == "ALT CRZ" or mode == "ALT CRZ*")) { + FMGCInternal.phase = 3; setprop("systems/pressurization/mode", "CR"); } if (FMGCInternal.crzFl >= 200) { - if (phase == 3 and (flightPlanController.arrivalDist <= 200 or altSel < 20000)) { - setprop("/FMGC/status/phase", 4); + if (FMGCInternal.FMGCInternal.phase == 3 and (flightPlanController.arrivalDist <= 200 or altSel < 20000)) { + FMGCInternal.phase = 4; setprop("systems/pressurization/mode", "DE"); } } else { - if (phase == 3 and (flightPlanController.arrivalDist <= 200 or altSel < (FMGCInternal.crzFl * 100))) { # todo - not sure about crzFl condition, investigate what happens! - setprop("/FMGC/status/phase", 4); + if (FMGCInternal.FMGCInternal.phase == 3 and (flightPlanController.arrivalDist <= 200 or altSel < (FMGCInternal.crzFl * 100))) { # todo - not sure about crzFl condition, investigate what happens! + FMGCInternal.phase = 4; setprop("systems/pressurization/mode", "DE"); } } - if (phase == 4 and getprop("/FMGC/internal/decel")) { - setprop("/FMGC/status/phase", 5); + if (FMGCInternal.FMGCInternal.phase == 4 and getprop("/FMGC/internal/decel")) { + FMGCInternal.phase = 5; } if (flightPlanController.num[2].getValue() > 0 and getprop("/FMGC/flightplan[2]/active") == 1 and flightPlanController.arrivalDist <= 15 and (modelat == "NAV" or modelat == "LOC" or modelat == "LOC*") and aglalt < 9500) { #todo decel pseudo waypoint setprop("/FMGC/internal/decel", 1); - } else if (getprop("/FMGC/internal/decel") == 1 and (phase == 0 or phase == 6)) { + } else if (getprop("/FMGC/internal/decel") == 1 and (FMGCInternal.FMGCInternal.phase == 0 or FMGCInternal.FMGCInternal.phase == 6)) { setprop("/FMGC/internal/decel", 0); } - if ((phase == "5") and state1 == "TOGA" and state2 == "TOGA") { - setprop("/FMGC/status/phase", 6); + if ((FMGCInternal.FMGCInternal.phase == 5) and state1 == "TOGA" and state2 == "TOGA") { + FMGCInternal.phase = 6; setprop("systems/pressurization/mode", "TO"); setprop("/it-autoflight/input/toga", 1); } - if (phase == "6" and alt >= accel_agl_ft) { # todo when insert altn or new dest - setprop("/FMGC/status/phase", 2); + if (FMGCInternal.FMGCInternal.phase == 6 and alt >= accel_agl_ft) { # todo when insert altn or new dest + FMGCInternal.phase = 2; } if (getprop("/systems/navigation/adr/computation/overspeed-vfe-spd") != 1024) { @@ -561,7 +556,7 @@ var masterFMGC = maketimer(0.2, func { } # predicted takeoff speeds - if (phase == "1") { + if (FMGCInternal.FMGCInternal.phase == 1) { setprop("/FMGC/internal/computed-speeds/clean_to", getprop("/FMGC/internal/computed-speeds/clean")); setprop("/FMGC/internal/computed-speeds/vs1g_clean_to", getprop("/FMGC/internal/computed-speeds/vs1g_clean")); setprop("/FMGC/internal/computed-speeds/vs1g_conf_2_to", getprop("/FMGC/internal/computed-speeds/vs1g_conf_2")); @@ -584,7 +579,7 @@ var masterFMGC = maketimer(0.2, func { } # predicted approach (temp go-around) speeds - if (phase == "5" or phase == "6") { + if (FMGCInternal.FMGCInternal.phase == 5 or FMGCInternal.FMGCInternal.phase == 6) { setprop("/FMGC/internal/computed-speeds/clean_appr", getprop("/FMGC/internal/computed-speeds/clean")); setprop("/FMGC/internal/computed-speeds/vs1g_clean_appr", getprop("/FMGC/internal/computed-speeds/vs1g_clean")); setprop("/FMGC/internal/computed-speeds/vs1g_conf_2_appr", getprop("/FMGC/internal/computed-speeds/vs1g_conf_2")); @@ -702,7 +697,7 @@ var masterFMGC = maketimer(0.2, func { setprop("/FMGC/internal/minspeed", getprop("/FMGC/internal/computed-speeds/vapp")); } - if (gear0 == 1 and (state1 == "MCT" or state1 == "MAN THR" or state1 == "TOGA") and (state2 == "MCT" or state2 == "MAN THR" or state2 == "TOGA") and flaps < 5) { + if (gear0 and (state1 == "MCT" or state1 == "MAN THR" or state1 == "TOGA") and (state2 == "MCT" or state2 == "MAN THR" or state2 == "TOGA") and flaps < 5) { setprop("/FMGC/status/to-state", 1); } if (pts.Position.gearAglFt.getValue() >= 55) { @@ -907,7 +902,7 @@ var ManagedSPD = maketimer(0.25, func { kts_sel = getprop("/it-autoflight/input/kts"); mach_sel = getprop("/it-autoflight/input/mach"); srsSPD = getprop("/it-autoflight/settings/togaspd"); - phase = getprop("/FMGC/status/phase"); # 0 is Preflight 1 is Takeoff 2 is Climb 3 is Cruise 4 is Descent 5 is Decel/Approach 6 is Go Around 7 is Done + phase = fmgc.FMGCInternal.phase; # 0 is Preflight 1 is Takeoff 2 is Climb 3 is Cruise 4 is Descent 5 is Decel/Approach 6 is Go Around 7 is Done flap = getprop("/controls/flight/flaps-pos"); maxspeed = getprop("/FMGC/internal/maxspeed"); minspeed = getprop("/FMGC/internal/minspeed"); @@ -920,22 +915,22 @@ var ManagedSPD = maketimer(0.25, func { mng_alt_mach_cmd = getprop("/FMGC/internal/mng-alt-mach"); mng_alt_mach = math.round(mng_alt_mach_cmd, 0.001); - if (mach > mng_alt_mach and (phase == 2 or phase == 3)) { + if (mach > mng_alt_mach and (FMGCInternal.FMGCInternal.phase == 2 or FMGCInternal.FMGCInternal.phase == 3)) { setprop("/FMGC/internal/mach-switchover", 1); } - if (ias > mng_alt_spd and (phase == 4 or phase == 5)) { + if (ias > mng_alt_spd and (FMGCInternal.FMGCInternal.phase == 4 or FMGCInternal.FMGCInternal.phase == 5)) { setprop("/FMGC/internal/mach-switchover", 0); } - if ((mode == " " or mode == "SRS") and (phase == 0 or phase == 1)) { + if ((mode == " " or mode == "SRS") and (FMGCInternal.FMGCInternal.phase == 0 or FMGCInternal.FMGCInternal.phase == 1)) { if (mngktsmach) { setprop("/FMGC/internal/mng-kts-mach", 0); } if (mng_spd_cmd != srsSPD) { setprop("/FMGC/internal/mng-spd-cmd", srsSPD); } - } else if ((phase == 2 or phase == 3) and altitude <= 10050) { + } else if ((FMGCInternal.FMGCInternal.phase == 2 or FMGCInternal.FMGCInternal.phase == 3) and altitude <= 10050) { if (mngktsmach) { setprop("/FMGC/internal/mng-kts-mach", 0); } @@ -944,35 +939,35 @@ var ManagedSPD = maketimer(0.25, func { } else if (mng_spd_cmd != minspeed and decel) { setprop("/FMGC/internal/mng-spd-cmd", minspeed); } - } else if ((phase == 2 or phase == 3) and altitude > 10070 and !mach_switchover) { + } else if ((FMGCInternal.FMGCInternal.phase == 2 or FMGCInternal.FMGCInternal.phase == 3) and altitude > 10070 and !mach_switchover) { if (mngktsmach) { setprop("/FMGC/internal/mng-kts-mach", 0); } if (mng_spd_cmd != mng_alt_spd) { setprop("/FMGC/internal/mng-spd-cmd", mng_alt_spd); } - } else if ((phase == 2 or phase == 3) and altitude > 10070 and mach_switchover) { + } else if ((FMGCInternal.FMGCInternal.phase == 2 or FMGCInternal.FMGCInternal.phase == 3) and altitude > 10070 and mach_switchover) { if (!mngktsmach) { setprop("/FMGC/internal/mng-kts-mach", 1); } if (mng_spd_cmd != mng_alt_mach) { setprop("/FMGC/internal/mng-spd-cmd", mng_alt_mach); } - } else if (phase == 4 and altitude > 11000 and !mach_switchover) { + } else if (FMGCInternal.FMGCInternal.phase == 4 and altitude > 11000 and !mach_switchover) { if (mngktsmach) { setprop("/FMGC/internal/mng-kts-mach", 0); } if (mng_spd_cmd != mng_alt_spd) { setprop("/FMGC/internal/mng-spd-cmd", mng_alt_spd); } - } else if (phase == 4 and altitude > 11000 and mach_switchover) { + } else if (FMGCInternal.FMGCInternal.phase == 4 and altitude > 11000 and mach_switchover) { if (!mngktsmach) { setprop("/FMGC/internal/mng-kts-mach", 1); } if (mng_spd_cmd != mng_alt_mach) { setprop("/FMGC/internal/mng-spd-cmd", mng_alt_mach); } - } else if ((phase == 4 or phase == 5 or phase == 6) and altitude > 11000 and !mach_switchover) { + } else if ((FMGCInternal.FMGCInternal.phase == 4 or FMGCInternal.FMGCInternal.phase == 5 or FMGCInternal.FMGCInternal.phase == 6) and altitude > 11000 and !mach_switchover) { if (mngktsmach) { setprop("/FMGC/internal/mng-kts-mach", 0); } @@ -981,7 +976,7 @@ var ManagedSPD = maketimer(0.25, func { } else if (mng_spd_cmd != minspeed and decel) { setprop("/FMGC/internal/mng-spd-cmd", minspeed); } - } else if ((phase == 4 or phase == 5 or phase == 6) and altitude <= 10980) { + } else if ((FMGCInternal.FMGCInternal.phase == 4 or FMGCInternal.FMGCInternal.phase == 5 or FMGCInternal.FMGCInternal.phase == 6) and altitude <= 10980) { if (mngktsmach) { setprop("/FMGC/internal/mng-kts-mach", 0); } diff --git a/Nasal/MCDU/F-PLN.nas b/Nasal/MCDU/F-PLN.nas index 324d0035..27d87e1c 100644 --- a/Nasal/MCDU/F-PLN.nas +++ b/Nasal/MCDU/F-PLN.nas @@ -319,7 +319,7 @@ var fplnPage = { # this one is only created once, and then updated - remember th colour = "grn"; } for (var i = 0; i < me.plan.getPlanSize(); i += 1) { - if (!me.temporaryFlagFpln and i > fmgc.flightPlanController.arrivalIndex[me.planIndex] and getprop("/FMGC/status/phase") != 6) { + if (!me.temporaryFlagFpln and i > fmgc.flightPlanController.arrivalIndex[me.planIndex] and fmgc.FMGCInternal.phase != 6) { append(me.planList, fplnItem.new(me.plan.getWP(i), i, me.planIndex, me.computer, "blu")); } else { append(me.planList, fplnItem.new(me.plan.getWP(i), i, me.planIndex, me.computer, colour)); diff --git a/Nasal/MCDU/INITA.nas b/Nasal/MCDU/INITA.nas index 00807cfa..8e997de2 100644 --- a/Nasal/MCDU/INITA.nas +++ b/Nasal/MCDU/INITA.nas @@ -267,7 +267,7 @@ var initInputA = func(key, i) { if (scratchpad == "CLR") { fmgc.FMGCInternal.gndTempSet = 0; mcdu_scratchpad.scratchpads[i].empty(); - } 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 fmgc.FMGCInternal.phase == 0 and size(scratchpad) >= 1 and size(scratchpad) <= 3 and scratchpad >= -99 and scratchpad <= 99) { fmgc.FMGCInternal.gndTemp = scratchpad; fmgc.FMGCInternal.gndTempSet = 1; mcdu_scratchpad.scratchpads[i].empty(); diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 7106285d..aa6e21d5 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -875,33 +875,33 @@ var pagebutton = func(btn, i) { if (btn == "radnav") { setprop("/MCDU[" ~ i ~ "]/page", "RADNAV"); } else if (btn == "prog") { - if (getprop("/FMGC/status/phase") == 0 or getprop("/FMGC/status/phase") == 1) { + if (fmgc.FMGCInternal.phase == 0 or fmgc.FMGCInternal.phase == 1) { setprop("MCDU[" ~ i ~ "]/page", "PROGTO"); - } else if (getprop("/FMGC/status/phase") == 2) { + } else if (fmgc.FMGCInternal.phase == 2) { setprop("MCDU[" ~ i ~ "]/page", "PROGCLB"); - } else if (getprop("/FMGC/status/phase") == 3) { + } else if (fmgc.FMGCInternal.phase == 3) { setprop("MCDU[" ~ i ~ "]/page", "PROGCRZ"); - } else if (getprop("/FMGC/status/phase") == 4 or getprop("/FMGC/status/phase") == 5 or getprop("/FMGC/status/phase") == 6) { + } else if (fmgc.FMGCInternal.phase == 4 or fmgc.FMGCInternal.phase == 5 or fmgc.FMGCInternal.phase == 6) { setprop("MCDU[" ~ i ~ "]/page", "PROGDES"); } } else if (btn == "perf") { - if (getprop("/FMGC/status/phase") == 0 or getprop("/FMGC/status/phase") == 1) { + if (fmgc.FMGCInternal.phase == 0 or fmgc.FMGCInternal.phase == 1) { setprop("MCDU[" ~ i ~ "]/page", "PERFTO"); - } else if (getprop("/FMGC/status/phase") == 2) { + } else if (fmgc.FMGCInternal.phase == 2) { setprop("MCDU[" ~ i ~ "]/page", "PERFCLB"); - } else if (getprop("/FMGC/status/phase") == 3) { + } else if (fmgc.FMGCInternal.phase == 3) { setprop("MCDU[" ~ i ~ "]/page", "PERFCRZ"); - } else if (getprop("/FMGC/status/phase") == 4) { + } else if (fmgc.FMGCInternal.phase == 4) { setprop("MCDU[" ~ i ~ "]/page", "PERFDES"); - } else if (getprop("/FMGC/status/phase") == 5) { + } else if (fmgc.FMGCInternal.phase == 5) { setprop("MCDU[" ~ i ~ "]/page", "PERFAPPR"); - } else if (getprop("/FMGC/status/phase") == 6) { + } else if (fmgc.FMGCInternal.phase == 6) { setprop("MCDU[" ~ i ~ "]/page", "PERFGA"); - } else if (getprop("/FMGC/status/phase") == 7) { + } else if (fmgc.FMGCInternal.phase == 7) { fmgc.reset_FMGC(); } } else if (btn == "init") { - if (getprop("/FMGC/status/phase") == 7) { + if (fmgc.FMGCInternal.phase == 7) { fmgc.reset_FMGC(); } setprop("/MCDU[" ~ i ~ "]/page", "INITA"); @@ -917,7 +917,7 @@ var pagebutton = func(btn, i) { canvas_mcdu.myFpln[i] = fplnPage.new(2, i); } if (btn == "airport") { - if (getprop("FMGC/status/phase") == 0 or getprop("FMGC/status/phase") == 1) { + if (fmgc.FMGCInternal.phase == 0 or fmgc.FMGCInternal.phase == 1) { canvas_mcdu.myFpln[i].scroll = 0; } else { if (fmgc.flightPlanController.temporaryFlag[i]) { diff --git a/Nasal/MCDU/PERFCLB.nas b/Nasal/MCDU/PERFCLB.nas index f57d1b7a..e9f3b4bf 100644 --- a/Nasal/MCDU/PERFCLB.nas +++ b/Nasal/MCDU/PERFCLB.nas @@ -6,16 +6,18 @@ var perfCLBInput = func(key, i) { var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; if (key == "L2") { if (scratchpad == "CLR") { - setprop("/FMGC/internal/cost-index", 0); - setprop("/FMGC/internal/cost-index-set", 0); + fmgc.FMGCInternal.costIndex = 0; + fmgc.FMGCInternal.costIndexSet = 0; + fmgc.FMGCNodes.costIndex.setValue(0); mcdu_scratchpad.scratchpads[i].empty(); } else { var ci = int(scratchpad); var cis = size(scratchpad); if (cis >= 1 and cis <= 3) { if (ci != nil and ci >= 0 and ci <= 999) { - setprop("/FMGC/internal/cost-index", ci); - setprop("/FMGC/internal/cost-index-set", 1); + fmgc.FMGCInternal.costIndex = ci; + fmgc.FMGCInternal.costIndexSet = 1; + fmgc.FMGCNodes.costIndex.setValue(fmgc.FMGCInternal.costIndex); mcdu_scratchpad.scratchpads[i].empty(); } else { mcdu_message(i, "NOT ALLOWED"); @@ -25,13 +27,13 @@ var perfCLBInput = func(key, i) { } } } else if (key == "L5") { - if (getprop("/FMGC/status/phase") == 2) { + if (fmgc.FMGCInternal.phase == 2) { setprop("MCDU[" ~ i ~ "]/page", "PERFTO"); } else { mcdu_message(i, "NOT ALLOWED"); } } else if (key == "L6") { - if (getprop("/FMGC/status/phase") == 2) { + if (fmgc.FMGCInternal.phase == 2) { if (getprop("/FMGC/internal/activate-once") == 1) { if (getprop("/FMGC/internal/activate-twice") == 0) { setprop("/FMGC/internal/activate-twice", 1); diff --git a/Nasal/MCDU/PERFCRZ.nas b/Nasal/MCDU/PERFCRZ.nas index b26af62c..dbb003f8 100644 --- a/Nasal/MCDU/PERFCRZ.nas +++ b/Nasal/MCDU/PERFCRZ.nas @@ -6,16 +6,18 @@ var perfCRZInput = func(key, i) { var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; if (key == "L2") { if (scratchpad == "CLR") { - setprop("/FMGC/internal/cost-index", 0); - setprop("/FMGC/internal/cost-index-set", 0); + fmgc.FMGCInternal.costIndex = 0; + fmgc.FMGCInternal.costIndexSet = 0; + fmgc.FMGCNodes.costIndex.setValue(0); mcdu_scratchpad.scratchpads[i].empty(); } else { var ci = int(scratchpad); var cis = size(scratchpad); if (cis >= 1 and cis <= 3) { if (ci != nil and ci >= 0 and ci <= 999) { - setprop("/FMGC/internal/cost-index", ci); - setprop("/FMGC/internal/cost-index-set", 1); + fmgc.FMGCInternal.costIndex = ci; + fmgc.FMGCInternal.costIndexSet = 1; + fmgc.FMGCNodes.costIndex.setValue(fmgc.FMGCInternal.costIndex); mcdu_scratchpad.scratchpads[i].empty(); } else { mcdu_message(i, "NOT ALLOWED"); @@ -25,7 +27,7 @@ var perfCRZInput = func(key, i) { } } } else if (key == "L6") { - if (getprop("/FMGC/status/phase") == 3) { + if (fmgc.FMGCInternal.phase == 3) { if (getprop("/FMGC/internal/activate-once") == 1) { if (getprop("/FMGC/internal/activate-twice") == 0) { setprop("/FMGC/internal/activate-twice", 1); diff --git a/Nasal/MCDU/PERFDES.nas b/Nasal/MCDU/PERFDES.nas index c3c5c611..ea5bb443 100644 --- a/Nasal/MCDU/PERFDES.nas +++ b/Nasal/MCDU/PERFDES.nas @@ -6,16 +6,18 @@ var perfDESInput = func(key, i) { var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; if (key == "L2") { if (scratchpad == "CLR") { - setprop("/FMGC/internal/cost-index", 0); - setprop("/FMGC/internal/cost-index-set", 0); + fmgc.FMGCInternal.costIndex = 0; + fmgc.FMGCInternal.costIndexSet = 0; + fmgc.FMGCNodes.costIndex.setValue(0); mcdu_scratchpad.scratchpads[i].empty(); } else { var ci = int(scratchpad); var cis = size(scratchpad); if (cis >= 1 and cis <= 3) { if (ci != nil and ci >= 0 and ci <= 999) { - setprop("/FMGC/internal/cost-index", ci); - setprop("/FMGC/internal/cost-index-set", 1); + fmgc.FMGCInternal.costIndex = ci; + fmgc.FMGCInternal.costIndexSet = 1; + fmgc.FMGCNodes.costIndex.setValue(fmgc.FMGCInternal.costIndex); mcdu_scratchpad.scratchpads[i].empty(); } else { mcdu_message(i, "NOT ALLOWED"); @@ -25,7 +27,7 @@ var perfDESInput = func(key, i) { } } } else if (key == "L6") { - if (getprop("/FMGC/status/phase") == 4) { + if (fmgc.FMGCInternal.phase == 4) { if (getprop("/FMGC/internal/activate-once") == 1) { if (getprop("/FMGC/internal/activate-twice") == 0) { setprop("/FMGC/internal/activate-twice", 1); diff --git a/Nasal/MCDU/PERFTO.nas b/Nasal/MCDU/PERFTO.nas index d3d1ba8d..4f647b14 100644 --- a/Nasal/MCDU/PERFTO.nas +++ b/Nasal/MCDU/PERFTO.nas @@ -6,7 +6,7 @@ var perfTOInput = func(key, i) { var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; if (key == "L1") { - if (getprop("/FMGC/status/phase") != 1) { + if (fmgc.FMGCInternal.phase != 1) { if (scratchpad == "CLR") { fmgc.FMGCInternal.v1 = 0; fmgc.FMGCInternal.v1set = 0; @@ -35,7 +35,7 @@ var perfTOInput = func(key, i) { mcdu_message(i, "NOT ALLOWED"); } } else if (key == "L2") { - if (getprop("/FMGC/status/phase") != 1) { + if (fmgc.FMGCInternal.phase != 1) { if (scratchpad == "CLR") { fmgc.FMGCInternal.vr = 0; fmgc.FMGCInternal.vrset = 0; @@ -58,7 +58,7 @@ var perfTOInput = func(key, i) { mcdu_message(i, "NOT ALLOWED"); } } else if (key == "L3") { - if (getprop("/FMGC/status/phase") != 1) { + if (fmgc.FMGCInternal.phase != 1) { if (scratchpad == "CLR") { fmgc.FMGCInternal.v2 = 0; fmgc.FMGCInternal.v2set = 0; diff --git a/Nasal/MCDU/PROGCLB.nas b/Nasal/MCDU/PROGCLB.nas index ef868d1f..8319d135 100644 --- a/Nasal/MCDU/PROGCLB.nas +++ b/Nasal/MCDU/PROGCLB.nas @@ -5,7 +5,7 @@ var progCLBInput = func(key, i) { if (key == "L1") { if (scratchpad == "CLR") { fmgc.FMGCInternal.crzProg = fmgc.FMGCInternal.crzFl; - if (getprop("/FMGC/status/phase") == 5) { + if (fmgc.FMGCInternal.phase == 5) { setprop("/FMGC/status/phase", 3); setprop("/FMGC/internal/activate-once", 0); setprop("/FMGC/internal/activate-twice", 0); @@ -17,7 +17,7 @@ var progCLBInput = func(key, i) { if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and fmgc.FMGCInternal.crzSet <= scratchpad * 100) { fmgc.FMGCInternal.crzProg = scratchpad; mcdu_scratchpad.scratchpads[i].empty(); - if (getprop("/FMGC/status/phase") == 5) { + if (fmgc.FMGCInternal.phase == 5) { setprop("/FMGC/status/phase", 3); setprop("/FMGC/internal/activate-once", 0); setprop("/FMGC/internal/activate-twice", 0); diff --git a/Nasal/MCDU/PROGCRZ.nas b/Nasal/MCDU/PROGCRZ.nas index a6b142cf..428344d5 100644 --- a/Nasal/MCDU/PROGCRZ.nas +++ b/Nasal/MCDU/PROGCRZ.nas @@ -5,7 +5,7 @@ var progCRZInput = func(key, i) { if (key == "L1") { if (scratchpad == "CLR") { fmgc.FMGCInternal.crzProg = fmgc.FMGCInternal.crzFl; - if (getprop("/FMGC/status/phase") == 5) { + if (fmgc.FMGCInternal.phase == 5) { setprop("/FMGC/status/phase", 3); setprop("/FMGC/internal/activate-once", 0); setprop("/FMGC/internal/activate-twice", 0); @@ -17,7 +17,7 @@ var progCRZInput = func(key, i) { if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and fmgc.FMGCInternal.crzSet <= scratchpad * 100) { fmgc.FMGCInternal.crzProg = scratchpad; mcdu_scratchpad.scratchpads[i].empty(); - if (getprop("/FMGC/status/phase") == 5) { + if (fmgc.FMGCInternal.phase == 5) { setprop("/FMGC/status/phase", 3); setprop("/FMGC/internal/activate-once", 0); setprop("/FMGC/internal/activate-twice", 0); diff --git a/Nasal/MCDU/PROGDES.nas b/Nasal/MCDU/PROGDES.nas index a16fb07a..b81437f0 100644 --- a/Nasal/MCDU/PROGDES.nas +++ b/Nasal/MCDU/PROGDES.nas @@ -5,7 +5,7 @@ var progDESInput = func(key, i) { if (key == "L1") { if (scratchpad == "CLR") { fmgc.FMGCInternal.crzProg = fmgc.FMGCInternal.crzFl; - if (getprop("/FMGC/status/phase") == 5 or getprop("/FMGC/status/phase") == 6) { + if (fmgc.FMGCInternal.phase == 5 or fmgc.FMGCInternal.phase == 6) { setprop("/FMGC/status/phase", 3); setprop("/FMGC/internal/activate-once", 0); setprop("/FMGC/internal/activate-twice", 0); @@ -17,7 +17,7 @@ var progDESInput = func(key, i) { if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and fmgc.FMGCInternal.crzSet <= scratchpad * 100) { fmgc.FMGCInternal.crzProg = scratchpad; mcdu_scratchpad.scratchpads[i].empty(); - if (getprop("/FMGC/status/phase") == 4 or getprop("/FMGC/status/phase") == 5 or getprop("/FMGC/status/phase") == 6) { + if (fmgc.FMGCInternal.phase == 4 or fmgc.FMGCInternal.phase == 5 or fmgc.FMGCInternal.phase == 6) { setprop("/FMGC/status/phase", 3); setprop("/FMGC/internal/activate-once", 0); setprop("/FMGC/internal/activate-twice", 0); diff --git a/Nasal/MCDU/VERTREV.nas b/Nasal/MCDU/VERTREV.nas index 26058af3..3f73810e 100644 --- a/Nasal/MCDU/VERTREV.nas +++ b/Nasal/MCDU/VERTREV.nas @@ -126,7 +126,7 @@ var vertRev = { } }, updateR5: func() { - if (fmgc.FMGCInternal.crzSet and (getprop("FMGC/status/phase") < 4 or getprop("FMGC/status/phase") == 7)) { + if (fmgc.FMGCInternal.crzSet and (fmgc.FMGCInternal.phase < 4 or fmgc.FMGCInternal.phase == 7)) { me.R5 = ["STEP ALTS ", nil, "wht"]; me.arrowsMatrix[1][4] = 1; } else { @@ -192,7 +192,7 @@ var updateCrzLvlCallback = func () { } }; -setlistener("FMGC/status/phase", func() { +var updatePhaseCallback = func() { if (canvas_mcdu.myVertRev[0] != nil) { canvas_mcdu.myVertRev[0].updateR5(); } @@ -200,4 +200,4 @@ setlistener("FMGC/status/phase", func() { if (canvas_mcdu.myVertRev[1] != nil) { canvas_mcdu.myVertRev[1].updateR5(); } -}, 0, 0); \ No newline at end of file +}; \ No newline at end of file