void validateAndFixConfig(void) { if (!(feature(FEATURE_RX_PARALLEL_PWM) || feature(FEATURE_RX_PPM) || feature(FEATURE_RX_SERIAL) || feature(FEATURE_RX_MSP))) { featureSet(FEATURE_RX_PARALLEL_PWM); // Consider changing the default to PPM } if (feature(FEATURE_RX_PPM)) { featureClear(FEATURE_RX_PARALLEL_PWM); } if (feature(FEATURE_RX_MSP)) { featureClear(FEATURE_RX_SERIAL); featureClear(FEATURE_RX_PARALLEL_PWM); featureClear(FEATURE_RX_PPM); } if (feature(FEATURE_RX_SERIAL)) { featureClear(FEATURE_RX_PARALLEL_PWM); featureClear(FEATURE_RX_PPM); } if (feature(FEATURE_RX_PARALLEL_PWM)) { #if defined(STM32F10X) // rssi adc needs the same ports featureClear(FEATURE_RSSI_ADC); // current meter needs the same ports featureClear(FEATURE_CURRENT_METER); #endif #if defined(STM32F10X) || defined(CHEBUZZ) || defined(STM32F3DISCOVERY) // led strip needs the same ports featureClear(FEATURE_LED_STRIP); #endif // software serial needs free PWM ports featureClear(FEATURE_SOFTSERIAL); } #if defined(LED_STRIP) && (defined(USE_SOFTSERIAL1) || defined(USE_SOFTSERIAL2)) if (feature(FEATURE_SOFTSERIAL) && ( #ifdef USE_SOFTSERIAL1 (LED_STRIP_TIMER == SOFTSERIAL_1_TIMER) #else 0 #endif || #ifdef USE_SOFTSERIAL2 (LED_STRIP_TIMER == SOFTSERIAL_2_TIMER) #else 0 #endif )) { // led strip needs the same timer as softserial featureClear(FEATURE_LED_STRIP); } #endif #if defined(NAZE) && defined(SONAR) if (feature(FEATURE_RX_PARALLEL_PWM) && feature(FEATURE_SONAR) && feature(FEATURE_CURRENT_METER)) { featureClear(FEATURE_CURRENT_METER); } #endif #if defined(OLIMEXINO) && defined(SONAR) if (feature(FEATURE_SONAR) && feature(FEATURE_CURRENT_METER)) { featureClear(FEATURE_CURRENT_METER); } #endif useRxConfig(&masterConfig.rxConfig); serialConfig_t *serialConfig = &masterConfig.serialConfig; applySerialConfigToPortFunctions(serialConfig); if (!isSerialConfigValid(serialConfig)) { resetSerialConfig(serialConfig); } }
void validateAndFixConfig(void) { if (!(feature(FEATURE_RX_PARALLEL_PWM) || feature(FEATURE_RX_PPM) || feature(FEATURE_RX_SERIAL) || feature(FEATURE_RX_MSP))) { featureSet(FEATURE_RX_PARALLEL_PWM); // Consider changing the default to PPM } if (feature(FEATURE_RX_PPM)) { featureClear(FEATURE_RX_PARALLEL_PWM); } if (feature(FEATURE_RX_MSP)) { featureClear(FEATURE_RX_SERIAL); featureClear(FEATURE_RX_PARALLEL_PWM); featureClear(FEATURE_RX_PPM); } if (feature(FEATURE_RX_SERIAL)) { featureClear(FEATURE_RX_PARALLEL_PWM); featureClear(FEATURE_RX_PPM); } if (feature(FEATURE_RX_PARALLEL_PWM)) { #if defined(STM32F103_MD) // rssi adc needs the same ports featureClear(FEATURE_RSSI_ADC); // current meter needs the same ports featureClear(FEATURE_CURRENT_METER); #ifdef SONAR // sonar needs a free PWM port featureClear(FEATURE_SONAR); #endif #endif #if defined(STM32F103_MD) || defined(CHEBUZZ) || defined(STM32F3DISCOVERY) // led strip needs the same ports featureClear(FEATURE_LED_STRIP); #endif // software serial needs free PWM ports featureClear(FEATURE_SOFTSERIAL); } #if defined(STM32F103_MD) // led strip needs the same timer as softserial if (feature(FEATURE_SOFTSERIAL)) { featureClear(FEATURE_LED_STRIP); } #endif useRxConfig(&masterConfig.rxConfig); serialConfig_t *serialConfig = &masterConfig.serialConfig; applySerialConfigToPortFunctions(serialConfig); if (!isSerialConfigValid(serialConfig)) { resetSerialConfig(serialConfig); }