mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-17 05:15:25 +03:00
Added 'disarm' option to crash recovery.
This commit is contained in:
parent
22b9f34532
commit
247f759652
3 changed files with 9 additions and 4 deletions
|
@ -150,7 +150,7 @@ static const char * const lookupTableOffOn[] = {
|
|||
};
|
||||
|
||||
static const char * const lookupTableCrashRecovery[] = {
|
||||
"OFF", "ON" ,"BEEP"
|
||||
"OFF", "ON" ,"BEEP", "DISARM"
|
||||
};
|
||||
|
||||
static const char * const lookupTableUnit[] = {
|
||||
|
|
|
@ -886,9 +886,13 @@ static void detectAndSetCrashRecovery(
|
|||
&& fabsf(delta) > crashDtermThreshold
|
||||
&& fabsf(errorRate) > crashGyroThreshold
|
||||
&& fabsf(getSetpointRate(axis)) < crashSetpointThreshold) {
|
||||
if (crash_recovery == PID_CRASH_RECOVERY_DISARM) {
|
||||
disarm();
|
||||
} else {
|
||||
inCrashRecoveryMode = true;
|
||||
crashDetectedAtUs = currentTimeUs;
|
||||
}
|
||||
}
|
||||
if (inCrashRecoveryMode && cmpTimeUs(currentTimeUs, crashDetectedAtUs) < crashTimeDelayUs && (fabsf(errorRate) < crashGyroThreshold
|
||||
|| fabsf(getSetpointRate(axis)) > crashSetpointThreshold)) {
|
||||
inCrashRecoveryMode = false;
|
||||
|
|
|
@ -71,7 +71,8 @@ typedef enum {
|
|||
typedef enum {
|
||||
PID_CRASH_RECOVERY_OFF = 0,
|
||||
PID_CRASH_RECOVERY_ON,
|
||||
PID_CRASH_RECOVERY_BEEP
|
||||
PID_CRASH_RECOVERY_BEEP,
|
||||
PID_CRASH_RECOVERY_DISARM,
|
||||
} pidCrashRecovery_e;
|
||||
|
||||
typedef struct pidf_s {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue