1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 14:25:20 +03:00

Merge pull request #3693 from DanNixon/dshot_beeper_config

Allow toggling of the DShot beeper
This commit is contained in:
Martin Budden 2017-08-12 07:41:43 +01:00 committed by GitHub
commit 202b820551
4 changed files with 13 additions and 3 deletions

View file

@ -156,7 +156,10 @@ PG_RESET_TEMPLATE(systemConfig_t, systemConfig,
#endif #endif
#ifdef BEEPER #ifdef BEEPER
PG_REGISTER(beeperConfig_t, beeperConfig, PG_BEEPER_CONFIG, 0); PG_REGISTER_WITH_RESET_TEMPLATE(beeperConfig_t, beeperConfig, PG_BEEPER_CONFIG, 0);
PG_RESET_TEMPLATE(beeperConfig_t, beeperConfig,
.dshotForward = true
);
#endif #endif
#ifdef USE_ADC #ifdef USE_ADC
PG_REGISTER_WITH_RESET_FN(adcConfig_t, adcConfig, PG_ADC_CONFIG, 0); PG_REGISTER_WITH_RESET_FN(adcConfig_t, adcConfig, PG_ADC_CONFIG, 0);

View file

@ -54,6 +54,7 @@
#include "flight/pid.h" #include "flight/pid.h"
#include "flight/servos.h" #include "flight/servos.h"
#include "io/beeper.h"
#include "io/dashboard.h" #include "io/dashboard.h"
#include "io/gimbal.h" #include "io/gimbal.h"
#include "io/gps.h" #include "io/gps.h"
@ -443,11 +444,16 @@ const clivalue_t valueTable[] = {
{ "ibatv_offset", VAR_INT16 | MASTER_VALUE, .config.minmax = { -16000, 16000 }, PG_CURRENT_SENSOR_VIRTUAL_CONFIG, offsetof(currentSensorVirtualConfig_t, offset) }, { "ibatv_offset", VAR_INT16 | MASTER_VALUE, .config.minmax = { -16000, 16000 }, PG_CURRENT_SENSOR_VIRTUAL_CONFIG, offsetof(currentSensorVirtualConfig_t, offset) },
#endif #endif
// PG_BEEPER_DEV_CONFIG
#ifdef BEEPER #ifdef BEEPER
// PG_BEEPER_DEV_CONFIG
{ "beeper_inversion", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_BEEPER_DEV_CONFIG, offsetof(beeperDevConfig_t, isInverted) }, { "beeper_inversion", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_BEEPER_DEV_CONFIG, offsetof(beeperDevConfig_t, isInverted) },
{ "beeper_od", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_BEEPER_DEV_CONFIG, offsetof(beeperDevConfig_t, isOpenDrain) }, { "beeper_od", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_BEEPER_DEV_CONFIG, offsetof(beeperDevConfig_t, isOpenDrain) },
{ "beeper_frequency", VAR_INT16 | MASTER_VALUE, .config.minmax = { 0, 16000 }, PG_BEEPER_DEV_CONFIG, offsetof(beeperDevConfig_t, frequency) }, { "beeper_frequency", VAR_INT16 | MASTER_VALUE, .config.minmax = { 0, 16000 }, PG_BEEPER_DEV_CONFIG, offsetof(beeperDevConfig_t, frequency) },
// PG_BEEPER_CONFIG
#ifdef USE_DSHOT
{ "beeper_dshot", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_BEEPER_CONFIG, offsetof(beeperConfig_t, dshotForward) },
#endif
#endif #endif
// PG_MIXER_CONFIG // PG_MIXER_CONFIG

View file

@ -363,7 +363,7 @@ void beeperUpdate(timeUs_t currentTimeUs)
} }
#ifdef USE_DSHOT #ifdef USE_DSHOT
if (!ARMING_FLAG(ARMED) && currentBeeperEntry->mode == BEEPER_RX_SET) { if (!ARMING_FLAG(ARMED) && beeperConfig()->dshotForward && currentBeeperEntry->mode == BEEPER_RX_SET) {
for (unsigned index = 0; index < getMotorCount(); index++) { for (unsigned index = 0; index < getMotorCount(); index++) {
pwmWriteDshotCommand(index, DSHOT_CMD_BEEP3); pwmWriteDshotCommand(index, DSHOT_CMD_BEEP3);
} }

View file

@ -51,6 +51,7 @@ typedef enum {
typedef struct beeperConfig_s { typedef struct beeperConfig_s {
uint32_t beeper_off_flags; uint32_t beeper_off_flags;
uint32_t preferred_beeper_off_flags; uint32_t preferred_beeper_off_flags;
bool dshotForward;
} beeperConfig_t; } beeperConfig_t;
#ifdef BEEPER #ifdef BEEPER