Exemplo n.º 1
0
void activateConfig(void)
{
    static imuRuntimeConfig_t imuRuntimeConfig;

    generatePitchCurve(&currentProfile->controlRateConfig);
    generateThrottleCurve(&currentProfile->controlRateConfig, &masterConfig.escAndServoConfig);

    useGyroConfig(&masterConfig.gyroConfig);
#ifdef TELEMETRY
    useTelemetryConfig(&masterConfig.telemetryConfig);
#endif
    setPIDController(currentProfile->pidController);
#ifdef GPS
    gpsUseProfile(&currentProfile->gpsProfile);
    gpsUsePIDs(&currentProfile->pidProfile);
#endif
    useFailsafeConfig(&currentProfile->failsafeConfig);
    setAccelerationTrims(&masterConfig.accZero);
    mixerUseConfigs(
        currentProfile->servoConf,
        &masterConfig.flight3DConfig,
        &masterConfig.escAndServoConfig,
        &currentProfile->mixerConfig,
        &masterConfig.airplaneConfig,
        &masterConfig.rxConfig,
        &currentProfile->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;

    configureImu(&imuRuntimeConfig, &currentProfile->pidProfile, &currentProfile->barometerConfig, &currentProfile->accDeadband);

    calculateThrottleAngleScale(currentProfile->throttle_correction_angle);
    calculateAccZLowPassFilterRCTimeConstant(currentProfile->accz_lpf_cutoff);

#ifdef BARO
    useBarometerConfig(&currentProfile->barometerConfig);
#endif
}
Exemplo n.º 2
0
void activateConfig(void)
{
    static imuRuntimeConfig_t imuRuntimeConfig;

    generatePitchCurve(&currentProfile.controlRateConfig);
    generateThrottleCurve(&currentProfile.controlRateConfig, &masterConfig.escAndServoConfig);

    useGyroConfig(&masterConfig.gyroConfig);
    useTelemetryConfig(&masterConfig.telemetryConfig);
    setPIDController(currentProfile.pidController);
    gpsUseProfile(&currentProfile.gpsProfile);
    gpsUsePIDs(&currentProfile.pidProfile);
    useFailsafeConfig(&currentProfile.failsafeConfig);
    setAccelerationTrims(&masterConfig.accZero);
    mixerUseConfigs(
            currentProfile.servoConf,
            &masterConfig.flight3DConfig,
            &masterConfig.escAndServoConfig,
            &currentProfile.mixerConfig,
            &masterConfig.airplaneConfig,
            &masterConfig.rxConfig,
            &currentProfile.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;;


    configureImu(&imuRuntimeConfig, &currentProfile.pidProfile, &currentProfile.barometerConfig, &currentProfile.accDeadband);

    calculateThrottleAngleScale(currentProfile.throttle_correction_angle);

#ifdef BARO
    useBarometerConfig(&currentProfile.barometerConfig);
#endif