mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-17 13:25:30 +03:00
Added switching off of beeper in all cases when crash recovery is disabled.
This commit is contained in:
parent
b7fe3e203e
commit
46624d28ca
1 changed files with 9 additions and 10 deletions
|
@ -517,22 +517,21 @@ void pidController(const pidProfile_t *pidProfile, const rollAndPitchTrims_t *an
|
|||
// if crash recovery is on and accelerometer enabled then check for a crash
|
||||
if (pidProfile->crash_recovery) {
|
||||
if (ARMING_FLAG(ARMED)) {
|
||||
if (motorMixRange >= 1.0f && inCrashRecoveryMode == false
|
||||
&& ABS(delta) > crashDtermThreshold
|
||||
&& ABS(errorRate) > crashGyroThreshold
|
||||
&& ABS(getSetpointRate(axis)) < crashSetpointThreshold) {
|
||||
if (motorMixRange >= 1.0f && !inCrashRecoveryMode
|
||||
&& ABS(delta) > crashDtermThreshold
|
||||
&& ABS(errorRate) > crashGyroThreshold
|
||||
&& ABS(getSetpointRate(axis)) < crashSetpointThreshold) {
|
||||
inCrashRecoveryMode = true;
|
||||
crashDetectedAtUs = currentTimeUs;
|
||||
}
|
||||
if (cmpTimeUs(currentTimeUs, crashDetectedAtUs) < crashTimeDelayUs && (ABS(errorRate) < crashGyroThreshold
|
||||
|| ABS(getSetpointRate(axis)) > crashSetpointThreshold)) {
|
||||
if (inCrashRecoveryMode && cmpTimeUs(currentTimeUs, crashDetectedAtUs) < crashTimeDelayUs && (ABS(errorRate) < crashGyroThreshold
|
||||
|| ABS(getSetpointRate(axis)) > crashSetpointThreshold)) {
|
||||
inCrashRecoveryMode = false;
|
||||
BEEP_OFF;
|
||||
}
|
||||
} else {
|
||||
if (inCrashRecoveryMode) {
|
||||
BEEP_OFF;
|
||||
}
|
||||
} else if (inCrashRecoveryMode) {
|
||||
inCrashRecoveryMode = false;
|
||||
BEEP_OFF;
|
||||
}
|
||||
}
|
||||
axisPID_D[axis] = Kd[axis] * delta * tpaFactor;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue