mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 06:15:16 +03:00
Keep I-terms at zero throttle for fixed wings (#13127)
* Keep Iterms at zero throttle for fixed wing mixer * Ctz suggestions * Update src/main/fc/core.c based on ladvinap suggestion Co-authored-by: Petr Ledvina <ledvinap@gmail.com> --------- Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
This commit is contained in:
parent
efe1825afa
commit
dd198b2cda
1 changed files with 7 additions and 20 deletions
|
@ -768,30 +768,17 @@ bool processRx(timeUs_t currentTimeUs)
|
|||
failsafeStartMonitoring();
|
||||
}
|
||||
|
||||
const throttleStatus_e throttleStatus = calculateThrottleStatus();
|
||||
const bool throttleActive = calculateThrottleStatus() != THROTTLE_LOW;
|
||||
const uint8_t throttlePercent = calculateThrottlePercentAbs();
|
||||
|
||||
const bool launchControlActive = isLaunchControlActive();
|
||||
airmodeIsActivated = airmodeIsEnabled() && ARMING_FLAG(ARMED) && throttlePercent >= rxConfig()->airModeActivateThreshold && !launchControlActive;
|
||||
|
||||
if (airmodeIsEnabled() && ARMING_FLAG(ARMED) && !launchControlActive) {
|
||||
if (throttlePercent >= rxConfig()->airModeActivateThreshold) {
|
||||
airmodeIsActivated = true; // Prevent iterm from being reset
|
||||
}
|
||||
} else {
|
||||
airmodeIsActivated = false;
|
||||
}
|
||||
|
||||
/* In airmode iterm should be prevented to grow when Low thottle and Roll + Pitch Centered.
|
||||
This is needed to prevent iterm winding on the ground, but keep full stabilisation on 0 throttle while in air */
|
||||
if (throttleStatus == THROTTLE_LOW && !airmodeIsActivated && !launchControlActive) {
|
||||
pidSetItermReset(true);
|
||||
if (currentPidProfile->pidAtMinThrottle)
|
||||
pidStabilisationState(PID_STABILISATION_ON);
|
||||
else
|
||||
pidStabilisationState(PID_STABILISATION_OFF);
|
||||
} else {
|
||||
if (ARMING_FLAG(ARMED) && (airmodeIsActivated || throttleActive || launchControlActive || isFixedWing())) {
|
||||
pidSetItermReset(false);
|
||||
pidStabilisationState(PID_STABILISATION_ON);
|
||||
} else {
|
||||
pidSetItermReset(true);
|
||||
pidStabilisationState(currentPidProfile->pidAtMinThrottle ? PID_STABILISATION_ON : PID_STABILISATION_OFF);
|
||||
}
|
||||
|
||||
#ifdef USE_RUNAWAY_TAKEOFF
|
||||
|
@ -814,7 +801,7 @@ bool processRx(timeUs_t currentTimeUs)
|
|||
// - sticks are active and have deflection greater than runaway_takeoff_deactivate_stick_percent
|
||||
// - pidSum on all axis is less then runaway_takeoff_deactivate_pidlimit
|
||||
bool inStableFlight = false;
|
||||
if (!featureIsEnabled(FEATURE_MOTOR_STOP) || airmodeIsEnabled() || (throttleStatus != THROTTLE_LOW)) { // are motors running?
|
||||
if (!featureIsEnabled(FEATURE_MOTOR_STOP) || airmodeIsEnabled() || throttleActive) { // are motors running?
|
||||
const uint8_t lowThrottleLimit = pidConfig()->runaway_takeoff_deactivate_throttle;
|
||||
const uint8_t midThrottleLimit = constrain(lowThrottleLimit * 2, lowThrottleLimit * 2, RUNAWAY_TAKEOFF_HIGH_THROTTLE_PERCENT);
|
||||
if ((((throttlePercent >= lowThrottleLimit) && areSticksActive(RUNAWAY_TAKEOFF_DEACTIVATE_STICK_PERCENT)) || (throttlePercent >= midThrottleLimit))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue