Made the timerioTagGetByUsage zero based, as it is not used by users.

This commit is contained in:
blckmn 2018-05-06 09:37:19 +10:00
parent aad6efdf03
commit 88ed243d32
4 changed files with 5 additions and 5 deletions

View File

@ -60,10 +60,10 @@ const timerHardware_t *timerGetByTag(ioTag_t ioTag)
ioTag_t timerioTagGetByUsage(timerUsageFlag_e usageFlag, uint8_t index)
{
uint8_t currentIndex = 1;
uint8_t currentIndex = 0;
for (int i = 0; i < (int)USABLE_TIMER_CHANNEL_COUNT; i++) {
if ((timerHardware[i].usageFlags & usageFlag) == usageFlag) {
if (currentIndex == index || index == 0) {
if (currentIndex == index) {
return timerHardware[i].tag;
}
currentIndex++;

View File

@ -105,7 +105,7 @@ void pgResetFn_motorConfig(motorConfig_t *motorConfig)
#endif
for (int motorIndex = 0; motorIndex < MAX_SUPPORTED_MOTORS; motorIndex++) {
motorConfig->dev.ioTags[motorIndex] = timerioTagGetByUsage(TIM_USE_MOTOR, motorIndex + 1);
motorConfig->dev.ioTags[motorIndex] = timerioTagGetByUsage(TIM_USE_MOTOR, motorIndex);
}
motorConfig->motorPoleCount = 14; // Most brushes motors that we use are 14 poles

View File

@ -67,7 +67,7 @@ void pgResetFn_servoConfig(servoConfig_t *servoConfig)
servoConfig->channelForwardingStartChannel = AUX1;
for (unsigned servoIndex = 0; servoIndex < MAX_SUPPORTED_SERVOS; servoIndex++) {
servoConfig->dev.ioTags[servoIndex] = timerioTagGetByUsage(TIM_USE_SERVO, servoIndex + 1);
servoConfig->dev.ioTags[servoIndex] = timerioTagGetByUsage(TIM_USE_SERVO, servoIndex);
}
}

View File

@ -39,7 +39,7 @@ void pgResetFn_pwmConfig(pwmConfig_t *pwmConfig)
{
pwmConfig->inputFilteringMode = INPUT_FILTERING_DISABLED;
for (unsigned inputIndex = 0; inputIndex < PWM_INPUT_PORT_COUNT; inputIndex++) {
pwmConfig->ioTags[inputIndex] = timerioTagGetByUsage(TIM_USE_PWM, inputIndex + 1);
pwmConfig->ioTags[inputIndex] = timerioTagGetByUsage(TIM_USE_PWM, inputIndex);
}
}
#endif