mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-21 15:25:36 +03:00
Ensure failsafe does not repeatedly call disarm when landed.
This commit is contained in:
parent
a34e8f0bdb
commit
d4eb558254
2 changed files with 17 additions and 1 deletions
|
@ -185,13 +185,15 @@ void failsafeUpdateState(void)
|
|||
|
||||
case FAILSAFE_LANDED:
|
||||
|
||||
if (!armed) {
|
||||
break;
|
||||
}
|
||||
// This will prevent the automatic rearm if failsafe shuts it down and prevents
|
||||
// to restart accidently by just reconnect to the tx - you will have to switch off first to rearm
|
||||
ENABLE_ARMING_FLAG(PREVENT_ARMING);
|
||||
|
||||
failsafeState.active = false;
|
||||
mwDisarm();
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -238,6 +238,20 @@ TEST(FlightFailsafeTest, TestFailsafeCausesLanding)
|
|||
EXPECT_EQ(1, CALL_COUNTER(COUNTER_MW_DISARM));
|
||||
EXPECT_TRUE(ARMING_FLAG(PREVENT_ARMING));
|
||||
|
||||
// given
|
||||
DISABLE_ARMING_FLAG(ARMED);
|
||||
|
||||
// when
|
||||
failsafeOnRxCycleStarted();
|
||||
// no call to failsafeOnValidDataReceived();
|
||||
failsafeUpdateState();
|
||||
|
||||
// then
|
||||
EXPECT_EQ(false, failsafeIsActive());
|
||||
EXPECT_EQ(FAILSAFE_LANDED, failsafePhase());
|
||||
EXPECT_EQ(1, CALL_COUNTER(COUNTER_MW_DISARM)); // disarm not called repeatedly.
|
||||
EXPECT_TRUE(ARMING_FLAG(PREVENT_ARMING));
|
||||
|
||||
}
|
||||
|
||||
// STUBS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue