diff --git a/src/main/cli/cli.c b/src/main/cli/cli.c index 437e10865a..f12e289160 100644 --- a/src/main/cli/cli.c +++ b/src/main/cli/cli.c @@ -3332,12 +3332,12 @@ static void printBeeper(dumpFlags_t dumpMask, const uint32_t offFlags, const uin headingStr = cliPrintSectionHeading(dumpMask, false, headingStr); const uint8_t beeperCount = beeperTableEntryCount(); 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 *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; + cliDefaultPrintLinef(dumpMask, equalsDefault, offFlags & beeperModeMask ? formatOn : formatOff, name, beeperNameForTableIndex(i)); headingStr = cliPrintSectionHeading(dumpMask, !equalsDefault, headingStr); cliDumpPrintLinef(dumpMask, equalsDefault, offFlags & beeperModeMask ? formatOff : formatOn, name, beeperNameForTableIndex(i)); } diff --git a/src/main/io/beeper.h b/src/main/io/beeper.h index e1f1d9ee2c..97da104da2 100644 --- a/src/main/io/beeper.h +++ b/src/main/io/beeper.h @@ -21,6 +21,7 @@ #pragma once #include "common/time.h" +#include "common/utils.h" #define BEEPER_GET_FLAG(mode) (1U << ((mode) - 1)) @@ -64,6 +65,7 @@ typedef enum { // BEEPER_ALL must remain at the bottom of this enum } beeperMode_e; +STATIC_ASSERT(BEEPER_ALL < sizeof(uint32_t) * 8, "BEEPER bits exhausted"); #define BEEPER_ALLOWED_MODES ( \ BEEPER_GET_FLAG(BEEPER_GYRO_CALIBRATED) \