Merge pull request #11195 from mathiasvr/pr-elrs-clean
[betaflight.git] / src / main / target / YUPIF4 / config.c
blobdea7c28997a24b9e7fd264e9483e76c611c16624
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
27 #include "blackbox/blackbox.h"
29 #include "flight/pid.h"
31 #include "pg/adc.h"
32 #include "pg/beeper_dev.h"
34 #include "telemetry/telemetry.h"
36 #include "hardware_revision.h"
38 // BEEPER_OPT will be handled by post-flash configuration
39 #define BEEPER_OPT PB14
41 // alternative defaults settings for YuPiF4 targets
42 void targetConfiguration(void)
44 /* Changes depending on versions */
45 if (hardwareRevision == YUPIF4_RACE3) {
46 beeperDevConfigMutable()->ioTag = IO_TAG(BEEPER_OPT);
47 telemetryConfigMutable()->halfDuplex = false;
49 } else if (hardwareRevision == YUPIF4_RACE2) {
50 beeperDevConfigMutable()->ioTag = IO_TAG(BEEPER_OPT);
52 } else if (hardwareRevision == YUPIF4_MINI) {
53 beeperDevConfigMutable()->frequency = 0;
54 blackboxConfigMutable()->device = BLACKBOX_DEVICE_NONE;
55 adcConfigMutable()->current.enabled = 0;
57 } else if (hardwareRevision == YUPIF4_NAV) {
58 beeperDevConfigMutable()->ioTag = IO_TAG(BEEPER_OPT);
60 } else {
61 adcConfigMutable()->current.enabled = 0;
64 /* Specific PID values for YupiF4 */
65 for (uint8_t pidProfileIndex = 0; pidProfileIndex < PID_PROFILE_COUNT; pidProfileIndex++) {
66 pidProfile_t *pidProfile = pidProfilesMutable(pidProfileIndex);
68 pidProfile->pid[PID_ROLL].P = 30;
69 pidProfile->pid[PID_ROLL].I = 45;
70 pidProfile->pid[PID_ROLL].D = 20;
71 pidProfile->pid[PID_PITCH].P = 30;
72 pidProfile->pid[PID_PITCH].I = 50;
73 pidProfile->pid[PID_PITCH].D = 20;
74 pidProfile->pid[PID_YAW].P = 40;
75 pidProfile->pid[PID_YAW].I = 50;
78 #endif