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:
parent
f1838fb7fe
commit
0d546f5384
1 changed files with 14 additions and 6 deletions
|
@ -94,6 +94,8 @@ var propFlightControls = props.globals.getNode(flightControls, 0);
|
||||||
var elevatorControl = propFlightControls.getNode("elevator", 0);
|
var elevatorControl = propFlightControls.getNode("elevator", 0);
|
||||||
var elevatorTrimControl = propFlightControls.getNode("elevator-trim", 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 headingNeedleDeflection = "/instrumentation/nav/heading-needle-deflection";
|
||||||
var gsNeedleDeflection = "/instrumentation/nav/gs-needle-deflection-norm";
|
var gsNeedleDeflection = "/instrumentation/nav/gs-needle-deflection-norm";
|
||||||
var staticPressure = "systems/static/pressure-inhg";
|
var staticPressure = "systems/static/pressure-inhg";
|
||||||
|
@ -704,10 +706,11 @@ var navArmFromRol = func
|
||||||
lockRollAxis.setBoolValue(1);
|
lockRollAxis.setBoolValue(1);
|
||||||
settingTargetTurnRate.setDoubleValue(0.0);
|
settingTargetTurnRate.setDoubleValue(0.0);
|
||||||
var deviation = getprop(headingNeedleDeflection);
|
var deviation = getprop(headingNeedleDeflection);
|
||||||
|
var deviationValid = getprop(navHeadingValid);
|
||||||
##
|
##
|
||||||
# If the deflection is more than 3 degrees wait 5 seconds and check again.
|
# 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");
|
#print("deviation");
|
||||||
settimer(navArmFromRol, 5);
|
settimer(navArmFromRol, 5);
|
||||||
|
@ -806,10 +809,11 @@ var aprArmFromHdg = func
|
||||||
##
|
##
|
||||||
lockAprHold.setBoolValue(1);
|
lockAprHold.setBoolValue(1);
|
||||||
var deviation = getprop(headingNeedleDeflection);
|
var deviation = getprop(headingNeedleDeflection);
|
||||||
|
var deviationValid = getprop(navHeadingValid);
|
||||||
##
|
##
|
||||||
# If the deflection is more than 3 degrees wait 5 seconds and check again.
|
# 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");
|
#print("deviation");
|
||||||
settimer(aprArmFromHdg, 5);
|
settimer(aprArmFromHdg, 5);
|
||||||
|
@ -862,10 +866,11 @@ var aprArmFromRol = func
|
||||||
lockRollAxis.setBoolValue(1);
|
lockRollAxis.setBoolValue(1);
|
||||||
settingTargetTurnRate.setDoubleValue(0.0);
|
settingTargetTurnRate.setDoubleValue(0.0);
|
||||||
var deviation = getprop(headingNeedleDeflection);
|
var deviation = getprop(headingNeedleDeflection);
|
||||||
|
var deviationValid = getprop(navHeadingValid);
|
||||||
##
|
##
|
||||||
# If the deflection is more than 3 degrees wait 5 seconds and check again.
|
# 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");
|
#print("deviation");
|
||||||
settimer(aprArmFromRol, 5);
|
settimer(aprArmFromRol, 5);
|
||||||
|
@ -911,10 +916,11 @@ var gsArm = func {
|
||||||
annunciatorGsArm.setBoolValue(1);
|
annunciatorGsArm.setBoolValue(1);
|
||||||
|
|
||||||
var deviation = getprop(gsNeedleDeflection);
|
var deviation = getprop(gsNeedleDeflection);
|
||||||
|
var deviationValid = getprop(navGSValid);
|
||||||
##
|
##
|
||||||
# If the deflection is more than 50% (manual says '2 to 3 dots')
|
# 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");
|
#print("deviation");
|
||||||
settimer(gsArm, 5);
|
settimer(gsArm, 5);
|
||||||
|
@ -1012,10 +1018,11 @@ var revArmFromHdg = func
|
||||||
##
|
##
|
||||||
lockRevHold.setBoolValue(1);
|
lockRevHold.setBoolValue(1);
|
||||||
var deviation = getprop(headingNeedleDeflection);
|
var deviation = getprop(headingNeedleDeflection);
|
||||||
|
var deviationValid = getprop(navHeadingValid);
|
||||||
##
|
##
|
||||||
# If the deflection is more than 3 degrees wait 5 seconds and check again.
|
# 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");
|
#print("deviation");
|
||||||
settimer(revArmFromHdg, 5);
|
settimer(revArmFromHdg, 5);
|
||||||
|
@ -1078,10 +1085,11 @@ var revArmFromRol = func
|
||||||
lockRollAxis.setBoolValue(1);
|
lockRollAxis.setBoolValue(1);
|
||||||
settingTargetTurnRate.setDoubleValue(0.0);
|
settingTargetTurnRate.setDoubleValue(0.0);
|
||||||
var deviation = getprop(headingNeedleDeflection);
|
var deviation = getprop(headingNeedleDeflection);
|
||||||
|
var deviationValid = getprop(navHeadingValid);
|
||||||
##
|
##
|
||||||
# If the deflection is more than 3 degrees wait 5 seconds and check again.
|
# 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");
|
#print("deviation");
|
||||||
settimer(revArmFromRol, 5);
|
settimer(revArmFromRol, 5);
|
||||||
|
|
Loading…
Reference in a new issue