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

Replace global flags with stateFlags, flightModeFlags and armingFlags.

Each flag was previously a whole byte, now all of the flags only take up
4 bytes as they are represented by bit masks.

This is cleaner because the different kind of flags are now separated.

Additionally this changes the behaviour of arming slightly.  When using
a switch to arm the aircraft will not arm unless the switch has been in
the off state once.  This prevents arming if you power the aircraft with
a low throttle and the switch in the on position.
This commit is contained in:
Dominic Clifton 2014-08-24 12:11:30 +01:00
parent 1ea014ae25
commit 3f0754d295
18 changed files with 220 additions and 164 deletions

View file

@ -71,7 +71,7 @@ void beepcodeUpdateState(bool warn_vbat)
}
//===================== Beeps for failsafe =====================
if (feature(FEATURE_FAILSAFE)) {
if (failsafe->vTable->shouldForceLanding(f.ARMED)) {
if (failsafe->vTable->shouldForceLanding(ARMING_FLAG(ARMED))) {
warn_failsafe = FAILSAFE_LANDING;
if (failsafe->vTable->shouldHaveCausedLandingByNow()) {
@ -79,7 +79,7 @@ void beepcodeUpdateState(bool warn_vbat)
}
}
if (failsafe->vTable->hasTimerElapsed() && !f.ARMED) {
if (failsafe->vTable->hasTimerElapsed() && !ARMING_FLAG(ARMED)) {
warn_failsafe = FAILSAFE_FIND_ME;
}
@ -91,7 +91,7 @@ void beepcodeUpdateState(bool warn_vbat)
#ifdef GPS
//===================== GPS fix notification handling =====================
if (sensors(SENSOR_GPS)) {
if ((rcOptions[BOXGPSHOME] || rcOptions[BOXGPSHOLD]) && !f.GPS_FIX) { // if no fix and gps funtion is activated: do warning beeps
if ((rcOptions[BOXGPSHOME] || rcOptions[BOXGPSHOLD]) && !STATE(GPS_FIX)) { // if no fix and gps funtion is activated: do warning beeps
warn_noGPSfix = 1;
} else {
warn_noGPSfix = 0;
@ -114,7 +114,7 @@ void beepcodeUpdateState(bool warn_vbat)
beep_code('S','S','S','M'); // beeperon
else if (warn_vbat)
beep_code('S','M','M','D');
else if (f.AUTOTUNE_MODE)
else if (FLIGHT_MODE(AUTOTUNE_MODE))
beep_code('S','M','S','M');
else if (toggleBeep > 0)
beep(50); // fast confirmation beep