<Gauge Name="A32x FBW Fix" Version="1.0">
<!-- Fly By Wire Fix
Will disengage the default SEC mode to enable more direct aileron and elevator control when the stick is deflected.
When the stick is recentered, SEC will engage again and the plane will try to hold the last pitch and bank angle
Pitch and bank protection modes are implemented
-->
<Macro Name="FBWStickLimit">0.1</Macro><!-- SEC will disengage at this (absolute) stick deflection from center (default: 0.1 = 10%) -->
<Macro Name="FBWBankLimit">30</Macro><!-- Bank Limiter will engage at this bank angle -->
<Macro Name="FBWPitchLimitUp">30</Macro><!-- Pitch Limiter will engage at this upward pitch -->
<Macro Name="FBWPitchLimitDown">15</Macro><!-- Pitch Limiter will engage at this downward pitch -->
<!-- FLY BY WIRE FIX -->
<!-- FLY BY WIRE FIX -->
<!-- FLY BY WIRE FIX -->
<Element>
<Select>
<Value>
<!-- Track stick position -->
(A:YOKE X POSITION,position) abs (>G:Var1)
(A:YOKE Y POSITION,position) abs (>G:Var2)
<!-- Protection modes -->
(A:Autopilot Master,bool) ! if{
<!-- Bank protection. Monitors plane bank and freezes the bank angle at the limiter value, unless corrective action is taken -->
(A:PLANE BANK DEGREES, radians) rddg abs @FBWBankLimit > (L:A32x FBW Bank Protection, number) 0 == and
if{ 1 (>L:A32x FBW Bank Protection, number) }
(L:A32x FBW Bank Protection, number) 0 !=
if{ (A:PLANE BANK DEGREES, radians) rddg -@FBWBankLimit < (A:YOKE X POSITION,position) 0 > and if{ -@FBWBankLimit (>C:SIMVARS:PLANE BANK DEGREES, degrees) }
(A:PLANE BANK DEGREES, radians) rddg @FBWBankLimit > (A:YOKE X POSITION,position) 0 < and if{ @FBWBankLimit (>C:SIMVARS:PLANE BANK DEGREES, degrees) }
(A:PLANE BANK DEGREES, radians) rddg abs @FBWBankLimit <
(A:PLANE BANK DEGREES, radians) rddg -@FBWBankLimit < (A:YOKE X POSITION,position) 0 < and or
(A:PLANE BANK DEGREES, radians) rddg @FBWBankLimit > (A:YOKE X POSITION,position) 0 > and or
if{ 0 (>L:A32x FBW Bank Protection, number) } }
<!-- Pitch protection. Monitors plane pitch and freezes the bank angle at the respective limiter value, unless corrective action is taken -->
(A:PLANE PITCH DEGREES, radians) rddg @FBWPitchLimitDown > if{ 1 (>L:A32x FBW Pitch Protection, number) }
(A:PLANE PITCH DEGREES, radians) rddg -@FBWPitchLimitUp < if{ 2 (>L:A32x FBW Pitch Protection, number) }
(L:A32x FBW Pitch Protection, number) 1 == if{ @FBWPitchLimitDown (>C:SIMVARS:PLANE PITCH DEGREES, degrees) }
(L:A32x FBW Pitch Protection, number) 2 == if{ -@FBWPitchLimitUp (>C:SIMVARS:PLANE PITCH DEGREES, degrees) }
(L:A32x FBW Pitch Protection, number) 1 ==
(A:PLANE PITCH DEGREES, radians) rddg @FBWPitchLimitDown < (A:YOKE Y POSITION,position) 0 > or and if{ 0 (>L:A32x FBW Pitch Protection, number) }
(L:A32x FBW Pitch Protection, number) 2 ==
(A:PLANE PITCH DEGREES, radians) rddg -@FBWPitchLimitUp > (A:YOKE Y POSITION,position) 0 < or and if{ 0 (>L:A32x FBW Pitch Protection, number) }
}
(A:Sim On Ground,bool) ! if{
<!-- Disable SEC when stick is deflected or keeps on deflecting and bank and alpha values are within limits -->
(A:YOKE X POSITION,position) abs (G:Var1) !=
(A:YOKE Y POSITION,position) abs (G:Var2) != or
(A:YOKE X POSITION,position) abs @FBWStickLimit > or
(A:YOKE Y POSITION,position) abs @FBWStickLimit > or
(A:Fly By Wire Sec Switch:1,bool) and
if{ 1 (>K:FLY_BY_WIRE_SEC_TOGGLE) }
<!-- Reenable SEC switch if there's no more stick movement or bank or alpha limits have been exceeded -->
(A:YOKE X POSITION,position) abs (G:Var1) ==
(A:YOKE Y POSITION,position) abs (G:Var2) == and
(A:YOKE X POSITION,position) abs @FBWStickLimit < and
(A:YOKE Y POSITION,position) abs @FBWStickLimit < and
(A:Fly By Wire Sec Switch:1,bool) ! and
if{ 1 (>K:FLY_BY_WIRE_SEC_TOGGLE) }
}
</Value>
</Select>
</Element>
</Gauge>