1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 16:25:31 +03:00

Require the arm switch to be off before arming

Requires that the arm switch must be moved from off to on after all
arming disable flags are unset.

Prevents accidental arming due to arm switch being left in the on
position.
This commit is contained in:
Dan Nixon 2017-08-05 18:07:04 +01:00
parent f283d2460a
commit 945870089f
3 changed files with 21 additions and 10 deletions

View file

@ -189,6 +189,15 @@ void updateArmingStatus(void)
setArmingDisabled(ARMING_DISABLED_NOPREARM);
}
if (!isUsingSticksForArming()) {
// If arming is disabled and the ARM switch is on
if (isArmingDisabled() && IS_RC_MODE_ACTIVE(BOXARM)) {
setArmingDisabled(ARMING_DISABLED_ARM_SWITCH);
} else if (!IS_RC_MODE_ACTIVE(BOXARM)) {
unsetArmingDisabled(ARMING_DISABLED_ARM_SWITCH);
}
}
if (isArmingDisabled()) {
warningLedFlash();
} else {

View file

@ -32,7 +32,8 @@ static uint32_t enabledSensors = 0;
#if defined(OSD) || !defined(MINIMAL_CLI)
const char *armingDisableFlagNames[]= {
"NOGYRO", "FAILSAFE", "RX LOSS", "BOXFAILSAFE", "THROTTLE",
"ANGLE", "NO PREARM", "LOAD", "CALIB", "CLI", "CMS", "OSD", "BST"
"ANGLE", "NO PREARM", "ARM SWITCH", "LOAD", "CALIB", "CLI",
"CMS", "OSD", "BST"
};
#endif

View file

@ -42,15 +42,16 @@ typedef enum {
ARMING_DISABLED_THROTTLE = (1 << 4),
ARMING_DISABLED_ANGLE = (1 << 5),
ARMING_DISABLED_NOPREARM = (1 << 6),
ARMING_DISABLED_LOAD = (1 << 7),
ARMING_DISABLED_CALIBRATING = (1 << 8),
ARMING_DISABLED_CLI = (1 << 9),
ARMING_DISABLED_CMS_MENU = (1 << 10),
ARMING_DISABLED_OSD_MENU = (1 << 11),
ARMING_DISABLED_BST = (1 << 12)
ARMING_DISABLED_ARM_SWITCH = (1 << 7),
ARMING_DISABLED_LOAD = (1 << 8),
ARMING_DISABLED_CALIBRATING = (1 << 9),
ARMING_DISABLED_CLI = (1 << 10),
ARMING_DISABLED_CMS_MENU = (1 << 11),
ARMING_DISABLED_OSD_MENU = (1 << 12),
ARMING_DISABLED_BST = (1 << 13)
} armingDisableFlags_e;
#define NUM_ARMING_DISABLE_FLAGS 13
#define NUM_ARMING_DISABLE_FLAGS 14
#if defined(OSD) || !defined(MINIMAL_CLI)
extern const char *armingDisableFlagNames[NUM_ARMING_DISABLE_FLAGS];