mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 21:05:35 +03:00
Fixed tests, added crash indication.
This commit is contained in:
parent
247f759652
commit
760a524027
8 changed files with 29 additions and 23 deletions
|
@ -318,11 +318,12 @@ void updateArmingStatus(void)
|
|||
&& !flight3DConfig()->switched_mode3d
|
||||
&& !(getArmingDisableFlags() & ~(ARMING_DISABLED_ARM_SWITCH | ARMING_DISABLED_THROTTLE));
|
||||
|
||||
#ifdef USE_RUNAWAY_TAKEOFF
|
||||
if (!IS_RC_MODE_ACTIVE(BOXARM)) {
|
||||
#ifdef USE_RUNAWAY_TAKEOFF
|
||||
unsetArmingDisabled(ARMING_DISABLED_RUNAWAY_TAKEOFF);
|
||||
}
|
||||
#endif
|
||||
unsetArmingDisabled(ARMING_DISABLED_CRASH_DETECTED);
|
||||
}
|
||||
|
||||
// If arming is disabled and the ARM switch is on
|
||||
if (isArmingDisabled()
|
||||
|
@ -371,7 +372,7 @@ void disarm(void)
|
|||
flipOverAfterCrashActive = false;
|
||||
|
||||
// if ARMING_DISABLED_RUNAWAY_TAKEOFF is set then we want to play it's beep pattern instead
|
||||
if (!(getArmingDisableFlags() & ARMING_DISABLED_RUNAWAY_TAKEOFF)) {
|
||||
if (!(getArmingDisableFlags() & (ARMING_DISABLED_RUNAWAY_TAKEOFF | ARMING_DISABLED_CRASH_DETECTED))) {
|
||||
beeper(BEEPER_DISARMING); // emit disarm tone
|
||||
}
|
||||
}
|
||||
|
|
|
@ -208,6 +208,7 @@ void processRcStickPositions()
|
|||
// before they're able to rearm
|
||||
unsetArmingDisabled(ARMING_DISABLED_RUNAWAY_TAKEOFF);
|
||||
#endif
|
||||
unsetArmingDisabled(ARMING_DISABLED_CRASH_DETECTED);
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
@ -230,7 +231,7 @@ void processRcStickPositions()
|
|||
resetTryingToArm();
|
||||
}
|
||||
|
||||
if (ARMING_FLAG(ARMED) || doNotRepeat || rcDelayMs <= STICK_DELAY_MS || (getArmingDisableFlags() & ARMING_DISABLED_RUNAWAY_TAKEOFF)) {
|
||||
if (ARMING_FLAG(ARMED) || doNotRepeat || rcDelayMs <= STICK_DELAY_MS || (getArmingDisableFlags() & (ARMING_DISABLED_RUNAWAY_TAKEOFF | ARMING_DISABLED_CRASH_DETECTED))) {
|
||||
return;
|
||||
}
|
||||
doNotRepeat = true;
|
||||
|
|
|
@ -40,6 +40,7 @@ const char *armingDisableFlagNames[]= {
|
|||
"BADRX",
|
||||
"BOXFAILSAFE",
|
||||
"RUNAWAY",
|
||||
"CRASH",
|
||||
"THROTTLE",
|
||||
"ANGLE",
|
||||
"BOOTGRACE",
|
||||
|
|
|
@ -46,21 +46,22 @@ typedef enum {
|
|||
ARMING_DISABLED_BAD_RX_RECOVERY = (1 << 3),
|
||||
ARMING_DISABLED_BOXFAILSAFE = (1 << 4),
|
||||
ARMING_DISABLED_RUNAWAY_TAKEOFF = (1 << 5),
|
||||
ARMING_DISABLED_THROTTLE = (1 << 6),
|
||||
ARMING_DISABLED_ANGLE = (1 << 7),
|
||||
ARMING_DISABLED_BOOT_GRACE_TIME = (1 << 8),
|
||||
ARMING_DISABLED_NOPREARM = (1 << 9),
|
||||
ARMING_DISABLED_LOAD = (1 << 10),
|
||||
ARMING_DISABLED_CALIBRATING = (1 << 11),
|
||||
ARMING_DISABLED_CLI = (1 << 12),
|
||||
ARMING_DISABLED_CMS_MENU = (1 << 13),
|
||||
ARMING_DISABLED_BST = (1 << 14),
|
||||
ARMING_DISABLED_MSP = (1 << 15),
|
||||
ARMING_DISABLED_PARALYZE = (1 << 16),
|
||||
ARMING_DISABLED_GPS = (1 << 17),
|
||||
ARMING_DISABLED_RESC = (1 << 18),
|
||||
ARMING_DISABLED_RPMFILTER = (1 << 19),
|
||||
ARMING_DISABLED_ARM_SWITCH = (1 << 20), // Needs to be the last element, since it's always activated if one of the others is active when arming
|
||||
ARMING_DISABLED_CRASH_DETECTED = (1 << 6),
|
||||
ARMING_DISABLED_THROTTLE = (1 << 7),
|
||||
ARMING_DISABLED_ANGLE = (1 << 8),
|
||||
ARMING_DISABLED_BOOT_GRACE_TIME = (1 << 9),
|
||||
ARMING_DISABLED_NOPREARM = (1 << 10),
|
||||
ARMING_DISABLED_LOAD = (1 << 11),
|
||||
ARMING_DISABLED_CALIBRATING = (1 << 12),
|
||||
ARMING_DISABLED_CLI = (1 << 13),
|
||||
ARMING_DISABLED_CMS_MENU = (1 << 14),
|
||||
ARMING_DISABLED_BST = (1 << 15),
|
||||
ARMING_DISABLED_MSP = (1 << 16),
|
||||
ARMING_DISABLED_PARALYZE = (1 << 17),
|
||||
ARMING_DISABLED_GPS = (1 << 18),
|
||||
ARMING_DISABLED_RESC = (1 << 19),
|
||||
ARMING_DISABLED_RPMFILTER = (1 << 20),
|
||||
ARMING_DISABLED_ARM_SWITCH = (1 << 21), // Needs to be the last element, since it's always activated if one of the others is active when arming
|
||||
} armingDisableFlags_e;
|
||||
|
||||
#define ARMING_DISABLE_FLAGS_COUNT (LOG2(ARMING_DISABLED_ARM_SWITCH) + 1)
|
||||
|
|
|
@ -887,6 +887,7 @@ static void detectAndSetCrashRecovery(
|
|||
&& fabsf(errorRate) > crashGyroThreshold
|
||||
&& fabsf(getSetpointRate(axis)) < crashSetpointThreshold) {
|
||||
if (crash_recovery == PID_CRASH_RECOVERY_DISARM) {
|
||||
setArmingDisabled(ARMING_DISABLED_CRASH_DETECTED);
|
||||
disarm();
|
||||
} else {
|
||||
inCrashRecoveryMode = true;
|
||||
|
|
|
@ -89,7 +89,7 @@ static void rcdeviceCameraControlProcess(void)
|
|||
// avoid display wifi page when arming, in the next firmware(>2.0) of rcsplit we have change the wifi page logic:
|
||||
// when the wifi was turn on it won't turn off the analog video output,
|
||||
// and just put a wifi indicator on the right top of the video output. here is for the old split firmware
|
||||
if (!ARMING_FLAG(ARMED) && ((getArmingDisableFlags() & ARMING_DISABLED_RUNAWAY_TAKEOFF) == 0)) {
|
||||
if (!ARMING_FLAG(ARMED) && !(getArmingDisableFlags() & (ARMING_DISABLED_RUNAWAY_TAKEOFF | ARMING_DISABLED_CRASH_DETECTED))) {
|
||||
behavior = RCDEVICE_PROTOCOL_CAM_CTRL_SIMULATE_WIFI_BTN;
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ static void rcdeviceCameraControlProcess(void)
|
|||
case BOXCAMERA3:
|
||||
if (isFeatureSupported(RCDEVICE_PROTOCOL_FEATURE_CHANGE_MODE)) {
|
||||
// avoid change camera mode when arming
|
||||
if (!ARMING_FLAG(ARMED) && ((getArmingDisableFlags() & ARMING_DISABLED_RUNAWAY_TAKEOFF) == 0)) {
|
||||
if (!ARMING_FLAG(ARMED) && !(getArmingDisableFlags() & (ARMING_DISABLED_RUNAWAY_TAKEOFF | ARMING_DISABLED_CRASH_DETECTED))) {
|
||||
behavior = RCDEVICE_PROTOCOL_CAM_CTRL_CHANGE_MODE;
|
||||
}
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ static void rcdevice5KeySimulationProcess(timeUs_t currentTimeUs)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (ARMING_FLAG(ARMED) || getArmingDisableFlags() & ARMING_DISABLED_RUNAWAY_TAKEOFF) {
|
||||
if (ARMING_FLAG(ARMED) || (getArmingDisableFlags() & (ARMING_DISABLED_RUNAWAY_TAKEOFF | ARMING_DISABLED_CRASH_DETECTED))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -629,7 +629,7 @@ STATIC_UNIT_TESTED void osdRefresh(timeUs_t currentTimeUs)
|
|||
resumeRefreshAt = currentTimeUs + (REFRESH_1S / 2);
|
||||
} else if (isSomeStatEnabled()
|
||||
&& !suppressStatsDisplay
|
||||
&& (!(getArmingDisableFlags() & ARMING_DISABLED_RUNAWAY_TAKEOFF)
|
||||
&& (!(getArmingDisableFlags() & (ARMING_DISABLED_RUNAWAY_TAKEOFF | ARMING_DISABLED_CRASH_DETECTED))
|
||||
|| !VISIBLE(osdConfig()->item_pos[OSD_WARNINGS]))) { // suppress stats if runaway takeoff triggered disarm and WARNINGS element is visible
|
||||
osdStatsEnabled = true;
|
||||
resumeRefreshAt = currentTimeUs + (60 * REFRESH_1S);
|
||||
|
|
|
@ -79,6 +79,7 @@ extern "C" {
|
|||
float getRcDeflection(int axis) { return simulatedRcDeflection[axis]; }
|
||||
void beeperConfirmationBeeps(uint8_t) { }
|
||||
bool isLaunchControlActive(void) {return unitLaunchControlActive; }
|
||||
void disarm(void) { }
|
||||
}
|
||||
|
||||
pidProfile_t *pidProfile;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue