Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1471 | - | 1 | /***************************************************************************** |
2 | * Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
||
3 | * Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
||
4 | * Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
||
5 | * Copyright (C) 2011 Harald Bongartz * |
||
6 | * * |
||
7 | * This program is free software; you can redistribute it and/or modify * |
||
8 | * it under the terms of the GNU General Public License as published by * |
||
9 | * the Free Software Foundation; either version 2 of the License. * |
||
10 | * * |
||
11 | * This program is distributed in the hope that it will be useful, * |
||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
||
14 | * GNU General Public License for more details. * |
||
15 | * * |
||
16 | * You should have received a copy of the GNU General Public License * |
||
17 | * along with this program; if not, write to the * |
||
18 | * Free Software Foundation, Inc., * |
||
19 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
||
20 | * * |
||
21 | * * |
||
22 | * Credits to: * |
||
23 | * Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
||
24 | * http://www.mikrokopter.de * |
||
25 | * Gregor "killagreg" Stobrawa for his version of the MK code * |
||
26 | * Thomas Kaiser "thkais" for the original project. See * |
||
27 | * http://www.ft-fanpage.de/mikrokopter/ * |
||
28 | * http://forum.mikrokopter.de/topic-4061-1.html * |
||
29 | * Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
||
30 | * http://www.mylifesucks.de/oss/c-osd/ * |
||
31 | * Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
||
32 | *****************************************************************************/ |
||
33 | |||
34 | |||
35 | #ifndef _MK_DATA_STRUCTS_H |
||
36 | #define _MK_DATA_STRUCTS_H |
||
37 | |||
38 | |||
39 | // FC Version 0.86 |
||
40 | #define EEProm_Version 88 // FC EEProm Revision / Struktur FC 0.86 |
||
41 | #define FC_Version "0.86x" //Softwareversion der FC |
||
42 | |||
43 | |||
44 | #define u8 uint8_t |
||
45 | #define s8 int8_t |
||
46 | #define u16 uint16_t |
||
47 | #define s16 int16_t |
||
48 | #define u32 uint32_t |
||
49 | #define s32 int32_t |
||
50 | |||
51 | #define NUMBER_OF_DEBUG_DATAS 32 |
||
52 | #define ANALOG_NAME_LENGTH 16 |
||
53 | |||
54 | // Version of supported serial protocol |
||
55 | #define MIN_VERSION 7 |
||
56 | #define MAX_VERSION 10 |
||
57 | |||
58 | // Setting index |
||
59 | #define SETTING_1 1 |
||
60 | #define SETTING_2 2 |
||
61 | #define SETTING_3 3 |
||
62 | #define SETTING_4 4 |
||
63 | #define SETTING_5 5 |
||
64 | #define SETTING_CURRENT 0xff |
||
65 | |||
66 | typedef struct |
||
67 | { |
||
68 | unsigned char SWMajor; |
||
69 | unsigned char SWMinor; |
||
70 | unsigned char ProtoMajor; |
||
71 | unsigned char ProtoMinor; |
||
72 | unsigned char SWPatch; |
||
73 | unsigned char HardwareError[5]; |
||
74 | } __attribute__((packed)) Version_t; |
||
75 | |||
76 | |||
77 | // FC Debug Struct |
||
78 | // portions taken and adapted from |
||
79 | // http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.72p%2Fuart.h |
||
80 | // |
||
81 | typedef struct |
||
82 | { |
||
83 | uint8_t Digital[2]; |
||
84 | // NC: unsigned; FC: signed !!!! |
||
85 | int16_t Analog[32]; // Debugvalues |
||
86 | } __attribute__((packed)) DebugData_t; |
||
87 | |||
88 | //typedef struct |
||
89 | //{ |
||
90 | // uint8_t line; |
||
91 | // uint8_t text[20]; |
||
92 | //} __attribute__((packed)) Display_t; |
||
93 | |||
94 | |||
95 | //typedef struct |
||
96 | //{ |
||
97 | // uint8_t Revision; |
||
98 | // int8_t Name[12]; |
||
99 | // int8_t Motor[16][4]; |
||
100 | // uint8_t crc; |
||
101 | //} __attribute__((packed)) Mixer_t; |
||
102 | |||
103 | |||
104 | // |
||
105 | // NaviCtrl OSD Structs |
||
106 | // portions taken and adapted from |
||
107 | // http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=NaviCtrl&path=%2Ftags%2FV0.15c%2Fuart1.h |
||
108 | // |
||
109 | //typedef struct |
||
110 | //{ |
||
111 | // signed int Winkel[3]; // nick, roll, compass in 0,1.^ |
||
112 | // signed char Centroid[3]; |
||
113 | // signed char reserve[5]; |
||
114 | //} __attribute__((packed)) Data3D_t; |
||
115 | |||
116 | |||
117 | typedef struct |
||
118 | { |
||
119 | s32 Longitude; // in 1E-7 deg |
||
120 | s32 Latitude; // in 1E-7 deg |
||
121 | s32 Altitude; // in mm |
||
122 | u8 Status; // validity of data |
||
123 | } __attribute__((packed)) GPS_Pos_t; |
||
124 | |||
125 | |||
126 | typedef struct |
||
127 | { |
||
128 | u16 Distance; // distance to target in cm |
||
129 | s16 Bearing; // course to target in deg |
||
130 | } __attribute__((packed)) GPS_PosDev_t; |
||
131 | |||
132 | typedef struct |
||
133 | { |
||
134 | GPS_Pos_t Position; // the gps position of the waypoint, see ubx.h for details |
||
135 | s16 Heading; // orientation, 0 no action, 1...360 fix heading, neg. = Index to POI in WP List |
||
136 | u8 ToleranceRadius; // in meters, if the MK is within that range around the target, then the next target is triggered |
||
137 | u8 HoldTime; // in seconds, if the was once in the tolerance area around a WP, this time defines the delay before the next WP is triggered |
||
138 | u8 Event_Flag; // future implementation |
||
139 | u8 Index; // to indentify different waypoints, workaround for bad communications PC <-> NC |
||
140 | u8 Type; // typeof Waypoint |
||
141 | u8 WP_EventChannelValue; |
||
142 | u8 AltitudeRate; // rate to change the setpoint |
||
143 | u8 reserve[8]; // reserve |
||
144 | } __attribute__((packed)) Point_t; |
||
145 | |||
146 | |||
147 | // NaviCtrl struct |
||
148 | // taken from |
||
149 | // http://mikrocontroller.cco-ev.de/mikrowebsvn/filedetails.php?repname=NaviCtrl&path=%2Ftags%2FV0.15c%2Fuart1.h |
||
150 | // |
||
151 | typedef struct |
||
152 | { |
||
153 | u8 Version; // version of the data structure |
||
154 | GPS_Pos_t CurrentPosition; // see ubx.h for details |
||
155 | GPS_Pos_t TargetPosition; |
||
156 | GPS_PosDev_t TargetPositionDeviation; |
||
157 | GPS_Pos_t HomePosition; |
||
158 | GPS_PosDev_t HomePositionDeviation; |
||
159 | u8 WaypointIndex; // index of current waypoints running from 0 to WaypointNumber-1 |
||
160 | u8 WaypointNumber; // number of stored waypoints |
||
161 | u8 SatsInUse; // number of satellites used for position solution |
||
162 | s16 Altimeter; // hight according to air pressure |
||
163 | s16 Variometer; // climb(+) and sink(-) rate |
||
164 | u16 FlyingTime; // in seconds |
||
165 | u8 UBat; // Battery Voltage in 0.1 Volts |
||
166 | u16 GroundSpeed; // speed over ground in cm/s (2D) |
||
167 | s16 Heading; // current flight direction in . as angle to north |
||
168 | s16 CompassHeading; // current compass value in . |
||
169 | s8 AngleNick; // current Nick angle in 1. |
||
170 | s8 AngleRoll; // current Rick angle in 1. |
||
171 | u8 RC_Quality; // RC_Quality |
||
172 | u8 FCFlags; // Flags from FC |
||
173 | u8 NCFlags; // Flags from NC |
||
174 | u8 Errorcode; // 0 --> okay |
||
175 | u8 OperatingRadius; // current operation radius around the Home Position in m |
||
176 | s16 TopSpeed; // velocity in vertical direction in cm/s |
||
177 | u8 TargetHoldTime; // time in s to stay at the given target, counts down to 0 if target has been reached |
||
178 | u8 RC_RSSI; // Receiver signal strength (since version 2 added) |
||
179 | s16 SetpointAltitude; // setpoint for altitude |
||
180 | u8 Gas; // for future use |
||
181 | u16 Current; // actual current in 0.1A steps |
||
182 | u16 UsedCapacity; // used capacity in mAh |
||
183 | } __attribute__((packed)) NaviData_t; |
||
184 | |||
185 | |||
186 | |||
187 | |||
188 | // MikroKopter Flags |
||
189 | // taken from |
||
190 | // http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.73d%2Ffc.h |
||
191 | // |
||
192 | #define FCFLAG_MOTOR_RUN 0x01 |
||
193 | #define FCFLAG_FLY 0x02 |
||
194 | #define FCFLAG_CALIBRATE 0x04 |
||
195 | #define FCFLAG_START 0x08 |
||
196 | #define FCFLAG_NOTLANDUNG 0x10 |
||
197 | #define FCFLAG_LOWBAT 0x20 |
||
198 | #define FCFLAG_SPI_RX_ERR 0x40 |
||
199 | #define FCFLAG_I2CERR 0x80 |
||
200 | |||
201 | |||
202 | // NaviCtrl Flags |
||
203 | // taken from |
||
204 | // http://mikrocontroller.cco-ev.de/mikrowebsvn/filedetails.php?repname=NaviCtrl&path=%2Ftags%2FV0.15c%2Fuart1.h |
||
205 | // |
||
206 | #define NC_FLAG_FREE 0x01 |
||
207 | #define NC_FLAG_PH 0x02 |
||
208 | #define NC_FLAG_CH 0x04 |
||
209 | #define NC_FLAG_RANGE_LIMIT 0x08 |
||
210 | #define NC_FLAG_NOSERIALLINK 0x10 |
||
211 | #define NC_FLAG_TARGET_REACHED 0x20 |
||
212 | #define NC_FLAG_MANUAL_CONTROL 0x40 |
||
213 | #define NC_FLAG_GPS_OK 0x80 |
||
214 | |||
215 | |||
216 | |||
217 | |||
218 | // Aus FC eeprom.h |
||
219 | // |
||
220 | typedef struct |
||
221 | { |
||
222 | unsigned char Revision; |
||
223 | unsigned char Kanalbelegung[12]; // GAS[0], GIER[1],NICK[2], ROLL[3], POTI1, POTI2, POTI3 |
||
224 | unsigned char GlobalConfig; // 0x01=Höhenregler aktiv,0x02=Kompass aktiv, 0x04=GPS aktiv, 0x08=Heading Hold aktiv |
||
225 | unsigned char Hoehe_MinGas; // Wert : 0-100 |
||
226 | unsigned char Luftdruck_D; // Wert : 0-250 |
||
227 | unsigned char MaxHoehe; // Wert : 0-32 |
||
228 | unsigned char Hoehe_P; // Wert : 0-32 |
||
229 | unsigned char Hoehe_Verstaerkung; // Wert : 0-50 |
||
230 | unsigned char Hoehe_ACC_Wirkung; // Wert : 0-250 |
||
231 | unsigned char Hoehe_HoverBand; // Wert : 0-250 |
||
232 | unsigned char Hoehe_GPS_Z; // Wert : 0-250 |
||
233 | unsigned char Hoehe_StickNeutralPoint; // Wert : 0-250 |
||
234 | unsigned char Stick_P; // Wert : 1-6 |
||
235 | unsigned char Stick_D; // Wert : 0-64 |
||
236 | unsigned char StickGier_P; // Wert : 1-20 |
||
237 | unsigned char Gas_Min; // Wert : 0-32 |
||
238 | unsigned char Gas_Max; // Wert : 33-250 |
||
239 | unsigned char GyroAccFaktor; // Wert : 1-64 |
||
240 | unsigned char KompassWirkung; // Wert : 0-32 |
||
241 | unsigned char Gyro_P; // Wert : 10-250 |
||
242 | unsigned char Gyro_I; // Wert : 0-250 |
||
243 | unsigned char Gyro_D; // Wert : 0-250 |
||
244 | unsigned char Gyro_Gier_P; // Wert : 10-250 |
||
245 | unsigned char Gyro_Gier_I; // Wert : 0-250 |
||
246 | unsigned char Gyro_Stability; // Wert : 0-16 |
||
247 | unsigned char UnterspannungsWarnung; // Wert : 0-250 |
||
248 | unsigned char NotGas; // Wert : 0-250 //Gaswert bei Empängsverlust |
||
249 | unsigned char NotGasZeit; // Wert : 0-250 // Zeitbis auf NotGas geschaltet wird, wg. Rx-Problemen |
||
250 | unsigned char Receiver; // 0= Summensignal, 1= Spektrum, 2 =Jeti, 3=ACT DSL, 4=ACT S3D |
||
251 | unsigned char I_Faktor; // Wert : 0-250 |
||
252 | unsigned char UserParam1; // Wert : 0-250 |
||
253 | unsigned char UserParam2; // Wert : 0-250 |
||
254 | unsigned char UserParam3; // Wert : 0-250 |
||
255 | unsigned char UserParam4; // Wert : 0-250 |
||
256 | unsigned char ServoNickControl; // Wert : 0-250 // Stellung des Servos |
||
257 | unsigned char ServoNickComp; // Wert : 0-250 // Einfluss Gyro/Servo |
||
258 | unsigned char ServoNickMin; // Wert : 0-250 // Anschlag |
||
259 | unsigned char ServoNickMax; // Wert : 0-250 // Anschlag |
||
260 | //--- Seit V0.75 |
||
261 | unsigned char ServoRollControl; // Wert : 0-250 // Stellung des Servos |
||
262 | unsigned char ServoRollComp; // Wert : 0-250 |
||
263 | unsigned char ServoRollMin; // Wert : 0-250 |
||
264 | unsigned char ServoRollMax; // Wert : 0-250 |
||
265 | //--- |
||
266 | unsigned char ServoNickRefresh; // Speed of the Servo |
||
267 | unsigned char ServoManualControlSpeed; // |
||
268 | unsigned char CamOrientation; // |
||
269 | unsigned char Servo3; // Value or mapping of the Servo Output |
||
270 | unsigned char Servo4; // Value or mapping of the Servo Output |
||
271 | unsigned char Servo5; // Value or mapping of the Servo Output |
||
272 | unsigned char LoopGasLimit; // Wert: 0-250 max. Gas während Looping |
||
273 | unsigned char LoopThreshold; // Wert: 0-250 Schwelle für Stickausschlag |
||
274 | unsigned char LoopHysterese; // Wert: 0-250 Hysterese für Stickausschlag |
||
275 | unsigned char AchsKopplung1; // Wert: 0-250 Faktor, mit dem Gier die Achsen Roll und Nick koppelt (NickRollMitkopplung) |
||
276 | unsigned char AchsKopplung2; // Wert: 0-250 Faktor, mit dem Nick und Roll verkoppelt werden |
||
277 | unsigned char CouplingYawCorrection; // Wert: 0-250 Faktor, mit dem Nick und Roll verkoppelt werden |
||
278 | unsigned char WinkelUmschlagNick; // Wert: 0-250 180°-Punkt |
||
279 | unsigned char WinkelUmschlagRoll; // Wert: 0-250 180°-Punkt |
||
280 | unsigned char GyroAccAbgleich; // 1/k (Koppel_ACC_Wirkung) |
||
281 | unsigned char Driftkomp; |
||
282 | unsigned char DynamicStability; |
||
283 | unsigned char UserParam5; // Wert : 0-250 |
||
284 | unsigned char UserParam6; // Wert : 0-250 |
||
285 | unsigned char UserParam7; // Wert : 0-250 |
||
286 | unsigned char UserParam8; // Wert : 0-250 |
||
287 | //---Output --------------------------------------------- |
||
288 | unsigned char J16Bitmask; // for the J16 Output |
||
289 | unsigned char J16Timing; // for the J16 Output |
||
290 | unsigned char J17Bitmask; // for the J17 Output |
||
291 | unsigned char J17Timing; // for the J17 Output |
||
292 | // seit version V0.75c |
||
293 | unsigned char WARN_J16_Bitmask; // for the J16 Output |
||
294 | unsigned char WARN_J17_Bitmask; // for the J17 Output |
||
295 | //---NaviCtrl--------------------------------------------- |
||
296 | unsigned char NaviGpsModeControl; // Parameters for the Naviboard |
||
297 | unsigned char NaviGpsGain; |
||
298 | unsigned char NaviGpsP; |
||
299 | unsigned char NaviGpsI; |
||
300 | unsigned char NaviGpsD; |
||
301 | unsigned char NaviGpsPLimit; |
||
302 | unsigned char NaviGpsILimit; |
||
303 | unsigned char NaviGpsDLimit; |
||
304 | unsigned char NaviGpsACC; |
||
305 | unsigned char NaviGpsMinSat; |
||
306 | unsigned char NaviStickThreshold; |
||
307 | unsigned char NaviWindCorrection; |
||
308 | unsigned char NaviAccCompensation; // New since 0.86 -> was: SpeedCompensation |
||
309 | unsigned char NaviOperatingRadius; |
||
310 | unsigned char NaviAngleLimitation; |
||
311 | unsigned char NaviPH_LoginTime; |
||
312 | //---Ext.Ctrl--------------------------------------------- |
||
313 | unsigned char ExternalControl; // for serial Control |
||
314 | //---CareFree--------------------------------------------- |
||
315 | unsigned char OrientationAngle; // Where is the front-direction? |
||
316 | unsigned char CareFreeModeControl; // switch for CareFree |
||
317 | unsigned char MotorSafetySwitch; |
||
318 | unsigned char MotorSmooth; |
||
319 | unsigned char ComingHomeAltitude; |
||
320 | unsigned char FailSafeTime; |
||
321 | unsigned char MaxAltitude; |
||
322 | //------------------------------------------------ |
||
323 | unsigned char BitConfig; // (war Loop-Cfg) Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts / wird getrennt behandelt |
||
324 | unsigned char ServoCompInvert; // 0x01 = Nick, 0x02 = Roll 0 oder 1 // WICHTIG!!! am Ende lassen |
||
325 | unsigned char ExtraConfig; // bitcodiert |
||
326 | char Name[12]; |
||
327 | unsigned char crc; // MUST BE THE LAST BYTE! |
||
328 | } __attribute__((packed)) mk_param_struct_t; |
||
329 | |||
330 | #endif |