Rev 762 | Rev 832 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 762 | Rev 783 | ||
---|---|---|---|
1 | /**************************************************************************** |
1 | /**************************************************************************** |
2 | * Copyright (C) 2009-2010 by Claas Anders "CaScAdE" Rathje * |
2 | * Copyright (C) 2009-2010 by Claas Anders "CaScAdE" Rathje * |
3 | * admiralcascade@gmail.com * |
3 | * admiralcascade@gmail.com * |
4 | * Project-URL: http://www.mylifesucks.de/oss/c-osd/ * |
4 | * Project-URL: http://www.mylifesucks.de/oss/c-osd/ * |
5 | * * |
5 | * * |
6 | * This program is free software; you can redistribute it and/or modify * |
6 | * This program is free software; you can redistribute it and/or modify * |
7 | * it under the terms of the GNU General Public License as published by * |
7 | * it under the terms of the GNU General Public License as published by * |
8 | * the Free Software Foundation; either version 2 of the License. * |
8 | * the Free Software Foundation; either version 2 of the License. * |
9 | * * |
9 | * * |
10 | * This program is distributed in the hope that it will be useful, * |
10 | * This program is distributed in the hope that it will be useful, * |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
13 | * GNU General Public License for more details. * |
13 | * GNU General Public License for more details. * |
14 | * * |
14 | * * |
15 | * You should have received a copy of the GNU General Public License * |
15 | * You should have received a copy of the GNU General Public License * |
16 | * along with this program; if not, write to the * |
16 | * along with this program; if not, write to the * |
17 | * Free Software Foundation, Inc., * |
17 | * Free Software Foundation, Inc., * |
18 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
18 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
19 | ****************************************************************************/ |
19 | ****************************************************************************/ |
20 | 20 | ||
21 | #ifndef _MK_DATA_STRUCTS_H |
21 | #ifndef _MK_DATA_STRUCTS_H |
22 | #define _MK_DATA_STRUCTS_H |
22 | #define _MK_DATA_STRUCTS_H |
23 | 23 | ||
24 | /* ########################################################################## |
24 | /* ########################################################################## |
25 | * gain some fake arm compat :) |
25 | * gain some fake arm compat :) |
26 | * ##########################################################################*/ |
26 | * ##########################################################################*/ |
27 | #define u8 uint8_t |
27 | #define u8 uint8_t |
28 | #define s8 int8_t |
28 | #define s8 int8_t |
29 | #define u16 uint16_t |
29 | #define u16 uint16_t |
30 | #define s16 int16_t |
30 | #define s16 int16_t |
31 | #define u32 uint32_t |
31 | #define u32 uint32_t |
32 | #define s32 int32_t |
32 | #define s32 int32_t |
33 | 33 | ||
34 | /* |
34 | /* |
35 | * FC Debug Struct |
35 | * FC Debug Struct |
36 | * portions taken and adapted from |
36 | * portions taken and adapted from |
37 | * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.72p%2Fuart.h |
37 | * http://svn.mikrokopter.de/filedetails.php?repname=FlightCtrl&path=/tags/V0.80d/uart.h |
38 | */ |
38 | */ |
39 | typedef struct { |
39 | typedef struct { |
40 | uint8_t Digital[2]; |
40 | unsigned char Status[2]; |
41 | uint16_t Analog[32]; // Debugvalues |
41 | signed int Analog[32]; // Debugwerte |
42 | } __attribute__((packed)) DebugOut_t; |
42 | } __attribute__((packed)) str_DebugOut; |
43 | 43 | ||
44 | typedef struct { |
44 | typedef struct { |
45 | unsigned char SWMajor; |
45 | unsigned char SWMajor; |
46 | unsigned char SWMinor; |
46 | unsigned char SWMinor; |
47 | unsigned char ProtoMajor; |
47 | unsigned char ProtoMajor; |
48 | unsigned char ProtoMinor; |
48 | unsigned char ProtoMinor; |
49 | unsigned char SWPatch; |
49 | unsigned char SWPatch; |
50 | unsigned char Reserved[5]; |
50 | unsigned char HardwareError[5]; |
51 | } str_VersionInfo; |
51 | } __attribute__((packed)) str_VersionInfo; |
52 | 52 | ||
53 | /* |
53 | /* |
54 | * NaviCtrl OSD Structs |
54 | * NaviCtrl GPS Structs |
55 | * portions taken and adapted from |
55 | * portions taken and adapted from |
56 | * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=NaviCtrl&path=%2Ftags%2FV0.18c%2Fuart1.h |
56 | * http://svn.mikrokopter.de/filedetails.php?repname=NaviCtrl&path=/tags/V0.20c/ubx.h |
57 | */ |
57 | */ |
58 | typedef struct { |
58 | typedef struct { |
59 | s32 Longitude; // in 1E-7 deg |
59 | s32 Longitude; // in 1E-7 deg |
60 | s32 Latitude; // in 1E-7 deg |
60 | s32 Latitude; // in 1E-7 deg |
61 | s32 Altitude; // in mm |
61 | s32 Altitude; // in mm |
62 | u8 Status; // validity of data |
62 | u8 Status;// validity of data |
63 | } __attribute__((packed)) GPS_Pos_t; |
63 | } __attribute__((packed)) GPS_Pos_t; |
- | 64 | ||
64 | #define INVALID 0x00 |
65 | #define INVALID 0x00 |
65 | #define NEWDATA 0x01 |
66 | #define NEWDATA 0x01 |
66 | #define PROCESSED 0x02 |
67 | #define PROCESSED 0x02 |
- | 68 | ||
- | 69 | ||
- | 70 | /* |
|
- | 71 | * NaviCtrl OSD Structs |
|
- | 72 | * portions taken and adapted from |
|
- | 73 | * http://svn.mikrokopter.de/filedetails.php?repname=NaviCtrl&path=/tags/V0.20c/uart1.h |
|
67 | 74 | */ |
|
68 | typedef struct { |
75 | typedef struct { |
69 | u16 Distance; // distance to target in cm |
76 | u16 Distance; // distance to target in dm |
70 | s16 Bearing; // course to target in deg |
77 | s16 Bearing; // course to target in deg |
71 | } __attribute__((packed)) GPS_PosDev_t; |
78 | } __attribute__((packed)) GPS_PosDev_t; |
72 | 79 | ||
73 | typedef struct { |
80 | typedef struct { |
74 | u8 Version; // version of the data structure |
81 | u8 Version; // version of the data structure |
75 | GPS_Pos_t CurrentPosition; // see ubx.h for details |
82 | GPS_Pos_t CurrentPosition; // see ubx.h for details |
76 | GPS_Pos_t TargetPosition; |
83 | GPS_Pos_t TargetPosition; |
77 | GPS_PosDev_t TargetPositionDeviation; |
84 | GPS_PosDev_t TargetPositionDeviation; |
78 | GPS_Pos_t HomePosition; |
85 | GPS_Pos_t HomePosition; |
79 | GPS_PosDev_t HomePositionDeviation; |
86 | GPS_PosDev_t HomePositionDeviation; |
80 | u8 WaypointIndex; // index of current waypoints running from 0 to WaypointNumber-1 |
87 | u8 WaypointIndex; // index of current waypoints running from 0 to WaypointNumber-1 |
81 | u8 WaypointNumber; // number of stored waypoints |
88 | u8 WaypointNumber; // number of stored waypoints |
82 | u8 SatsInUse; // number of satellites used for position solution |
89 | u8 SatsInUse; // number of satellites used for position solution |
83 | s16 Altimeter; // hight according to air pressure |
90 | s16 Altimeter; // hight according to air pressure |
84 | s16 Variometer; // climb(+) and sink(-) rate |
91 | s16 Variometer; // climb(+) and sink(-) rate |
85 | u16 FlyingTime; // in seconds |
92 | u16 FlyingTime; // in seconds |
86 | u8 UBat; // Battery Voltage in 0.1 Volts |
93 | u8 UBat; // Battery Voltage in 0.1 Volts |
87 | u16 GroundSpeed; // speed over ground in cm/s (2D) |
94 | u16 GroundSpeed; // speed over ground in cm/s (2D) |
88 | s16 Heading; // current flight direction in � as angle to north |
95 | s16 Heading; // current flight direction in ° as angle to north |
89 | s16 CompassHeading; // current compass value in � |
96 | s16 CompassHeading; // current compass value in ° |
90 | s8 AngleNick; // current Nick angle in 1� |
97 | s8 AngleNick; // current Nick angle in 1° |
91 | s8 AngleRoll; // current Rick angle in 1� |
98 | s8 AngleRoll; // current Rick angle in 1° |
92 | u8 RC_Quality; // RC_Quality |
99 | u8 RC_Quality; // RC_Quality |
93 | u8 FCFlags; // Flags from FC |
100 | u8 FCFlags; // Flags from FC |
94 | u8 NCFlags; // Flags from NC |
101 | u8 NCFlags; // Flags from NC |
95 | u8 Errorcode; // 0 --> okay |
102 | u8 Errorcode; // 0 --> okay |
96 | u8 OperatingRadius; // current operation radius around the Home Position in m |
103 | u8 OperatingRadius; // current operation radius around the Home Position in m |
97 | s16 TopSpeed; // velocity in vertical direction in cm/s |
104 | s16 TopSpeed; // velocity in vertical direction in cm/s |
98 | u8 TargetHoldTime; // time in s to stay at the given target, counts down to 0 if target has been reached |
105 | u8 TargetHoldTime; // time in s to stay at the given target, counts down to 0 if target has been reached |
99 | u8 RC_RSSI; // Receiver signal strength (since version 2 added) |
106 | u8 RC_RSSI; // Receiver signal strength (since version 2 added) |
100 | s16 SetpointAltitude; // setpoint for altitude |
107 | s16 SetpointAltitude; // setpoint for altitude |
101 | u8 Gas; // for future use |
108 | u8 Gas; // for future use |
102 | u16 Current; // actual current in 0.1A steps |
109 | u16 Current; // actual current in 0.1A steps |
103 | u16 UsedCapacity; // used capacity in mAh |
110 | u16 UsedCapacity; // used capacity in mAh |
104 | } __attribute__((packed)) NaviData_t; |
111 | } __attribute__((packed)) NaviData_t; |
- | 112 | ||
- | 113 | #define NC_FLAG_FREE 0x01 |
|
- | 114 | #define NC_FLAG_PH 0x02 |
|
- | 115 | #define NC_FLAG_CH 0x04 |
|
- | 116 | #define NC_FLAG_RANGE_LIMIT 0x08 |
|
- | 117 | #define NC_FLAG_NOSERIALLINK 0x10 |
|
- | 118 | #define NC_FLAG_TARGET_REACHED 0x20 |
|
- | 119 | #define NC_FLAG_MANUAL_CONTROL 0x40 |
|
105 | 120 | #define NC_FLAG_8 0x80 |
|
106 | 121 | ||
107 | /* |
122 | /* |
108 | * MikroKopter Flags |
123 | * MikroKopter Flags |
109 | * taken from |
124 | * portions taken and adapted from |
110 | * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.78b%2Ffc.h |
125 | * http://svn.mikrokopter.de/filedetails.php?repname=FlightCtrl&path=/tags/V0.80d/fc.h |
111 | */ |
126 | */ |
112 | #define FCFLAG_MOTOR_RUN 0x01 |
127 | #define FCFLAG_MOTOR_RUN 0x01 |
113 | #define FCFLAG_FLY 0x02 |
128 | #define FCFLAG_FLY 0x02 |
114 | #define FCFLAG_CALIBRATE 0x04 |
129 | #define FCFLAG_CALIBRATE 0x04 |
115 | #define FCFLAG_START 0x08 |
130 | #define FCFLAG_START 0x08 |
116 | #define FCFLAG_NOTLANDUNG 0x10 |
131 | #define FCFLAG_NOTLANDUNG 0x10 |
117 | #define FCFLAG_LOWBAT 0x20 |
132 | #define FCFLAG_LOWBAT 0x20 |
118 | #define FCFLAG_SPI_RX_ERR 0x40 |
133 | #define FCFLAG_SPI_RX_ERR 0x40 |
119 | #define FCFLAG_I2CERR 0x80 |
134 | #define FCFLAG_I2CERR 0x80 |
120 | 135 | ||
121 | // backward compat |
136 | #define DEFEKT_G_NICK 0x01 |
- | 137 | #define DEFEKT_G_ROLL 0x02 |
|
- | 138 | #define DEFEKT_G_GIER 0x04 |
|
- | 139 | #define DEFEKT_A_NICK 0x08 |
|
122 | #define FLAG_MOTOR_RUN FCFLAG_MOTOR_RUN |
140 | #define DEFEKT_A_ROLL 0x10 |
- | 141 | #define DEFEKT_A_Z 0x20 |
|
123 | #define FLAG_FLY FCFLAG_FLY |
142 | #define DEFEKT_PRESSURE 0x40 |
- | 143 | #define DEFEKT_CAREFREE_ERR 0x80 |
|
124 | #define FLAG_CALIBRATE FCFLAG_CALIBRATE |
144 | |
- | 145 | #define DEFEKT_I2C 0x01 |
|
- | 146 | #define DEFEKT_BL_MISSING 0x02 |
|
- | 147 | #define DEFEKT_SPI_RX_ERR 0x04 |
|
- | 148 | #define DEFEKT_PPM_ERR 0x08 |
|
- | 149 | #define DEFEKT_MIXER_ERR 0x10 |
|
125 | #define FLAG_START FCFLAG_START |
150 | |
126 | 151 | ||
127 | /* |
152 | /* |
128 | * NaviCtrl Flags |
153 | * MikroKopter config struct |
129 | * taken from |
154 | * portions taken and adapted from |
- | 155 | * http://svn.mikrokopter.de/filedetails.php?repname=FlightCtrl&path=/tags/V0.80d/eeprom.h |
|
- | 156 | */ |
|
- | 157 | typedef struct { |
|
- | 158 | unsigned char Revision; |
|
- | 159 | unsigned char Kanalbelegung[12]; // GAS[0], GIER[1],NICK[2], ROLL[3], POTI1, POTI2, POTI3 |
|
- | 160 | unsigned char GlobalConfig; // 0x01=Höhenregler aktiv,0x02=Kompass aktiv, 0x04=GPS aktiv, 0x08=Heading Hold aktiv |
|
- | 161 | unsigned char Hoehe_MinGas; // Wert : 0-100 |
|
- | 162 | unsigned char Luftdruck_D; // Wert : 0-250 |
|
- | 163 | unsigned char MaxHoehe; // Wert : 0-32 |
|
- | 164 | unsigned char Hoehe_P; // Wert : 0-32 |
|
- | 165 | unsigned char Hoehe_Verstaerkung; // Wert : 0-50 |
|
- | 166 | unsigned char Hoehe_ACC_Wirkung; // Wert : 0-250 |
|
- | 167 | unsigned char Hoehe_HoverBand; // Wert : 0-250 |
|
- | 168 | unsigned char Hoehe_GPS_Z; // Wert : 0-250 |
|
- | 169 | unsigned char Hoehe_StickNeutralPoint;// Wert : 0-250 |
|
- | 170 | unsigned char Stick_P; // Wert : 1-6 |
|
- | 171 | unsigned char Stick_D; // Wert : 0-64 |
|
- | 172 | unsigned char Gier_P; // Wert : 1-20 |
|
- | 173 | unsigned char Gas_Min; // Wert : 0-32 |
|
- | 174 | unsigned char Gas_Max; // Wert : 33-250 |
|
- | 175 | unsigned char GyroAccFaktor; // Wert : 1-64 |
|
- | 176 | unsigned char KompassWirkung; // Wert : 0-32 |
|
- | 177 | unsigned char Gyro_P; // Wert : 10-250 |
|
- | 178 | unsigned char Gyro_I; // Wert : 0-250 |
|
- | 179 | unsigned char Gyro_D; // Wert : 0-250 |
|
- | 180 | unsigned char Gyro_Gier_P; // Wert : 10-250 |
|
- | 181 | unsigned char Gyro_Gier_I; // Wert : 0-250 |
|
- | 182 | unsigned char Gyro_Stability; // Wert : 0-16 |
|
- | 183 | unsigned char UnterspannungsWarnung; // Wert : 0-250 |
|
- | 184 | unsigned char NotGas; // Wert : 0-250 //Gaswert bei Empängsverlust |
|
- | 185 | unsigned char NotGasZeit; // Wert : 0-250 // Zeitbis auf NotGas geschaltet wird, wg. Rx-Problemen |
|
- | 186 | unsigned char Receiver; // 0= Summensignal, 1= Spektrum, 2 =Jeti, 3=ACT DSL, 4=ACT S3D |
|
- | 187 | unsigned char I_Faktor; // Wert : 0-250 |
|
- | 188 | unsigned char UserParam1; // Wert : 0-250 |
|
- | 189 | unsigned char UserParam2; // Wert : 0-250 |
|
- | 190 | unsigned char UserParam3; // Wert : 0-250 |
|
- | 191 | unsigned char UserParam4; // Wert : 0-250 |
|
- | 192 | unsigned char ServoNickControl; // Wert : 0-250 // Stellung des Servos |
|
- | 193 | unsigned char ServoNickComp; // Wert : 0-250 // Einfluss Gyro/Servo |
|
- | 194 | unsigned char ServoNickMin; // Wert : 0-250 // Anschlag |
|
- | 195 | unsigned char ServoNickMax; // Wert : 0-250 // Anschlag |
|
- | 196 | //--- Seit V0.75 |
|
- | 197 | unsigned char ServoRollControl; // Wert : 0-250 // Stellung des Servos |
|
- | 198 | unsigned char ServoRollComp; // Wert : 0-250 |
|
- | 199 | unsigned char ServoRollMin; // Wert : 0-250 |
|
- | 200 | unsigned char ServoRollMax; // Wert : 0-250 |
|
- | 201 | //--- |
|
- | 202 | unsigned char ServoNickRefresh; // Speed of the Servo |
|
- | 203 | unsigned char Servo3; // Value or mapping of the Servo Output |
|
- | 204 | unsigned char Servo4; // Value or mapping of the Servo Output |
|
- | 205 | unsigned char Servo5; // Value or mapping of the Servo Output |
|
- | 206 | unsigned char LoopGasLimit; // Wert: 0-250 max. Gas während Looping |
|
- | 207 | unsigned char LoopThreshold; // Wert: 0-250 Schwelle für Stickausschlag |
|
- | 208 | unsigned char LoopHysterese; // Wert: 0-250 Hysterese für Stickausschlag |
|
- | 209 | unsigned char AchsKopplung1; // Wert: 0-250 Faktor, mit dem Gier die Achsen Roll und Nick koppelt (NickRollMitkopplung) |
|
- | 210 | unsigned char AchsKopplung2; // Wert: 0-250 Faktor, mit dem Nick und Roll verkoppelt werden |
|
- | 211 | unsigned char CouplingYawCorrection; // Wert: 0-250 Faktor, mit dem Nick und Roll verkoppelt werden |
|
- | 212 | unsigned char WinkelUmschlagNick; // Wert: 0-250 180°-Punkt |
|
- | 213 | unsigned char WinkelUmschlagRoll; // Wert: 0-250 180°-Punkt |
|
- | 214 | unsigned char GyroAccAbgleich; // 1/k (Koppel_ACC_Wirkung) |
|
- | 215 | unsigned char Driftkomp; |
|
- | 216 | unsigned char DynamicStability; |
|
- | 217 | unsigned char UserParam5; // Wert : 0-250 |
|
- | 218 | unsigned char UserParam6; // Wert : 0-250 |
|
- | 219 | unsigned char UserParam7; // Wert : 0-250 |
|
- | 220 | unsigned char UserParam8; // Wert : 0-250 |
|
- | 221 | //---Output --------------------------------------------- |
|
- | 222 | unsigned char J16Bitmask; // for the J16 Output |
|
- | 223 | unsigned char J16Timing; // for the J16 Output |
|
- | 224 | unsigned char J17Bitmask; // for the J17 Output |
|
- | 225 | unsigned char J17Timing; // for the J17 Output |
|
- | 226 | // seit version V0.75c |
|
- | 227 | unsigned char WARN_J16_Bitmask; // for the J16 Output |
|
- | 228 | unsigned char WARN_J17_Bitmask; // for the J17 Output |
|
- | 229 | //---NaviCtrl--------------------------------------------- |
|
- | 230 | unsigned char NaviGpsModeControl; // Parameters for the Naviboard |
|
- | 231 | unsigned char NaviGpsGain; |
|
- | 232 | unsigned char NaviGpsP; |
|
130 | * http://mikrocontroller.cco-ev.de/mikrowebsvn/filedetails.php?repname=NaviCtrl&path=%2Ftags%2FV0.17e%2Fuart1.h |
233 | unsigned char NaviGpsI; |
131 | */ |
234 | unsigned char NaviGpsD; |
132 | #define NC_FLAG_FREE 0x01 |
235 | unsigned char NaviGpsPLimit; |
- | 236 | unsigned char NaviGpsILimit; |
|
133 | #define NC_FLAG_PH 0x02 |
237 | unsigned char NaviGpsDLimit; |
134 | #define NC_FLAG_CH 0x04 |
238 | unsigned char NaviGpsACC; |
- | 239 | unsigned char NaviGpsMinSat; |
|
135 | #define NC_FLAG_RANGE_LIMIT 0x08 |
240 | unsigned char NaviStickThreshold; |
136 | #define NC_FLAG_NOSERIALLINK 0x10 |
241 | unsigned char NaviWindCorrection; |
- | 242 | unsigned char NaviSpeedCompensation; |
|
137 | #define NC_FLAG_TARGET_REACHED 0x20 |
243 | unsigned char NaviOperatingRadius; |
- | 244 | unsigned char NaviAngleLimitation; |
|
- | 245 | unsigned char NaviPH_LoginTime; |
|
- | 246 | //---Ext.Ctrl--------------------------------------------- |
|
- | 247 | unsigned char ExternalControl; // for serial Control |
|
- | 248 | //---CareFree--------------------------------------------- |
|
- | 249 | unsigned char OrientationAngle; // Where is the front-direction? |
|
- | 250 | unsigned char OrientationModeControl; // switch for CareFree |
|
- | 251 | //------------------------------------------------ |
|
- | 252 | unsigned char BitConfig; // (war Loop-Cfg) Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts / wird getrennt behandelt |
|
- | 253 | unsigned char ServoCompInvert; // // 0x01 = Nick, 0x02 = Roll 0 oder 1 // WICHTIG!!! am Ende lassen |
|
- | 254 | unsigned char ExtraConfig; // bitcodiert |
|
- | 255 | char Name[12]; |
|
- | 256 | unsigned char crc; // must be the last byte! |
|
- | 257 | } __attribute__((packed)) paramset_t; |
|
- | 258 | ||
- | 259 | typedef struct { |
|
138 | #define NC_FLAG_MANUAL_CONTROL 0x40 |
260 | u8 SettingsIndex; |
139 | #define NC_FLAG_8 0x80 |
261 | paramset_t param; |
140 | 262 | } __attribute__((packed)) paramset_serial; |
|
141 | 263 | ||
142 | #endif |
264 | #endif |
143 | 265 |