Rev 1179 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1179 | Rev 1180 | ||
---|---|---|---|
Line -... | Line 1... | ||
- | 1 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
- | 2 | // + Copyright (c) 04.2007 Holger Buss |
|
- | 3 | // + Nur für den privaten Gebrauch |
|
- | 4 | // + www.MikroKopter.com |
|
- | 5 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
- | 6 | // + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
|
- | 7 | // + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
|
- | 8 | // + Sollten direkte oder indirekte kommerzielle Absichten verfolgt werden, ist mit uns (info@mikrokopter.de) Kontakt |
|
- | 9 | // + bzgl. der Nutzungsbedingungen aufzunehmen. |
|
- | 10 | // + Eine kommerzielle Nutzung ist z.B.Verkauf von MikroKoptern, Bestückung und Verkauf von Platinen oder Bausätzen, |
|
- | 11 | // + Verkauf von Luftbildaufnahmen, usw. |
|
- | 12 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
- | 13 | // + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
|
- | 14 | // + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
|
- | 15 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
- | 16 | // + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
|
- | 17 | // + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
|
- | 18 | // + eindeutig als Ursprung verlinkt werden |
|
- | 19 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
- | 20 | // + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
|
- | 21 | // + Benutzung auf eigene Gefahr |
|
- | 22 | // + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
|
- | 23 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
- | 24 | // + Die Portierung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
|
- | 25 | // + mit unserer Zustimmung zulässig |
|
- | 26 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
- | 27 | // + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
|
- | 28 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
- | 29 | // + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
|
- | 30 | // + this list of conditions and the following disclaimer. |
|
- | 31 | // + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
|
- | 32 | // + from this software without specific prior written permission. |
|
- | 33 | // + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
|
- | 34 | // + for non-commercial use (directly or indirectly) |
|
- | 35 | // + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
|
- | 36 | // + with our written permission |
|
- | 37 | // + * If sources or documentations are redistributet on other webpages, out webpage (http://www.MikroKopter.de) must be |
|
- | 38 | // + clearly linked as origin |
|
- | 39 | // + * porting to systems other than hardware from www.mikrokopter.de is not allowed |
|
- | 40 | // + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
|
- | 41 | // + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|
- | 42 | // + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
|
- | 43 | // + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
|
- | 44 | // + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
- | 45 | // + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
|
- | 46 | // + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
|
- | 47 | // + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
|
- | 48 | // + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
- | 49 | // + POSSIBILITY OF SUCH DAMAGE. |
|
- | 50 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
- | 51 | ||
1 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
52 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2 | // + Konstanten |
53 | // + Contant Values |
3 | // + 0-250 -> normale Werte |
54 | // + 0-250 -> normale Values |
4 | // + 251 -> Poti1 |
55 | // + 251 -> Poti1 |
5 | // + 252 -> Poti2 |
56 | // + 252 -> Poti2 |
6 | // + 253 -> Poti3 |
57 | // + 253 -> Poti3 |
- | 58 | // + 254 -> Poti4 |
|
7 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
59 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
Line 8... | Line 60... | ||
8 | 60 | ||
9 | #ifndef EEMEM |
61 | #ifndef EEMEM |
10 | #define EEMEM __attribute__ ((section (".eeprom"))) |
62 | #define EEMEM __attribute__ ((section (".eeprom"))) |
Line 14... | Line 66... | ||
14 | #include <avr/eeprom.h> |
66 | #include <avr/eeprom.h> |
15 | #include <string.h> |
67 | #include <string.h> |
16 | #include "eeprom.h" |
68 | #include "eeprom.h" |
17 | #include "printf_P.h" |
69 | #include "printf_P.h" |
18 | #include "led.h" |
70 | #include "led.h" |
- | 71 | #include "main.h" |
|
Line 19... | Line 72... | ||
19 | 72 | ||
20 | 73 | ||
Line 28... | Line 81... | ||
28 | /***************************************************/ |
81 | /***************************************************/ |
29 | /* Default Values for parameter set 1 */ |
82 | /* Default Values for parameter set 1 */ |
30 | /***************************************************/ |
83 | /***************************************************/ |
31 | void ParamSet_DefaultSet1(void) // sport |
84 | void ParamSet_DefaultSet1(void) // sport |
32 | { |
85 | { |
- | 86 | if(BoardRelease >= 20) |
|
- | 87 | { |
|
- | 88 | ParamSet.GyroD = 5; |
|
- | 89 | ParamSet.DriftComp = 0; |
|
- | 90 | ParamSet.GyroAccFactor = 27; |
|
- | 91 | ParamSet.AngleTurnOverNick = 78; |
|
- | 92 | ParamSet.AngleTurnOverRoll = 78; |
|
- | 93 | } |
|
- | 94 | else |
|
- | 95 | { |
|
- | 96 | ParamSet.GyroD = 3; |
|
- | 97 | ParamSet.DriftComp = 32; |
|
- | 98 | ParamSet.GyroAccFactor = 30; |
|
- | 99 | ParamSet.AngleTurnOverNick = 85; |
|
- | 100 | ParamSet.AngleTurnOverRoll = 85; |
|
- | 101 | } |
|
33 | ParamSet.ChannelAssignment[CH_NICK] = 1; |
102 | ParamSet.ChannelAssignment[CH_NICK] = 1; |
34 | ParamSet.ChannelAssignment[CH_ROLL] = 2; |
103 | ParamSet.ChannelAssignment[CH_ROLL] = 2; |
35 | ParamSet.ChannelAssignment[CH_GAS] = 3; |
104 | ParamSet.ChannelAssignment[CH_GAS] = 3; |
36 | ParamSet.ChannelAssignment[CH_YAW] = 4; |
105 | ParamSet.ChannelAssignment[CH_YAW] = 4; |
37 | ParamSet.ChannelAssignment[CH_POTI1] = 5; |
106 | ParamSet.ChannelAssignment[CH_POTI1] = 5; |
38 | ParamSet.ChannelAssignment[CH_POTI2] = 6; |
107 | ParamSet.ChannelAssignment[CH_POTI2] = 6; |
39 | ParamSet.ChannelAssignment[CH_POTI3] = 7; |
108 | ParamSet.ChannelAssignment[CH_POTI3] = 7; |
40 | ParamSet.ChannelAssignment[CH_POTI4] = 8; |
109 | ParamSet.ChannelAssignment[CH_POTI4] = 8; |
41 | ParamSet.GlobalConfig = CFG_AXIS_COUPLING_ACTIVE | CFG_COMPASS_ACTIVE | CFG_GPS_ACTIVE;//CFG_HEIGHT_CONTROL | CFG_HEIGHT_SWITCH | CFG_COMPASS_FIX; |
110 | ParamSet.GlobalConfig = CFG_AXIS_COUPLING_ACTIVE | CFG_COMPASS_ACTIVE | CFG_GPS_ACTIVE;//CFG_HEIGHT_CONTROL | CFG_HEIGHT_SWITCH | CFG_COMPASS_FIX; |
42 | ParamSet.Height_MinGas = 30; |
111 | ParamSet.HeightMinGas = 30; |
43 | ParamSet.MaxHeight = 251; // Wert : 0-250 251 -> Poti1 |
112 | ParamSet.MaxHeight = 251; |
44 | ParamSet.Height_P = 10; // Wert : 0-32 |
113 | ParamSet.HeightP = 10; |
45 | ParamSet.Height_D = 30; // Wert : 0-250 |
114 | ParamSet.HeightD = 30; |
46 | ParamSet.Height_ACC_Effect = 30; // Wert : 0-250 |
115 | ParamSet.Height_ACC_Effect = 30; |
47 | ParamSet.Height_Gain = 4; // Wert : 0-50 |
116 | ParamSet.Height_Gain = 4; |
48 | ParamSet.Stick_P = 15; // Wert : 1-24 |
117 | ParamSet.StickP = 15; |
49 | ParamSet.Stick_D = 30; // Wert : 0-250 |
118 | ParamSet.StickD = 30; |
50 | ParamSet.Yaw_P = 12; // Wert : 1-20 |
119 | ParamSet.StickYawP = 12; |
51 | ParamSet.Gas_Min = 8; // Wert : 0-32 |
120 | ParamSet.GasMin = 8; |
52 | ParamSet.Gas_Max = 230; // Wert : 33-250 |
121 | ParamSet.GasMax = 230; |
53 | ParamSet.GyroAccFactor = 30; // Wert : 1-64 |
- | |
54 | ParamSet.CompassYawEffect = 128; // Wert : 0-250 |
122 | ParamSet.CompassYawEffect = 128; |
55 | ParamSet.Gyro_P = 80; // Wert : 0-250 |
123 | ParamSet.GyroP = 80; |
56 | ParamSet.Gyro_I = 150; // Wert : 0-250 |
124 | ParamSet.GyroI = 150; |
57 | ParamSet.LowVoltageWarning = 94; // Wert : 0-250 |
125 | ParamSet.LowVoltageWarning = 94; |
58 | ParamSet.EmergencyGas = 35; // Wert : 0-250 // Gaswert bei Empangsverlust |
126 | ParamSet.EmergencyGas = 35; |
59 | ParamSet.EmergencyGasDuration = 30; // Wert : 0-250 // Zeit bis auf EmergencyGas geschaltet wird, wg. Rx-Problemen |
127 | ParamSet.EmergencyGasDuration = 30; |
60 | ParamSet.UfoArrangement = 0; // X oder + Formation |
128 | ParamSet.UfoArrangement = 0; |
61 | ParamSet.I_Factor = 32; |
129 | ParamSet.IFactor = 32; |
62 | ParamSet.UserParam1 = 0; //zur freien Verwendung |
130 | ParamSet.UserParam1 = 0; |
63 | ParamSet.UserParam2 = 0; //zur freien Verwendung |
131 | ParamSet.UserParam2 = 0; |
64 | ParamSet.UserParam3 = 0; //zur freien Verwendung |
132 | ParamSet.UserParam3 = 0; |
65 | ParamSet.UserParam4 = 0; //zur freien Verwendung |
133 | ParamSet.UserParam4 = 0; |
66 | ParamSet.UserParam5 = 0; // zur freien Verwendung |
134 | ParamSet.UserParam5 = 0; |
67 | ParamSet.UserParam6 = 0; // zur freien Verwendung |
135 | ParamSet.UserParam6 = 0; |
68 | ParamSet.UserParam7 = 0; // zur freien Verwendung |
136 | ParamSet.UserParam7 = 0; |
69 | ParamSet.UserParam8 = 0; // zur freien Verwendung |
137 | ParamSet.UserParam8 = 0; |
70 | ParamSet.ServoNickControl = 100; // Wert : 0-250 // Stellung des Servos |
138 | ParamSet.ServoNickControl = 100; |
71 | ParamSet.ServoNickComp = 40; // Wert : 0-250 // Einfluss Gyro/Servo |
139 | ParamSet.ServoNickComp = 40; |
72 | ParamSet.ServoNickCompInvert = 0; // Wert : 0-250 // Richtung Einfluss Gyro/Servo |
140 | ParamSet.ServoNickCompInvert = 0; |
73 | ParamSet.ServoNickMin = 50; // Wert : 0-250 // Anschlag |
141 | ParamSet.ServoNickMin = 50; |
74 | ParamSet.ServoNickMax = 150; // Wert : 0-250 // Anschlag |
142 | ParamSet.ServoNickMax = 150; |
75 | ParamSet.ServoNickRefresh = 5; |
143 | ParamSet.ServoRefresh = 5; |
76 | ParamSet.LoopGasLimit = 50; |
144 | ParamSet.LoopGasLimit = 50; |
77 | ParamSet.LoopThreshold = 90; // Wert: 0-250 Schwelle für Stickausschlag |
145 | ParamSet.LoopThreshold = 90; |
78 | ParamSet.LoopHysteresis = 50; |
146 | ParamSet.LoopHysteresis = 50; |
79 | ParamSet.BitConfig = 0; // Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts / wird getrennt behandelt |
- | |
80 | ParamSet.Yaw_PosFeedback = 90; |
147 | ParamSet.BitConfig = 0; |
81 | ParamSet.Yaw_NegFeedback = 5; |
148 | ParamSet.AxisCoupling1 = 90; |
82 | ParamSet.AngleTurnOverNick = 85; |
149 | ParamSet.AxisCoupling2 = 67; |
83 | ParamSet.AngleTurnOverRoll = 85; |
150 | ParamSet.AxisCouplingYawCorrection = 0; |
84 | ParamSet.GyroAccTrim = 16; // 1/k |
151 | ParamSet.GyroAccTrim = 16; |
85 | ParamSet.DriftComp = 4; |
- | |
86 | ParamSet.DynamicStability = 100; |
152 | ParamSet.DynamicStability = 100; |
87 | ParamSet.J16Bitmask = 95; |
153 | ParamSet.J16Bitmask = 95; |
88 | ParamSet.J17Bitmask = 243; |
154 | ParamSet.J17Bitmask = 243; |
89 | ParamSet.J16Timing = 15; |
155 | ParamSet.J16Timing = 15; |
90 | ParamSet.J17Timing = 15; |
156 | ParamSet.J17Timing = 15; |
91 | ParamSet.NaviGpsModeControl = 253; |
157 | ParamSet.NaviGpsModeControl = 253; |
92 | ParamSet.NaviGpsGain = 100; |
158 | ParamSet.NaviGpsGain = 100; |
93 | ParamSet.NaviGpsP = 90; |
159 | ParamSet.NaviGpsP = 90; |
94 | ParamSet.NaviGpsI = 90; |
160 | ParamSet.NaviGpsI = 90; |
95 | ParamSet.NaviGpsD = 90; |
161 | ParamSet.NaviGpsD = 90; |
- | 162 | ParamSet.NaviGpsPLimit = 75; |
|
- | 163 | ParamSet.NaviGpsILimit = 75; |
|
- | 164 | ParamSet.NaviGpsDLimit = 75; |
|
96 | ParamSet.NaviGpsACC = 0; |
165 | ParamSet.NaviGpsACC = 0; |
97 | ParamSet.NaviGpsMinSat = 6; |
166 | ParamSet.NaviGpsMinSat = 6; |
98 | ParamSet.NaviStickThreshold = 8; |
167 | ParamSet.NaviStickThreshold = 8; |
99 | ParamSet.NaviWindCorrection = 90; |
168 | ParamSet.NaviWindCorrection = 90; |
100 | ParamSet.NaviSpeedCompensation = 30; |
169 | ParamSet.NaviSpeedCompensation = 30; |
101 | ParamSet.NaviOperatingRadius = 100; |
170 | ParamSet.NaviOperatingRadius = 100; |
102 | ParamSet.NaviAngleLimitation = 60; |
171 | ParamSet.NaviAngleLimitation = 100; |
- | 172 | ParamSet.NaviPHLoginTime = 4; |
|
103 | memcpy(ParamSet.Name, "Sport\0",6); |
173 | memcpy(ParamSet.Name, "Sport\0",6); |
104 | } |
174 | } |
Line 105... | Line 175... | ||
105 | 175 | ||
106 | 176 | ||
107 | /***************************************************/ |
177 | /***************************************************/ |
108 | /* Default Values for parameter set 2 */ |
178 | /* Default Values for parameter set 2 */ |
109 | /***************************************************/ |
179 | /***************************************************/ |
- | 180 | void ParamSet_DefaultSet2(void) // normal |
|
- | 181 | { |
|
- | 182 | if(BoardRelease >= 20) |
|
- | 183 | { |
|
- | 184 | ParamSet.GyroD = 5; |
|
- | 185 | ParamSet.DriftComp = 0; |
|
- | 186 | ParamSet.GyroAccFactor = 27; |
|
- | 187 | ParamSet.AngleTurnOverNick = 78; |
|
- | 188 | ParamSet.AngleTurnOverRoll = 78; |
|
- | 189 | } |
|
- | 190 | else |
|
- | 191 | { |
|
- | 192 | ParamSet.GyroD = 3; |
|
- | 193 | ParamSet.DriftComp = 32; |
|
- | 194 | ParamSet.GyroAccFactor = 30; |
|
- | 195 | ParamSet.AngleTurnOverNick = 85; |
|
110 | void ParamSet_DefaultSet2(void) // normal |
196 | ParamSet.AngleTurnOverRoll = 85; |
111 | { |
197 | } |
112 | ParamSet.ChannelAssignment[CH_NICK] = 1; |
198 | ParamSet.ChannelAssignment[CH_NICK] = 1; |
113 | ParamSet.ChannelAssignment[CH_ROLL] = 2; |
199 | ParamSet.ChannelAssignment[CH_ROLL] = 2; |
114 | ParamSet.ChannelAssignment[CH_GAS] = 3; |
200 | ParamSet.ChannelAssignment[CH_GAS] = 3; |
115 | ParamSet.ChannelAssignment[CH_YAW] = 4; |
201 | ParamSet.ChannelAssignment[CH_YAW] = 4; |
116 | ParamSet.ChannelAssignment[CH_POTI1] = 5; |
202 | ParamSet.ChannelAssignment[CH_POTI1] = 5; |
117 | ParamSet.ChannelAssignment[CH_POTI2] = 6; |
203 | ParamSet.ChannelAssignment[CH_POTI2] = 6; |
118 | ParamSet.ChannelAssignment[CH_POTI3] = 7; |
204 | ParamSet.ChannelAssignment[CH_POTI3] = 7; |
119 | ParamSet.ChannelAssignment[CH_POTI4] = 8; |
205 | ParamSet.ChannelAssignment[CH_POTI4] = 8; |
120 | ParamSet.GlobalConfig = CFG_AXIS_COUPLING_ACTIVE | CFG_COMPASS_ACTIVE | CFG_GPS_ACTIVE;//CFG_HEIGHT_CONTROL | CFG_HEIGHT_SWITCH | CFG_COMPASS_FIX; |
206 | ParamSet.GlobalConfig = CFG_AXIS_COUPLING_ACTIVE | CFG_COMPASS_ACTIVE | CFG_GPS_ACTIVE;//CFG_HEIGHT_CONTROL | CFG_HEIGHT_SWITCH | CFG_COMPASS_FIX; |
121 | ParamSet.Height_MinGas = 30; |
207 | ParamSet.HeightMinGas = 30; |
122 | ParamSet.MaxHeight = 251; // Wert : 0-250 251 -> Poti1 |
208 | ParamSet.MaxHeight = 251; |
123 | ParamSet.Height_P = 10; // Wert : 0-32 |
209 | ParamSet.HeightP = 10; |
124 | ParamSet.Height_D = 30; // Wert : 0-250 |
210 | ParamSet.HeightD = 30; |
125 | ParamSet.Height_ACC_Effect = 30; // Wert : 0-250 |
211 | ParamSet.Height_ACC_Effect = 30; |
126 | ParamSet.Height_Gain = 3; // Wert : 0-50 |
212 | ParamSet.Height_Gain = 3; |
127 | ParamSet.Stick_P = 12; // Wert : 1-24 |
213 | ParamSet.StickP = 12; |
128 | ParamSet.Stick_D = 16; // Wert : 0-250 |
214 | ParamSet.StickD = 16; |
129 | ParamSet.Yaw_P = 6; // Wert : 1-20 |
215 | ParamSet.StickYawP = 6; |
130 | ParamSet.Gas_Min = 8; // Wert : 0-32 |
- | |
131 | ParamSet.Gas_Max = 230; // Wert : 33-250 |
216 | ParamSet.GasMin = 8; |
132 | ParamSet.GyroAccFactor = 30; // Wert : 1-64 |
217 | ParamSet.GasMax = 230; |
133 | ParamSet.CompassYawEffect = 128; // Wert : 0-250 |
218 | ParamSet.CompassYawEffect = 128; |
134 | ParamSet.Gyro_P = 80; // Wert : 0-250 |
219 | ParamSet.GyroP = 80; |
135 | ParamSet.Gyro_I = 120; // Wert : 0-250 |
220 | ParamSet.GyroI = 120; |
136 | ParamSet.LowVoltageWarning = 94; // Wert : 0-250 |
221 | ParamSet.LowVoltageWarning = 94; |
137 | ParamSet.EmergencyGas = 35; // Wert : 0-250 // Gaswert bei Empangsverlust |
222 | ParamSet.EmergencyGas = 35; |
138 | ParamSet.EmergencyGasDuration = 30; // Wert : 0-250 // Zeit bis auf EmergencyGas geschaltet wird, wg. Rx-Problemen |
223 | ParamSet.EmergencyGasDuration = 30; |
139 | ParamSet.UfoArrangement = 0; // X oder + Formation |
224 | ParamSet.UfoArrangement = 0; |
140 | ParamSet.I_Factor = 32; |
225 | ParamSet.IFactor = 32; |
141 | ParamSet.UserParam1 = 0; // zur freien Verwendung |
226 | ParamSet.UserParam1 = 0; |
142 | ParamSet.UserParam2 = 0; // zur freien Verwendung |
227 | ParamSet.UserParam2 = 0; |
143 | ParamSet.UserParam3 = 0; // zur freien Verwendung |
228 | ParamSet.UserParam3 = 0; |
144 | ParamSet.UserParam4 = 0; // zur freien Verwendung |
229 | ParamSet.UserParam4 = 0; |
145 | ParamSet.UserParam5 = 0; // zur freien Verwendung |
230 | ParamSet.UserParam5 = 0; |
146 | ParamSet.UserParam6 = 0; // zur freien Verwendung |
231 | ParamSet.UserParam6 = 0; |
147 | ParamSet.UserParam7 = 0; // zur freien Verwendung |
232 | ParamSet.UserParam7 = 0; |
148 | ParamSet.UserParam8 = 0; // zur freien Verwendung |
233 | ParamSet.UserParam8 = 0; |
149 | ParamSet.ServoNickControl = 100; // Wert : 0-250 // Stellung des Servos |
234 | ParamSet.ServoNickControl = 100; |
150 | ParamSet.ServoNickComp = 40; // Wert : 0-250 // Einfluss Gyro/Servo |
235 | ParamSet.ServoNickComp = 40; |
151 | ParamSet.ServoNickCompInvert = 0; // Wert : 0-250 // Richtung Einfluss Gyro/Servo |
236 | ParamSet.ServoNickCompInvert = 0; |
152 | ParamSet.ServoNickMin = 50; // Wert : 0-250 // Anschlag |
237 | ParamSet.ServoNickMin = 50; |
153 | ParamSet.ServoNickMax = 150; // Wert : 0-250 // Anschlag |
238 | ParamSet.ServoNickMax = 150; |
154 | ParamSet.ServoNickRefresh = 5; |
239 | ParamSet.ServoRefresh = 5; |
155 | ParamSet.LoopGasLimit = 50; |
240 | ParamSet.LoopGasLimit = 50; |
156 | ParamSet.LoopThreshold = 90; // Wert: 0-250 Schwelle für Stickausschlag |
- | |
157 | ParamSet.LoopHysteresis = 50; |
- | |
158 | ParamSet.BitConfig = 0; // Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts |
241 | ParamSet.LoopThreshold = 90; |
159 | ParamSet.Yaw_PosFeedback = 90; // Faktor, mit dem Yaw die Achsen Roll und Nick verkoppelt |
242 | ParamSet.LoopHysteresis = 50; |
160 | ParamSet.Yaw_NegFeedback = 5; |
243 | ParamSet.BitConfig = 0; |
161 | ParamSet.AngleTurnOverNick = 85; |
244 | ParamSet.AxisCoupling1 = 90; |
162 | ParamSet.AngleTurnOverRoll = 85; |
245 | ParamSet.AxisCoupling2 = 67; |
163 | ParamSet.GyroAccTrim = 32; // 1/k |
246 | ParamSet.AxisCouplingYawCorrection = 60; |
164 | ParamSet.DriftComp = 4; |
247 | ParamSet.GyroAccTrim = 32; |
165 | ParamSet.DynamicStability = 75; |
248 | ParamSet.DynamicStability = 75; |
166 | ParamSet.J16Bitmask = 95; |
249 | ParamSet.J16Bitmask = 95; |
167 | ParamSet.J17Bitmask = 243; |
250 | ParamSet.J17Bitmask = 243; |
168 | ParamSet.J16Timing = 20; |
251 | ParamSet.J16Timing = 20; |
169 | ParamSet.J17Timing = 20; |
252 | ParamSet.J17Timing = 20; |
170 | ParamSet.NaviGpsModeControl = 253; |
253 | ParamSet.NaviGpsModeControl = 253; |
171 | ParamSet.NaviGpsGain = 100; |
254 | ParamSet.NaviGpsGain = 100; |
172 | ParamSet.NaviGpsP = 90; |
255 | ParamSet.NaviGpsP = 90; |
- | 256 | ParamSet.NaviGpsI = 90; |
|
- | 257 | ParamSet.NaviGpsD = 90; |
|
- | 258 | ParamSet.NaviGpsPLimit = 75; |
|
173 | ParamSet.NaviGpsI = 90; |
259 | ParamSet.NaviGpsILimit = 75; |
174 | ParamSet.NaviGpsD = 90; |
260 | ParamSet.NaviGpsDLimit = 75; |
175 | ParamSet.NaviGpsACC = 0; |
261 | ParamSet.NaviGpsACC = 0; |
176 | ParamSet.NaviGpsMinSat = 6; |
262 | ParamSet.NaviGpsMinSat = 6; |
177 | ParamSet.NaviStickThreshold = 8; |
263 | ParamSet.NaviStickThreshold = 8; |
178 | ParamSet.NaviWindCorrection = 90; |
264 | ParamSet.NaviWindCorrection = 90; |
179 | ParamSet.NaviSpeedCompensation = 30; |
265 | ParamSet.NaviSpeedCompensation = 30; |
- | 266 | ParamSet.NaviOperatingRadius = 100; |
|
180 | ParamSet.NaviOperatingRadius = 100; |
267 | ParamSet.NaviAngleLimitation = 100; |
181 | ParamSet.NaviAngleLimitation = 60; |
268 | ParamSet.NaviPHLoginTime = 4; |
Line 182... | Line 269... | ||
182 | memcpy(ParamSet.Name, "Normal\0", 7); |
269 | memcpy(ParamSet.Name, "Normal\0", 7); |
183 | } |
270 | } |
184 | 271 | ||
185 | 272 | ||
186 | /***************************************************/ |
273 | /***************************************************/ |
- | 274 | /* Default Values for parameter set 3 */ |
|
- | 275 | /***************************************************/ |
|
- | 276 | void ParamSet_DefaultSet3(void) // beginner |
|
- | 277 | { |
|
- | 278 | if(BoardRelease >= 20) |
|
- | 279 | { |
|
- | 280 | ParamSet.GyroD = 5; |
|
- | 281 | ParamSet.DriftComp = 0; |
|
- | 282 | ParamSet.GyroAccFactor = 27; // Wert : 1-64 |
|
- | 283 | ParamSet.AngleTurnOverNick = 78; |
|
- | 284 | ParamSet.AngleTurnOverRoll = 78; |
|
- | 285 | } |
|
- | 286 | else |
|
- | 287 | { |
|
- | 288 | ParamSet.GyroD = 3; |
|
- | 289 | ParamSet.DriftComp = 32; |
|
187 | /* Default Values for parameter set 3 */ |
290 | ParamSet.GyroAccFactor = 30; // Wert : 1-64 |
188 | /***************************************************/ |
291 | ParamSet.AngleTurnOverNick = 85; |
189 | void ParamSet_DefaultSet3(void) // beginner |
292 | ParamSet.AngleTurnOverRoll = 85; |
190 | { |
293 | } |
191 | ParamSet.ChannelAssignment[CH_NICK] = 1; |
294 | ParamSet.ChannelAssignment[CH_NICK] = 1; |
192 | ParamSet.ChannelAssignment[CH_ROLL] = 2; |
295 | ParamSet.ChannelAssignment[CH_ROLL] = 2; |
193 | ParamSet.ChannelAssignment[CH_GAS] = 3; |
296 | ParamSet.ChannelAssignment[CH_GAS] = 3; |
194 | ParamSet.ChannelAssignment[CH_YAW] = 4; |
297 | ParamSet.ChannelAssignment[CH_YAW] = 4; |
195 | ParamSet.ChannelAssignment[CH_POTI1] = 5; |
298 | ParamSet.ChannelAssignment[CH_POTI1] = 5; |
196 | ParamSet.ChannelAssignment[CH_POTI2] = 6; |
299 | ParamSet.ChannelAssignment[CH_POTI2] = 6; |
197 | ParamSet.ChannelAssignment[CH_POTI3] = 7; |
300 | ParamSet.ChannelAssignment[CH_POTI3] = 7; |
198 | ParamSet.ChannelAssignment[CH_POTI4] = 8; |
301 | ParamSet.ChannelAssignment[CH_POTI4] = 8; |
199 | ParamSet.GlobalConfig = CFG_ROTARY_RATE_LIMITER | CFG_AXIS_COUPLING_ACTIVE | CFG_COMPASS_ACTIVE | CFG_GPS_ACTIVE;//CFG_HEIGHT_CONTROL | CFG_HEIGHT_SWITCH | CFG_COMPASS_FIX; |
302 | ParamSet.GlobalConfig = CFG_ROTARY_RATE_LIMITER | CFG_AXIS_COUPLING_ACTIVE | CFG_COMPASS_ACTIVE | CFG_GPS_ACTIVE;//CFG_HEIGHT_CONTROL | CFG_HEIGHT_SWITCH | CFG_COMPASS_FIX; |
200 | ParamSet.Height_MinGas = 30; |
303 | ParamSet.HeightMinGas = 30; |
201 | ParamSet.MaxHeight = 251; // Wert : 0-250 251 -> Poti1 |
304 | ParamSet.MaxHeight = 251; |
202 | ParamSet.Height_P = 10; // Wert : 0-32 |
305 | ParamSet.HeightP = 10; |
203 | ParamSet.Height_D = 30; // Wert : 0-250 |
306 | ParamSet.HeightD = 30; |
204 | ParamSet.Height_ACC_Effect = 30; // Wert : 0-250 |
307 | ParamSet.Height_ACC_Effect = 30; |
205 | ParamSet.Height_Gain = 3; // Wert : 0-50 |
308 | ParamSet.Height_Gain = 3; |
206 | ParamSet.Stick_P = 8; // Wert : 1-24 |
309 | ParamSet.StickP = 8; |
207 | ParamSet.Stick_D = 16; // Wert : 0-250 |
- | |
208 | ParamSet.Yaw_P = 6; // Wert : 1-20 |
310 | ParamSet.StickD = 16; |
209 | ParamSet.Gas_Min = 8; // Wert : 0-32 |
311 | ParamSet.StickYawP = 6; |
210 | ParamSet.Gas_Max = 230; // Wert : 33-250 |
312 | ParamSet.GasMin = 8; |
211 | ParamSet.GyroAccFactor = 30; // Wert : 1-64 |
313 | ParamSet.GasMax = 230; |
212 | ParamSet.CompassYawEffect = 128; // Wert : 0-250 |
314 | ParamSet.CompassYawEffect = 128; |
213 | ParamSet.Gyro_P = 100; // Wert : 0-250 |
315 | ParamSet.GyroP = 100; |
214 | ParamSet.Gyro_I = 120; // Wert : 0-250 |
316 | ParamSet.GyroI = 120; |
215 | ParamSet.LowVoltageWarning = 94; // Wert : 0-250 |
317 | ParamSet.LowVoltageWarning = 94; |
216 | ParamSet.EmergencyGas = 35; // Wert : 0-250 // Gaswert bei Empangsverlust |
318 | ParamSet.EmergencyGas = 35; |
217 | ParamSet.EmergencyGasDuration = 20; // Wert : 0-250 // Zeit bis auf EmergencyGas geschaltet wird, wg. Rx-Problemen |
319 | ParamSet.EmergencyGasDuration = 20; |
218 | ParamSet.UfoArrangement = 0; // X oder + Formation |
320 | ParamSet.UfoArrangement = 0; |
219 | ParamSet.I_Factor = 16; |
321 | ParamSet.IFactor = 16; |
220 | ParamSet.UserParam1 = 0; // zur freien Verwendung |
322 | ParamSet.UserParam1 = 0; |
221 | ParamSet.UserParam2 = 0; // zur freien Verwendung |
323 | ParamSet.UserParam2 = 0; |
222 | ParamSet.UserParam3 = 0; // zur freien Verwendung |
324 | ParamSet.UserParam3 = 0; |
223 | ParamSet.UserParam4 = 0; // zur freien Verwendung |
325 | ParamSet.UserParam4 = 0; |
224 | ParamSet.UserParam5 = 0; // zur freien Verwendung |
326 | ParamSet.UserParam5 = 0; |
225 | ParamSet.UserParam6 = 0; // zur freien Verwendung |
327 | ParamSet.UserParam6 = 0; |
226 | ParamSet.UserParam7 = 0; // zur freien Verwendung |
328 | ParamSet.UserParam7 = 0; |
227 | ParamSet.UserParam8 = 0; // zur freien Verwendung |
329 | ParamSet.UserParam8 = 0; |
228 | ParamSet.ServoNickControl = 100; // Wert : 0-250 // Stellung des Servos |
330 | ParamSet.ServoNickControl = 100; |
229 | ParamSet.ServoNickComp = 40; // Wert : 0-250 // Einfluss Gyro/Servo |
331 | ParamSet.ServoNickComp = 40; |
230 | ParamSet.ServoNickCompInvert = 0; // Wert : 0-250 // Richtung Einfluss Gyro/Servo |
332 | ParamSet.ServoNickCompInvert = 0; |
231 | ParamSet.ServoNickMin = 50; // Wert : 0-250 // Anschlag |
333 | ParamSet.ServoNickMin = 50; |
232 | ParamSet.ServoNickMax = 150; // Wert : 0-250 // Anschlag |
334 | ParamSet.ServoNickMax = 150; |
233 | ParamSet.ServoNickRefresh = 5; |
- | |
234 | ParamSet.LoopGasLimit = 50; |
- | |
235 | ParamSet.LoopThreshold = 90; // Wert: 0-250 Schwelle für Stickausschlag |
335 | ParamSet.ServoRefresh = 5; |
236 | ParamSet.LoopHysteresis = 50; |
336 | ParamSet.LoopGasLimit = 50; |
237 | ParamSet.BitConfig = 0; // Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts |
337 | ParamSet.LoopThreshold = 90; |
238 | ParamSet.Yaw_PosFeedback = 90; // Faktor, mit dem Yaw die Achsen Roll und Nick verkoppelt |
338 | ParamSet.LoopHysteresis = 50; |
239 | ParamSet.Yaw_NegFeedback = 5; |
339 | ParamSet.BitConfig = 0; |
240 | ParamSet.AngleTurnOverNick = 85; |
340 | ParamSet.AxisCoupling1 = 90; |
241 | ParamSet.AngleTurnOverRoll = 85; |
341 | ParamSet.AxisCoupling2 = 67; |
242 | ParamSet.GyroAccTrim = 32; // 1/k |
342 | ParamSet.AxisCouplingYawCorrection = 70; |
243 | ParamSet.DriftComp = 4; |
343 | ParamSet.GyroAccTrim = 32; |
244 | ParamSet.DynamicStability = 50; |
344 | ParamSet.DynamicStability = 50; |
245 | ParamSet.J16Bitmask = 95; |
345 | ParamSet.J16Bitmask = 95; |
246 | ParamSet.J17Bitmask = 243; |
346 | ParamSet.J17Bitmask = 243; |
247 | ParamSet.J16Timing = 30; |
347 | ParamSet.J16Timing = 30; |
248 | ParamSet.J17Timing = 30; |
348 | ParamSet.J17Timing = 30; |
249 | ParamSet.NaviGpsModeControl = 253; |
349 | ParamSet.NaviGpsModeControl = 253; |
- | 350 | ParamSet.NaviGpsGain = 100; |
|
- | 351 | ParamSet.NaviGpsP = 90; |
|
- | 352 | ParamSet.NaviGpsI = 90; |
|
250 | ParamSet.NaviGpsGain = 100; |
353 | ParamSet.NaviGpsD = 90; |
251 | ParamSet.NaviGpsP = 90; |
354 | ParamSet.NaviGpsPLimit = 75; |
252 | ParamSet.NaviGpsI = 90; |
355 | ParamSet.NaviGpsILimit = 75; |
253 | ParamSet.NaviGpsD = 90; |
356 | ParamSet.NaviGpsDLimit = 75; |
254 | ParamSet.NaviGpsACC = 0; |
357 | ParamSet.NaviGpsACC = 0; |
255 | ParamSet.NaviGpsMinSat = 6; |
358 | ParamSet.NaviGpsMinSat = 6; |
256 | ParamSet.NaviStickThreshold = 8; |
359 | ParamSet.NaviStickThreshold = 8; |
- | 360 | ParamSet.NaviWindCorrection = 90; |
|
257 | ParamSet.NaviWindCorrection = 90; |
361 | ParamSet.NaviSpeedCompensation = 30; |
258 | ParamSet.NaviSpeedCompensation = 30; |
362 | ParamSet.NaviOperatingRadius = 100; |
Line 259... | Line 363... | ||
259 | ParamSet.NaviOperatingRadius = 100; |
363 | ParamSet.NaviAngleLimitation = 100; |
260 | ParamSet.NaviAngleLimitation = 60; |
364 | ParamSet.NaviPHLoginTime = 4; |
Line 312... | Line 416... | ||
312 | void ParamSet_WriteToEEProm(uint8_t setnumber) |
416 | void ParamSet_WriteToEEProm(uint8_t setnumber) |
313 | { |
417 | { |
314 | if(setnumber > 5) setnumber = 5; |
418 | if(setnumber > 5) setnumber = 5; |
315 | if(setnumber < 1) return; |
419 | if(setnumber < 1) return; |
316 | eeprom_write_block((uint8_t *) &ParamSet.ChannelAssignment[0], &EEPromArray[EEPROM_ADR_PARAMSET_BEGIN + PARAMSET_STRUCT_LEN * (setnumber - 1)], PARAMSET_STRUCT_LEN); |
420 | eeprom_write_block((uint8_t *) &ParamSet.ChannelAssignment[0], &EEPromArray[EEPROM_ADR_PARAMSET_BEGIN + PARAMSET_STRUCT_LEN * (setnumber - 1)], PARAMSET_STRUCT_LEN); |
- | 421 | eeprom_write_word((uint16_t *) &EEPromArray[EEPROM_ADR_PARAMSET_LENGTH], PARAMSET_STRUCT_LEN); |
|
- | 422 | eeprom_write_block( &ParamSet.ChannelAssignment[0], &EEPromArray[EEPROM_ADR_CHANNELS], 8); // backup the first 8 bytes that is the rc channel mapping |
|
317 | // set this parameter set to active set |
423 | // set this parameter set to active set |
318 | SetActiveParamSet(setnumber); |
424 | SetActiveParamSet(setnumber); |
319 | LED_Init(); |
425 | LED_Init(); |
320 | } |
426 | } |
Line 347... | Line 453... | ||
347 | /***************************************************/ |
453 | /***************************************************/ |
348 | /* Initialize EEPROM Parameter Sets */ |
454 | /* Initialize EEPROM Parameter Sets */ |
349 | /***************************************************/ |
455 | /***************************************************/ |
350 | void ParamSet_Init(void) |
456 | void ParamSet_Init(void) |
351 | { |
457 | { |
- | 458 | uint8_t Channel_Backup = 0; |
|
352 | // version check |
459 | // parameter version check |
353 | if(eeprom_read_byte(&EEPromArray[PID_VERSION]) != EEPARAM_VERSION) |
460 | if(eeprom_read_byte(&EEPromArray[PID_VERSION]) != EEPARAM_VERSION) |
354 | { |
461 | { |
355 | // if version check faild |
462 | // if version check faild |
356 | printf("\n\rInit. EEPROM: Generating Default-Parameter..."); |
463 | printf("\n\rInit. EEPROM"); |
- | 464 | ||
- | 465 | // check if cannel mapping backup is valid |
|
- | 466 | if( (eeprom_read_byte(&EEPromArray[EEPROM_ADR_CHANNELS+0]) < 12) |
|
- | 467 | && (eeprom_read_byte(&EEPromArray[EEPROM_ADR_CHANNELS+1]) < 12) |
|
- | 468 | && (eeprom_read_byte(&EEPromArray[EEPROM_ADR_CHANNELS+2]) < 12) |
|
357 | ParamSet_DefaultSet1(); // Fill ParamSet Structure to default parameter set 1 (Sport) |
469 | && (eeprom_read_byte(&EEPromArray[EEPROM_ADR_CHANNELS+3]) < 12) |
- | 470 | ) |
|
- | 471 | { |
|
- | 472 | Channel_Backup = 1; |
|
- | 473 | } |
|
358 | // fill all 5 parameter settings with set 1 except otherwise defined |
474 | // fill all 5 parameter settings |
359 | for (uint8_t i = 1;i < 6; i++) |
475 | for (uint8_t i = 1;i < 6; i++) |
360 | { |
476 | { |
- | 477 | switch(i) |
|
- | 478 | { |
|
- | 479 | case 1: |
|
- | 480 | ParamSet_DefaultSet1(); // Fill ParamSet Structure to default parameter set 1 (Sport) |
|
- | 481 | break; |
|
- | 482 | case 2: |
|
361 | if(i==2) ParamSet_DefaultSet2(); // Kamera |
483 | ParamSet_DefaultSet2(); // Kamera |
- | 484 | break; |
|
- | 485 | case 3: |
|
362 | if(i==3) ParamSet_DefaultSet3(); // Beginner |
486 | ParamSet_DefaultSet3(); // Beginner |
- | 487 | break; |
|
- | 488 | default: |
|
363 | if(i>3) ParamSet_DefaultSet2(); // Kamera |
489 | ParamSet_DefaultSet2(); // Kamera |
- | 490 | break; |
|
- | 491 | } |
|
- | 492 | if(Channel_Backup) // if we have a rc channel mapping backup in eeprom |
|
- | 493 | { |
|
- | 494 | // restore it |
|
- | 495 | ParamSet.ChannelAssignment[0] = eeprom_read_byte(&EEPromArray[EEPROM_ADR_CHANNELS+0]); |
|
- | 496 | ParamSet.ChannelAssignment[1] = eeprom_read_byte(&EEPromArray[EEPROM_ADR_CHANNELS+1]); |
|
- | 497 | ParamSet.ChannelAssignment[2] = eeprom_read_byte(&EEPromArray[EEPROM_ADR_CHANNELS+2]); |
|
- | 498 | ParamSet.ChannelAssignment[3] = eeprom_read_byte(&EEPromArray[EEPROM_ADR_CHANNELS+3]); |
|
- | 499 | ParamSet.ChannelAssignment[4] = eeprom_read_byte(&EEPromArray[EEPROM_ADR_CHANNELS+4]); |
|
- | 500 | ParamSet.ChannelAssignment[5] = eeprom_read_byte(&EEPromArray[EEPROM_ADR_CHANNELS+5]); |
|
- | 501 | ParamSet.ChannelAssignment[6] = eeprom_read_byte(&EEPromArray[EEPROM_ADR_CHANNELS+6]); |
|
- | 502 | ParamSet.ChannelAssignment[7] = eeprom_read_byte(&EEPromArray[EEPROM_ADR_CHANNELS+7]); |
|
- | 503 | } |
|
364 | ParamSet_WriteToEEProm(i); |
504 | ParamSet_WriteToEEProm(i); |
365 | } |
505 | } |
366 | // default-Setting is parameter set 3 |
506 | // default-Setting is parameter set 3 |
367 | SetActiveParamSet(3); |
507 | SetActiveParamSet(3); |
368 | // update version info |
508 | // update version info |