1
0
Fork 0
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:
mikeller 2019-04-04 22:40:00 +13:00
parent 22b9f34532
commit 247f759652
3 changed files with 9 additions and 4 deletions

View file

@ -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[] = {

View file

@ -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;

View file

@ -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 {