mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-13 19:40:31 +03:00
beeper - minor refactoring (#13610)
This commit is contained in:
parent
3094dd6766
commit
dac4939215
2 changed files with 5 additions and 3 deletions
|
@ -3332,12 +3332,12 @@ static void printBeeper(dumpFlags_t dumpMask, const uint32_t offFlags, const uin
|
||||||
headingStr = cliPrintSectionHeading(dumpMask, false, headingStr);
|
headingStr = cliPrintSectionHeading(dumpMask, false, headingStr);
|
||||||
const uint8_t beeperCount = beeperTableEntryCount();
|
const uint8_t beeperCount = beeperTableEntryCount();
|
||||||
for (int32_t i = 0; i < beeperCount - 1; i++) {
|
for (int32_t i = 0; i < beeperCount - 1; i++) {
|
||||||
if (beeperModeMaskForTableIndex(i) & allowedFlags) {
|
const uint32_t beeperModeMask = beeperModeMaskForTableIndex(i);
|
||||||
|
if (beeperModeMask & allowedFlags) {
|
||||||
const char *formatOff = "%s -%s";
|
const char *formatOff = "%s -%s";
|
||||||
const char *formatOn = "%s %s";
|
const char *formatOn = "%s %s";
|
||||||
const uint32_t beeperModeMask = beeperModeMaskForTableIndex(i);
|
|
||||||
cliDefaultPrintLinef(dumpMask, ~(offFlags ^ offFlagsDefault) & beeperModeMask, offFlags & beeperModeMask ? formatOn : formatOff, name, beeperNameForTableIndex(i));
|
|
||||||
const bool equalsDefault = ~(offFlags ^ offFlagsDefault) & beeperModeMask;
|
const bool equalsDefault = ~(offFlags ^ offFlagsDefault) & beeperModeMask;
|
||||||
|
cliDefaultPrintLinef(dumpMask, equalsDefault, offFlags & beeperModeMask ? formatOn : formatOff, name, beeperNameForTableIndex(i));
|
||||||
headingStr = cliPrintSectionHeading(dumpMask, !equalsDefault, headingStr);
|
headingStr = cliPrintSectionHeading(dumpMask, !equalsDefault, headingStr);
|
||||||
cliDumpPrintLinef(dumpMask, equalsDefault, offFlags & beeperModeMask ? formatOff : formatOn, name, beeperNameForTableIndex(i));
|
cliDumpPrintLinef(dumpMask, equalsDefault, offFlags & beeperModeMask ? formatOff : formatOn, name, beeperNameForTableIndex(i));
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "common/time.h"
|
#include "common/time.h"
|
||||||
|
#include "common/utils.h"
|
||||||
|
|
||||||
#define BEEPER_GET_FLAG(mode) (1U << ((mode) - 1))
|
#define BEEPER_GET_FLAG(mode) (1U << ((mode) - 1))
|
||||||
|
|
||||||
|
@ -64,6 +65,7 @@ typedef enum {
|
||||||
// BEEPER_ALL must remain at the bottom of this enum
|
// BEEPER_ALL must remain at the bottom of this enum
|
||||||
} beeperMode_e;
|
} beeperMode_e;
|
||||||
|
|
||||||
|
STATIC_ASSERT(BEEPER_ALL < sizeof(uint32_t) * 8, "BEEPER bits exhausted");
|
||||||
|
|
||||||
#define BEEPER_ALLOWED_MODES ( \
|
#define BEEPER_ALLOWED_MODES ( \
|
||||||
BEEPER_GET_FLAG(BEEPER_GYRO_CALIBRATED) \
|
BEEPER_GET_FLAG(BEEPER_GYRO_CALIBRATED) \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue