From 2590e734037cecf784cfdeb97574be789765d95d Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sun, 13 Jun 2021 18:57:13 +0100 Subject: [PATCH] Nasal cleanup --- Nasal/FMGC/FMGC.nas | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index 1d32c4c8..26bba681 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -997,16 +997,14 @@ var masterFMGC = maketimer(0.2, func { ############################ #handle radios, runways, v1/vr/v2 ############################ - +var airportRadiosPhase = nil; var updateAirportRadios = func { - var phase = FMGCInternal.phase; - - print("# Update airport radios"); + airportRadiosPhase = FMGCInternal.phase; departure_rwy = fmgc.flightPlanController.flightplans[2].departure_runway; destination_rwy = fmgc.flightPlanController.flightplans[2].destination_runway; - if (phase >= 2 and destination_rwy != nil) { + if (airportRadiosPhase >= 2 and destination_rwy != nil) { var airport = airportinfo(FMGCInternal.arrApt); setprop("/FMGC/internal/ldg-elev", airport.elevation * M2FT); # eventually should be runway elevation magnetic_hdg = geo.normdeg(destination_rwy.heading - getprop("/environment/magnetic-variation-deg")); @@ -1021,7 +1019,7 @@ var updateAirportRadios = func { } else if (!getprop("/FMGC/internal/ils1crs-set")) { setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg); } - } else if (phase <= 1 and departure_rwy != nil) { + } else if (airportRadiosPhase <= 1 and departure_rwy != nil) { magnetic_hdg = geo.normdeg(departure_rwy.heading - getprop("/environment/magnetic-variation-deg")); runway_ils = departure_rwy.ils_frequency_mhz; if (runway_ils != nil and !getprop("/FMGC/internal/ils1freq-set") and !getprop("/FMGC/internal/ils1crs-set")) { @@ -1039,7 +1037,7 @@ var updateAirportRadios = func { }; setlistener(FMGCNodes.phase, updateAirportRadios,0,0); -setlistener(flightPlanController.changed, updateAirportRadios); +setlistener(flightPlanController.changed, updateAirportRadios,0,0); var reset_FMGC = func { FMGCInternal.phase = 0;