Exemplo n.º 1
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);
    }
}
Exemplo n.º 2
0
// alternative defaults settings for AlienFlight targets
void targetConfiguration(void)
{
    /* depending on revision ... depends on the LEDs to be utilised. */
    if (hardwareRevision == AFF3_REV_2) {
        statusLedConfigMutable()->inversion = 0
#ifdef LED0_A_INVERTED
            | BIT(0)
#endif
#ifdef LED1_A_INVERTED
            | BIT(1)
#endif
#ifdef LED2_A_INVERTED
            | BIT(2)
#endif
            ;

        for (int i = 0; i < STATUS_LED_NUMBER; i++) {
            statusLedConfigMutable()->ioTags[i] = IO_TAG_NONE;
        }
#ifdef LED0_A
        statusLedConfigMutable()->ioTags[0] = IO_TAG(LED0_A);
#endif
#ifdef LED1_A
        statusLedConfigMutable()->ioTags[1] = IO_TAG(LED1_A);
#endif
#ifdef LED2_A
        statusLedConfigMutable()->ioTags[2] = IO_TAG(LED2_A);
#endif
    } else {
        gyroConfigMutable()->gyro_sync_denom = 2;
        pidConfigMutable()->pid_process_denom = 2;
    }

    if (!haveFrSkyRX) {
        rxConfigMutable()->serialrx_provider = SERIALRX_SPEKTRUM2048;
        rxConfigMutable()->spektrum_sat_bind = 5;
        rxConfigMutable()->spektrum_sat_bind_autoreset = 1;
        parseRcChannels("TAER1234", rxConfigMutable());
    } else {
        rxConfigMutable()->serialrx_provider = SERIALRX_SBUS;
        rxConfigMutable()->serialrx_inverted = true;
        serialConfigMutable()->portConfigs[findSerialPortIndexByIdentifier(SERIALRX_UART)].functionMask = FUNCTION_TELEMETRY_FRSKY_HUB | FUNCTION_RX_SERIAL;
        telemetryConfigMutable()->telemetry_inverted = false;
        featureSet(FEATURE_TELEMETRY);
        beeperDevConfigMutable()->isOpenDrain = false;
        beeperDevConfigMutable()->isInverted = true;
        parseRcChannels("AETR1234", rxConfigMutable());
    }

    if (hardwareMotorType == MOTOR_BRUSHED) {
        motorConfigMutable()->dev.motorPwmRate = BRUSHED_MOTORS_PWM_RATE;
        pidConfigMutable()->pid_process_denom = 1;
    }

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

        pidProfile->pid[PID_ROLL].P = 90;
        pidProfile->pid[PID_ROLL].I = 44;
        pidProfile->pid[PID_ROLL].D = 60;
        pidProfile->pid[PID_PITCH].P = 90;
        pidProfile->pid[PID_PITCH].I = 44;
        pidProfile->pid[PID_PITCH].D = 60;
    }

    *customMotorMixerMutable(0) = (motorMixer_t){ 1.0f, -0.414178f,  1.0f, -1.0f };    // REAR_R
    *customMotorMixerMutable(1) = (motorMixer_t){ 1.0f, -0.414178f, -1.0f,  1.0f };    // FRONT_R
    *customMotorMixerMutable(2) = (motorMixer_t){ 1.0f,  0.414178f,  1.0f,  1.0f };    // REAR_L
    *customMotorMixerMutable(3) = (motorMixer_t){ 1.0f,  0.414178f, -1.0f, -1.0f };    // FRONT_L
    *customMotorMixerMutable(4) = (motorMixer_t){ 1.0f, -1.0f, -0.414178f, -1.0f };    // MIDFRONT_R
    *customMotorMixerMutable(5) = (motorMixer_t){ 1.0f,  1.0f, -0.414178f,  1.0f };    // MIDFRONT_L
    *customMotorMixerMutable(6) = (motorMixer_t){ 1.0f, -1.0f,  0.414178f,  1.0f };    // MIDREAR_R
    *customMotorMixerMutable(7) = (motorMixer_t){ 1.0f,  1.0f,  0.414178f, -1.0f };    // MIDREAR_L
}
Exemplo n.º 3
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_lpf = GYRO_LPF_188HZ;
    gyroConfigMutable()->gyro_soft_lpf_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 (int profileId = 0; profileId < 2; profileId++) {
        pidProfilesMutable(0)->P8[ROLL] = 60;
        pidProfilesMutable(0)->I8[ROLL] = 70;
        pidProfilesMutable(0)->D8[ROLL] = 17;
        pidProfilesMutable(0)->P8[PITCH] = 80;
        pidProfilesMutable(0)->I8[PITCH] = 90;
        pidProfilesMutable(0)->D8[PITCH] = 18;
        pidProfilesMutable(0)->P8[YAW] = 200;
        pidProfilesMutable(0)->I8[YAW] = 45;
        pidProfilesMutable(0)->P8[PIDLEVEL] = 30;
        pidProfilesMutable(0)->D8[PIDLEVEL] = 30;

        for (int rateProfileId = 0; rateProfileId < CONTROL_RATE_PROFILE_COUNT; rateProfileId++) {
            controlRateProfilesMutable(rateProfileId)->rcRate8 = 100;
            controlRateProfilesMutable(rateProfileId)->rcYawRate8 = 110;
            controlRateProfilesMutable(rateProfileId)->rcExpo8 = 0;
            controlRateProfilesMutable(rateProfileId)->rates[FD_ROLL] = 77;
            controlRateProfilesMutable(rateProfileId)->rates[FD_PITCH] = 77;
            controlRateProfilesMutable(rateProfileId)->rates[FD_YAW] = 80;

            pidProfilesMutable(0)->dtermSetpointWeight = 200;
            pidProfilesMutable(0)->setpointRelaxRatio = 50;
        }
    }
#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
}
Exemplo n.º 4
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
}