mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 00:05:33 +03:00
Add prevention for turning radio on at any time with arm switch on
This commit is contained in:
parent
0c0483d020
commit
ad540d8ad8
4 changed files with 102 additions and 18 deletions
|
@ -158,6 +158,24 @@ void updateArmingStatus(void)
|
|||
unsetArmingDisabled(ARMING_DISABLED_BOOT_GRACE_TIME);
|
||||
}
|
||||
|
||||
// If switch is used for arming then check it is not defaulting to on when the RX link recovers from a fault
|
||||
if (!isUsingSticksForArming()) {
|
||||
static bool hadRx = false;
|
||||
const bool haveRx = rxIsReceivingSignal();
|
||||
|
||||
const bool justGotRxBack = !hadRx && haveRx;
|
||||
|
||||
if (justGotRxBack && IS_RC_MODE_ACTIVE(BOXARM)) {
|
||||
// If the RX has just started to receive a signal again and the arm switch is on, apply arming restriction
|
||||
setArmingDisabled(ARMING_DISABLED_BAD_RX_RECOVERY);
|
||||
} else if (haveRx && !IS_RC_MODE_ACTIVE(BOXARM)) {
|
||||
// If RX signal is OK and the arm switch is off, remove arming restriction
|
||||
unsetArmingDisabled(ARMING_DISABLED_BAD_RX_RECOVERY);
|
||||
}
|
||||
|
||||
hadRx = haveRx;
|
||||
}
|
||||
|
||||
if (IS_RC_MODE_ACTIVE(BOXFAILSAFE)) {
|
||||
setArmingDisabled(ARMING_DISABLED_BOXFAILSAFE);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue