mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 00:05:33 +03:00
Add in prearm option for safer arming.
When prearm is used, it must be enabled before arming. Before you can arm again, the prearm switch needs to get toggled. (+3 squashed commit)
This commit is contained in:
parent
5b31ca2916
commit
f8bd089e47
4 changed files with 29 additions and 10 deletions
|
@ -182,6 +182,13 @@ void updateArmingStatus(void)
|
|||
unsetArmingDisabled(ARMING_DISABLED_CALIBRATING);
|
||||
}
|
||||
|
||||
if ((isModeActivationConditionPresent(BOXPREARM) && IS_RC_MODE_ACTIVE(BOXPREARM) && !ARMING_FLAG(WAS_ARMED_WITH_PREARM))
|
||||
|| !isModeActivationConditionPresent(BOXPREARM)) {
|
||||
unsetArmingDisabled(ARMING_DISABLED_NOPREARM);
|
||||
} else {
|
||||
setArmingDisabled(ARMING_DISABLED_NOPREARM);
|
||||
}
|
||||
|
||||
if (isArmingDisabled()) {
|
||||
warningLedFlash();
|
||||
} else {
|
||||
|
@ -237,6 +244,9 @@ void tryArm(void)
|
|||
|
||||
ENABLE_ARMING_FLAG(ARMED);
|
||||
ENABLE_ARMING_FLAG(WAS_EVER_ARMED);
|
||||
if (isModeActivationConditionPresent(BOXPREARM)) {
|
||||
ENABLE_ARMING_FLAG(WAS_ARMED_WITH_PREARM);
|
||||
}
|
||||
headFreeModeHold = DECIDEGREES_TO_DEGREES(attitude.values.yaw);
|
||||
|
||||
disarmAt = millis() + armingConfig()->auto_disarm_delay * 1000; // start disarm timeout, will be extended when throttle is nonzero
|
||||
|
@ -451,6 +461,10 @@ void processRx(timeUs_t currentTimeUs)
|
|||
LED1_OFF;
|
||||
}
|
||||
|
||||
if (!IS_RC_MODE_ACTIVE(BOXPREARM) && ARMING_FLAG(WAS_ARMED_WITH_PREARM)) {
|
||||
DISABLE_ARMING_FLAG(WAS_ARMED_WITH_PREARM);
|
||||
}
|
||||
|
||||
#if defined(ACC) || defined(MAG)
|
||||
if (sensors(SENSOR_ACC) || sensors(SENSOR_MAG)) {
|
||||
#if defined(GPS) || defined(MAG)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue