void activateConfig(void) { static imuRuntimeConfig_t imuRuntimeConfig; activateControlRateConfig(); resetAdjustmentStates(); useRcControlsConfig( currentProfile->modeActivationConditions, &masterConfig.escAndServoConfig, ¤tProfile->pidProfile ); useGyroConfig(&masterConfig.gyroConfig, currentProfile->pidProfile.gyro_soft_lpf_hz); #ifdef TELEMETRY telemetryUseConfig(&masterConfig.telemetryConfig); #endif useFailsafeConfig(&masterConfig.failsafeConfig); setAccelerationZero(&masterConfig.accZero); setAccelerationGain(&masterConfig.accGain); setAccelerationFilter(currentProfile->pidProfile.acc_soft_lpf_hz); mixerUseConfigs( #ifdef USE_SERVOS currentProfile->servoConf, ¤tProfile->gimbalConfig, #endif &masterConfig.flight3DConfig, &masterConfig.escAndServoConfig, &masterConfig.mixerConfig, &masterConfig.rxConfig ); imuRuntimeConfig.dcm_kp_acc = masterConfig.dcm_kp_acc / 10000.0f; imuRuntimeConfig.dcm_ki_acc = masterConfig.dcm_ki_acc / 10000.0f; imuRuntimeConfig.dcm_kp_mag = masterConfig.dcm_kp_mag / 10000.0f; imuRuntimeConfig.dcm_ki_mag = masterConfig.dcm_ki_mag / 10000.0f; imuRuntimeConfig.small_angle = masterConfig.small_angle; imuConfigure(&imuRuntimeConfig, ¤tProfile->pidProfile); pidInit(); #ifdef NAV navigationUseConfig(&masterConfig.navConfig); navigationUsePIDs(¤tProfile->pidProfile); navigationUseRcControlsConfig(¤tProfile->rcControlsConfig); navigationUseRxConfig(&masterConfig.rxConfig); navigationUseFlight3DConfig(&masterConfig.flight3DConfig); navigationUseEscAndServoConfig(&masterConfig.escAndServoConfig); #endif #ifdef BARO useBarometerConfig(&masterConfig.barometerConfig); #endif }
static void activateConfig(void) { activateControlRateConfig(); resetAdjustmentStates(); useRcControlsConfig(modeActivationProfile()->modeActivationConditions); pidInitFilters(pidProfile()); #ifdef GPS gpsUsePIDs(pidProfile()); #endif useFailsafeConfig(); setAccelerationTrims(&sensorTrims()->accZero); accelerationFilterInit(accelerometerConfig()->acc_cut_hz); #ifdef USE_SERVOS mixerUseConfigs(servoProfile()->servoConf); #endif #ifdef GPS recalculateMagneticDeclination(); #endif #ifdef VTX initVTXState(); #endif static imuRuntimeConfig_t imuRuntimeConfig; imuRuntimeConfig.dcm_kp = imuConfig()->dcm_kp / 10000.0f; imuRuntimeConfig.dcm_ki = imuConfig()->dcm_ki / 10000.0f; imuRuntimeConfig.acc_cut_hz = accelerometerConfig()->acc_cut_hz; imuRuntimeConfig.acc_unarmedcal = accelerometerConfig()->acc_unarmedcal; imuRuntimeConfig.small_angle = imuConfig()->small_angle; imuConfigure( &imuRuntimeConfig, &accelerometerConfig()->accDeadband, accelerometerConfig()->accz_lpf_cutoff, throttleCorrectionConfig()->throttle_correction_angle ); }
void activateConfig(void) { #ifndef USE_OSD_SLAVE initRcProcessing(); resetAdjustmentStates(); pidInit(currentPidProfile); useRcControlsConfig(currentPidProfile); useAdjustmentConfig(currentPidProfile); #ifdef USE_NAV gpsUsePIDs(currentPidProfile); #endif failsafeReset(); setAccelerationTrims(&accelerometerConfigMutable()->accZero); accInitFilters(); imuConfigure(throttleCorrectionConfig()->throttle_correction_angle); #endif // USE_OSD_SLAVE }
void activateConfig(void) { static imuRuntimeConfig_t imuRuntimeConfig; activateControlRateConfig(); resetAdjustmentStates(); useRcControlsConfig( masterConfig.modeActivationConditions, &masterConfig.motorConfig, ¤tProfile->pidProfile ); // Prevent invalid notch cutoff if (masterConfig.gyro_soft_notch_cutoff_1 >= masterConfig.gyro_soft_notch_hz_1) masterConfig.gyro_soft_notch_hz_1 = 0; if (masterConfig.gyro_soft_notch_cutoff_2 >= masterConfig.gyro_soft_notch_hz_2) masterConfig.gyro_soft_notch_hz_2 = 0; gyroUseConfig(&masterConfig.gyroConfig, masterConfig.gyro_soft_lpf_hz, masterConfig.gyro_soft_notch_hz_1, masterConfig.gyro_soft_notch_cutoff_1, masterConfig.gyro_soft_notch_hz_2, masterConfig.gyro_soft_notch_cutoff_2, masterConfig.gyro_soft_type); #ifdef TELEMETRY telemetryUseConfig(&masterConfig.telemetryConfig); #endif #ifdef GPS gpsUseProfile(&masterConfig.gpsProfile); gpsUsePIDs(¤tProfile->pidProfile); #endif useFailsafeConfig(&masterConfig.failsafeConfig); setAccelerationTrims(&masterConfig.accZero); setAccelerationFilter(masterConfig.acc_lpf_hz); mixerUseConfigs( &masterConfig.flight3DConfig, &masterConfig.motorConfig, &masterConfig.mixerConfig, &masterConfig.airplaneConfig, &masterConfig.rxConfig ); #ifdef USE_SERVOS servoUseConfigs(&masterConfig.servoMixerConfig, masterConfig.servoConf, &masterConfig.gimbalConfig); #endif imuRuntimeConfig.dcm_kp = masterConfig.dcm_kp / 10000.0f; imuRuntimeConfig.dcm_ki = masterConfig.dcm_ki / 10000.0f; imuRuntimeConfig.acc_unarmedcal = masterConfig.acc_unarmedcal; imuRuntimeConfig.small_angle = masterConfig.small_angle; imuConfigure( &imuRuntimeConfig, ¤tProfile->pidProfile, &masterConfig.accDeadband, masterConfig.throttle_correction_angle ); configureAltitudeHold( ¤tProfile->pidProfile, &masterConfig.barometerConfig, &masterConfig.rcControlsConfig, &masterConfig.motorConfig ); #ifdef BARO useBarometerConfig(&masterConfig.barometerConfig); #endif }
void activateConfig(void) { static imuRuntimeConfig_t imuRuntimeConfig; activateControlRateConfig(); useRcControlsConfig( currentProfile->modeActivationConditions, &masterConfig.escAndServoConfig, ¤tProfile->pidProfile ); useGyroConfig(&masterConfig.gyroConfig); #ifdef TELEMETRY useTelemetryConfig(&masterConfig.telemetryConfig); #endif setPIDController(currentProfile->pidProfile.pidController); #ifdef GPS gpsUseProfile(¤tProfile->gpsProfile); gpsUsePIDs(¤tProfile->pidProfile); #endif useFailsafeConfig(¤tProfile->failsafeConfig); setAccelerationTrims(&masterConfig.accZero); mixerUseConfigs( currentProfile->servoConf, &masterConfig.flight3DConfig, &masterConfig.escAndServoConfig, ¤tProfile->mixerConfig, &masterConfig.airplaneConfig, &masterConfig.rxConfig, ¤tProfile->gimbalConfig ); imuRuntimeConfig.gyro_cmpf_factor = masterConfig.gyro_cmpf_factor; imuRuntimeConfig.gyro_cmpfm_factor = masterConfig.gyro_cmpfm_factor; imuRuntimeConfig.acc_lpf_factor = currentProfile->acc_lpf_factor; imuRuntimeConfig.acc_unarmedcal = currentProfile->acc_unarmedcal;; imuRuntimeConfig.small_angle = masterConfig.small_angle; imuConfigure( &imuRuntimeConfig, ¤tProfile->pidProfile, ¤tProfile->accDeadband, currentProfile->accz_lpf_cutoff, currentProfile->throttle_correction_angle ); configureAltitudeHold( ¤tProfile->pidProfile, ¤tProfile->barometerConfig, ¤tProfile->rcControlsConfig, &masterConfig.escAndServoConfig ); #ifdef BARO useBarometerConfig(¤tProfile->barometerConfig); #endif }
void activateConfig(void) { static imuRuntimeConfig_t imuRuntimeConfig; activateControlRateConfig(); resetAdjustmentStates(); useRcControlsConfig( currentProfile->modeActivationConditions, &masterConfig.escAndServoConfig, ¤tProfile->pidProfile ); useGyroConfig(&masterConfig.gyroConfig, masterConfig.soft_gyro_lpf_hz); #ifdef TELEMETRY telemetryUseConfig(&masterConfig.telemetryConfig); #endif pidSetController(currentProfile->pidProfile.pidController); #ifdef GPS gpsUseProfile(¤tProfile->gpsProfile); gpsUsePIDs(¤tProfile->pidProfile); #endif useFailsafeConfig(&masterConfig.failsafeConfig); setAccelerationTrims(&masterConfig.accZero); mixerUseConfigs( #ifdef USE_SERVOS currentProfile->servoConf, ¤tProfile->gimbalConfig, #endif &masterConfig.flight3DConfig, &masterConfig.escAndServoConfig, &masterConfig.mixerConfig, &masterConfig.airplaneConfig, &masterConfig.rxConfig ); imuRuntimeConfig.dcm_kp = masterConfig.dcm_kp / 10000.0f; imuRuntimeConfig.dcm_ki = masterConfig.dcm_ki / 10000.0f; imuRuntimeConfig.acc_cut_hz = currentProfile->acc_cut_hz; imuRuntimeConfig.acc_unarmedcal = currentProfile->acc_unarmedcal; imuRuntimeConfig.small_angle = masterConfig.small_angle; imuConfigure( &imuRuntimeConfig, ¤tProfile->pidProfile, ¤tProfile->accDeadband, currentProfile->accz_lpf_cutoff, currentProfile->throttle_correction_angle ); #if defined(BARO) || defined(SONAR) configureAltitudeHold( ¤tProfile->pidProfile, ¤tProfile->barometerConfig, ¤tProfile->rcControlsConfig, &masterConfig.escAndServoConfig ); #endif #ifdef BARO useBarometerConfig(¤tProfile->barometerConfig); #endif }