1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 16:55:36 +03:00

avoid dshot telemetry collisions

actually use calculated deadtime

fix whitespace and return value

fix ws

Address review feedback

fix ws
This commit is contained in:
Thorsten Laux 2019-03-19 13:02:44 +01:00 committed by mikeller
parent 8984a7195f
commit 5a759c56ef
7 changed files with 82 additions and 51 deletions

View file

@ -96,8 +96,9 @@ FAST_CODE void pwmDshotSetDirectionOutput(
DMA_DeInit(dmaRef);
#ifdef USE_DSHOT_TELEMETRY
motor->isInput = !output;
if (!output) {
motor->isInput = true;
motor->timer->inputDirectionStampUs = micros();
TIM_ICInit(timer, &motor->icInitStruct);
#if defined(STM32F3)
@ -111,6 +112,9 @@ FAST_CODE void pwmDshotSetDirectionOutput(
UNUSED(output);
#endif
{
#ifdef USE_DSHOT_TELEMETRY
motor->isInput = false;
#endif
timerOCPreloadConfig(timer, timerHardware->channel, TIM_OCPreload_Disable);
timerOCInit(timer, timerHardware->channel, pOcInit);
timerOCPreloadConfig(timer, timerHardware->channel, TIM_OCPreload_Enable);
@ -388,6 +392,9 @@ void pwmDshotMotorHardwareConfig(const timerHardware_t *timerHardware, uint8_t m
#ifdef USE_DSHOT_TELEMETRY
motor->dmaInputLen = motor->useProshot ? PROSHOT_TELEMETRY_INPUT_LEN : DSHOT_TELEMETRY_INPUT_LEN;
motor->dshotTelemetryDeadtimeUs = DSHOT_TELEMETRY_DEADTIME_US + 1000000 *
( 2 + (motor->useProshot ? 4 * MOTOR_NIBBLE_LENGTH_PROSHOT : 16 * MOTOR_BITLENGTH))
/ getDshotHz(pwmProtocolType);
pwmDshotSetDirectionOutput(motor, true);
#else
pwmDshotSetDirectionOutput(motor, true, &OCINIT, &DMAINIT);