1
0
Fork 0

KAP140: improve locking to GS/LOC signals

Patch from Benedkit Hallinger:

This patch introduces a check for valid VOR/LOC as well as GS signals, 
and only if they are valid they will be catched.

See: https://sourceforge.net/p/flightgear/codetickets/2476/
This commit is contained in:
James Turner 2020-12-17 10:26:00 +00:00
parent f1838fb7fe
commit 0d546f5384

View file

@ -94,6 +94,8 @@ var propFlightControls = props.globals.getNode(flightControls, 0);
var elevatorControl = propFlightControls.getNode("elevator", 0);
var elevatorTrimControl = propFlightControls.getNode("elevator-trim", 0);
var navHeadingValid = "/instrumentation/nav/in-range";
var navGSValid = "/instrumentation/nav/gs-in-range";
var headingNeedleDeflection = "/instrumentation/nav/heading-needle-deflection";
var gsNeedleDeflection = "/instrumentation/nav/gs-needle-deflection-norm";
var staticPressure = "systems/static/pressure-inhg";
@ -704,10 +706,11 @@ var navArmFromRol = func
lockRollAxis.setBoolValue(1);
settingTargetTurnRate.setDoubleValue(0.0);
var deviation = getprop(headingNeedleDeflection);
var deviationValid = getprop(navHeadingValid);
##
# If the deflection is more than 3 degrees wait 5 seconds and check again.
##
if (abs(deviation) > 3.0)
if (!deviationValid or abs(deviation) > 3.0)
{
#print("deviation");
settimer(navArmFromRol, 5);
@ -806,10 +809,11 @@ var aprArmFromHdg = func
##
lockAprHold.setBoolValue(1);
var deviation = getprop(headingNeedleDeflection);
var deviationValid = getprop(navHeadingValid);
##
# If the deflection is more than 3 degrees wait 5 seconds and check again.
##
if (abs(deviation) > 3.0)
if (!deviationValid or abs(deviation) > 3.0)
{
#print("deviation");
settimer(aprArmFromHdg, 5);
@ -862,10 +866,11 @@ var aprArmFromRol = func
lockRollAxis.setBoolValue(1);
settingTargetTurnRate.setDoubleValue(0.0);
var deviation = getprop(headingNeedleDeflection);
var deviationValid = getprop(navHeadingValid);
##
# If the deflection is more than 3 degrees wait 5 seconds and check again.
##
if (abs(deviation) > 3.0)
if (!deviationValid or abs(deviation) > 3.0)
{
#print("deviation");
settimer(aprArmFromRol, 5);
@ -911,10 +916,11 @@ var gsArm = func {
annunciatorGsArm.setBoolValue(1);
var deviation = getprop(gsNeedleDeflection);
var deviationValid = getprop(navGSValid);
##
# If the deflection is more than 50% (manual says '2 to 3 dots')
##
if (abs(deviation) > 0.5)
if (!deviationValid or abs(deviation) > 0.5)
{
#print("deviation");
settimer(gsArm, 5);
@ -1012,10 +1018,11 @@ var revArmFromHdg = func
##
lockRevHold.setBoolValue(1);
var deviation = getprop(headingNeedleDeflection);
var deviationValid = getprop(navHeadingValid);
##
# If the deflection is more than 3 degrees wait 5 seconds and check again.
##
if (abs(deviation) > 3.0)
if (!deviationValid or abs(deviation) > 3.0)
{
#print("deviation");
settimer(revArmFromHdg, 5);
@ -1078,10 +1085,11 @@ var revArmFromRol = func
lockRollAxis.setBoolValue(1);
settingTargetTurnRate.setDoubleValue(0.0);
var deviation = getprop(headingNeedleDeflection);
var deviationValid = getprop(navHeadingValid);
##
# If the deflection is more than 3 degrees wait 5 seconds and check again.
##
if (abs(deviation) > 3.0)
if (!deviationValid or abs(deviation) > 3.0)
{
#print("deviation");
settimer(revArmFromRol, 5);