From f7365617012d245bae365f32f0c1f649852e4d14 Mon Sep 17 00:00:00 2001 From: Thorsten Laux Date: Tue, 7 May 2019 18:24:53 +0200 Subject: [PATCH] avoid double esc startup sounds on f7 --- src/main/drivers/pwm_output_dshot.c | 10 ++++++---- src/main/drivers/pwm_output_dshot_hal.c | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/main/drivers/pwm_output_dshot.c b/src/main/drivers/pwm_output_dshot.c index 12f3928536..3891fb98b5 100644 --- a/src/main/drivers/pwm_output_dshot.c +++ b/src/main/drivers/pwm_output_dshot.c @@ -393,10 +393,6 @@ void pwmDshotMotorHardwareConfig(const timerHardware_t *timerHardware, uint8_t m ( 2 + (motor->useProshot ? 4 * MOTOR_NIBBLE_LENGTH_PROSHOT : 16 * MOTOR_BITLENGTH)) / getDshotHz(pwmProtocolType); pwmDshotSetDirectionOutput(motor, true); - if (useDshotTelemetry) { - // avoid high line during startup to prevent bootloader activation - *timerChCCR(timerHardware) = 0xffff; - } #else pwmDshotSetDirectionOutput(motor, true, &OCINIT, &DMAINIT); #endif @@ -420,6 +416,12 @@ void pwmDshotMotorHardwareConfig(const timerHardware_t *timerHardware, uint8_t m TIM_CtrlPWMOutputs(timer, ENABLE); TIM_Cmd(timer, ENABLE); } +#ifdef USE_DSHOT_TELEMETRY + if (useDshotTelemetry) { + // avoid high line during startup to prevent bootloader activation + *timerChCCR(timerHardware) = 0xffff; + } +#endif motor->configured = true; } diff --git a/src/main/drivers/pwm_output_dshot_hal.c b/src/main/drivers/pwm_output_dshot_hal.c index d56ee9810b..e714cc05ad 100644 --- a/src/main/drivers/pwm_output_dshot_hal.c +++ b/src/main/drivers/pwm_output_dshot_hal.c @@ -354,10 +354,6 @@ void pwmDshotMotorHardwareConfig(const timerHardware_t *timerHardware, uint8_t m ( 2 + (motor->useProshot ? 4 * MOTOR_NIBBLE_LENGTH_PROSHOT : 16 * MOTOR_BITLENGTH)) / getDshotHz(pwmProtocolType); pwmDshotSetDirectionOutput(motor, true); - if (useDshotTelemetry) { - // avoid high line during startup to prevent bootloader activation - *timerChCCR(timerHardware) = 0xffff; - } #else pwmDshotSetDirectionOutput(motor, true, &OCINIT, &DMAINIT); #endif @@ -386,6 +382,12 @@ void pwmDshotMotorHardwareConfig(const timerHardware_t *timerHardware, uint8_t m LL_TIM_EnableARRPreload(timer); LL_TIM_EnableCounter(timer); } +#ifdef USE_DSHOT_TELEMETRY + if (useDshotTelemetry) { + // avoid high line during startup to prevent bootloader activation + *timerChCCR(timerHardware) = 0xffff; + } +#endif motor->configured = true; } #endif