NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
config.h
Go to the documentation of this file.
1 /*
2  * This file is part of Ninjaflight.
3  *
4  * Ninjaflight is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * Ninjaflight is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with Ninjaflight. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #pragma once
19 
25 #include <stdint.h>
26 #include <stdbool.h>
27 
28 
29 #include "accelerometer.h"
30 #include "altitudehold.h"
31 #include "anglerate.h"
32 #include "blackbox.h"
33 #include "battery.h"
34 #include "compass.h"
35 #include "failsafe.h"
36 #include "gps.h"
37 #include "imu.h"
38 #include "mixer.h"
39 #include "navigation.h"
40 #include "rate_profile.h"
41 #include "sensors.h"
42 #include "tilt.h"
43 #include "gimbal.h"
44 #include "rx.h"
45 #include "rc_controls.h"
46 #include "rc_adjustments.h"
47 #include "transponder.h"
48 #include "boardalignment.h"
49 #include "ledstrip.h"
50 #include "frsky.h"
51 #include "hott.h"
52 #include "barometer.h"
53 #include "gyro.h"
54 #include "pwm_rx.h"
55 #include "gtune.h"
56 #include "telemetry.h"
57 #include "serial.h"
58 #include "profile.h"
59 #include "system.h"
60 #include "feature.h"
61 
62 #define MAX_PROFILE_COUNT 1
63 #define ONESHOT_FEATURE_CHANGED_DELAY_ON_BOOT_MS 1500
64 
66  struct pid_config pid;
68  struct mag_config mag;
74  struct gps_profile gps;
79 } __attribute__((packed)) ;
80 
81 struct config {
83  struct gyro_config gyro;
94  struct gps_config gps;
95  struct imu_config imu;
103  struct rx_config rx;
110 } __attribute__((packed,aligned(2))) ;
111 
113 struct config_store {
114  struct config data;
115  uint16_t crc;
116 } __attribute__((aligned(4)));
120 struct config_profile const * config_get_profile(const struct config * const self);
121 struct config_profile *config_get_profile_rw(struct config *self);
122 struct rate_profile const * config_get_rate_profile(const struct config * const self);
123 struct rate_profile *config_get_rate_profile_rw(struct config *self);
124 
125 int config_save(const struct config *self, const struct system_calls *system);
126 int config_load(struct config *self, const struct system_calls *system);
127 void config_reset(struct config *self);
128 bool config_fixup(struct config *config);
129 
3d mode mixer settings (used when mixer_enable_3d_mode is called with true)
Definition: mixer.h:58
Definition: rx.h:79
struct accelerometer_config acc
Definition: config.h:67
int config_save(const struct config *self, const struct system_calls *system)
Definition: config.c:722
Definition: frsky.h:39
Definition: altitudehold.h:34
Definition: config.h:81
Definition: gimbal.h:30
Definition: imu.h:36
Definition: hott.h:24
Definition: gps.h:69
struct airplane_althold_config airplane_althold
Definition: config.h:85
struct servo_profile servos
Definition: config.h:73
bool config_fixup(struct config *config)
Definition: config.c:780
Definition: mixer.h:89
Definition: ledstrip.h:126
struct feature_config feature
Definition: config.h:91
Definition: telemetry.h:24
struct rate_profile const * config_get_rate_profile(const struct config *const self)
Definition: config.c:634
int config_load(struct config *self, const struct system_calls *system)
Definition: config.c:799
struct motor_3d_config motor_3d
Definition: config.h:98
Definition: navigation.h:26
Definition: failsafe.h:46
struct board_alignment_config alignment
Definition: config.h:88
struct config_profile * config_get_profile_rw(struct config *self)
Definition: config.c:630
struct rate_config rate
Definition: config.h:101
Definition: rate_profile.h:41
Definition: imu.h:49
Definition: gtune.h:26
struct arming_config arm
Definition: config.h:102
Definition: rc_controls.h:86
struct telemetry_config telemetry
Definition: config.h:107
struct rate_profile * config_get_rate_profile_rw(struct config *self)
Definition: config.c:638
Definition: anglerate.h:66
struct pwm_output_config pwm_out
Definition: config.h:99
Definition: rc_adjustments.h:116
struct system_config system
Definition: config.h:99
Definition: rc_adjustments.h:41
Definition: system.h:20
Definition: compass.h:24
Definition: mixer.h:64
Definition: profile.h:20
Definition: rx.h:97
struct config __attribute__((packed, aligned(2)))
struct rate_profile_selection rate
Definition: config.h:75
struct gimbal_config gimbal
Definition: config.h:70
Definition: barometer.h:24
Definition: rc.h:91
Definition: serial.h:80
struct config data
Definition: config.h:114
Definition: pwm_rx.h:29
struct serial_config serial
Definition: config.h:106
#define MAX_PROFILE_COUNT
Definition: config.h:62
Definition: feature.h:46
Definition: battery.h:37
struct pid_config pid
Definition: config.h:66
Definition: config.h:65
struct frsky_telemetry_config frsky
Definition: config.h:92
Definition: blackbox.h:90
const struct config_profile const * config_get_profile(const struct config *const self)
Definition: config.c:626
struct profile_config profile
Definition: config.h:82
Definition: rate_profile.h:26
Definition: rc_controls.h:78
struct gyro_config gyro
Definition: config.h:83
Definition: gyro.h:24
struct gtune_config gtune
Definition: config.h:71
Definition: accelerometer.h:48
uint16_t crc
Definition: config.h:115
struct throttle_correction_config throttle
Definition: config.h:72
Definition: gps.h:48
Definition: system_calls.h:200
general mixer settings
Definition: mixer.h:207
struct rx_output_config rx_output
Definition: config.h:104
struct config_profile profiles[MAX_PROFILE_COUNT]
Definition: config.h:84
Definition: tilt.h:34
Failsafe system configuration.
Definition: failsafe.h:30
struct tilt_config tilt
Definition: config.h:108
struct transponder_config transponder
Definition: config.h:109
void config_reset(struct config *self)
Definition: config.c:585
struct pwm_input_config pwm_in
Definition: config.h:100
Definition: rx.h:84
structure used for storing config in the eeprom
Definition: config.h:113
struct battery_config bat
Definition: config.h:86
Definition: sensors.h:74
Definition: rate_profile.h:37
struct rc_function_profile rc_funcs
Definition: config.h:77
Definition: imu.h:24
Definition: barometer.h:33
Definition: hott.h:489
struct mag_config mag
Definition: config.h:68
Definition: blackbox.h:38
struct system_config system
Definition: config.h:89
Definition: mixer.h:55
struct sensor_config sensors
Definition: config.h:105
Definition: ledstrip.h:30
Definition: transponder.h:24
Definition: boardalignment.h:24
Definition: rc_controls.h:74