From 09b59b76685c5c2d95b9ca6c765db57579b0c515 Mon Sep 17 00:00:00 2001 From: Mark Haslinghuis Date: Sun, 3 Dec 2023 10:36:42 +0100 Subject: [PATCH] Add default config option for dshot telemetry (#13184) --- src/main/pg/motor.c | 8 ++++++++ src/main/pg/motor.h | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/src/main/pg/motor.c b/src/main/pg/motor.c index 10d341c7394..27fa8e49b62 100644 --- a/src/main/pg/motor.c +++ b/src/main/pg/motor.c @@ -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) @@ -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; diff --git a/src/main/pg/motor.h b/src/main/pg/motor.h index 8c55a87b848..74a93ee31bb 100644 --- a/src/main/pg/motor.h +++ b/src/main/pg/motor.h @@ -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