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

Fixed problems with bitbanged Dshot and lazily allocated timers.

This commit is contained in:
mikeller 2019-09-10 01:48:25 +12:00
parent 534dc31ab3
commit 2b98f137db
5 changed files with 20 additions and 0 deletions

View file

@ -311,6 +311,10 @@ static void bbFindPacerTimer(void)
for (unsigned timerIndex = 0; timerIndex < ARRAYLEN(bbTimerHardware); timerIndex++) {
timer = &bbTimerHardware[timerIndex];
int timNumber = timerGetTIMNumber(timer->tim);
if ((motorConfig()->dev.useDshotBitbangedTimer == DSHOT_BITBANGED_TIMER_TIM1 && timNumber != 1)
|| (motorConfig()->dev.useDshotBitbangedTimer == DSHOT_BITBANGED_TIMER_TIM8 && timNumber != 8)) {
continue;
}
bool timerConflict = false;
for (int channel = 0; channel < CC_CHANNELS_PER_TIMER; channel++) {
const resourceOwner_e timerOwner = timerGetOwner(timNumber, CC_CHANNEL_FROM_INDEX(channel))->owner;
@ -334,6 +338,7 @@ static void bbFindPacerTimer(void)
if (dmaGetOwner(dmaIdentifier)->owner == OWNER_FREE &&
!usedTimerChannels[timNumber][timer->channel]) {
usedTimerChannels[timNumber][timer->channel] = true;
break;
}
}