1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 00:05:33 +03:00
This commit is contained in:
jflyper 2016-11-03 12:11:12 +09:00
commit ccdf1424c5
100 changed files with 3789 additions and 893 deletions

View file

@ -244,6 +244,14 @@ void resetServoConfig(servoConfig_t *servoConfig)
{
servoConfig->servoCenterPulse = 1500;
servoConfig->servoPwmRate = 50;
int servoIndex = 0;
for (int i = 0; i < USABLE_TIMER_CHANNEL_COUNT && servoIndex < MAX_SUPPORTED_SERVOS; i++) {
if (timerHardware[i].usageFlags & TIM_USE_SERVO) {
servoConfig->ioTags[servoIndex] = timerHardware[i].tag;
servoIndex++;
}
}
}
#endif
@ -263,9 +271,9 @@ void resetMotorConfig(motorConfig_t *motorConfig)
motorConfig->mincommand = 1000;
motorConfig->digitalIdleOffset = 40;
uint8_t motorIndex = 0;
for (int i = 0; i < USABLE_TIMER_CHANNEL_COUNT && i < MAX_SUPPORTED_MOTORS; i++) {
if ((timerHardware[i].output & TIMER_OUTPUT_ENABLED) == TIMER_OUTPUT_ENABLED) {
int motorIndex = 0;
for (int i = 0; i < USABLE_TIMER_CHANNEL_COUNT && motorIndex < MAX_SUPPORTED_MOTORS; i++) {
if (timerHardware[i].usageFlags & TIM_USE_MOTOR) {
motorConfig->ioTags[motorIndex] = timerHardware[i].tag;
motorIndex++;
}
@ -305,7 +313,7 @@ void resetPpmConfig(ppmConfig_t *ppmConfig)
ppmConfig->ioTag = IO_TAG(PPM_PIN);
#else
for (int i = 0; i < USABLE_TIMER_CHANNEL_COUNT; i++) {
if ((timerHardware[i].output == TIMER_INPUT_ENABLED)) {
if (timerHardware[i].usageFlags & TIM_USE_PPM) {
ppmConfig->ioTag = timerHardware[i].tag;
return;
}
@ -317,9 +325,9 @@ void resetPpmConfig(ppmConfig_t *ppmConfig)
void resetPwmConfig(pwmConfig_t *pwmConfig)
{
uint8_t inputIndex = 0;
int inputIndex = 0;
for (int i = 0; i < USABLE_TIMER_CHANNEL_COUNT && inputIndex < PWM_INPUT_PORT_COUNT; i++) {
if ((timerHardware[i].output == TIMER_INPUT_ENABLED)) {
if (timerHardware[i].usageFlags & TIM_USE_PWM) {
pwmConfig->ioTags[inputIndex] = timerHardware[i].tag;
inputIndex++;
}
@ -896,8 +904,8 @@ void validateAndFixConfig(void)
#endif
#if defined(CC3D) && defined(DISPLAY) && defined(USE_UART3)
if (doesConfigurationUsePort(SERIAL_PORT_USART3) && feature(FEATURE_DISPLAY)) {
featureClear(FEATURE_DISPLAY);
if (doesConfigurationUsePort(SERIAL_PORT_USART3) && feature(FEATURE_DASHBOARD)) {
featureClear(FEATURE_DASHBOARD);
}
#endif