1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 21:05:35 +03:00

Fix CLI beacon dump output

Previously the `beacon` portion of a `dump` would display the flags associated with `beeper` rather then only the limited set for `beacon`. This would result in output that would cause errors if copy/pasted back in as commands.
This commit is contained in:
Bruce Luckcuck 2019-03-09 15:27:16 -05:00
parent 52c4e96c88
commit 607bb64855

View file

@ -165,7 +165,6 @@ extern uint8_t __config_end;
#include "cli.h" #include "cli.h"
static serialPort_t *cliPort; static serialPort_t *cliPort;
#ifdef STM32F1 #ifdef STM32F1
@ -2969,15 +2968,17 @@ static void cliFeature(char *cmdline)
} }
#if defined(USE_BEEPER) #if defined(USE_BEEPER)
static void printBeeper(uint8_t dumpMask, const uint32_t offFlags, const uint32_t offFlagsDefault, const char *name) static void printBeeper(uint8_t dumpMask, const uint32_t offFlags, const uint32_t offFlagsDefault, const char *name, const uint32_t allowedFlags)
{ {
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++) {
const char *formatOff = "%s -%s"; if (beeperModeMaskForTableIndex(i) & allowedFlags) {
const char *formatOn = "%s %s"; const char *formatOff = "%s -%s";
const uint32_t beeperModeMask = beeperModeMaskForTableIndex(i); const char *formatOn = "%s %s";
cliDefaultPrintLinef(dumpMask, ~(offFlags ^ offFlagsDefault) & beeperModeMask, offFlags & beeperModeMask ? formatOn : formatOff, name, beeperNameForTableIndex(i)); const uint32_t beeperModeMask = beeperModeMaskForTableIndex(i);
cliDumpPrintLinef(dumpMask, ~(offFlags ^ offFlagsDefault) & beeperModeMask, offFlags & beeperModeMask ? formatOff : formatOn, name, beeperNameForTableIndex(i)); cliDefaultPrintLinef(dumpMask, ~(offFlags ^ offFlagsDefault) & beeperModeMask, offFlags & beeperModeMask ? formatOn : formatOff, name, beeperNameForTableIndex(i));
cliDumpPrintLinef(dumpMask, ~(offFlags ^ offFlagsDefault) & beeperModeMask, offFlags & beeperModeMask ? formatOff : formatOn, name, beeperNameForTableIndex(i));
}
} }
} }
@ -5353,11 +5354,11 @@ static void printConfig(char *cmdline, bool doDiff)
#if defined(USE_BEEPER) #if defined(USE_BEEPER)
cliPrintHashLine("beeper"); cliPrintHashLine("beeper");
printBeeper(dumpMask, beeperConfig_Copy.beeper_off_flags, beeperConfig()->beeper_off_flags, "beeper"); printBeeper(dumpMask, beeperConfig_Copy.beeper_off_flags, beeperConfig()->beeper_off_flags, "beeper", BEEPER_ALLOWED_MODES);
#if defined(USE_DSHOT) #if defined(USE_DSHOT)
cliPrintHashLine("beacon"); cliPrintHashLine("beacon");
printBeeper(dumpMask, beeperConfig_Copy.dshotBeaconOffFlags, beeperConfig()->dshotBeaconOffFlags, "beacon"); printBeeper(dumpMask, beeperConfig_Copy.dshotBeaconOffFlags, beeperConfig()->dshotBeaconOffFlags, "beacon", DSHOT_BEACON_ALLOWED_MODES);
#endif #endif
#endif // USE_BEEPER #endif // USE_BEEPER