From 51ae8d99d2a771820cc33c755dc0bb99a3a333eb Mon Sep 17 00:00:00 2001 From: Thorsten Laux Date: Thu, 2 May 2019 15:26:00 +0200 Subject: [PATCH] Avoid high dshot lines with telemetry during startup --- src/main/drivers/pwm_output_dshot.c | 4 ++++ src/main/drivers/pwm_output_dshot_hal.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/main/drivers/pwm_output_dshot.c b/src/main/drivers/pwm_output_dshot.c index 6a23638a89..12f3928536 100644 --- a/src/main/drivers/pwm_output_dshot.c +++ b/src/main/drivers/pwm_output_dshot.c @@ -393,6 +393,10 @@ 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 diff --git a/src/main/drivers/pwm_output_dshot_hal.c b/src/main/drivers/pwm_output_dshot_hal.c index 6bb79edc60..d56ee9810b 100644 --- a/src/main/drivers/pwm_output_dshot_hal.c +++ b/src/main/drivers/pwm_output_dshot_hal.c @@ -354,6 +354,10 @@ 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