20,741
edits
m (→/Nasal/fbw.nas: remove redundant code) |
m (→/Nasal/fbw.nas: use function to determine max/idle state of throttles, so that more than just 2 throttles can be supported) |
||
Line 258: | Line 258: | ||
### Reduce throttle if aircraft is faster than 250 KIAS under 10000 ft | ### Reduce throttle if aircraft is faster than 250 KIAS under 10000 ft | ||
if ((airspeedkt >= 250) and (altitudemsl <= 10000) and | if ((airspeedkt >= 250) and (altitudemsl <= 10000) and me.throttles_not_idle() ) { | ||
me.dec_throttles(); | me.dec_throttles(); | ||
me.throttlefix = 1; | me.throttlefix = 1; | ||
} | } | ||
if ((me.throttlefix == 1) and (airspeedkt < 245) and (altitudemsl <= 10000) and | if ((me.throttlefix == 1) and (airspeedkt < 245) and (altitudemsl <= 10000) and me.throttles_not_maxed() ) { | ||
me.inc_throttles(); | me.inc_throttles(); | ||
} | } | ||
Line 269: | Line 269: | ||
### Adjust Throttle to stay under Vne | ### Adjust Throttle to stay under Vne | ||
if ((airspeedkt >= 350) and (altitudemsl > 10000) and ( | if ((airspeedkt >= 350) and (altitudemsl > 10000) and me.throttles_not_idle() ) { | ||
me.dec_throttles(); | me.dec_throttles(); | ||
me.throttlefix = 1; | me.throttlefix = 1; | ||
} | } | ||
if ((me.throttlefix == 1) and (airspeedkt < 340) and (altitudemsl > 10000) and ( | if ((me.throttlefix == 1) and (airspeedkt < 340) and (altitudemsl > 10000) and me.throttles_not_maxed() ) { | ||
me.inc_throttles(); | me.inc_throttles(); | ||
} | } | ||
Line 280: | Line 280: | ||
### Adjust Throttle to keep from stalling | ### Adjust Throttle to keep from stalling | ||
if ((airspeedkt < 125) and (me.altitudeagl > 250) and ( | if ((airspeedkt < 125) and (me.altitudeagl > 250) and me.throttles_not_maxed() ) { | ||
me.inc_throttles(); | me.inc_throttles(); | ||
Line 408: | Line 408: | ||
forindex(var t; me.throttles) | forindex(var t; me.throttles) | ||
me.throttles[t] -= INCREMENT * me.fpsfix; | me.throttles[t] -= INCREMENT * me.fpsfix; | ||
}, | |||
throttles_not_idle: func { | |||
foreach(var t; me.throttles) { | |||
if (me.throttles[t] == 0) return 0; # at least one throttle is idle | |||
} | |||
return 1; # throttles are idle | |||
}, | |||
throttles_not_maxed: func { | |||
foreach(var t; me.throttles) { | |||
if (me.throttles[t] == 1) return 1; # at least one throttle is maxed | |||
} | |||
return 0; # throttles are not maxed | |||
}, | }, | ||
reset : func { | reset : func { |