Subversion Repositories Projects

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

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