mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 21:05:35 +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[] = {
|
static const char * const lookupTableCrashRecovery[] = {
|
||||||
"OFF", "ON" ,"BEEP"
|
"OFF", "ON" ,"BEEP", "DISARM"
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char * const lookupTableUnit[] = {
|
static const char * const lookupTableUnit[] = {
|
||||||
|
|
|
@ -886,8 +886,12 @@ static void detectAndSetCrashRecovery(
|
||||||
&& fabsf(delta) > crashDtermThreshold
|
&& fabsf(delta) > crashDtermThreshold
|
||||||
&& fabsf(errorRate) > crashGyroThreshold
|
&& fabsf(errorRate) > crashGyroThreshold
|
||||||
&& fabsf(getSetpointRate(axis)) < crashSetpointThreshold) {
|
&& fabsf(getSetpointRate(axis)) < crashSetpointThreshold) {
|
||||||
inCrashRecoveryMode = true;
|
if (crash_recovery == PID_CRASH_RECOVERY_DISARM) {
|
||||||
crashDetectedAtUs = currentTimeUs;
|
disarm();
|
||||||
|
} else {
|
||||||
|
inCrashRecoveryMode = true;
|
||||||
|
crashDetectedAtUs = currentTimeUs;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (inCrashRecoveryMode && cmpTimeUs(currentTimeUs, crashDetectedAtUs) < crashTimeDelayUs && (fabsf(errorRate) < crashGyroThreshold
|
if (inCrashRecoveryMode && cmpTimeUs(currentTimeUs, crashDetectedAtUs) < crashTimeDelayUs && (fabsf(errorRate) < crashGyroThreshold
|
||||||
|| fabsf(getSetpointRate(axis)) > crashSetpointThreshold)) {
|
|| fabsf(getSetpointRate(axis)) > crashSetpointThreshold)) {
|
||||||
|
|
|
@ -71,7 +71,8 @@ typedef enum {
|
||||||
typedef enum {
|
typedef enum {
|
||||||
PID_CRASH_RECOVERY_OFF = 0,
|
PID_CRASH_RECOVERY_OFF = 0,
|
||||||
PID_CRASH_RECOVERY_ON,
|
PID_CRASH_RECOVERY_ON,
|
||||||
PID_CRASH_RECOVERY_BEEP
|
PID_CRASH_RECOVERY_BEEP,
|
||||||
|
PID_CRASH_RECOVERY_DISARM,
|
||||||
} pidCrashRecovery_e;
|
} pidCrashRecovery_e;
|
||||||
|
|
||||||
typedef struct pidf_s {
|
typedef struct pidf_s {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue