1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 00:35:39 +03:00

Update turtle / crashflip mode (#13905)

* stop motors after 90 degrees of rotation and with max rate

* handle no accelerometer data

* improve check for acc, although seems to be OK without it

* disable all attenuation if rate is set to zero

* refactoring thanks Karate

* use sensors.h

* remove unnecessary arming check

* exit crashFlip immediately switch is reverted if throttle is zero

* add Crashflip Rate to OSD

* Revert unnecessary changes in crashflip core.c code

and clarify comments about crashflip switch

* update / minimise comments, thanks Karate

* ensure all names say `crashflip` consistently

* Undo quick re-arm because motrors were not reversed

* fix issue with reversed motors, we must disarm

* ignore yaw rotation and set gyro limit to 1900 deg/s

* default attenuation to off (crashflip_rate = 0)

* refactoring, increase rate limit to allow stronger inhibition

* enable in race_pro mode

* don't attenuate on attitude until a significant change occurs

* no attenuation for small changes

* Updates from review by PL

* remove whitespace

* refactor motorOutput, update comments, renaming variables

thanks PL

* changes from review PL

* only permit fast re-arm if crashflip rate set and crashflip was successful

* properly exit turtle mode

* add crashFlipSuccessful to unit test extern c

* small updates from review

* improved crashflip switch handling

* remove unnecessary motors normal check
This commit is contained in:
ctzsnooze 2024-10-05 07:58:33 +10:00 committed by GitHub
parent 95d55525ad
commit 7156dc84a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 247 additions and 155 deletions

View file

@ -690,7 +690,7 @@ typedef enum {
WARNING_ARMING_DISABLED,
WARNING_LOW_BATTERY,
WARNING_FAILSAFE,
WARNING_CRASH_FLIP_ACTIVE,
WARNING_CRASHFLIP_ACTIVE,
} warningFlags_e;
static void applyLedWarningLayer(bool updateNow, timeUs_t *timer)
@ -714,8 +714,8 @@ static void applyLedWarningLayer(bool updateNow, timeUs_t *timer)
if (!ARMING_FLAG(ARMED) && isArmingDisabled()) {
warningFlags |= 1 << WARNING_ARMING_DISABLED;
}
if (isFlipOverAfterCrashActive()) {
warningFlags |= 1 << WARNING_CRASH_FLIP_ACTIVE;
if (isCrashFlipModeActive()) {
warningFlags |= 1 << WARNING_CRASHFLIP_ACTIVE;
}
}
*timer += HZ_TO_US(LED_OVERLAY_WARNING_RATE_HZ);
@ -731,7 +731,7 @@ static void applyLedWarningLayer(bool updateNow, timeUs_t *timer)
case WARNING_ARMING_DISABLED:
warningColor = colorOn ? &HSV(GREEN) : &HSV(BLACK);
break;
case WARNING_CRASH_FLIP_ACTIVE:
case WARNING_CRASHFLIP_ACTIVE:
warningColor = colorOn ? &HSV(MAGENTA) : &HSV(BLACK);
break;
case WARNING_LOW_BATTERY: