Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2248 | - | 1 | /***************************************************************************************************************************** |
2 | * File: eeprom.c |
||
3 | * |
||
4 | * Purpose: storing or loading the EEPROM values to RAM or writing them to EE_Parameter |
||
5 | * |
||
6 | * Functions: void DefaultStickMapping(void) // stick setting at RC control for incoming sum signal chain |
||
7 | * void DefaultKonstanten3(void) // |
||
8 | * void DefaultKonstanten2(void) // |
||
9 | * void DefaultKonstanten1(void) // |
||
10 | * void ReadParameterSet(unsigned char number, unsigned char *buffer, unsigned char length) |
||
11 | * void WriteParameterSet(unsigned char number, unsigned char *buffer, unsigned char length) |
||
12 | * unsigned char GetActiveParamSetNumber(void) |
||
13 | * void SetActiveParamSetNumber(unsigned char number) |
||
14 | * |
||
15 | *****************************************************************************************************************************/ |
||
16 | #include "eeprom.h" |
||
17 | |||
18 | |||
19 | unsigned char EEPromArray[E2END+1] EEMEM; // E2END = 2047 |
||
20 | // wird im EEPROM deklariert |
||
21 | // in den I/O-Headern wird die letzte EEPROM-Adresse als E2END definiert |
||
22 | // #define EEMEM __attribute__ ((section (".eeprom"))) |
||
23 | // EEPROM Size = 2 Kbytes // Page Size = 8 bytes // No. of Pages = 256 // siehe Atmega644 manual S287 |
||
24 | |||
25 | |||
26 | // --------------------------------------------------------------------------------------------------------------------------- |
||
27 | // + Konstanten |
||
28 | // + 0-250 -> normale Werte |
||
29 | // + 251 -> Poti1 |
||
30 | // + 252 -> Poti2 |
||
31 | // + 253 -> Poti3 |
||
32 | // --------------------------------------------------------------------------------------------------------------------------- |
||
33 | |||
34 | |||
35 | //----------------------------------------------------------------------------------------------------------------------------- |
||
36 | // stick setting at RC control for incoming sum signal chain |
||
37 | //----------------------------------------------------------------------------------------------------------------------------- |
||
38 | void DefaultStickMapping(void) // remote control is set to mode 2 |
||
39 | { |
||
40 | EE_Parameter.Kanalbelegung[K_NICK] = 3; // #define K_NICK 0 // Koptertool -> Einstellungen -> Kanäle -> "NICK" |
||
41 | EE_Parameter.Kanalbelegung[K_ROLL] = 2; // #define K_ROLL 1 // Koptertool -> Einstellungen -> Kanäle -> "ROLL" |
||
42 | EE_Parameter.Kanalbelegung[K_GAS] = 1; // #define K_GAS 2 // Koptertool -> Einstellungen -> Kanäle -> "GAS" |
||
43 | EE_Parameter.Kanalbelegung[K_GIER] = 4; // #define K_GIER 3 // Koptertool -> Einstellungen -> Kanäle -> "Gier" |
||
44 | EE_Parameter.Kanalbelegung[K_POTI1] = 5; // #define K_POTI1 4 // Koptertool -> Einstellungen -> Kanäle -> "POTI1" |
||
45 | EE_Parameter.Kanalbelegung[K_POTI2] = 6; // #define K_POTI2 5 // Koptertool -> Einstellungen -> Kanäle -> "POTI2" |
||
46 | EE_Parameter.Kanalbelegung[K_POTI3] = 7; // #define K_POTI3 6 // Koptertool -> Einstellungen -> Kanäle -> "POTI3" |
||
47 | EE_Parameter.Kanalbelegung[K_POTI4] = 8; // #define K_POTI4 7 // Koptertool -> Einstellungen -> Kanäle -> "POTI4" |
||
48 | } |
||
49 | //----------------------------------------------------------------------------------------------------------------------------- |
||
50 | |||
51 | |||
52 | |||
53 | //----------------------------------------------------------------------------------------------------------------------------- |
||
54 | void DefaultKonstanten3(void) |
||
55 | { |
||
56 | EE_Parameter.GlobalConfig = CFG_KOMPASS_AKTIV; |
||
57 | // |
||
58 | // #define CFG_HOEHENREGELUNG 0x01 |
||
59 | // #define CFG_HOEHEN_SCHALTER 0x02 |
||
60 | // #define CFG_HEADING_HOLD 0x04 |
||
61 | // #define CFG_KOMPASS_AKTIV 0x08 |
||
62 | // #define CFG_KOMPASS_FIX 0x10 |
||
63 | // #define CFG_GPS_AKTIV 0x20 |
||
64 | // #define CFG_ACHSENKOPPLUNG_AKTIV 0x40 |
||
65 | // #define CFG_DREHRATEN_BEGRENZER 0x80 |
||
66 | |||
67 | EE_Parameter.ExtraConfig = CFG2_HEIGHT_LIMIT; |
||
68 | // |
||
69 | // #define CFG2_HEIGHT_LIMIT 0x01 // Koptertool -> Einstellungen -> Höhe -> Höhenregelung aktiv -> "Höhenbegrenzung" |
||
70 | // #define CFG2_VARIO_BEEP 0x02 // Koptertool -> Einstellungen -> Höhe -> Höhenregelung aktiv -> "akustisches Variometer" |
||
71 | // #define CFG_SENSITIVE_RC 0x04 // Koptertool -> Einstellungen -> Konfiguration -> "Erweiterte Empfangssignalprüfung" |
||
72 | // #define CFG_3_3V_REFERENCE 0x08 // Koptertool -> Einstellungen -> Verschiedenes -> "Voltage Reference" 3.0V |
||
73 | // #define CFG_NO_RCOFF_BEEPING 0x10 // Koptertool -> Einstellungen -> Verschiedenes -> "kein Signalton ohne aktiven Empfänger" |
||
74 | // #define CFG_GPS_AID 0x20 // Koptertool -> ??? |
||
75 | // #define CFG_LEARNABLE_CAREFREE 0x40 // Koptertool -> Einstellungen -> Easy Setup -> "Teachable Carefree" |
||
76 | // #define CFG_IGNORE_MAG_ERR_AT_STARTUP 0x80 |
||
77 | |||
78 | EE_Parameter.Hoehe_MinGas = 30; |
||
79 | EE_Parameter.MaxHoehe = 251; // Wert : 0-250 251 -> Poti1 |
||
80 | EE_Parameter.Hoehe_P = 10; // Wert : 0-32 |
||
81 | EE_Parameter.Luftdruck_D = 30; // Wert : 0-250 |
||
82 | EE_Parameter.Hoehe_ACC_Wirkung = 30; // Wert : 0-250 |
||
83 | EE_Parameter.Hoehe_HoverBand = 5; // Wert : 0-250 |
||
84 | EE_Parameter.Hoehe_GPS_Z = 64; // Wert : 0-250 |
||
85 | EE_Parameter.Hoehe_StickNeutralPoint = 0; // Wert : 0-250 (0 = Hoover-Estimation) |
||
86 | EE_Parameter.Hoehe_Verstaerkung = 15; // Wert : 0-50 |
||
87 | EE_Parameter.Stick_P = 8; // Wert : 1-6 |
||
88 | EE_Parameter.Stick_D = 16; // Wert : 0-64 |
||
89 | EE_Parameter.Gier_P = 6; // Wert : 1-20 |
||
90 | EE_Parameter.Gas_Min = 8; // Wert : 0-32 |
||
91 | EE_Parameter.Gas_Max = 230; // Wert : 33-250 |
||
92 | EE_Parameter.GyroAccFaktor = 30; // Wert : 1-64 |
||
93 | EE_Parameter.KompassWirkung = 128; // Wert : 0-250 |
||
94 | EE_Parameter.Gyro_P = 100; // Wert : 0-250 |
||
95 | EE_Parameter.Gyro_I = 120; // Wert : 0-250 |
||
96 | EE_Parameter.Gyro_D = 3; // Wert : 0-250 |
||
97 | EE_Parameter.Gyro_Gier_P = 100; // Wert : 0-250 |
||
98 | EE_Parameter.Gyro_Gier_I = 120; // Wert : 0-250 |
||
99 | EE_Parameter.UnterspannungsWarnung = 33; // Wert : 0-250 // Automatische Zellenerkennung bei < 50 |
||
100 | EE_Parameter.NotGas = 35; // Wert : 0-250 // Gaswert bei Empangsverlust |
||
101 | EE_Parameter.NotGasZeit = 20; // Wert : 0-250 // Zeit bis auf NotGas geschaltet wird, wg. Rx-Problemen |
||
102 | EE_Parameter.UfoAusrichtung = 0; // X oder + Formation |
||
103 | EE_Parameter.I_Faktor = 16; |
||
104 | |||
105 | EE_Parameter.UserParam1 = 0; // zur freien Verwendung |
||
106 | EE_Parameter.UserParam2 = 0; // zur freien Verwendung |
||
107 | EE_Parameter.UserParam3 = 0; // zur freien Verwendung |
||
108 | EE_Parameter.UserParam4 = 0; // zur freien Verwendung |
||
109 | EE_Parameter.UserParam5 = 0; // zur freien Verwendung |
||
110 | EE_Parameter.UserParam6 = 0; // zur freien Verwendung |
||
111 | EE_Parameter.UserParam7 = 0; // zur freien Verwendung |
||
112 | EE_Parameter.UserParam8 = 0; // zur freien Verwendung |
||
113 | |||
114 | EE_Parameter.ServoNickControl = 100; // Wert : 0-250 // Stellung des Servos |
||
115 | EE_Parameter.ServoNickComp = 40; // Wert : 0-250 // Einfluss Gyro/Servo |
||
116 | EE_Parameter.ServoCompInvert = 1; // Wert : 0-250 // Richtung Einfluss Gyro/Servo |
||
117 | EE_Parameter.ServoNickMin = 0; // Wert : 0-250 // Anschlag |
||
118 | EE_Parameter.ServoNickMax = 250; // Wert : 0-250 // Anschlag |
||
119 | EE_Parameter.ServoNickRefresh = 6; |
||
120 | EE_Parameter.ServoRollControl = 100; // Wert : 0-250 // Stellung des Servos |
||
121 | EE_Parameter.ServoRollComp = 40; // Wert : 0-250 // Einfluss Gyro/Servo |
||
122 | EE_Parameter.ServoRollMin = 0; // Wert : 0-250 // Anschlag |
||
123 | EE_Parameter.ServoRollMax = 250; // Wert : 0-250 // Anschlag |
||
124 | |||
125 | EE_Parameter.LoopGasLimit = 50; |
||
126 | EE_Parameter.LoopThreshold = 90; // Wert: 0-250 Schwelle für Stickausschlag |
||
127 | EE_Parameter.LoopHysterese = 50; |
||
128 | |||
129 | EE_Parameter.BitConfig = 0; // Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts |
||
130 | EE_Parameter.AchsKopplung1 = 90; |
||
131 | EE_Parameter.AchsKopplung2 = 80; |
||
132 | EE_Parameter.CouplingYawCorrection = 70; |
||
133 | EE_Parameter.WinkelUmschlagNick = 85; |
||
134 | EE_Parameter.WinkelUmschlagRoll = 85; |
||
135 | EE_Parameter.GyroAccAbgleich = 32; // 1/k |
||
136 | EE_Parameter.Driftkomp = 32; |
||
137 | EE_Parameter.DynamicStability = 50; |
||
138 | EE_Parameter.J16Bitmask = 95; |
||
139 | EE_Parameter.J17Bitmask = 243; |
||
140 | EE_Parameter.WARN_J16_Bitmask = 0xAA; |
||
141 | EE_Parameter.WARN_J17_Bitmask = 0xAA; |
||
142 | EE_Parameter.J16Timing = 30; |
||
143 | EE_Parameter.J17Timing = 30; |
||
144 | |||
145 | EE_Parameter.NaviGpsModeControl = 252; |
||
146 | EE_Parameter.NaviGpsGain = 100; |
||
147 | EE_Parameter.NaviGpsP = 90; |
||
148 | EE_Parameter.NaviGpsI = 90; |
||
149 | EE_Parameter.NaviGpsD = 90; |
||
150 | EE_Parameter.NaviGpsPLimit = 75; |
||
151 | EE_Parameter.NaviGpsILimit = 75; |
||
152 | EE_Parameter.NaviGpsDLimit = 75; |
||
153 | EE_Parameter.NaviGpsACC = 0; |
||
154 | EE_Parameter.NaviGpsMinSat = 6; |
||
155 | EE_Parameter.NaviStickThreshold = 8; |
||
156 | EE_Parameter.NaviWindCorrection = 90; |
||
157 | EE_Parameter.NaviSpeedCompensation = 30; |
||
158 | EE_Parameter.NaviOperatingRadius = 100; |
||
159 | EE_Parameter.NaviAngleLimitation = 100; |
||
160 | EE_Parameter.NaviPH_LoginTime = 4; |
||
161 | memcpy(EE_Parameter.Name, "Beginner\0", 12); |
||
162 | } |
||
163 | //----------------------------------------------------------------------------------------------------------------------------- |
||
164 | |||
165 | |||
166 | |||
167 | |||
168 | //----------------------------------------------------------------------------------------------------------------------------- |
||
169 | void DefaultKonstanten2(void) |
||
170 | { |
||
171 | EE_Parameter.GlobalConfig = CFG_ACHSENKOPPLUNG_AKTIV | CFG_KOMPASS_AKTIV | CFG_GPS_AKTIV | CFG_HOEHEN_SCHALTER; |
||
172 | EE_Parameter.ExtraConfig = CFG2_HEIGHT_LIMIT;// | CFG2_VARIO_BEEP | CFG_SENSITIVE_RC |
||
173 | EE_Parameter.Hoehe_MinGas = 30; |
||
174 | EE_Parameter.MaxHoehe = 251; // Wert : 0-250 251 -> Poti1 |
||
175 | EE_Parameter.Hoehe_P = 10; // Wert : 0-32 |
||
176 | EE_Parameter.Luftdruck_D = 30; // Wert : 0-250 |
||
177 | EE_Parameter.Hoehe_ACC_Wirkung = 30; // Wert : 0-250 |
||
178 | EE_Parameter.Hoehe_HoverBand = 5; // Wert : 0-250 |
||
179 | EE_Parameter.Hoehe_GPS_Z = 64; // Wert : 0-250 |
||
180 | EE_Parameter.Hoehe_StickNeutralPoint = 0; // Wert : 0-250 (0 = Hoover-Estimation) |
||
181 | EE_Parameter.Hoehe_Verstaerkung = 15; // Wert : 0-50 |
||
182 | EE_Parameter.Stick_P = 10; // Wert : 1-6 |
||
183 | EE_Parameter.Stick_D = 16; // Wert : 0-64 |
||
184 | EE_Parameter.Gier_P = 6; // Wert : 1-20 |
||
185 | EE_Parameter.Gas_Min = 8; // Wert : 0-32 |
||
186 | EE_Parameter.Gas_Max = 230; // Wert : 33-250 |
||
187 | EE_Parameter.GyroAccFaktor = 30; // Wert : 1-64 |
||
188 | EE_Parameter.KompassWirkung = 128; // Wert : 0-250 |
||
189 | EE_Parameter.Gyro_P = 90; // Wert : 0-250 |
||
190 | EE_Parameter.Gyro_I = 120; // Wert : 0-250 |
||
191 | EE_Parameter.Gyro_D = 3; // Wert : 0-250 |
||
192 | EE_Parameter.Gyro_Gier_P = 90; // Wert : 0-250 |
||
193 | EE_Parameter.Gyro_Gier_I = 120; // Wert : 0-250 |
||
194 | EE_Parameter.UnterspannungsWarnung = 33; // Wert : 0-250 ( Automatische Zellenerkennung bei < 50) |
||
195 | EE_Parameter.NotGas = 35; // Wert : 0-250 // Gaswert bei Empangsverlust |
||
196 | EE_Parameter.NotGasZeit = 30; // Wert : 0-250 // Zeit bis auf NotGas geschaltet wird, wg. Rx-Problemen |
||
197 | EE_Parameter.UfoAusrichtung = 0; // X oder + Formation |
||
198 | EE_Parameter.I_Faktor = 32; |
||
199 | EE_Parameter.UserParam1 = 0; // zur freien Verwendung |
||
200 | EE_Parameter.UserParam2 = 0; // zur freien Verwendung |
||
201 | EE_Parameter.UserParam3 = 0; // zur freien Verwendung |
||
202 | EE_Parameter.UserParam4 = 0; // zur freien Verwendung |
||
203 | EE_Parameter.UserParam5 = 0; // zur freien Verwendung |
||
204 | EE_Parameter.UserParam6 = 0; // zur freien Verwendung |
||
205 | EE_Parameter.UserParam7 = 0; // zur freien Verwendung |
||
206 | EE_Parameter.UserParam8 = 0; // zur freien Verwendung |
||
207 | EE_Parameter.ServoNickControl = 100; // Wert : 0-250 // Stellung des Servos |
||
208 | EE_Parameter.ServoNickComp = 40; // Wert : 0-250 // Einfluss Gyro/Servo |
||
209 | EE_Parameter.ServoCompInvert = 1; // Wert : 0-250 // Richtung Einfluss Gyro/Servo |
||
210 | EE_Parameter.ServoNickMin = 0; // Wert : 0-250 // Anschlag |
||
211 | EE_Parameter.ServoNickMax = 250; // Wert : 0-250 // Anschlag |
||
212 | EE_Parameter.ServoNickRefresh = 6; |
||
213 | EE_Parameter.ServoRollControl = 100; // Wert : 0-250 // Stellung des Servos |
||
214 | EE_Parameter.ServoRollComp = 40; // Wert : 0-250 // Einfluss Gyro/Servo |
||
215 | EE_Parameter.ServoRollMin = 0; // Wert : 0-250 // Anschlag |
||
216 | EE_Parameter.ServoRollMax = 250; // Wert : 0-250 // Anschlag |
||
217 | EE_Parameter.LoopGasLimit = 50; |
||
218 | EE_Parameter.LoopThreshold = 90; // Wert: 0-250 Schwelle für Stickausschlag |
||
219 | EE_Parameter.LoopHysterese = 50; |
||
220 | EE_Parameter.BitConfig = 0; // Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts |
||
221 | EE_Parameter.AchsKopplung1 = 90; |
||
222 | EE_Parameter.AchsKopplung2 = 80; |
||
223 | EE_Parameter.CouplingYawCorrection = 60; |
||
224 | EE_Parameter.WinkelUmschlagNick = 85; |
||
225 | EE_Parameter.WinkelUmschlagRoll = 85; |
||
226 | EE_Parameter.GyroAccAbgleich = 32; // 1/k |
||
227 | EE_Parameter.Driftkomp = 32; |
||
228 | EE_Parameter.DynamicStability = 75; |
||
229 | EE_Parameter.J16Bitmask = 95; |
||
230 | EE_Parameter.J17Bitmask = 243; |
||
231 | EE_Parameter.WARN_J16_Bitmask = 0xAA; |
||
232 | EE_Parameter.WARN_J17_Bitmask = 0xAA; |
||
233 | EE_Parameter.J16Timing = 20; |
||
234 | EE_Parameter.J17Timing = 20; |
||
235 | EE_Parameter.NaviGpsModeControl = 252; |
||
236 | EE_Parameter.NaviGpsGain = 100; |
||
237 | EE_Parameter.NaviGpsP = 90; |
||
238 | EE_Parameter.NaviGpsI = 90; |
||
239 | EE_Parameter.NaviGpsD = 90; |
||
240 | EE_Parameter.NaviGpsPLimit = 75; |
||
241 | EE_Parameter.NaviGpsILimit = 75; |
||
242 | EE_Parameter.NaviGpsDLimit = 75; |
||
243 | EE_Parameter.NaviGpsACC = 0; |
||
244 | EE_Parameter.NaviGpsMinSat = 6; |
||
245 | EE_Parameter.NaviStickThreshold = 8; |
||
246 | EE_Parameter.NaviWindCorrection = 90; |
||
247 | EE_Parameter.NaviSpeedCompensation = 30; |
||
248 | EE_Parameter.NaviOperatingRadius = 100; |
||
249 | EE_Parameter.NaviAngleLimitation = 100; |
||
250 | EE_Parameter.NaviPH_LoginTime = 4; |
||
251 | memcpy(EE_Parameter.Name, "Normal\0", 12); |
||
252 | } |
||
253 | //----------------------------------------------------------------------------------------------------------------------------- |
||
254 | |||
255 | |||
256 | |||
257 | //----------------------------------------------------------------------------------------------------------------------------- |
||
258 | void DefaultKonstanten1(void) |
||
259 | { |
||
260 | EE_Parameter.GlobalConfig = CFG_ACHSENKOPPLUNG_AKTIV | CFG_KOMPASS_AKTIV | CFG_GPS_AKTIV | CFG_HOEHEN_SCHALTER; |
||
261 | EE_Parameter.ExtraConfig = CFG2_HEIGHT_LIMIT;// | CFG2_VARIO_BEEP | CFG_SENSITIVE_RC |
||
262 | EE_Parameter.Hoehe_MinGas = 30; |
||
263 | EE_Parameter.MaxHoehe = 251; // Wert : 0-250 251 -> Poti1 |
||
264 | EE_Parameter.Hoehe_P = 10; // Wert : 0-32 |
||
265 | EE_Parameter.Luftdruck_D = 30; // Wert : 0-250 |
||
266 | EE_Parameter.Hoehe_ACC_Wirkung = 30; // Wert : 0-250 |
||
267 | EE_Parameter.Hoehe_HoverBand = 5; // Wert : 0-250 |
||
268 | EE_Parameter.Hoehe_GPS_Z = 64; // Wert : 0-250 |
||
269 | EE_Parameter.Hoehe_StickNeutralPoint = 0; // Wert : 0-250 (0 = Hoover-Estimation) |
||
270 | EE_Parameter.Hoehe_Verstaerkung = 20; // Wert : 0-50 |
||
271 | EE_Parameter.Stick_P = 14; // Wert : 1-6 |
||
272 | EE_Parameter.Stick_D = 16; // Wert : 0-64 |
||
273 | EE_Parameter.Gier_P = 12; // Wert : 1-20 |
||
274 | EE_Parameter.Gas_Min = 8; // Wert : 0-32 |
||
275 | EE_Parameter.Gas_Max = 230; // Wert : 33-250 |
||
276 | EE_Parameter.GyroAccFaktor = 30; // Wert : 1-64 |
||
277 | EE_Parameter.KompassWirkung = 128; // Wert : 0-250 |
||
278 | EE_Parameter.Gyro_P = 80; // Wert : 0-250 |
||
279 | EE_Parameter.Gyro_I = 150; // Wert : 0-250 |
||
280 | EE_Parameter.Gyro_D = 3; // Wert : 0-250 |
||
281 | EE_Parameter.Gyro_Gier_P = 80; // Wert : 0-250 |
||
282 | EE_Parameter.Gyro_Gier_I = 150; // Wert : 0-250 |
||
283 | EE_Parameter.UnterspannungsWarnung = 33; // Wert : 0-250 ( Automatische Zellenerkennung bei < 50) |
||
284 | EE_Parameter.NotGas = 35; // Wert : 0-250 // Gaswert bei Empangsverlust |
||
285 | EE_Parameter.NotGasZeit = 30; // Wert : 0-250 // Zeit bis auf NotGas geschaltet wird, wg. Rx-Problemen |
||
286 | EE_Parameter.UfoAusrichtung = 0; // X oder + Formation |
||
287 | EE_Parameter.I_Faktor = 32; |
||
288 | EE_Parameter.UserParam1 = 0; // zur freien Verwendung |
||
289 | EE_Parameter.UserParam2 = 0; // zur freien Verwendung |
||
290 | EE_Parameter.UserParam3 = 0; // zur freien Verwendung |
||
291 | EE_Parameter.UserParam4 = 0; // zur freien Verwendung |
||
292 | EE_Parameter.UserParam5 = 0; // zur freien Verwendung |
||
293 | EE_Parameter.UserParam6 = 0; // zur freien Verwendung |
||
294 | EE_Parameter.UserParam7 = 0; // zur freien Verwendung |
||
295 | EE_Parameter.UserParam8 = 0; // zur freien Verwendung |
||
296 | |||
297 | EE_Parameter.ServoNickControl = 100; // Wert : 0-250 // Stellung des Servos |
||
298 | EE_Parameter.ServoNickComp = 40; // Wert : 0-250 // Einfluss Gyro/Servo |
||
299 | EE_Parameter.ServoCompInvert = 1; // Wert : 0-250 // Richtung Einfluss Gyro/Servo |
||
300 | EE_Parameter.ServoNickMin = 0; // Wert : 0-250 // Anschlag |
||
301 | EE_Parameter.ServoNickMax = 250; // Wert : 0-250 // Anschlag |
||
302 | EE_Parameter.ServoNickRefresh = 6; |
||
303 | EE_Parameter.ServoRollControl = 100; // Wert : 0-250 // Stellung des Servos |
||
304 | EE_Parameter.ServoRollComp = 40; // Wert : 0-250 // Einfluss Gyro/Servo |
||
305 | EE_Parameter.ServoRollMin = 0; // Wert : 0-250 // Anschlag |
||
306 | EE_Parameter.ServoRollMax = 250; // Wert : 0-250 // Anschlag |
||
307 | EE_Parameter.LoopGasLimit = 50; |
||
308 | EE_Parameter.LoopThreshold = 90; // Wert: 0-250 Schwelle für Stickausschlag |
||
309 | EE_Parameter.LoopHysterese = 50; |
||
310 | EE_Parameter.BitConfig = 0; // Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts / wird getrennt behandelt |
||
311 | EE_Parameter.AchsKopplung1 = 90; |
||
312 | EE_Parameter.AchsKopplung2 = 80; |
||
313 | EE_Parameter.CouplingYawCorrection = 1; |
||
314 | EE_Parameter.WinkelUmschlagNick = 85; |
||
315 | EE_Parameter.WinkelUmschlagRoll = 85; |
||
316 | EE_Parameter.GyroAccAbgleich = 16; // 1/k |
||
317 | EE_Parameter.Driftkomp = 32; |
||
318 | EE_Parameter.DynamicStability = 100; |
||
319 | EE_Parameter.J16Bitmask = 95; |
||
320 | EE_Parameter.J17Bitmask = 243; |
||
321 | EE_Parameter.WARN_J16_Bitmask = 0xAA; |
||
322 | EE_Parameter.WARN_J17_Bitmask = 0xAA; |
||
323 | EE_Parameter.J16Timing = 15; |
||
324 | EE_Parameter.J17Timing = 15; |
||
325 | EE_Parameter.NaviGpsModeControl = 252; |
||
326 | EE_Parameter.NaviGpsGain = 100; |
||
327 | EE_Parameter.NaviGpsP = 90; |
||
328 | EE_Parameter.NaviGpsI = 90; |
||
329 | EE_Parameter.NaviGpsD = 90; |
||
330 | EE_Parameter.NaviGpsPLimit = 75; |
||
331 | EE_Parameter.NaviGpsILimit = 75; |
||
332 | EE_Parameter.NaviGpsDLimit = 75; |
||
333 | EE_Parameter.NaviGpsACC = 0; |
||
334 | EE_Parameter.NaviGpsMinSat = 6; |
||
335 | EE_Parameter.NaviStickThreshold = 8; |
||
336 | EE_Parameter.NaviWindCorrection = 90; |
||
337 | EE_Parameter.NaviSpeedCompensation = 30; |
||
338 | EE_Parameter.NaviOperatingRadius = 100; |
||
339 | EE_Parameter.NaviAngleLimitation = 100; |
||
340 | EE_Parameter.NaviPH_LoginTime = 4; |
||
341 | memcpy(EE_Parameter.Name, "Sport\0", 12); |
||
342 | } |
||
343 | //----------------------------------------------------------------------------------------------------------------------------- |
||
344 | |||
345 | |||
346 | |||
347 | //----------------------------------------------------------------------------------------------------- |
||
348 | // Parametersatz aus dem EEPROM lesen |
||
349 | // Nummer [1..5] möglich |
||
350 | //----------------------------------------------------------------------------------------------------- |
||
351 | void ReadParameterSet(unsigned char number, unsigned char *buffer, unsigned char length) |
||
352 | { |
||
353 | if((number > 5)||(number < 1)) number = 3; |
||
354 | eeprom_read_block(buffer, &EEPromArray[EEPROM_ADR_PARAM_BEGIN + length * (number - 1)], length); // #define EEPROM_ADR_PARAM_BEGIN 100 |
||
355 | LED_Init (); // initialisiert die Schalt-Ausgänge PORTC2 und PORTC3 an SV2 (control of J16 & J17) |
||
356 | } |
||
357 | //----------------------------------------------------------------------------------------------------- |
||
358 | |||
359 | |||
360 | |||
361 | //----------------------------------------------------------------------------------------------------- |
||
362 | // Parametersatz vom ROM ins EEPROM schreiben |
||
363 | // Nummer [1..5] ist die mögliche Nummer des Paramtersatzes |
||
364 | // *buffer ist die Adresse, woher die Bytes kommen, die kopiert werden sollen |
||
365 | // length ist die Anzahl der zu kopierenden Bytes |
||
366 | //------------------------------------------------------------------------------------------------------------------------------------ |
||
367 | void WriteParameterSet(unsigned char number, unsigned char *buffer, unsigned char length) |
||
368 | { |
||
369 | if(number > 5) number = 5; |
||
370 | if(number < 1) return; |
||
371 | eeprom_write_block(buffer, &EEPromArray[EEPROM_ADR_PARAM_BEGIN + length * (number - 1)], length); // #define EEPROM_ADR_PARAM_BEGIN 100 |
||
372 | // eeprom_write_block(buffer, &EEPromArray[100 + length * (number - 1)], length); // aufgelöst |
||
373 | eeprom_write_byte(&EEPromArray[EEPROM_ADR_PARAM_LENGTH], length); // Länge der Datensätze merken // #define EEPROM_ADR_PARAM_LENGTH 98 |
||
374 | // eeprom_write_byte(&EEPromArray[98], length); // aufgelöst // lenght = 101 |
||
375 | eeprom_write_block(buffer, &EEPromArray[EEPROM_ADR_CHANNELS], 8); // 8 Kanäle merken // #define EEPROM_ADR_CHANNELS 80 |
||
376 | // eeprom_write_block(buffer, &EEPromArray[80], 8); // aufgelöst |
||
377 | |||
378 | SetActiveParamSetNumber(number); |
||
379 | LED_Init(); // initialisiert die Schalt-Ausgänge PORTC2 und PORTC3 an SV2 (control of J16 & J17) |
||
380 | } |
||
381 | //------------------------------------------------------------------------------------------------------------------------------------ |
||
382 | |||
383 | |||
384 | |||
385 | //------------------------------------------------------------------------------------------------------------------------------------- |
||
386 | unsigned char GetActiveParamSetNumber(void) // hier wird herausgelesen, mit welchem Parametersatz gefolgen werden soll |
||
387 | { // Beginner=3,Normal=2,Sport=1 |
||
388 | unsigned char set; |
||
389 | set = eeprom_read_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET]); // #define EEPROM_ADR_ACTIVE_SET 2 |
||
390 | if((set > 5) || (set < 1)) |
||
391 | { |
||
392 | set = 3; // default = Beginner |
||
393 | SetActiveParamSetNumber(set); // diesen Parametersatz als aktuell merken |
||
394 | } |
||
395 | return(set); |
||
396 | } |
||
397 | //------------------------------------------------------------------------------------------------------------------------------------- |
||
398 | |||
399 | |||
400 | |||
401 | //------------------------------------------------------------------------------------------------------------------------------------- |
||
402 | void SetActiveParamSetNumber(unsigned char number) |
||
403 | { |
||
404 | if(number > 5) number = 5; |
||
405 | if(number < 1) return; // #define EEPROM_ADR_ACTIVE_SET 2 |
||
406 | eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], number); // diesen Parametersatz im EEPROM als aktuell merken |
||
407 | } |
||
408 | //------------------------------------------------------------------------------------------------------------------------------------- |
||
409 | |||
410 | |||
411 | |||
412 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |