mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 16:55:36 +03:00
Added blocked dshot commands, Added post command delay
Moved the dshotcommand to happen in pwm_output_dshot. Simplified the timing and repeats to happen on a group basis instead works better for dshotburst
This commit is contained in:
parent
f37a8184d5
commit
0045b36320
8 changed files with 131 additions and 42 deletions
|
@ -37,6 +37,7 @@
|
|||
#endif
|
||||
#include "pwm_output.h"
|
||||
#include "drivers/nvic.h"
|
||||
#include "drivers/time.h"
|
||||
#include "dma.h"
|
||||
#include "rcc.h"
|
||||
|
||||
|
@ -57,7 +58,7 @@ uint8_t getTimerIndex(TIM_TypeDef *timer)
|
|||
}
|
||||
}
|
||||
dmaMotorTimers[dmaMotorTimerCount++].timer = timer;
|
||||
return dmaMotorTimerCount-1;
|
||||
return dmaMotorTimerCount - 1;
|
||||
}
|
||||
|
||||
void pwmWriteDshotInt(uint8_t index, uint16_t value)
|
||||
|
@ -68,6 +69,12 @@ void pwmWriteDshotInt(uint8_t index, uint16_t value)
|
|||
return;
|
||||
}
|
||||
|
||||
/*If there is a command ready to go overwrite the value and send that instead*/
|
||||
if (pwmIsProcessingDshotCommand()) {
|
||||
value = pwmGetDshotCommand(index);
|
||||
motor->requestTelemetry = true;
|
||||
}
|
||||
|
||||
uint16_t packet = prepareDshotPacket(motor, value);
|
||||
uint8_t bufferSize;
|
||||
|
||||
|
@ -89,6 +96,11 @@ void pwmCompleteDshotMotorUpdate(uint8_t motorCount)
|
|||
{
|
||||
UNUSED(motorCount);
|
||||
|
||||
/* If there is a dshot command loaded up, time it correctly with motor update*/
|
||||
if (pwmProcessDshotCommand(motorCount)) {
|
||||
return; //Skip motor update
|
||||
}
|
||||
|
||||
for (int i = 0; i < dmaMotorTimerCount; i++) {
|
||||
#ifdef USE_DSHOT_DMAR
|
||||
if (useBurstDshot) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue