diff --git a/src/main/interface/cli.c b/src/main/interface/cli.c index a881e4af7f..0c9cb157eb 100644 --- a/src/main/interface/cli.c +++ b/src/main/interface/cli.c @@ -2321,21 +2321,28 @@ static void cliFeature(char *cmdline) } } -#ifdef USE_BEEPER -static void printBeeper(uint8_t dumpMask, const beeperConfig_t *beeperConfig, const beeperConfig_t *beeperConfigDefault) +#if defined(USE_BEEPER) || defined(USE_DSHOT) +static void printBeeper(uint8_t dumpMask, const uint32_t offFlags, const uint32_t offFlagsDefault, char *name) { const uint8_t beeperCount = beeperTableEntryCount(); - const uint32_t mask = beeperConfig->beeper_off_flags; - const uint32_t defaultMask = beeperConfigDefault->beeper_off_flags; for (int32_t i = 0; i < beeperCount - 2; i++) { - const char *formatOff = "beeper -%s"; - const char *formatOn = "beeper %s"; + const char *formatOff = "%s -%s"; + const char *formatOn = "%s %s"; const uint32_t beeperModeMask = beeperModeMaskForTableIndex(i); - cliDefaultPrintLinef(dumpMask, ~(mask ^ defaultMask) & beeperModeMask, mask & beeperModeMask ? formatOn : formatOff, beeperNameForTableIndex(i)); - cliDumpPrintLinef(dumpMask, ~(mask ^ defaultMask) & beeperModeMask, mask & beeperModeMask ? formatOff : formatOn, 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)); } } +#endif +#if defined(USE_DSHOT) +static void cliBeacon(char *cmdline) +{ + UNUSED(cmdline); +} +#endif + +#if defined(USE_BEEPER) static void cliBeeper(char *cmdline) { uint32_t len = strlen(cmdline); @@ -4009,7 +4016,12 @@ static void printConfig(char *cmdline, bool doDiff) #ifdef USE_BEEPER cliPrintHashLine("beeper"); - printBeeper(dumpMask, &beeperConfig_Copy, beeperConfig()); + printBeeper(dumpMask, beeperConfig_Copy.beeper_off_flags, beeperConfig()->beeper_off_flags, "beeper"); +#endif + +#ifdef USE_DSHOT + cliPrintHashLine("beacon"); + printBeeper(dumpMask, beeperConfig_Copy.dshotBeaconOffFlags, beeperConfig()->dshotBeaconOffFlags, "beacon"); #endif cliPrintHashLine("map"); @@ -4165,6 +4177,10 @@ static void cliHelp(char *cmdline); const clicmd_t cmdTable[] = { CLI_COMMAND_DEF("adjrange", "configure adjustment ranges", NULL, cliAdjustmentRange), CLI_COMMAND_DEF("aux", "configure modes", " ", cliAux), +#ifdef USE_DSHOT + CLI_COMMAND_DEF("beacon", "turn on/off beeper", "list\r\n" + "\t<+|->[name]", cliBeacon), +#endif #ifdef USE_BEEPER CLI_COMMAND_DEF("beeper", "turn on/off beeper", "list\r\n" "\t<+|->[name]", cliBeeper), diff --git a/src/main/interface/settings.c b/src/main/interface/settings.c index 731ce95401..cf817009fe 100644 --- a/src/main/interface/settings.c +++ b/src/main/interface/settings.c @@ -629,7 +629,7 @@ const clivalue_t valueTable[] = { // PG_BEEPER_CONFIG #ifdef USE_DSHOT - { "beeper_dshot_beacon_tone", VAR_UINT8 | MASTER_VALUE, .config.minmax = {0, DSHOT_CMD_BEACON5 }, PG_BEEPER_CONFIG, offsetof(beeperConfig_t, dshotBeaconTone) }, + { "beeper_dshot_beacon_tone", VAR_UINT8 | MASTER_VALUE, .config.minmax = {1, DSHOT_CMD_BEACON5 }, PG_BEEPER_CONFIG, offsetof(beeperConfig_t, dshotBeaconTone) }, #endif #endif // USE_BEEPER diff --git a/src/main/pg/beeper.c b/src/main/pg/beeper.c index f1e39944ba..b97d07a35c 100644 --- a/src/main/pg/beeper.c +++ b/src/main/pg/beeper.c @@ -30,6 +30,6 @@ PG_REGISTER_WITH_RESET_TEMPLATE(beeperConfig_t, beeperConfig, PG_BEEPER_CONFIG, 2); PG_RESET_TEMPLATE(beeperConfig_t, beeperConfig, - .dshotBeaconTone = 0, + .dshotBeaconTone = 1, ); #endif diff --git a/src/main/pg/beeper.h b/src/main/pg/beeper.h index 5496e13cf3..deac9679f6 100644 --- a/src/main/pg/beeper.h +++ b/src/main/pg/beeper.h @@ -26,6 +26,7 @@ typedef struct beeperConfig_s { uint32_t beeper_off_flags; uint8_t dshotBeaconTone; + uint32_t dshotBeaconOffFlags; } beeperConfig_t; PG_DECLARE(beeperConfig_t, beeperConfig);