mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-25 09:16:07 +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:
parent
1ea014ae25
commit
3f0754d295
18 changed files with 220 additions and 164 deletions
|
@ -277,7 +277,7 @@ void applyLedModeLayer(void)
|
|||
|
||||
if (!(ledConfig->flags & LED_FUNCTION_MODE)) {
|
||||
if (ledConfig->flags & LED_FUNCTION_ARM_STATE) {
|
||||
if (!f.ARMED) {
|
||||
if (!ARMING_FLAG(ARMED)) {
|
||||
setLedColor(ledIndex, &green);
|
||||
} else {
|
||||
setLedColor(ledIndex, &blue);
|
||||
|
@ -288,15 +288,15 @@ void applyLedModeLayer(void)
|
|||
|
||||
applyDirectionalModeColor(ledIndex, ledConfig, &orientationModeColors);
|
||||
|
||||
if (f.HEADFREE_MODE) {
|
||||
if (FLIGHT_MODE(HEADFREE_MODE)) {
|
||||
applyDirectionalModeColor(ledIndex, ledConfig, &headfreeModeColors);
|
||||
#ifdef MAG
|
||||
} else if (f.MAG_MODE) {
|
||||
} else if (FLIGHT_MODE(MAG_MODE)) {
|
||||
applyDirectionalModeColor(ledIndex, ledConfig, &magModeColors);
|
||||
#endif
|
||||
} else if (f.HORIZON_MODE) {
|
||||
} else if (FLIGHT_MODE(HORIZON_MODE)) {
|
||||
applyDirectionalModeColor(ledIndex, ledConfig, &horizonModeColors);
|
||||
} else if (f.ANGLE_MODE) {
|
||||
} else if (FLIGHT_MODE(ANGLE_MODE)) {
|
||||
applyDirectionalModeColor(ledIndex, ledConfig, &angleModeColors);
|
||||
}
|
||||
}
|
||||
|
@ -388,7 +388,7 @@ static void applyLedAnimationLayer(void)
|
|||
{
|
||||
const ledConfig_t *ledConfig;
|
||||
|
||||
if (f.ARMED) {
|
||||
if (ARMING_FLAG(ARMED)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue