Merge branch 'master' into change-to-sending-expresslrs_RFrates_e-in-sync-packet
[ExpressLRS.git] / src / lib / CONFIG / config_legacy.h
blobef3d823a4199162186cc37fd74e9cf148d74ead9
1 #pragma once
3 /***
4 * Outdated config structs used by the update process
5 ***/
7 #include <inttypes.h>
9 /***
10 * TX config
11 ***/
13 // V5
14 typedef struct {
15 uint8_t rate:3;
16 uint8_t tlm:3;
17 uint8_t power:3;
18 uint8_t switchMode:2;
19 uint8_t modelMatch:1;
20 uint8_t dynamicPower:1;
21 uint8_t boostChannel:3;
22 } v5_model_config_t; // 16 bits
24 typedef struct {
25 uint32_t version;
26 uint8_t vtxBand;
27 uint8_t vtxChannel;
28 uint8_t vtxPower;
29 uint8_t vtxPitmode;
30 uint8_t powerFanThreshold:4; // Power level to enable fan if present
31 v5_model_config_t model_config[64];
32 uint8_t fanMode;
33 uint8_t motionMode;
34 } v5_tx_config_t;
36 // V6
37 typedef v5_model_config_t v6_model_config_t;
39 typedef struct {
40 uint32_t version;
41 char ssid[33];
42 char password[33];
43 uint8_t vtxBand;
44 uint8_t vtxChannel;
45 uint8_t vtxPower;
46 uint8_t vtxPitmode;
47 uint8_t powerFanThreshold:4; // Power level to enable fan if present
48 v6_model_config_t model_config[64];
49 uint8_t fanMode;
50 uint8_t motionMode;
51 uint8_t dvrAux:5;
52 uint8_t dvrStartDelay:3;
53 uint8_t dvrStopDelay:3;
54 } v6_tx_config_t;
56 // V7
57 typedef struct {
58 uint32_t rate:4,
59 tlm:4,
60 power:3,
61 switchMode:2,
62 boostChannel:3,
63 dynamicPower:1,
64 modelMatch:1,
65 txAntenna:2,
66 ptrStartChannel:4,
67 ptrEnableChannel:5,
68 linkMode:3;
69 } v7_model_config_t;
71 typedef struct {
72 uint32_t version;
73 char ssid[33];
74 char password[33];
75 uint8_t vtxBand;
76 uint8_t vtxChannel;
77 uint8_t vtxPower;
78 uint8_t vtxPitmode;
79 uint8_t powerFanThreshold:4; // Power level to enable fan if present
80 v7_model_config_t model_config[64];
81 uint8_t fanMode;
82 uint8_t motionMode;
83 uint8_t dvrAux:5;
84 uint8_t dvrStartDelay:3;
85 uint8_t dvrStopDelay:3;
86 } v7_tx_config_t;
88 /***
89 * RX config
90 ***/
92 // V4
93 typedef union {
94 struct {
95 uint16_t failsafe:10; // us output during failsafe +988 (e.g. 512 here would be 1500us)
96 uint8_t inputChannel:4; // 0-based input channel
97 uint8_t inverted:1; // invert channel output
98 uint8_t unused:1;
99 } val;
100 uint16_t raw;
101 } v4_rx_config_pwm_t;
103 typedef struct {
104 uint32_t version;
105 bool isBound;
106 uint8_t uid[6];
107 uint8_t powerOnCounter;
108 uint8_t modelId;
109 char ssid[33];
110 char password[33];
111 v4_rx_config_pwm_t pwmChannels[8];
112 } v4_rx_config_t;
114 // V5
115 typedef union {
116 struct {
117 uint32_t failsafe:10, // us output during failsafe +988 (e.g. 512 here would be 1500us)
118 inputChannel:4, // 0-based input channel
119 inverted:1, // invert channel output
120 mode:4, // Output mode (eServoOutputMode)
121 narrow:1, // Narrow output mode (half pulse width)
122 unused:13; // FUTURE: When someone complains "everyone" uses inverted polarity PWM or something :/
123 } val;
124 uint32_t raw;
125 } v5_rx_config_pwm_t;
127 typedef struct {
128 uint32_t version;
129 uint8_t uid[6]; // Hardcoding in case UID_LEN changes.
130 uint8_t loanUID[6]; // Hardcoding in case UID_LEN changes.
131 uint16_t vbatScale; // FUTURE: Override compiled vbat scale
132 uint8_t isBound:1,
133 onLoan:1,
134 power:4,
135 antennaMode:2; // 0=0, 1=1, 2=Diversity
136 uint8_t powerOnCounter:3,
137 forceTlmOff:1,
138 rateInitialIdx:4; // Rate to start rateCycling at on boot
139 uint8_t modelId;
140 v5_rx_config_pwm_t pwmChannels[16];
141 } v5_rx_config_t;
143 // V6
144 typedef union {
145 struct {
146 uint32_t failsafe:10, // us output during failsafe +988 (e.g. 512 here would be 1500us)
147 inputChannel:4, // 0-based input channel
148 inverted:1, // invert channel output
149 mode:4, // Output mode (eServoOutputMode)
150 narrow:1, // Narrow output mode (half pulse width)
151 unused:12; // FUTURE: When someone complains "everyone" uses inverted polarity PWM or something :/
152 } val;
153 uint32_t raw;
154 } v6_rx_config_pwm_t;
156 typedef struct {
157 uint32_t version;
158 uint8_t uid[6];
159 uint8_t loanUID[6];
160 uint16_t vbatScale; // FUTURE: Override compiled vbat scale
161 uint8_t isBound:1,
162 onLoan:1,
163 power:4,
164 antennaMode:2; // 0=0, 1=1, 2=Diversity
165 uint8_t powerOnCounter:3,
166 forceTlmOff:1,
167 rateInitialIdx:4; // Rate to start rateCycling at on boot
168 uint8_t modelId;
169 v6_rx_config_pwm_t pwmChannels[16];
170 } v6_rx_config_t;
172 typedef struct {
173 uint32_t version;
174 uint8_t uid[UID_LEN];
175 uint8_t loanUID[UID_LEN];
176 uint16_t vbatScale; // FUTURE: Override compiled vbat scale
177 uint8_t isBound:1,
178 onLoan:1,
179 power:4,
180 antennaMode:2; // 0=0, 1=1, 2=Diversity
181 uint8_t powerOnCounter:3,
182 forceTlmOff:1,
183 rateInitialIdx:4; // Rate to start rateCycling at on boot
184 uint8_t modelId;
185 uint8_t serialProtocol:4,
186 failsafeMode:2,
187 unused:2;
188 v6_rx_config_pwm_t pwmChannels[16];
189 } v7_rx_config_t;
191 // V8 is just V7 except PWM config inserted 10khz PWM in the middle
193 typedef struct {
194 uint32_t version;
195 uint8_t uid[UID_LEN];
196 uint8_t unused_padding;
197 uint8_t serial1Protocol:4, // secondary serial protocol
198 serial1Protocol_unused:4;
199 uint32_t flash_discriminator;
200 struct {
201 uint16_t scale; // FUTURE: Override compiled vbat scale
202 int16_t offset; // FUTURE: Override comiled vbat offset
203 } vbat;
204 uint8_t bindStorage:2, // rx_config_bindstorage_t
205 power:4,
206 antennaMode:2; // 0=0, 1=1, 2=Diversity
207 uint8_t powerOnCounter:3,
208 forceTlmOff:1,
209 rateInitialIdx:4; // Rate to start rateCycling at on boot
210 uint8_t modelId;
211 uint8_t serialProtocol:4,
212 failsafeMode:2,
213 unused:2;
214 v6_rx_config_pwm_t pwmChannels[16];
215 uint8_t teamraceChannel:4,
216 teamracePosition:3,
217 teamracePitMode:1; // FUTURE: Enable pit mode when disabling model
218 uint8_t targetSysId;
219 uint8_t sourceSysId;
220 } v9_rx_config_t;