1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 16:25:31 +03:00

Refactor pwmDshotSetDirectionOutput.

Refactoring steps were as follows:
* Duplicate pwmDshotSetDirectionOutput to pwmDshotSetDirectionInput and
remove `output` variable in preparation for removing the `output` variable from each method.
* Delete all trace of `output` flag from `pwmDshotSetDirectionInput`
* Delete all trace of `output` flag from `pwmDshotSetDirectionOutput`
* Cleanup now that pwmDshotSetDirectionInput is only called when USE_DSHOT_TELEMETRY is
enabled.
* Remove redundant code paths.
* Move #ifdef outside the method.
* Removed parameters that are never needed.
* Delete unneeded forward declarations.
This commit is contained in:
Dominic Clifton 2019-08-27 21:35:50 +02:00
parent 4f923e4827
commit a8262722d5
4 changed files with 93 additions and 83 deletions

View file

@ -219,17 +219,6 @@ uint16_t getDshotTelemetry(uint8_t index)
#endif
FAST_CODE void pwmDshotSetDirectionOutput(
motorDmaOutput_t * const motor, bool output
#ifndef USE_DSHOT_TELEMETRY
#ifdef USE_FULL_LL_DRIVER
, LL_TIM_OC_InitTypeDef* pOcInit, LL_DMA_InitTypeDef* pDmaInit
#else
, TIM_OCInitTypeDef *pOcInit, DMA_InitTypeDef* pDmaInit
#endif
#endif
);
#ifdef USE_DSHOT_TELEMETRY
#ifdef USE_DSHOT_TELEMETRY_STATS
void updateDshotTelemetryQuality(dshotTelemetryQuality_t *qualityStats, bool packetValid, timeMs_t currentTimeMs)
@ -307,7 +296,7 @@ FAST_CODE_NOINLINE bool pwmStartDshotMotorUpdate(void)
}
#endif
}
pwmDshotSetDirectionOutput(&dmaMotors[i], true);
pwmDshotSetDirectionOutput(&dmaMotors[i]);
}
inputStampUs = 0;
dshotEnableChannels(dshotPwmDevice.count);