Create release.yml
[betaflight.git] / src / main / target / ALIENFLIGHTF1 / config.c
blobbabc00da6904192ff838757651e7ffe00fb65e2c
1 /*
2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
8 * any later version.
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
21 #include <stdbool.h>
22 #include <stdint.h>
24 #include "platform.h"
26 #ifdef USE_TARGET_CONFIG
28 #include "common/axis.h"
30 #include "drivers/pwm_esc_detect.h"
32 #include "config/config.h"
34 #include "flight/pid.h"
36 #include "pg/rx.h"
37 #include "pg/motor.h"
39 #include "rx/rx.h"
41 #ifdef BRUSHED_MOTORS_PWM_RATE
42 #undef BRUSHED_MOTORS_PWM_RATE
43 #endif
45 #define BRUSHED_MOTORS_PWM_RATE 32000 // 32kHz
47 // alternative defaults settings for AlienFlight targets
48 void targetConfiguration(void)
50 rxConfigMutable()->spektrum_sat_bind = 5;
51 rxConfigMutable()->spektrum_sat_bind_autoreset = 1;
53 if (getDetectedMotorType() == MOTOR_BRUSHED) {
54 motorConfigMutable()->dev.motorPwmRate = BRUSHED_MOTORS_PWM_RATE;
57 for (uint8_t pidProfileIndex = 0; pidProfileIndex < PID_PROFILE_COUNT; pidProfileIndex++) {
58 pidProfile_t *pidProfile = pidProfilesMutable(pidProfileIndex);
60 pidProfile->pid[PID_ROLL].P = 90;
61 pidProfile->pid[PID_ROLL].I = 44;
62 pidProfile->pid[PID_ROLL].D = 60;
63 pidProfile->pid[PID_PITCH].P = 90;
64 pidProfile->pid[PID_PITCH].I = 44;
65 pidProfile->pid[PID_PITCH].D = 60;
68 *customMotorMixerMutable(0) = (motorMixer_t){ 1.0f, -0.414178f, 1.0f, -1.0f }; // REAR_R
69 *customMotorMixerMutable(1) = (motorMixer_t){ 1.0f, -0.414178f, -1.0f, 1.0f }; // FRONT_R
70 *customMotorMixerMutable(2) = (motorMixer_t){ 1.0f, 0.414178f, 1.0f, 1.0f }; // REAR_L
71 *customMotorMixerMutable(3) = (motorMixer_t){ 1.0f, 0.414178f, -1.0f, -1.0f }; // FRONT_L
72 *customMotorMixerMutable(4) = (motorMixer_t){ 1.0f, -1.0f, -0.414178f, -1.0f }; // MIDFRONT_R
73 *customMotorMixerMutable(5) = (motorMixer_t){ 1.0f, 1.0f, -0.414178f, 1.0f }; // MIDFRONT_L
74 *customMotorMixerMutable(6) = (motorMixer_t){ 1.0f, -1.0f, 0.414178f, 1.0f }; // MIDREAR_R
75 *customMotorMixerMutable(7) = (motorMixer_t){ 1.0f, 1.0f, 0.414178f, -1.0f }; // MIDREAR_L
77 #endif