Control: Fix incorrect handling of stick inputs in roll bank protection
This commit is contained in:
parent
b716c4e337
commit
b301edbc76
2 changed files with 22 additions and 2 deletions
|
@ -226,7 +226,15 @@ var update_loop = func {
|
|||
var fbw_loop = func {
|
||||
var ail = getprop("/controls/flight/aileron");
|
||||
|
||||
if (ail > 0.4 or ail < -0.4) {
|
||||
if (ail > 0.4 and getprop("/orientation/roll-deg") >= -33.5) {
|
||||
setprop("/it-fbw/roll-lim", "67");
|
||||
if (getprop("/it-fbw/roll-back") == 1 and getprop("/orientation/roll-deg") <= 33.5 and getprop("/orientation/roll-deg") >= -33.5) {
|
||||
setprop("/it-fbw/roll-back", 0);
|
||||
}
|
||||
if (getprop("/it-fbw/roll-back") == 0 and (getprop("/orientation/roll-deg") > 33.5 or getprop("/orientation/roll-deg") < -33.5)) {
|
||||
setprop("/it-fbw/roll-back", 1);
|
||||
}
|
||||
} else if (ail < -0.4 and getprop("/orientation/roll-deg") <= 33.5) {
|
||||
setprop("/it-fbw/roll-lim", "67");
|
||||
if (getprop("/it-fbw/roll-back") == 1 and getprop("/orientation/roll-deg") <= 33.5 and getprop("/orientation/roll-deg") >= -33.5) {
|
||||
setprop("/it-fbw/roll-back", 0);
|
||||
|
|
|
@ -329,7 +329,7 @@
|
|||
</function>
|
||||
</fcs_function>
|
||||
|
||||
<fcs_function name="fbw/roll/r-r-rb">
|
||||
<fcs_function name="fbw/roll/r-r-rb-f">
|
||||
<function>
|
||||
<table>
|
||||
<independentVar lookup="row">attitude/roll-rad</independentVar>
|
||||
|
@ -345,6 +345,18 @@
|
|||
</function>
|
||||
</fcs_function>
|
||||
|
||||
<switch name="fbw/roll/r-r-rb">
|
||||
<default value="fbw/roll/r-r-rb-f"/>
|
||||
<test logic="AND" value="fbw/roll/r-r-33">
|
||||
attitude/roll-rad lt 0
|
||||
fbw/roll/r-r-33 ge fbw/roll/r-r-rb-f
|
||||
</test>
|
||||
<test logic="AND" value="fbw/roll/r-r-33">
|
||||
attitude/roll-rad gt 0
|
||||
fbw/roll/r-r-33 le fbw/roll/r-r-rb-f
|
||||
</test>
|
||||
</switch>
|
||||
|
||||
<fcs_function name="fbw/roll/r-r-os-nrb">
|
||||
<function>
|
||||
<sum>
|
||||
|
|
Reference in a new issue