1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-13 19:40:31 +03:00

Fix the problem of multiple timer allocations with bitbanged Dshot.

This commit is contained in:
mikeller 2019-09-09 00:48:02 +12:00
parent f331cb3dd1
commit 4acf0893df
5 changed files with 30 additions and 24 deletions

View file

@ -5616,28 +5616,12 @@ static void showTimers(void)
cliRepeat('-', 23);
#endif
#ifdef USE_DSHOT_BITBANG
resourceOwner_t bitbangOwner = { OWNER_DSHOT_BITBANG, 0 };
#endif
int8_t timerNumber;
for (int i = 0; (timerNumber = timerGetNumberByIndex(i)); i++) {
cliPrintf("TIM%d:", timerNumber);
bool timerUsed = false;
for (unsigned timerIndex = 0; timerIndex < CC_CHANNELS_PER_TIMER; timerIndex++) {
const resourceOwner_t *timerOwner = timerGetOwner(timerNumber, CC_CHANNEL_FROM_INDEX(timerIndex));
#ifdef USE_DSHOT_BITBANG
if (!timerOwner->owner) {
const timerHardware_t* timer;
int pacerIndex = 0;
while ((timer = dshotBitbangGetPacerTimer(pacerIndex++))) {
if (timerGetTIMNumber(timer->tim) == timerNumber && timer->channel == CC_CHANNEL_FROM_INDEX(timerIndex)) {
timerOwner = &bitbangOwner;
bitbangOwner.resourceIndex++;
break;
}
}
}
#endif
if (timerOwner->owner) {
if (!timerUsed) {
timerUsed = true;