From b3be3edb0b97d3cf94b8fab7af5cf7e1d3dbe31f Mon Sep 17 00:00:00 2001 From: Mark Haslinghuis Date: Sun, 24 Dec 2023 13:56:14 +0100 Subject: [PATCH] Fix builds when PWM motor protocol is used (#13236) * Fix builds when PWM motor protocol is used * Enable useUnsyncedPwm for PWM by default --- src/main/pg/motor.c | 3 +++ src/main/target/AT32F435G/target.h | 2 -- src/main/target/AT32F435M/target.h | 2 -- src/main/target/SITL/target.h | 2 ++ 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/pg/motor.c b/src/main/pg/motor.c index 27fa8e49b6..76b0c88fcf 100644 --- a/src/main/pg/motor.c +++ b/src/main/pg/motor.c @@ -61,6 +61,9 @@ void pgResetFn_motorConfig(motorConfig_t *motorConfig) motorConfig->minthrottle = 1070; motorConfig->dev.motorPwmRate = BRUSHLESS_MOTORS_PWM_RATE; #ifndef USE_DSHOT + if (motorConfig->dev.motorPwmProtocol == PWM_TYPE_STANDARD) { + motorConfig->dev.useUnsyncedPwm = true; + } motorConfig->dev.motorPwmProtocol = PWM_TYPE_DISABLED; #elif defined(DEFAULT_MOTOR_DSHOT_SPEED) motorConfig->dev.motorPwmProtocol = DEFAULT_MOTOR_DSHOT_SPEED; diff --git a/src/main/target/AT32F435G/target.h b/src/main/target/AT32F435G/target.h index 0514e21530..7209196ad5 100644 --- a/src/main/target/AT32F435G/target.h +++ b/src/main/target/AT32F435G/target.h @@ -75,8 +75,6 @@ #define USE_ADC -#define USE_PWM_OUTPUT - // Remove these undefines as support is added //#undef USE_BEEPER //#undef USE_LED_STRIP diff --git a/src/main/target/AT32F435M/target.h b/src/main/target/AT32F435M/target.h index 53d7470032..f9459817b7 100644 --- a/src/main/target/AT32F435M/target.h +++ b/src/main/target/AT32F435M/target.h @@ -75,8 +75,6 @@ #define USE_ADC -#define USE_PWM_OUTPUT - // Remove these undefines as support is added //#undef USE_BEEPER //#undef USE_LED_STRIP diff --git a/src/main/target/SITL/target.h b/src/main/target/SITL/target.h index e51b997e84..6032570c42 100644 --- a/src/main/target/SITL/target.h +++ b/src/main/target/SITL/target.h @@ -99,7 +99,9 @@ #define USE_PARAMETER_GROUPS +#ifndef USE_PWM_OUTPUT #define USE_PWM_OUTPUT +#endif #undef USE_STACK_CHECK // I think SITL don't need this #undef USE_DASHBOARD