diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index b6c2fde6..7814463a 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -193,8 +193,8 @@ var dest_mag = props.globals.getNode("FMGC/internal/dest-mag", 1); var dest_wind = props.globals.getNode("FMGC/internal/dest-wind", 1); var vapp_speed_set = props.globals.getNode("FMGC/internal/vapp-speed-set", 1); var final = props.globals.getNode("FMGC/internal/final", 1); -var mda = props.globals.getNode("FMGC/internal/mda", 1); -var dh = props.globals.getNode("FMGC/internal/dh", 1); +var mda = props.globals.getNode("FMGC/internal/radio", 1); +var dh = props.globals.getNode("FMGC/internal/baro", 1); var ldg_config_3_set = props.globals.getNode("FMGC/internal/ldg-config-3-set", 1); var ldg_config_f_set = props.globals.getNode("FMGC/internal/ldg-config-f-set", 1); @@ -332,6 +332,8 @@ var canvas_MCDU_base = { me["ArrowRight"].show(); me["arrowsDepArr"].hide(); + me["Simple_L0S"].hide(); + me["Simple_L1_Arrow"].hide(); me["Simple_L2_Arrow"].hide(); me["Simple_L3_Arrow"].hide(); @@ -2588,7 +2590,7 @@ var canvas_MCDU_base = { me["Simple_L3S"].setText("MAG WIND"); if (dest_mag.getValue() != -1 and dest_wind.getValue() != -1) { - me["Simple_L3"].setText(sprintf("%3.0fg", dest_mag.getValue()) ~ sprintf("/%3.0f", dest_wind.getValue())); + me["Simple_L3"].setText(sprintf("%3.0fg", dest_mag.getValue()) ~ sprintf("/%.0f", dest_wind.getValue())); } else { me["Simple_L3"].setText("---g/---");; } @@ -2603,11 +2605,31 @@ var canvas_MCDU_base = { me["Simple_R1"].setText("--- "); } - me["Simple_R2S"].setText("MDA"); - me["Simple_R2"].setText(" [ ]"); + me["Simple_R2S"].setText("BARO"); + if (getprop("FMGC/internal/baro") != -1) { + me["Simple_R2"].setText(sprintf("%.0f", getprop("FMGC/internal/baro"))); + me.fontRight(0, default, 0, 0, 0, 0); + me.fontSizeRight(0, normal, 0, 0, 0, 0); + } else { + me["Simple_R2"].setText(" [ ]"); + me.fontRight(0, symbol, 0, 0, 0, 0); + me.fontSizeRight(0, small, 0, 0, 0, 0); + } - me["Simple_R3S"].setText("DH"); - me["Simple_R3"].setText(" [ ]"); + me["Simple_R3S"].setText("RADIO"); + if (getprop("FMGC/internal/radio") != -1) { + me["Simple_R3"].setText(sprintf("%.0f", getprop("FMGC/internal/radio"))); + me.fontRight(0, 0, default, 0, 0, 0); + me.fontSizeRight(0, 0, normal, 0, 0, 0); + } else if (getprop("FMGC/internal/radio-no")) { + me["Simple_R3"].setText("NO"); + me.fontRight(0, 0, default, 0, 0, 0); + me.fontSizeRight(0, 0, normal, 0, 0, 0); + } else { + me["Simple_R3"].setText(" [ ]"); + me.fontRight(0, 0, symbol, 0, 0, 0); + me.fontSizeRight(0, 0, small, 0, 0, 0); + } me["Simple_R4S"].setText("LDG CONF "); me["Simple_R4"].setText("CONF3 "); @@ -2636,7 +2658,7 @@ var canvas_MCDU_base = { me["Simple_C5"].setText(sprintf("%3.0f", getprop("FMGC/internal/computed-speeds/vls_appr"))); me["Simple_L5"].setText(sprintf("%3.0f", getprop("FMGC/internal/computed-speeds/vapp_appr"))); me.fontLeft(0, 0, 0, 0, default, 0); - if (vapp_speed_set.getValue() == 1) { + if (vapp_speed_set.getValue()) { me.fontSizeLeft(0, 0, 0, 0, normal, 0); } else { me.fontSizeLeft(0, 0, 0, 0, small, 0); @@ -2646,8 +2668,15 @@ var canvas_MCDU_base = { me["Simple_C2"].setText(" ---"); me["Simple_C3"].setText(" ---"); me["Simple_C5"].setText(" ---"); - me["Simple_L5"].setText("[ ] "); - me.fontLeft(0, 0, 0, 0, symbol, 0); + if (vapp_speed_set.getValue()) { + me["Simple_L5"].setText(sprintf("%3.0f", getprop("FMGC/internal/computed-speeds/vapp_appr"))); + me.fontLeft(0, 0, 0, 0, default, 0); + me.fontSizeLeft(0, 0, 0, 0, normal, 0); + } else { + me["Simple_L5"].setText("[ ] "); + me.fontLeft(0, 0, 0, 0, symbol, 0); + me.fontSizeLeft(0, 0, 0, 0, small, 0); + } } me["Simple_C1S"].setText("FLP RETR"); @@ -2764,6 +2793,8 @@ var canvas_MCDU_base = { me["ArrowLeft"].hide(); me["ArrowRight"].hide(); + me["Simple_L0S"].hide(); + me.fontLeft(default, default, default, default, default, default); me.fontLeftS(default, default, default, default, default, default); me.fontRight(default, default, default, default, default, default); @@ -3024,6 +3055,8 @@ var canvas_MCDU_base = { me["ArrowLeft"].hide(); me["ArrowRight"].hide(); + me["Simple_L0S"].hide(); + me.fontLeft(default, default, default, default, default, default); me.fontLeftS(default, default, default, default, default, default); me.fontRight(default, default, default, default, default, default); @@ -3296,6 +3329,8 @@ var canvas_MCDU_base = { me["Simple_R5_Arrow"].hide(); me["Simple_R6_Arrow"].hide(); + me["Simple_L0S"].hide(); + me.fontLeft(default, default, default, default, default, default); me.fontLeftS(default, default, default, default, default, default); me.fontRight(default, default, default, default, default, default); @@ -3613,6 +3648,8 @@ var canvas_MCDU_base = { me["ArrowLeft"].hide(); me["ArrowRight"].hide(); + me["Simple_L0S"].hide(); + me.fontLeft(default, default, default, default, default, default); me.fontLeftS(default, default, default, default, default, default); me.fontRight(default, default, default, default, default, default); @@ -3942,6 +3979,8 @@ var canvas_MCDU_base = { me["Simple_R5_Arrow"].hide(); me["Simple_R6_Arrow"].hide(); + me["Simple_L0S"].hide(); + me.fontLeft(default, default, default, default, default, default); me.fontLeftS(default, default, default, default, default, default); me.fontRight(default, default, default, default, default, default); @@ -4271,6 +4310,8 @@ var canvas_MCDU_base = { me["Simple_R5_Arrow"].hide(); me["Simple_R6_Arrow"].hide(); + me["Simple_L0S"].hide(); + me.fontLeft(default, default, default, default, default, default); me.fontLeftS(default, default, default, default, default, default); me.fontRight(default, default, default, default, default, default); @@ -4601,6 +4642,8 @@ var canvas_MCDU_base = { me["Simple_R5_Arrow"].hide(); me["Simple_R6_Arrow"].hide(); + me["Simple_L0S"].hide(); + me.fontLeft(default, default, default, default, default, default); me.fontLeftS(default, default, default, default, default, default); me.fontRight(default, default, default, default, default, default); diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index 7ab79986..988b1139 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -321,6 +321,7 @@ var masterFMGC = maketimer(0.2, func { } else { vapp = vls + dest_wind; } + setprop("FMGC/internal/computed-speeds/vapp", vapp); } aoa_prot = 15; @@ -370,6 +371,7 @@ var masterFMGC = maketimer(0.2, func { } else { vapp_appr = vls_appr + dest_wind; } + setprop("FMGC/internal/computed-speeds/vapp_appr", vapp_appr); } # set the values globally @@ -384,7 +386,6 @@ var masterFMGC = maketimer(0.2, func { setprop("FMGC/internal/computed-speeds/flap2", flap2); setprop("FMGC/internal/computed-speeds/flap3", flap3); setprop("FMGC/internal/computed-speeds/vls", vls); - setprop("FMGC/internal/computed-speeds/vapp", vapp); setprop("FMGC/internal/computed-speeds/alpha_prot", alpha_prot); setprop("FMGC/internal/computed-speeds/alpha_max", alpha_max); @@ -404,7 +405,6 @@ var masterFMGC = maketimer(0.2, func { setprop("FMGC/internal/computed-speeds/flap2_appr", flap2_appr); setprop("FMGC/internal/computed-speeds/clean_appr", clean_appr); setprop("FMGC/internal/computed-speeds/vls_appr", vls_appr); - setprop("FMGC/internal/computed-speeds/vapp_appr", vapp_appr); # Need info on these, also correct for height at altitude... # https://www.pprune.org/archive/index.php/t-587639.html @@ -469,7 +469,9 @@ var masterFMGC = maketimer(0.2, func { #handle radios, runways, v1/vr/v2 if (fmgc.flightPlanController.flightplans[2].approach != nil and phase >= 2) { - var runways = airportinfo(airportinfo(getprop("FMGC/internal/arr-arpt")).id).runways; + var airport = airportinfo(getprop("FMGC/internal/arr-arpt")).id; + setprop("FMGC/internal/ldg-elev", airport.elevation * M2FT); + var runways = airportinfo(airport).runways; var rwy = string.replace(fmgc.flightPlanController.flightplans[2].approach.id, "ILS", ""); if (runways[rwy] != nil) { var r = runways[rwy]; diff --git a/Nasal/MCDU/ARRIVAL.nas b/Nasal/MCDU/ARRIVAL.nas index f504f244..d1db7b9b 100644 --- a/Nasal/MCDU/ARRIVAL.nas +++ b/Nasal/MCDU/ARRIVAL.nas @@ -465,6 +465,9 @@ var arrivalPage = { me.makeTmpy(); fmgc.flightPlanController.flightplans[me.computer].destination_runway = me.arrAirport[0].runways[me.selectedApproach.runways[0]]; fmgc.flightPlanController.flightplans[me.computer].approach = me.selectedApproach; + setprop("FMGC/internal/baro", -1); + setprop("FMGC/internal/radio", -1); + setprop("FMGC/internal/radio-no", 0); me.updateActiveApproach(); me.updateApproaches(); fmgc.flightPlanController.flightPlanChanged(me.computer); diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 6ca98b04..360dba7d 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -160,8 +160,10 @@ var MCDU_reset = func(i) { setprop("FMGC/internal/dest-wind", -1); setprop("FMGC/internal/vapp-speed-set", 0); setprop("FMGC/internal/final", ""); - setprop("FMGC/internal/mda", -1); - setprop("FMGC/internal/dh", -1); + setprop("FMGC/internal/baro", -1); + setprop("FMGC/internal/radio", -1); + setprop("FMGC/internal/radio-no", 0); + setprop("FMGC/internal/ldg-elev", 0); setprop("FMGC/internal/ldg-config-3-set", 0); setprop("FMGC/internal/ldg-config-f-set", 1); diff --git a/Nasal/MCDU/PERFAPPR.nas b/Nasal/MCDU/PERFAPPR.nas index c1e07ff7..716b22b6 100644 --- a/Nasal/MCDU/PERFAPPR.nas +++ b/Nasal/MCDU/PERFAPPR.nas @@ -1,14 +1,6 @@ # Copyright (c) 2020 Matthew Maring (hayden2000) # APPR PERF -var dest_qnh = props.globals.getNode("FMGC/internal/dest-qnh", 1); -var dest_temp = props.globals.getNode("FMGC/internal/dest-temp", 1); -var dest_mag = props.globals.getNode("FMGC/internal/dest-mag", 1); -var dest_wind = props.globals.getNode("FMGC/internal/dest-wind", 1); -var transAlt = props.globals.getNode("FMGC/internal/trans-alt", 1); -var final = props.globals.getNode("FMGC/internal/final", 1); -var mda = props.globals.getNode("FMGC/internal/mda", 1); -var dh = props.globals.getNode("FMGC/internal/dh", 1); var ldg_config_3_set = props.globals.getNode("FMGC/internal/ldg-config-3-set", 1); var ldg_config_f_set = props.globals.getNode("FMGC/internal/ldg-config-f-set", 1); @@ -97,6 +89,36 @@ var perfAPPRInput = func(key, i) { } else { notAllowed(i); } + } else if (key == "R2") { + if (scratchpad == "CLR") { + setprop("FMGC/internal/baro", -1); + setprop("MCDU[" ~ i ~ "]/scratchpad", ""); + } else if (int(scratchpad) != nil and scratchpad >= getprop("FMGC/internal/ldg-elev") and scratchpad <= 5000 + getprop("FMGC/internal/ldg-elev")) { + if (getprop("FMGC/internal/radio-no") == 0) { + setprop("FMGC/internal/radio", -1); + } + setprop("FMGC/internal/baro", scratchpad); + setprop("MCDU[" ~ i ~ "]/scratchpad", ""); + } else { + notAllowed(i); + } + } else if (key == "R3") { + if (scratchpad == "CLR") { + setprop("FMGC/internal/radio", -1); + setprop("FMGC/internal/radio-no", 0); + setprop("MCDU[" ~ i ~ "]/scratchpad", ""); + } else if (scratchpad == "NO") { + setprop("FMGC/internal/radio", -1); + setprop("FMGC/internal/radio-no", 1); + setprop("MCDU[" ~ i ~ "]/scratchpad", ""); + } else if (int(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 700) { + setprop("FMGC/internal/baro", -1); + setprop("FMGC/internal/radio-no", 0); + setprop("FMGC/internal/radio", scratchpad); + setprop("MCDU[" ~ i ~ "]/scratchpad", ""); + } else { + notAllowed(i); + } } else if (key == "R5") { if (scratchpad == "" and ldg_config_3_set.getValue() == 1 and ldg_config_f_set.getValue() == 0) { setprop("FMGC/internal/ldg-config-3-set", 0);