mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-17 13:25:30 +03:00
Merge pull request #4172 from mikeller/add_dshot_beacon_command
Renamed 'DSHOT_CMD_BEEPx' to 'DSHOT_CMD_BEACONx', made beacon tone configurable.
This commit is contained in:
commit
c612280c1a
5 changed files with 14 additions and 15 deletions
|
@ -39,11 +39,11 @@
|
|||
|
||||
typedef enum {
|
||||
DSHOT_CMD_MOTOR_STOP = 0,
|
||||
DSHOT_CMD_BEEP1,
|
||||
DSHOT_CMD_BEEP2,
|
||||
DSHOT_CMD_BEEP3,
|
||||
DSHOT_CMD_BEEP4,
|
||||
DSHOT_CMD_BEEP5,
|
||||
DSHOT_CMD_BEACON1,
|
||||
DSHOT_CMD_BEACON2,
|
||||
DSHOT_CMD_BEACON3,
|
||||
DSHOT_CMD_BEACON4,
|
||||
DSHOT_CMD_BEACON5,
|
||||
DSHOT_CMD_ESC_INFO, // V2 includes settings
|
||||
DSHOT_CMD_SPIN_DIRECTION_1,
|
||||
DSHOT_CMD_SPIN_DIRECTION_2,
|
||||
|
|
|
@ -156,12 +156,6 @@ PG_RESET_TEMPLATE(systemConfig_t, systemConfig,
|
|||
);
|
||||
#endif
|
||||
|
||||
#ifdef BEEPER
|
||||
PG_REGISTER_WITH_RESET_TEMPLATE(beeperConfig_t, beeperConfig, PG_BEEPER_CONFIG, 0);
|
||||
PG_RESET_TEMPLATE(beeperConfig_t, beeperConfig,
|
||||
.dshotForward = true
|
||||
);
|
||||
#endif
|
||||
#ifdef USE_ADC
|
||||
PG_REGISTER_WITH_RESET_FN(adcConfig_t, adcConfig, PG_ADC_CONFIG, 0);
|
||||
#endif
|
||||
|
|
|
@ -477,7 +477,7 @@ const clivalue_t valueTable[] = {
|
|||
|
||||
// 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) },
|
||||
{ "beeper_dshot_beacon_tone", VAR_UINT8 | MASTER_VALUE, .config.minmax = {0, DSHOT_CMD_BEACON5 }, PG_BEEPER_CONFIG, offsetof(beeperConfig_t, dshotBeaconTone) },
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -84,6 +84,11 @@ PG_RESET_TEMPLATE(beeperDevConfig_t, beeperDevConfig,
|
|||
#define BEEPER_COMMAND_STOP 0xFF
|
||||
|
||||
#ifdef BEEPER
|
||||
PG_REGISTER_WITH_RESET_TEMPLATE(beeperConfig_t, beeperConfig, PG_BEEPER_CONFIG, 1);
|
||||
PG_RESET_TEMPLATE(beeperConfig_t, beeperConfig,
|
||||
.dshotBeaconTone = 0
|
||||
);
|
||||
|
||||
/* Beeper Sound Sequences: (Square wave generation)
|
||||
* Sequence must end with 0xFF or 0xFE. 0xFE repeats the sequence from
|
||||
* start when 0xFF stops the sound when it's completed.
|
||||
|
@ -363,11 +368,11 @@ void beeperUpdate(timeUs_t currentTimeUs)
|
|||
}
|
||||
|
||||
#ifdef USE_DSHOT
|
||||
if (!areMotorsRunning() && beeperConfig()->dshotForward && currentBeeperEntry->mode == BEEPER_RX_SET) {
|
||||
if (!areMotorsRunning() && beeperConfig()->dshotBeaconTone && (beeperConfig()->dshotBeaconTone <= DSHOT_CMD_BEACON5) && currentBeeperEntry->mode == BEEPER_RX_SET) {
|
||||
pwmDisableMotors();
|
||||
delay(1);
|
||||
|
||||
pwmWriteDshotCommand(ALL_MOTORS, getMotorCount(), DSHOT_CMD_BEEP3);
|
||||
pwmWriteDshotCommand(ALL_MOTORS, getMotorCount(), beeperConfig()->dshotBeaconTone);
|
||||
|
||||
pwmEnableMotors();
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ typedef enum {
|
|||
typedef struct beeperConfig_s {
|
||||
uint32_t beeper_off_flags;
|
||||
uint32_t preferred_beeper_off_flags;
|
||||
bool dshotForward;
|
||||
uint8_t dshotBeaconTone;
|
||||
} beeperConfig_t;
|
||||
|
||||
#ifdef BEEPER
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue