Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1622 | killagreg | 1 | #ifndef _EEPROM_H |
2 | #define _EEPROM_H |
||
3 | |||
4 | #include <inttypes.h> |
||
5 | |||
6 | #define EEPROM_ADR_PARAM_BEGIN 0 |
||
7 | #define PID_EE_REVISION 1 // byte |
||
8 | #define PID_ACTIVE_SET 2 // byte |
||
9 | #define PID_PRESSURE_OFFSET 3 // byte |
||
10 | |||
11 | #define PID_ACC_NICK 4 // word |
||
12 | #define PID_ACC_ROLL 6 // word |
||
13 | #define PID_ACC_TOP 8 // word |
||
14 | |||
15 | #define PID_FLIGHT_MINUTES_TOTAL 10 // word |
||
16 | #define PID_FLIGHT_MINUTES 14 // word |
||
17 | |||
18 | #define EEPROM_ADR_CHANNELS 80 // 12 bytes + 1crc |
||
19 | #define EEPROM_ADR_PARAMSET 100 |
||
20 | #define EEPROM_ADR_MIXERTABLE 1000 // 1000 - 1077 |
||
21 | |||
22 | |||
23 | #define MIX_GAS 0 |
||
24 | #define MIX_NICK 1 |
||
25 | #define MIX_ROLL 2 |
||
26 | #define MIX_YAW 3 |
||
27 | |||
28 | typedef struct |
||
29 | { |
||
30 | uint8_t Revision; |
||
31 | int8_t Name[12]; |
||
32 | int8_t Motor[16][4]; |
||
33 | uint8_t crc; |
||
34 | } __attribute__((packed)) MixerTable_t; |
||
35 | |||
36 | extern MixerTable_t Mixer; |
||
37 | |||
38 | #define CFG_HOEHENREGELUNG 0x01 |
||
39 | #define CFG_HOEHEN_SCHALTER 0x02 |
||
40 | #define CFG_HEADING_HOLD 0x04 |
||
41 | #define CFG_KOMPASS_AKTIV 0x08 |
||
42 | #define CFG_KOMPASS_FIX 0x10 |
||
43 | #define CFG_GPS_AKTIV 0x20 |
||
44 | #define CFG_ACHSENKOPPLUNG_AKTIV 0x40 |
||
45 | #define CFG_DREHRATEN_BEGRENZER 0x80 |
||
46 | |||
47 | #define CFG_LOOP_OBEN 0x01 |
||
48 | #define CFG_LOOP_UNTEN 0x02 |
||
49 | #define CFG_LOOP_LINKS 0x04 |
||
50 | #define CFG_LOOP_RECHTS 0x08 |
||
51 | #define CFG_MOTOR_BLINK 0x10 |
||
52 | #define CFG_MOTOR_OFF_LED1 0x20 |
||
53 | #define CFG_MOTOR_OFF_LED2 0x40 |
||
54 | #define CFG_RES4 0x80 |
||
55 | |||
56 | #define CFG2_HEIGHT_LIMIT 0x01 |
||
57 | #define CFG2_VARIO_BEEP 0x02 |
||
58 | #define CFG_SENSITIVE_RC 0x04 |
||
59 | |||
60 | // bit mask for ParamSet.Config0 |
||
61 | #define CFG0_AIRPRESS_SENSOR 0x01 |
||
62 | #define CFG0_HEIGHT_SWITCH 0x02 |
||
63 | #define CFG0_HEADING_HOLD 0x04 |
||
64 | #define CFG0_COMPASS_ACTIVE 0x08 |
||
65 | #define CFG0_COMPASS_FIX 0x10 |
||
66 | #define CFG0_GPS_ACTIVE 0x20 |
||
67 | #define CFG0_AXIS_COUPLING_ACTIVE 0x40 |
||
68 | #define CFG0_ROTARY_RATE_LIMITER 0x80 |
||
69 | |||
70 | // defines for the receiver selection |
||
71 | #define RECEIVER_PPM 0 |
||
72 | #define RECEIVER_SPEKTRUM 1 |
||
73 | #define RECEIVER_SPEKTRUM_HI_RES 2 |
||
74 | #define RECEIVER_SPEKTRUM_LOW_RES 3 |
||
75 | #define RECEIVER_JETI 4 |
||
76 | #define RECEIVER_ACT_DSL 5 |
||
77 | #define RECEIVER_UNKNOWN 0xFF |
||
78 | |||
79 | // defines for lookup ParamSet.ChannelAssignment |
||
80 | #define K_NICK 0 |
||
81 | #define K_ROLL 1 |
||
82 | #define K_GAS 2 |
||
83 | #define K_GIER 3 |
||
84 | #define K_POTI1 4 |
||
85 | #define K_POTI2 5 |
||
86 | #define K_POTI3 6 |
||
87 | #define K_POTI4 7 |
||
88 | #define K_POTI5 8 |
||
89 | #define K_POTI6 9 |
||
90 | #define K_POTI7 10 |
||
91 | #define K_POTI8 11 |
||
92 | |||
93 | |||
94 | #define EEPARAM_REVISION 82 // is count up, if paramater stucture has changed (compatibility) |
||
95 | #define EEMIXER_REVISION 1 // is count up, if mixer stucture has changed (compatibility) |
||
96 | |||
97 | // values above 247 representing poti1 to poti8 |
||
98 | // poti1 = 255 |
||
99 | // poti2 = 254 |
||
100 | // poti3 = 253 |
||
101 | // poti4 = 252 |
||
102 | // poti5 = 251 |
||
103 | // poti6 = 250 |
||
104 | // poti7 = 249 |
||
105 | // poti8 = 248 |
||
106 | |||
107 | |||
108 | typedef struct |
||
109 | { |
||
110 | unsigned char Revision; |
||
111 | unsigned char Kanalbelegung[12]; // GAS[0], GIER[1],NICK[2], ROLL[3], POTI1, POTI2, POTI3 |
||
112 | unsigned char GlobalConfig; // 0x01=Höhenregler aktiv,0x02=Kompass aktiv, 0x04=GPS aktiv, 0x08=Heading Hold aktiv |
||
113 | unsigned char Hoehe_MinGas; // Wert : 0-100 |
||
114 | unsigned char Luftdruck_D; // Wert : 0-250 |
||
115 | unsigned char MaxHoehe; // Wert : 0-32 |
||
116 | unsigned char Hoehe_P; // Wert : 0-32 |
||
117 | unsigned char Hoehe_Verstaerkung; // Wert : 0-50 |
||
118 | unsigned char Hoehe_ACC_Wirkung; // Wert : 0-250 |
||
119 | unsigned char Hoehe_HoverBand; // Wert : 0-250 |
||
120 | unsigned char Hoehe_GPS_Z; // Wert : 0-250 |
||
121 | unsigned char Hoehe_StickNeutralPoint;// Wert : 0-250 |
||
122 | unsigned char Stick_P; // Wert : 1-6 |
||
123 | unsigned char Stick_D; // Wert : 0-64 |
||
124 | unsigned char Gier_P; // Wert : 1-20 |
||
125 | unsigned char Gas_Min; // Wert : 0-32 |
||
126 | unsigned char Gas_Max; // Wert : 33-250 |
||
127 | unsigned char GyroAccFaktor; // Wert : 1-64 |
||
128 | unsigned char KompassWirkung; // Wert : 0-32 |
||
129 | unsigned char Gyro_P; // Wert : 10-250 |
||
130 | unsigned char Gyro_I; // Wert : 0-250 |
||
131 | unsigned char Gyro_D; // Wert : 0-250 |
||
132 | unsigned char Gyro_Gier_P; // Wert : 10-250 |
||
133 | unsigned char Gyro_Gier_I; // Wert : 0-250 |
||
134 | unsigned char UnterspannungsWarnung; // Wert : 0-250 |
||
135 | unsigned char NotGas; // Wert : 0-250 //Gaswert bei Empängsverlust |
||
136 | unsigned char NotGasZeit; // Wert : 0-250 // Zeitbis auf NotGas geschaltet wird, wg. Rx-Problemen |
||
137 | unsigned char Receiver; // 0= Summensignal, 1= Spektrum, 2 =Jeti, 3=ACT DSL, 4=ACT S3D |
||
138 | unsigned char I_Faktor; // Wert : 0-250 |
||
139 | unsigned char UserParam1; // Wert : 0-250 |
||
140 | unsigned char UserParam2; // Wert : 0-250 |
||
141 | unsigned char UserParam3; // Wert : 0-250 |
||
142 | unsigned char UserParam4; // Wert : 0-250 |
||
143 | unsigned char ServoNickControl; // Wert : 0-250 // Stellung des Servos |
||
144 | unsigned char ServoNickComp; // Wert : 0-250 // Einfluss Gyro/Servo |
||
145 | unsigned char ServoNickMin; // Wert : 0-250 // Anschlag |
||
146 | unsigned char ServoNickMax; // Wert : 0-250 // Anschlag |
||
147 | //--- Seit V0.75 |
||
148 | unsigned char ServoRollControl; // Wert : 0-250 // Stellung des Servos |
||
149 | unsigned char ServoRollComp; // Wert : 0-250 |
||
150 | unsigned char ServoRollMin; // Wert : 0-250 |
||
151 | unsigned char ServoRollMax; // Wert : 0-250 |
||
152 | //--- |
||
153 | unsigned char ServoNickRefresh; // Speed of the Servo |
||
154 | unsigned char Servo3; // Value or mapping of the Servo Output |
||
155 | unsigned char Servo4; // Value or mapping of the Servo Output |
||
156 | unsigned char Servo5; // Value or mapping of the Servo Output |
||
157 | unsigned char LoopGasLimit; // Wert: 0-250 max. Gas während Looping |
||
158 | unsigned char LoopThreshold; // Wert: 0-250 Schwelle für Stickausschlag |
||
159 | unsigned char LoopHysterese; // Wert: 0-250 Hysterese für Stickausschlag |
||
160 | unsigned char AchsKopplung1; // Wert: 0-250 Faktor, mit dem Gier die Achsen Roll und Nick koppelt (NickRollMitkopplung) |
||
161 | unsigned char AchsKopplung2; // Wert: 0-250 Faktor, mit dem Nick und Roll verkoppelt werden |
||
162 | unsigned char CouplingYawCorrection; // Wert: 0-250 Faktor, mit dem Nick und Roll verkoppelt werden |
||
163 | unsigned char WinkelUmschlagNick; // Wert: 0-250 180°-Punkt |
||
164 | unsigned char WinkelUmschlagRoll; // Wert: 0-250 180°-Punkt |
||
165 | unsigned char GyroAccAbgleich; // 1/k (Koppel_ACC_Wirkung) |
||
166 | unsigned char Driftkomp; |
||
167 | unsigned char DynamicStability; |
||
168 | unsigned char UserParam5; // Wert : 0-250 |
||
169 | unsigned char UserParam6; // Wert : 0-250 |
||
170 | unsigned char UserParam7; // Wert : 0-250 |
||
171 | unsigned char UserParam8; // Wert : 0-250 |
||
172 | //---Output --------------------------------------------- |
||
173 | unsigned char J16Bitmask; // for the J16 Output |
||
174 | unsigned char J16Timing; // for the J16 Output |
||
175 | unsigned char J17Bitmask; // for the J17 Output |
||
176 | unsigned char J17Timing; // for the J17 Output |
||
177 | // seit version V0.75c |
||
178 | unsigned char WARN_J16_Bitmask; // for the J16 Output |
||
179 | unsigned char WARN_J17_Bitmask; // for the J17 Output |
||
180 | //---NaviCtrl--------------------------------------------- |
||
181 | unsigned char NaviGpsModeControl; // Parameters for the Naviboard |
||
182 | unsigned char NaviGpsGain; |
||
183 | unsigned char NaviGpsP; |
||
184 | unsigned char NaviGpsI; |
||
185 | unsigned char NaviGpsD; |
||
186 | unsigned char NaviGpsPLimit; |
||
187 | unsigned char NaviGpsILimit; |
||
188 | unsigned char NaviGpsDLimit; |
||
189 | unsigned char NaviGpsACC; |
||
190 | unsigned char NaviGpsMinSat; |
||
191 | unsigned char NaviStickThreshold; |
||
192 | unsigned char NaviWindCorrection; |
||
193 | unsigned char NaviSpeedCompensation; |
||
194 | unsigned char NaviOperatingRadius; |
||
195 | unsigned char NaviAngleLimitation; |
||
196 | unsigned char NaviPH_LoginTime; |
||
197 | //---Ext.Ctrl--------------------------------------------- |
||
198 | unsigned char ExternalControl; // for serial Control |
||
199 | //------------------------------------------------ |
||
200 | unsigned char BitConfig; // (war Loop-Cfg) Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts / wird getrennt behandelt |
||
201 | unsigned char ServoCompInvert; // // 0x01 = Nick, 0x02 = Roll 0 oder 1 // WICHTIG!!! am Ende lassen |
||
202 | unsigned char ExtraConfig; // bitcodiert |
||
203 | char Name[12]; |
||
204 | unsigned char crc; // must be the last byte! |
||
205 | } paramset_t; |
||
206 | |||
207 | #define PARAMSET_STRUCT_LEN sizeof(paramset_t) |
||
208 | |||
209 | extern paramset_t EE_Parameter; |
||
210 | |||
211 | extern void ParamSet_Init(void); |
||
212 | extern uint8_t ParamSet_ReadFromEEProm(uint8_t setnumber); |
||
213 | extern uint8_t ParamSet_WriteToEEProm(uint8_t setnumber); |
||
214 | |||
215 | extern uint8_t GetActiveParamSet(void); |
||
216 | extern void SetActiveParamSet(uint8_t setnumber); |
||
217 | |||
218 | extern uint8_t MixerTable_ReadFromEEProm(void); |
||
219 | extern uint8_t MixerTable_WriteToEEProm(void); |
||
220 | |||
221 | |||
222 | extern uint8_t GetParamByte(uint16_t param_id); |
||
223 | extern void SetParamByte(uint16_t param_id, uint8_t value); |
||
224 | extern uint16_t GetParamWord(uint16_t param_id); |
||
225 | extern void SetParamWord(uint16_t param_id, uint16_t value); |
||
226 | |||
227 | |||
228 | #endif //_EEPROM_H |