5 * th9x - http://code.google.com/p/th9x
6 * er9x - http://code.google.com/p/er9x
7 * gruvin9x - http://code.google.com/p/gruvin9x
9 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
21 #ifndef _ER9XEEPROM_H_
22 #define _ER9XEEPROM_H_
25 #include "eeprominterface.h"
28 #define ER9X_MAX_MIXERS 32
29 #define ER9X_MAX_CURVE5 8
30 #define ER9X_MAX_CURVE9 8
31 #define ER9X_MAX_CSFUNC 13
35 #define ER9X_NUM_CHNOUT 16 //number of real outputchannels CH1-CH8
36 #define ER9X_NUM_CSW 12 //number of custom switches
37 #define CPN_MAX_STICKSnPOTS 7 //number of sticks and pots
38 #define ER9X_MAX_GVARS 7
40 #define ER9X_MAX_MODES 4
42 PACK(typedef struct t_Er9xTrainerMix
{
43 uint8_t srcChn
:3; //0-7 = ch1-8
46 uint8_t mode
:2; // off, add-mode, subst-mode
48 operator TrainerMix();
52 PACK(typedef struct t_Er9xTrainerData
{
54 Er9xTrainerMix mix
[4];
56 operator TrainerData();
60 PACK(typedef struct t_Er9xGeneral
{
62 int16_t calibMid
[CPN_MAX_STICKSnPOTS
];
63 int16_t calibSpanNeg
[CPN_MAX_STICKSnPOTS
];
64 int16_t calibSpanPos
[CPN_MAX_STICKSnPOTS
];
66 uint8_t currModel
; //0..15
69 int8_t txVoltageCalibration
;
71 Er9xTrainerData trainer
;
73 uint8_t disableThrottleWarning
:1;
74 uint8_t disableSwitchWarning
:1;
75 uint8_t disableMemoryWarning
:1;
77 uint8_t reserveWarning
:1;
78 uint8_t disableAlarmWarning
:1;
80 int8_t inactivityTimer
;
81 uint8_t throttleReversed
:1;
85 uint8_t disableSplashScreen
:1;
86 uint8_t disablePotScroll
:1;
88 uint8_t frskyinternalalarm
:1;
89 uint8_t spare_filter
; // No longer needed, left for eepe compatibility for now
91 uint8_t templateSetup
; //RETA order according to chout_ar array
92 int8_t PPM_Multiplier
;
95 uint8_t hideNameOnSplash
:1;
96 uint8_t enablePpmsim
:1;
98 uint8_t stickScroll
:1;
100 uint8_t hapticStrength
;
102 uint8_t lightOnStickMove
;
105 uint8_t switchWarningStates
;
111 operator GeneralSettings();
115 PACK(typedef struct t_Er9xExpoData
{
116 int8_t expo
[3][2][2];
120 t_Er9xExpoData() { memset(this, 0, sizeof(t_Er9xExpoData
)); }
124 PACK(typedef struct t_Er9xLimitData
{
130 operator LimitData();
138 PACK(typedef struct t_Er9xMixData
{
139 uint8_t destCh
; // 1..CPN_MAX_CHNOUT
143 uint8_t curve
; //0=symmetrisch 1=no neg 2=no pos
146 uint8_t speedUp
:4; // Servogeschwindigkeit aus Tabelle (10ms Cycle)
147 uint8_t speedDown
:4; // 0 nichts
149 uint8_t mltpx
:2; // multiplex method 0=+ 1=* 2=replace
150 uint8_t lateOffset
:1; // Add offset later
151 uint8_t mixWarn
:2; // mixer warning
152 uint8_t enableFmTrim
:1;
153 uint8_t differential
:1;
162 PACK(typedef struct t_Er9xLogicalSwitchData
{ // Custom Switches data
168 operator LogicalSwitchData();
169 t_Er9xLogicalSwitchData() { memset(this, 0, sizeof(t_Er9xLogicalSwitchData
)); }
170 }) Er9xLogicalSwitchData
;
172 PACK(typedef struct t_Er9xSafetySwData
{ // Custom Switches data
176 t_Er9xSafetySwData();
179 PACK(typedef struct t_Er9xFrSkyChannelData
{
180 uint8_t ratio
; // 0.0 means not used, 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
181 uint8_t alarms_value
[2]; // 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
182 uint8_t alarms_level
:4;
183 uint8_t alarms_greater
:2; // 0=LT(<), 1=GT(>)
184 uint8_t type
:2; // future use: 0=volts, ...
186 operator FrSkyChannelData();
187 t_Er9xFrSkyChannelData();
188 }) Er9xFrSkyChannelData
;
190 PACK(typedef struct t_Er9xFrSkyData
{
191 Er9xFrSkyChannelData channels
[2];
193 operator FrSkyData();
197 PACK(typedef struct t_gvar
{
203 PACK(typedef struct t_FlightModeData
{
204 // Trim store as -1001 to -1, trim value-501, 0-5 use trim of phase 0-5
205 int16_t trim
[4]; // -500..500 => trim value, 501 => use trim of phase 0, 502, 503, 504 => use trim of modes 1|2|3|4 instead
206 int8_t swtch
; // Try 0-5 use trim of phase 0-5, 1000-2000, trim + 1500 ???
209 }) Er9xFlightModeData
;
211 PACK(typedef struct t_Er9xModelData
{
212 char name
[10]; // 10 must be first for eeLoadModelName
213 uint8_t modelVoice
; // Index to model name voice (260+value)
214 int8_t tmrMode
; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
215 uint8_t tmrDir
:1; //0=>Count Down, 1=>Count Up
216 uint8_t traineron
:1; // 0 disable trainer, 1 allow trainer
217 uint8_t t2throttle
:1 ; // Start timer2 using throttle
218 uint8_t FrSkyUsrProto
:1 ; // Protocol in FrSky User Data, 0=FrSky Hub, 1=WS HowHigh
219 uint8_t FrSkyGpsAlt
:1 ; // Use Gps Altitude as main altitude reading
220 uint8_t FrSkyImperial
:1 ; // Convert FrSky values to imperial units
221 uint8_t FrSkyAltAlarm
:2;
225 uint8_t thrTrim
:1; // Enable Throttle Trim
226 uint8_t xnumBlades
:2; // RPM scaling
228 uint8_t thrExpo
:1; // Enable Throttle Expo
229 uint8_t ppmStart
:3 ; // Start channel for PPM
230 int8_t trimInc
; // Trim Increments
233 uint8_t beepANACenter
; // 1<<0->A1.. 1<<6->A7
235 uint8_t extendedLimits
:1;
236 uint8_t swashInvertELE
:1;
237 uint8_t swashInvertAIL
:1;
238 uint8_t swashInvertCOL
:1;
240 uint8_t swashCollectiveSource
;
241 uint8_t swashRingValue
;
242 int8_t ppmFrameLength
;
243 Er9xMixData mixData
[ER9X_MAX_MIXERS
];
244 Er9xLimitData limitData
[ER9X_NUM_CHNOUT
];
245 Er9xExpoData expoData
[4];
247 int8_t curves5
[ER9X_MAX_CURVE5
][5];
248 int8_t curves9
[ER9X_MAX_CURVE9
][9];
249 Er9xLogicalSwitchData logicalSw
[ER9X_NUM_CSW
];
250 uint8_t frSkyVoltThreshold
;
253 Er9xSafetySwData safetySw
[ER9X_NUM_CHNOUT
];
257 uint8_t CustomDisplayIndex
[6] ;
258 Er9xGvarData gvars
[ER9X_MAX_GVARS
] ;
259 Er9xFlightModeData flightModeData
[ER9X_MAX_MODES
] ;
261 operator ModelData();
262 t_Er9xModelData() { memset(this, 0, sizeof(t_Er9xModelData
)); }
265 #endif // _ER9XEEPROM_H_