1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-21 15:25:36 +03:00

Squash and rebase

This commit is contained in:
Blaine 2017-10-18 00:38:13 -07:00
parent 3038eb79ea
commit 9556ea6bf5
4 changed files with 13 additions and 2 deletions

View file

@ -42,6 +42,8 @@
#include "rx/rx.h" #include "rx/rx.h"
#include "flight/pid.h"
/* /*
* Usage: * Usage:
* *
@ -256,7 +258,7 @@ void failsafeUpdateState(void)
failsafeApplyControlInput(); failsafeApplyControlInput();
beeperMode = BEEPER_RX_LOST_LANDING; beeperMode = BEEPER_RX_LOST_LANDING;
} }
if (failsafeShouldHaveCausedLandingByNow() || !armed) { if (failsafeShouldHaveCausedLandingByNow() || crashRecoveryModeActive() || !armed) {
failsafeState.receivingRxDataPeriodPreset = PERIOD_OF_30_SECONDS; // require 30 seconds of valid rxData failsafeState.receivingRxDataPeriodPreset = PERIOD_OF_30_SECONDS; // require 30 seconds of valid rxData
failsafeState.phase = FAILSAFE_LANDED; failsafeState.phase = FAILSAFE_LANDED;
reprocessState = true; reprocessState = true;

View file

@ -52,6 +52,8 @@
uint32_t targetPidLooptime; uint32_t targetPidLooptime;
static bool pidStabilisationEnabled; static bool pidStabilisationEnabled;
static bool inCrashRecoveryMode = false;
float axisPID_P[3], axisPID_I[3], axisPID_D[3]; float axisPID_P[3], axisPID_I[3], axisPID_D[3];
static float dT; static float dT;
@ -406,7 +408,6 @@ void pidController(const pidProfile_t *pidProfile, const rollAndPitchTrims_t *an
static float previousRateError[2]; static float previousRateError[2];
const float tpaFactor = getThrottlePIDAttenuation(); const float tpaFactor = getThrottlePIDAttenuation();
const float motorMixRange = getMotorMixRange(); const float motorMixRange = getMotorMixRange();
static bool inCrashRecoveryMode = false;
static timeUs_t crashDetectedAtUs; static timeUs_t crashDetectedAtUs;
// Dynamic ki component to gradually scale back integration when above windup point // Dynamic ki component to gradually scale back integration when above windup point
@ -539,3 +540,8 @@ void pidController(const pidProfile_t *pidProfile, const rollAndPitchTrims_t *an
} }
} }
} }
bool crashRecoveryModeActive(void)
{
return inCrashRecoveryMode;
}

View file

@ -134,3 +134,4 @@ void pidInitFilters(const pidProfile_t *pidProfile);
void pidInitConfig(const pidProfile_t *pidProfile); void pidInitConfig(const pidProfile_t *pidProfile);
void pidInit(const pidProfile_t *pidProfile); void pidInit(const pidProfile_t *pidProfile);
void pidCopyProfile(uint8_t dstPidProfileIndex, uint8_t srcPidProfileIndex); void pidCopyProfile(uint8_t dstPidProfileIndex, uint8_t srcPidProfileIndex);
bool crashRecoveryModeActive(void);

View file

@ -471,4 +471,6 @@ bool isUsingSticksForArming(void)
} }
void beeperConfirmationBeeps(uint8_t beepCount) { UNUSED(beepCount); } void beeperConfirmationBeeps(uint8_t beepCount) { UNUSED(beepCount); }
bool crashRecoveryModeActive(void) { return false; }
} }