Example #1
0
void targetValidateConfiguration(void)
{
    /* make sure the SDCARD cannot be turned on */
    if (hardwareRevision == BJF4_MINI_REV3A || hardwareRevision == BJF4_REV1) {
        if (blackboxConfig()->device == BLACKBOX_DEVICE_SDCARD) {
            blackboxConfigMutable()->device = BLACKBOX_DEVICE_NONE;
        }
    }
}
Example #2
0
static long cmsx_Blackbox_FeatureWriteback(void)
{
    if (cmsx_FeatureBlackbox)
        featureSet(FEATURE_BLACKBOX);
    else
        featureClear(FEATURE_BLACKBOX);

    blackboxConfigMutable()->rate_denom = blackboxConfig_rate_denom;
    return 0;
}
Example #3
0
// alternative defaults settings for BlueJayF4 targets
void targetConfiguration(void)
{
    if (hardwareRevision == BJF4_REV1 || hardwareRevision == BJF4_REV2) {
        gyroDeviceConfigMutable(0)->align = CW180_DEG;
        beeperDevConfigMutable()->ioTag = IO_TAG(BEEPER_OPT);
    }

    if (hardwareRevision == BJF4_MINI_REV3A || hardwareRevision == BJF4_REV1) {
        blackboxConfigMutable()->device = BLACKBOX_DEVICE_NONE;
    }

    if (hardwareRevision == BJF4_MINI_REV3A) {
        adcConfigMutable()->vbat.ioTag = IO_TAG(PA4);
    }
}
Example #4
0
void targetConfiguration(void)
{
    if (getDetectedMotorType() == MOTOR_BRUSHED) {
        motorConfigMutable()->dev.motorPwmRate = BRUSHED_MOTORS_PWM_RATE;
        motorConfigMutable()->minthrottle = 1050; // for 6mm and 7mm brushed
    }

    /* Default to Spektrum */
    rxConfigMutable()->serialrx_provider = SERIALRX_SPEKTRUM2048; // all DSM* except DSM2 22ms
    rxConfigMutable()->spektrum_sat_bind = 5; // DSM2 11ms
    rxConfigMutable()->spektrum_sat_bind_autoreset = 1;
    rxConfigMutable()->mincheck = 1025;
    rxConfigMutable()->rcInterpolation = RC_SMOOTHING_MANUAL;
    rxConfigMutable()->rcInterpolationInterval = 14;
    parseRcChannels("TAER1234", rxConfigMutable());

    mixerConfigMutable()->yaw_motors_reversed = true;
    imuConfigMutable()->small_angle = 180;

    blackboxConfigMutable()->p_ratio = 128;

    /* Breadboard-specific settings for development purposes only
     */
#if defined(BREADBOARD)
    boardAlignmentMutable()->pitchDegrees = 90; // vertical breakout board
    barometerConfigMutable()->baro_hardware = BARO_DEFAULT; // still testing not on V1 or V2 pcb
#else
    barometerConfigMutable()->baro_hardware = BARO_NONE;
#endif

    compassConfigMutable()->mag_hardware =  MAG_NONE;

    systemConfigMutable()->cpu_overclock = 2; //216MHZ

    pidConfigMutable()->runaway_takeoff_prevention = false;

    featureEnable((FEATURE_DYNAMIC_FILTER | FEATURE_AIRMODE | FEATURE_ANTI_GRAVITY) ^ FEATURE_RX_PARALLEL_PWM);

    /* AlienWhoop PIDs tested with 6mm and 7mm motors on most frames */
    for (uint8_t pidProfileIndex = 0; pidProfileIndex < PID_PROFILE_COUNT; pidProfileIndex++) {
        pidProfile_t *pidProfile = pidProfilesMutable(pidProfileIndex);

	pidProfile->pidSumLimit = 1000;
	pidProfile->pidSumLimitYaw = 1000;

        /* AlienWhoop PIDs tested with 6mm and 7mm motors on most frames */
        pidProfile->pid[PID_PITCH].P = 115;
        pidProfile->pid[PID_PITCH].I = 75;
        pidProfile->pid[PID_PITCH].D = 95;
        pidProfile->pid[PID_ROLL].P = 110;
        pidProfile->pid[PID_ROLL].I = 75;
        pidProfile->pid[PID_ROLL].D = 85;
        pidProfile->pid[PID_YAW].P = 220;
        pidProfile->pid[PID_YAW].I = 75;
        pidProfile->pid[PID_YAW].D = 20;
        pidProfile->pid[PID_LEVEL].P = 65;
        pidProfile->pid[PID_LEVEL].I = 65;
        pidProfile->pid[PID_LEVEL].D = 55;

        /* Setpoints */
        pidProfile->dterm_filter_type = FILTER_BIQUAD;
        pidProfile->dterm_notch_hz = 0;
        pidProfile->pid[PID_PITCH].F = 100;
        pidProfile->pid[PID_ROLL].F = 100;
        pidProfile->feedForwardTransition = 0;

	/* Anti-Gravity */
	pidProfile->itermThrottleThreshold = 500;
	pidProfile->itermAcceleratorGain = 5000;

	pidProfile->levelAngleLimit = 65;
    }

    for (uint8_t rateProfileIndex = 0; rateProfileIndex < CONTROL_RATE_PROFILE_COUNT; rateProfileIndex++) {
        controlRateConfig_t *controlRateConfig = controlRateProfilesMutable(rateProfileIndex);

        /* RC Rates */
        controlRateConfig->rcRates[FD_ROLL] = 218;
        controlRateConfig->rcRates[FD_PITCH] = 218;
        controlRateConfig->rcRates[FD_YAW] = 218;

	/* Classic Expo */
        controlRateConfig->rcExpo[FD_ROLL] = 45;
        controlRateConfig->rcExpo[FD_PITCH] = 45;
        controlRateConfig->rcExpo[FD_YAW] = 45;

        /* Super Expo Rates */
        controlRateConfig->rates[FD_ROLL] = 0;
        controlRateConfig->rates[FD_PITCH] = 0;
        controlRateConfig->rates[FD_YAW] = 0;

        /* Throttle PID Attenuation (TPA) */
        controlRateConfig->dynThrPID = 0; // tpa_rate off
        controlRateConfig->tpa_breakpoint = 1600;

	/* Force the clipping mixer at 100% seems better for brushed than default (off) and scaling)? */
        controlRateConfig->throttle_limit_type = THROTTLE_LIMIT_TYPE_CLIP;
        //controlRateConfig->throttle_limit_percent = 100;

        controlRateConfig->thrExpo8 = 20; // 20% throttle expo
    }
}
Example #5
0
void targetConfiguration(void)
{
#ifdef BEEBRAIN
    // alternative defaults settings for Beebrain target
    motorConfigMutable()->dev.motorPwmRate = 4000;
    failsafeConfigMutable()->failsafe_delay = 2;
    failsafeConfigMutable()->failsafe_off_delay = 0;

    motorConfigMutable()->minthrottle = 1049;

    gyroConfigMutable()->gyro_hardware_lpf = GYRO_HARDWARE_LPF_1KHZ_SAMPLE;
    gyroConfigMutable()->gyro_lowpass_hz = 100;
    gyroConfigMutable()->gyro_soft_notch_hz_1 = 0;
    gyroConfigMutable()->gyro_soft_notch_hz_2 = 0;

    /*for (int channel = 0; channel < NON_AUX_CHANNEL_COUNT; channel++) {
        rxChannelRangeConfigsMutable(channel)->min = 1180;
        rxChannelRangeConfigsMutable(channel)->max = 1860;
    }*/

    for (uint8_t pidProfileIndex = 0; pidProfileIndex < MAX_PROFILE_COUNT; pidProfileIndex++) {
        pidProfile_t *pidProfile = pidProfilesMutable(pidProfileIndex);

        pidProfile->pid[PID_ROLL].P = 60;
        pidProfile->pid[PID_ROLL].I = 70;
        pidProfile->pid[PID_ROLL].D = 17;
        pidProfile->pid[PID_PITCH].P = 80;
        pidProfile->pid[PID_PITCH].I = 90;
        pidProfile->pid[PID_PITCH].D = 18;
        pidProfile->pid[PID_YAW].P = 200;
        pidProfile->pid[PID_YAW].I = 45;
        pidProfile->pid[PID_LEVEL].P = 30;
        pidProfile->pid[PID_LEVEL].D = 30;

        pidProfile->pid[PID_PITCH].F = 200;
        pidProfile->pid[PID_ROLL].F = 200;
        pidProfile->feedForwardTransition = 50;
    }

    for (uint8_t rateProfileIndex = 0; rateProfileIndex < CONTROL_RATE_PROFILE_COUNT; rateProfileIndex++) {
        controlRateConfig_t *controlRateConfig = controlRateProfilesMutable(rateProfileIndex);

        controlRateConfig->rcRates[FD_ROLL] = 100;
        controlRateConfig->rcRates[FD_PITCH] = 100;
        controlRateConfig->rcRates[FD_YAW] = 110;
        controlRateConfig->rcExpo[FD_ROLL] = 0;
        controlRateConfig->rcExpo[FD_PITCH] = 0;
        controlRateConfig->rates[FD_ROLL] = 77;
        controlRateConfig->rates[FD_PITCH] = 77;
        controlRateConfig->rates[FD_YAW] = 80;
    }
#endif

#if !defined(AFROMINI) && !defined(BEEBRAIN)
    if (hardwareRevision >= NAZE32_REV5) {
        // naze rev4 and below used opendrain to PNP for buzzer. Rev5 and above use PP to NPN.
        beeperDevConfigMutable()->isOpenDrain = false;
        beeperDevConfigMutable()->isInverted = true;
    } else {
        beeperDevConfigMutable()->isOpenDrain = true;
        beeperDevConfigMutable()->isInverted = false;
        flashConfigMutable()->csTag = IO_TAG_NONE;
    }
#endif

#ifdef MAG_INT_EXTI
    if (hardwareRevision < NAZE32_REV5) {
        compassConfigMutable()->interruptTag = IO_TAG(PB12);
    }
#endif

#ifdef BLACKBOX
    if (hardwareRevision >= NAZE32_REV5)
        blackboxConfigMutable()->device = BLACKBOX_DEVICE_FLASH;
#endif
}