Skip to content

Commit

Permalink
Add default config option for dshot telemetry (betaflight#13184)
Browse files Browse the repository at this point in the history
  • Loading branch information
haslinghuis authored Dec 3, 2023
1 parent 32ccc84 commit 09b59b7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/pg/motor.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
#define DEFAULT_DSHOT_BURST DSHOT_DMAR_OFF
#endif

#if !defined(DEFAULT_DSHOT_TELEMETRY)
#define DEFAULT_DSHOT_TELEMETRY DSHOT_TELEMETRY_OFF
#endif

PG_REGISTER_WITH_RESET_FN(motorConfig_t, motorConfig, PG_MOTOR_CONFIG, 2);

void pgResetFn_motorConfig(motorConfig_t *motorConfig)
Expand Down Expand Up @@ -107,6 +111,10 @@ void pgResetFn_motorConfig(motorConfig_t *motorConfig)
motorConfig->dev.useBurstDshot = DEFAULT_DSHOT_BURST;
#endif

#ifdef USE_DSHOT_TELEMETRY
motorConfig->dev.useDshotTelemetry = DEFAULT_DSHOT_TELEMETRY;
#endif

#ifdef USE_DSHOT_BITBANG
motorConfig->dev.useDshotBitbang = DEFAULT_DSHOT_BITBANG;
motorConfig->dev.useDshotBitbangedTimer = DSHOT_BITBANGED_TIMER_DEFAULT;
Expand Down
5 changes: 5 additions & 0 deletions src/main/pg/motor.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ typedef enum {
DSHOT_DMAR_AUTO
} dshotDmar_e;

typedef enum {
DSHOT_TELEMETRY_OFF,
DSHOT_TELEMETRY_ON,
} dshotTelemetry_e;

typedef struct motorDevConfig_s {
uint16_t motorPwmRate; // The update rate of motor outputs (50-498Hz)
uint8_t motorPwmProtocol; // Pwm Protocol
Expand Down

0 comments on commit 09b59b7

Please sign in to comment.