diff --git a/Nasal/FMGC-b.nas b/Nasal/FMGC-b.nas index 17d53dc3..99d7cb71 100644 --- a/Nasal/FMGC-b.nas +++ b/Nasal/FMGC-b.nas @@ -717,7 +717,7 @@ var make_loc_active = func { var apparmcheck = func { var signal = getprop("/instrumentation/nav[0]/gs-needle-deflection-norm"); - if ((signal <= -0.000000001) and (getprop("/FMGC/internal/loc-source") == "NAV0") and (getprop("/it-autoflight/output/lat") == 2)) { + if (((signal < 0 and signal >= 0.45) or (signal > 0 and signal <= 0.30)) and (getprop("/FMGC/internal/loc-source") == "NAV0") and (getprop("/it-autoflight/output/lat") == 2)) { make_appr_active(); } else { return 0; diff --git a/Nasal/PFD_FMA.nas b/Nasal/PFD_FMA.nas index 3f0405fb..88ee6e92 100644 --- a/Nasal/PFD_FMA.nas +++ b/Nasal/PFD_FMA.nas @@ -99,8 +99,9 @@ setlistener("/it-autoflight/mode/lat", func { setprop("/modes/pfd/fma/roll-mode", "NAV"); } } else if (lat == "LOC") { - if (newlat != "LOC") { - setprop("/modes/pfd/fma/roll-mode", "LOC"); + if (newlat != "LOC*" and newlat != "LOC") { + setprop("/modes/pfd/fma/roll-mode", "LOC*"); + locupdate.start(); } } else if (lat == "ALGN") { if (newlat != "LAND") { @@ -113,6 +114,20 @@ setlistener("/it-autoflight/mode/lat", func { } }); +var locupdate = maketimer(0.5, func { + var lat = getprop("/it-autoflight/mode/lat"); + var newlat = getprop("/modes/pfd/fma/roll-mode"); + var nav_defl = getprop("/it-autoflight/internal/nav-heading-error-deg"); + if (lat == "LOC") { + if (nav_defl > -1 and nav_defl < 1) { + locupdate.stop(); + if (newlat != "LOC") { + setprop("/modes/pfd/fma/roll-mode", "LOC"); + } + } + } +}); + # Master Vertical setlistener("/it-autoflight/mode/vert", func { var vert = getprop("/it-autoflight/mode/vert"); @@ -142,8 +157,9 @@ setlistener("/it-autoflight/mode/vert", func { setprop("/modes/pfd/fma/pitch-mode2-armed", "ALT"); } } else if (vert == "G/S") { - if (newvert != "G/S") { - setprop("/modes/pfd/fma/pitch-mode", "G/S"); + if (newvert != "G/S*" and newvert != "G/S") { + setprop("/modes/pfd/fma/pitch-mode", "G/S*"); + gsupdate.start(); } if (newvertarm != " ") { setprop("/modes/pfd/fma/pitch-mode2-armed", " "); @@ -223,6 +239,20 @@ setlistener("/it-autoflight/mode/vert", func { altvert(); }); +var gsupdate = maketimer(0.5, func { + var vert = getprop("/it-autoflight/mode/vert"); + var newvert = getprop("/modes/pfd/fma/pitch-mode"); + var gs_defl = getprop("/instrumentation/nav[0]/gs-needle-deflection-norm"); + if (vert == "G/S") { + if (gs_defl > -0.06 and gs_defl < 0.06) { + gsupdate.stop(); + if (newvert != "G/S") { + setprop("/modes/pfd/fma/pitch-mode", "G/S"); + } + } + } +}); + var altvert = func { var FMGCalt = getprop("/FMGC/internal/cruise-ft"); var MCPalt = getprop("/it-autoflight/internal/alt");