Subversion Repositories Projects

Rev

Rev 2099 | Rev 2225 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2099 Rev 2217
1
/****************************************************************************
1
/****************************************************************************
2
 *   Copyright (C) 2009-2015 by Claas Anders "CaScAdE" Rathje               *
2
 *   Copyright (C) 2009-2015 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
 * MikroKopter Slave-Addresses
35
 * MikroKopter Slave-Addresses
36
 * portions taken and adapted from
36
 * portions taken and adapted from
37
 * http://svn.mikrokopter.de/filedetails.php?repname=NaviCtrl&path=/tags/V0.22a/mkprotocol.h
37
 * http://svn.mikrokopter.de/filedetails.php?repname=NaviCtrl&path=/tags/V0.22a/mkprotocol.h
38
 */
38
 */
39
#define ANY_ADDRESS 0
39
#define ANY_ADDRESS 0
40
#define FC_ADDRESS 1
40
#define FC_ADDRESS 1
41
#define NC_ADDRESS 2
41
#define NC_ADDRESS 2
42
#define MK3MAG_ADDRESS 3
42
#define MK3MAG_ADDRESS 3
43
#define MKOSD_ADDRESS 4
43
#define MKOSD_ADDRESS 4
44
#define BL_ADDRESS 5
44
#define BL_ADDRESS 5
45
 
45
 
46
/*
46
/*
47
 * FC Debug Struct
47
 * FC Debug Struct
48
 * portions taken and adapted from
48
 * portions taken and adapted from
49
 * http://svn.mikrokopter.de/filedetails.php?repname=FlightCtrl&path=/tags/V0.88e/uart.h
49
 * http://svn.mikrokopter.de/filedetails.php?repname=FlightCtrl&path=/tags/V2.12a/uart.h
50
 */
50
 */
51
typedef struct {
51
typedef struct {
52
    unsigned char Status[2];
52
    unsigned char Status[2];
53
    signed int Analog[32]; // Debugwerte
53
    signed int Analog[32]; // Debugwerte
54
} __attribute__((packed)) str_DebugOut;
54
} __attribute__((packed)) str_DebugOut;
55
 
55
 
56
typedef struct {
56
typedef struct {
57
    unsigned char SWMajor;
57
        unsigned char SWMajor;
58
    unsigned char SWMinor;
58
        unsigned char SWMinor;
59
    unsigned char ProtoMajor;
59
        unsigned char ProtoMajor;
60
    unsigned char ProtoMinor;
60
        unsigned char LabelTextCRC;
61
    unsigned char SWPatch;
61
        unsigned char SWPatch;
62
    unsigned char HardwareError[5];
62
        unsigned char HardwareError[2];
-
 
63
        unsigned char HWMajor;
-
 
64
        unsigned char BL_Firmware;  
-
 
65
        unsigned char Flags;
63
} __attribute__((packed)) str_VersionInfo;
66
} __attribute__((packed)) str_VersionInfo;
64
 
67
 
65
/*
68
/*
66
 * NaviCtrl GPS Structs
69
 * NaviCtrl GPS Structs
67
 * portions taken and adapted from
70
 * portions taken and adapted from
68
 * http://svn.mikrokopter.de/filedetails.php?repname=NaviCtrl&path=/tags/V0.20c/ubx.h
71
 * http://svn.mikrokopter.de/filedetails.php?repname=NaviCtrl&path=/tags/V2.12a/gpspos.h
69
 */
72
 */
70
typedef struct {
73
typedef struct {
71
    s32 Longitude; // in 1E-7 deg
74
    s32 Longitude; // in 1E-7 deg
72
    s32 Latitude; // in 1E-7 deg
75
    s32 Latitude; // in 1E-7 deg
73
    s32 Altitude; // in mm
76
    s32 Altitude; // in mm
74
    u8 Status; // validity of data
77
    u8 Status; // validity of data
75
} __attribute__((packed)) GPS_Pos_t;
78
} __attribute__((packed)) GPS_Pos_t;
76
 
79
 
77
#define INVALID         0x00
80
#define INVALID         0x00
78
#define NEWDATA         0x01
81
#define NEWDATA         0x01
79
#define PROCESSED       0x02
82
#define PROCESSED       0x02
-
 
83
#define SIMULATION      0x03
80
 
84
 
81
/*
85
/*
82
 * NaviCtrl OSD Structs
86
 * NaviCtrl OSD Structs
83
 * portions taken and adapted from
87
 * portions taken and adapted from
84
 * http://svn.mikrokopter.de/filedetails.php?repname=NaviCtrl&path=/tags/V2.06a/uart1.h
88
 * http://svn.mikrokopter.de/filedetails.php?repname=NaviCtrl&path=/tags/V2.12a/uart1.h
85
 */
89
 */
86
typedef struct {
90
typedef struct {
87
    u16 Distance; // distance to target in dm
91
    u16 Distance; // distance to target in dm
88
    s16 Bearing; // course to target in deg
92
    s16 Bearing; // course to target in deg
89
} __attribute__((packed)) GPS_PosDev_t;
93
} __attribute__((packed)) GPS_PosDev_t;
90
 
94
 
91
#define NAVIDATA_VERSION 5
95
#define NAVIDATA_VERSION 5
92
 
96
 
93
typedef struct {
97
typedef struct {
94
    u8 Version; // version of the data structure
98
    u8 Version; // version of the data structure
95
    GPS_Pos_t CurrentPosition; // see gpspos.h for details
99
    GPS_Pos_t CurrentPosition; // see gpspos.h for details
96
    GPS_Pos_t TargetPosition;
100
    GPS_Pos_t TargetPosition;
97
    GPS_PosDev_t TargetPositionDeviation;
101
    GPS_PosDev_t TargetPositionDeviation;
98
    GPS_Pos_t HomePosition;
102
    GPS_Pos_t HomePosition;
99
    GPS_PosDev_t HomePositionDeviation;
103
    GPS_PosDev_t HomePositionDeviation;
100
    u8 WaypointIndex; // index of current waypoints running from 0 to WaypointNumber-1
104
    u8 WaypointIndex; // index of current waypoints running from 0 to WaypointNumber-1
101
    u8 WaypointNumber; // number of stored waypoints
105
    u8 WaypointNumber; // number of stored waypoints
102
    u8 SatsInUse; // number of satellites used for position solution
106
    u8 SatsInUse; // number of satellites used for position solution
103
    s16 Altimeter; // hight according to air pressure
107
    s16 Altimeter; // hight according to air pressure
104
    s16 Variometer; // climb(+) and sink(-) rate
108
    s16 Variometer; // climb(+) and sink(-) rate
105
    u16 FlyingTime; // in seconds
109
    u16 FlyingTime; // in seconds
106
    u8 UBat; // Battery Voltage in 0.1 Volts
110
    u8 UBat; // Battery Voltage in 0.1 Volts
107
    u16 GroundSpeed; // speed over ground in cm/s (2D)
111
    u16 GroundSpeed; // speed over ground in cm/s (2D)
108
    s16 Heading; // current flight direction in ° as angle to north
112
    s16 Heading; // current flight direction in ° as angle to north
109
    s16 CompassHeading; // current compass value in °
113
    s16 CompassHeading; // current compass value in °
110
    s8 AngleNick; // current Nick angle in 1°
114
    s8 AngleNick; // current Nick angle in 1°
111
    s8 AngleRoll; // current Rick angle in 1°
115
    s8 AngleRoll; // current Rick angle in 1°
112
    u8 RC_Quality; // RC_Quality
116
    u8 RC_Quality; // RC_Quality
113
    u8 FCStatusFlags; // Flags from FC
117
    u8 FCStatusFlags; // Flags from FC
114
    u8 NCFlags; // Flags from NC
118
    u8 NCFlags; // Flags from NC
115
    u8 Errorcode; // 0 --> okay
119
    u8 Errorcode; // 0 --> okay
116
    u8 OperatingRadius; // current operation radius around the Home Position in m
120
    u8  WP_OperatingRadius; // current WP operation radius around the Home Position in m
117
    s16 TopSpeed; // velocity in vertical direction in cm/s
121
    s16 TopSpeed; // velocity in vertical direction in cm/s
118
    u8 TargetHoldTime; // time in s to stay at the given target, counts down to 0 if target has been reached
122
    u8 TargetHoldTime; // time in s to stay at the given target, counts down to 0 if target has been reached
119
    u8 FCStatusFlags2; // StatusFlags2 (since version 5 added)
123
    u8 FCStatusFlags2; // StatusFlags2 (since version 5 added)
120
    s16 SetpointAltitude; // setpoint for altitude
124
    s16 SetpointAltitude; // setpoint for altitude
121
    u8 Gas; // for future use
125
    u8 Gas; // for future use
122
    u16 Current; // actual current in 0.1A steps
126
    u16 Current; // actual current in 0.1A steps
123
    u16 UsedCapacity; // used capacity in mAh
127
    u16 UsedCapacity; // used capacity in mAh
124
} __attribute__((packed)) NaviData_t;
128
} __attribute__((packed)) NaviData_t;
-
 
129
 
-
 
130
/*
-
 
131
 * NaviCtrl & FCFlags Flags
-
 
132
 * portions taken and adapted from
-
 
133
 * http://svn.mikrokopter.de/filedetails.php?repname=NaviCtrl&path=/tags/V2.12a/main.h
-
 
134
 */
125
 
135
 // .NCFlags
126
#define NC_FLAG_FREE                    0x01
136
#define NC_FLAG_FREE                    0x01
127
#define NC_FLAG_PH                              0x02
137
#define NC_FLAG_PH                              0x02
128
#define NC_FLAG_CH                              0x04
138
#define NC_FLAG_CH                              0x04
129
#define NC_FLAG_RANGE_LIMIT             0x08
139
#define NC_FLAG_RANGE_LIMIT             0x08
130
#define NC_FLAG_NOSERIALLINK    0x10
140
#define NC_FLAG_NOSERIALLINK    0x10
131
#define NC_FLAG_TARGET_REACHED  0x20
141
#define NC_FLAG_TARGET_REACHED  0x20
132
#define NC_FLAG_MANUAL_CONTROL  0x40
142
#define NC_FLAG_MANUAL_CONTROL  0x40
133
#define NC_FLAG_GPS_OK                  0x80
143
#define NC_FLAG_GPS_OK                  0x80
134
 
-
 
135
/*
144
 
136
 * MikroKopter Flags
-
 
137
 * portions taken and adapted from
-
 
138
 * http://svn.mikrokopter.de/filedetails.php?repname=FlightCtrl&path=/tags/V0.80d/fc.h
-
 
139
 */
145
// FC.StatusFlags
140
#define FCFLAG_MOTOR_RUN        0x01
146
#define FCFLAG_MOTOR_RUN        0x01
141
#define FCFLAG_FLY              0x02
147
#define FCFLAG_FLY              0x02
142
#define FCFLAG_CALIBRATE        0x04
148
#define FCFLAG_CALIBRATE        0x04
143
#define FCFLAG_START            0x08
149
#define FCFLAG_START            0x08
144
#define FCFLAG_NOTLANDUNG       0x10
150
#define FCFLAG_NOTLANDUNG       0x10
145
#define FCFLAG_LOWBAT           0x20
151
#define FCFLAG_LOWBAT           0x20
146
#define FCFLAG_VARIO_TRIM_UP    0x40
152
#define FCFLAG_VARIO_TRIM_UP    0x40
147
#define FCFLAG_VARIO_TRIM_DOWN  0x80
153
#define FCFLAG_VARIO_TRIM_DOWN  0x80
148
 
154
 
149
// FC STATUS FLAGS2
155
// FC.StatusFlags2
150
#define FC_STATUS2_CAREFREE                 0x01
156
#define FC_STATUS2_CAREFREE                 0x01
-
 
157
#define FC_STATUS2_ALTITUDE_CONTROL         0x02
-
 
158
#define FC_STATUS2_RC_FAILSAVE_ACTIVE       0x04
-
 
159
#define FC_STATUS2_OUT1_ACTIVE                  0x08
-
 
160
#define FC_STATUS2_OUT2_ACTIVE                  0x10
-
 
161
#define FC_STATUS2_WAIT_FOR_TAKEOFF             0x20   // Motor Running, but still on the ground
151
#define FC_STATUS2_ALTITUDE_CONTROL         0x02
162
 
-
 
163
 
-
 
164
// FC.StatusFlags3
-
 
165
#define FC_STATUS3_REDUNDANCE_AKTIVE        0x01
-
 
166
#define FC_STATUS3_BOAT                         0x02
-
 
167
#define FC_STATUS3_REDUNDANCE_ERROR                     0x04
-
 
168
#define FC_STATUS3_REDUNDANCE_TEST                      0x08
-
 
169
 
152
 
170
// FC ERRORS FLAGS
153
#define DEFEKT_G_NICK           0x01
171
#define FC_ERROR0_GYRO_NICK     0x01
154
#define DEFEKT_G_ROLL           0x02
172
#define FC_ERROR0_GYRO_ROLL     0x02
155
#define DEFEKT_G_GIER           0x04
173
#define FC_ERROR0_GYRO_YAW              0x04
156
#define DEFEKT_A_NICK           0x08
174
#define FC_ERROR0_ACC_NICK              0x08
157
#define DEFEKT_A_ROLL           0x10
175
#define FC_ERROR0_ACC_ROLL              0x10
158
#define DEFEKT_A_Z              0x20
176
#define FC_ERROR0_ACC_TOP               0x20
159
#define DEFEKT_PRESSURE         0x40
177
#define FC_ERROR0_PRESSURE              0x40
160
#define DEFEKT_CAREFREE_ERR 0x80
178
#define FC_ERROR0_CAREFREE              0x80
161
 
179
 
162
#define DEFEKT_I2C              0x01
180
#define FC_ERROR1_I2C                   0x01
163
#define DEFEKT_BL_MISSING       0x02
181
#define FC_ERROR1_BL_MISSING    0x02
164
#define DEFEKT_SPI_RX_ERR       0x04
182
#define FC_ERROR1_SPI_RX                0x04
165
#define DEFEKT_PPM_ERR          0x08
183
#define FC_ERROR1_PPM                   0x08
-
 
184
#define FC_ERROR1_MIXER                 0x10
-
 
185
#define FC_ERROR1_RES1                  0x20
-
 
186
#define FC_ERROR1_RES2                  0x40
166
#define DEFEKT_MIXER_ERR    0x10
187
#define FC_ERROR1_RES3                  0x80
167
 
188
 
168
/*
189
/*
169
 * MikroKopter config struct
190
 * MikroKopter config struct
170
 * portions taken and adapted from
191
 * portions taken and adapted from
171
 * http://svn.mikrokopter.de/filedetails.php?repname=FlightCtrl&path=/tags/V2.10a/eeprom.h
192
 * http://svn.mikrokopter.de/filedetails.php?repname=FlightCtrl&path=/tags/V2.12a/eeprom.h
172
 */
193
 */
173
 
194
 
174
#define EEPARAM_REVISION        105 // is count up, if paramater stucture has changed (compatibility)
-
 
-
 
195
#define EEPARAM_REVISION        106 // is count up, if paramater stucture has changed (compatibility)
175
 
196
#define EEMIXER_REVISION         1  // is count up, if mixer stucture has changed (compatibility)
176
 
197
 
177
typedef struct
198
typedef struct
178
{
199
{
179
        unsigned char Revision;
200
        unsigned char Revision;
180
        unsigned char Kanalbelegung[12];       // GAS[0], GIER[1],NICK[2], ROLL[3], POTI1, POTI2, POTI3
201
        unsigned char Kanalbelegung[12];       // GAS[0], GIER[1],NICK[2], ROLL[3], POTI1, POTI2, POTI3
181
        unsigned char GlobalConfig;           // 0x01=Höhenregler aktiv,0x02=Kompass aktiv, 0x04=GPS aktiv, 0x08=Heading Hold aktiv
202
        unsigned char GlobalConfig;           // 0x01=Höhenregler aktiv,0x02=Kompass aktiv, 0x04=GPS aktiv, 0x08=Heading Hold aktiv
182
        unsigned char Hoehe_MinGas;           // Wert : 0-100
203
        unsigned char Hoehe_MinGas;           // Wert : 0-100
183
        unsigned char Luftdruck_D;            // Wert : 0-250
204
        unsigned char Luftdruck_D;            // Wert : 0-250
184
        unsigned char HoeheChannel;           // Wert : 0-32
205
        unsigned char HoeheChannel;           // Wert : 0-32
185
        unsigned char Hoehe_P;                // Wert : 0-32
206
        unsigned char Hoehe_P;                // Wert : 0-32
186
        unsigned char Hoehe_Verstaerkung;     // Wert : 0-50
207
        unsigned char Hoehe_Verstaerkung;     // Wert : 0-50
187
        unsigned char Hoehe_ACC_Wirkung;      // Wert : 0-250
208
        unsigned char Hoehe_ACC_Wirkung;      // Wert : 0-250
188
        unsigned char Hoehe_HoverBand;        // Wert : 0-250
209
        unsigned char Hoehe_HoverBand;        // Wert : 0-250
189
        unsigned char Hoehe_TiltCompensation; // Wert : 0-250
210
        unsigned char Hoehe_TiltCompensation; // Wert : 0-250
190
        unsigned char Hoehe_StickNeutralPoint;// Wert : 0-250
211
        unsigned char Hoehe_StickNeutralPoint;// Wert : 0-250
191
        unsigned char Stick_P;                // Wert : 1-6
212
        unsigned char Stick_P;                // Wert : 1-6
192
        unsigned char Stick_D;                // Wert : 0-64
213
        unsigned char Stick_D;                // Wert : 0-64
193
        unsigned char StickGier_P;            // Wert : 1-20
214
        unsigned char StickGier_P;            // Wert : 1-20
194
        unsigned char Gas_Min;                // Wert : 0-32
215
        unsigned char Gas_Min;                // Wert : 0-32
195
        unsigned char Gas_Max;                // Wert : 33-250
216
        unsigned char Gas_Max;                // Wert : 33-250
196
        unsigned char GyroAccFaktor;          // Wert : 1-64
217
        unsigned char GyroAccFaktor;          // Wert : 1-64
197
        unsigned char KompassWirkung;         // Wert : 0-32
218
        unsigned char KompassWirkung;         // Wert : 0-32
198
        unsigned char Gyro_P;                 // Wert : 10-250
219
        unsigned char Gyro_P;                 // Wert : 10-250
199
        unsigned char Gyro_I;                 // Wert : 0-250
220
        unsigned char Gyro_I;                 // Wert : 0-250
200
        unsigned char Gyro_D;                 // Wert : 0-250
221
        unsigned char Gyro_D;                 // Wert : 0-250
201
        unsigned char Gyro_Gier_P;            // Wert : 10-250
222
        unsigned char Gyro_Gier_P;            // Wert : 10-250
202
        unsigned char Gyro_Gier_I;            // Wert : 0-250
223
        unsigned char Gyro_Gier_I;            // Wert : 0-250
203
        unsigned char Gyro_Stability;         // Wert : 0-16
224
        unsigned char Gyro_Stability;         // Wert : 0-16
204
        unsigned char UnterspannungsWarnung;  // Wert : 0-250
225
        unsigned char UnterspannungsWarnung;  // Wert : 0-250
205
        unsigned char NotGas;                 // Wert : 0-250     //Gaswert bei Empängsverlust
226
        unsigned char NotGas;                 // Wert : 0-250     //Gaswert bei Empängsverlust
206
        unsigned char NotGasZeit;             // Wert : 0-250     // Zeitbis auf NotGas geschaltet wird, wg. Rx-Problemen
227
        unsigned char NotGasZeit;             // Wert : 0-250     // Zeitbis auf NotGas geschaltet wird, wg. Rx-Problemen
207
        unsigned char Receiver;                   // 0= Summensignal, 1= Spektrum, 2 =Jeti, 3=ACT DSL, 4=ACT S3D
228
        unsigned char Receiver;                   // 0= Summensignal, 1= Spektrum, 2 =Jeti, 3=ACT DSL, 4=ACT S3D
208
        unsigned char I_Faktor;               // Wert : 0-250
229
        unsigned char I_Faktor;               // Wert : 0-250
209
        unsigned char UserParam1;             // Wert : 0-250
230
        unsigned char UserParam1;             // Wert : 0-250
210
        unsigned char UserParam2;             // Wert : 0-250
231
        unsigned char UserParam2;             // Wert : 0-250
211
        unsigned char UserParam3;             // Wert : 0-250
232
        unsigned char UserParam3;             // Wert : 0-250
212
        unsigned char UserParam4;             // Wert : 0-250
233
        unsigned char UserParam4;             // Wert : 0-250
213
        unsigned char ServoNickControl;       // Wert : 0-250     // Stellung des Servos
234
        unsigned char ServoNickControl;       // Wert : 0-250     // Stellung des Servos
214
        unsigned char ServoNickComp;          // Wert : 0-250     // Einfluss Gyro/Servo
235
        unsigned char ServoNickComp;          // Wert : 0-250     // Einfluss Gyro/Servo
215
        unsigned char ServoNickMin;           // Wert : 0-250     // Anschlag
236
        unsigned char ServoNickMin;           // Wert : 0-250     // Anschlag
216
        unsigned char ServoNickMax;           // Wert : 0-250     // Anschlag
237
        unsigned char ServoNickMax;           // Wert : 0-250     // Anschlag
217
        //--- Seit V0.75
238
        //--- Seit V0.75
218
        unsigned char ServoRollControl;       // Wert : 0-250     // Stellung des Servos
239
        unsigned char ServoRollControl;       // Wert : 0-250     // Stellung des Servos
219
        unsigned char ServoRollComp;          // Wert : 0-250
240
        unsigned char ServoRollComp;          // Wert : 0-250
220
        unsigned char ServoRollMin;           // Wert : 0-250
241
        unsigned char ServoRollMin;           // Wert : 0-250
221
        unsigned char ServoRollMax;           // Wert : 0-250
242
        unsigned char ServoRollMax;           // Wert : 0-250
222
        //---
243
        //---
223
        unsigned char ServoNickRefresh;       // Speed of the Servo
244
        unsigned char ServoNickRefresh;       // Speed of the Servo
224
    unsigned char ServoManualControlSpeed;//
245
    unsigned char ServoManualControlSpeed;//
225
    unsigned char CamOrientation;         //
246
    unsigned char CamOrientation;         //
226
        unsigned char Servo3;                    // Value or mapping of the Servo Output
247
        unsigned char Servo3;                    // Value or mapping of the Servo Output
227
        unsigned char Servo4;                            // Value or mapping of the Servo Output
248
        unsigned char Servo4;                            // Value or mapping of the Servo Output
228
        unsigned char Servo5;                            // Value or mapping of the Servo Output
249
        unsigned char Servo5;                            // Value or mapping of the Servo Output
229
        unsigned char LoopGasLimit;           // Wert: 0-250  max. Gas während Looping
250
        unsigned char LoopGasLimit;           // Wert: 0-250  max. Gas während Looping
230
        unsigned char LoopThreshold;          // Wert: 0-250  Schwelle für Stickausschlag
251
        unsigned char LoopThreshold;          // Wert: 0-250  Schwelle für Stickausschlag
231
        unsigned char LoopHysterese;          // Wert: 0-250  Hysterese für Stickausschlag
252
        unsigned char LoopHysterese;          // Wert: 0-250  Hysterese für Stickausschlag
232
        unsigned char AchsKopplung1;          // Wert: 0-250  Faktor, mit dem Gier die Achsen Roll und Nick koppelt (NickRollMitkopplung)
253
        unsigned char AchsKopplung1;          // Wert: 0-250  Faktor, mit dem Gier die Achsen Roll und Nick koppelt (NickRollMitkopplung)
233
        unsigned char AchsKopplung2;          // Wert: 0-250  Faktor, mit dem Nick und Roll verkoppelt werden
254
        unsigned char AchsKopplung2;          // Wert: 0-250  Faktor, mit dem Nick und Roll verkoppelt werden
234
        unsigned char CouplingYawCorrection;  // Wert: 0-250  Faktor, mit dem Nick und Roll verkoppelt werden
255
        unsigned char CouplingYawCorrection;  // Wert: 0-250  Faktor, mit dem Nick und Roll verkoppelt werden
235
        unsigned char WinkelUmschlagNick;     // Wert: 0-250  180°-Punkt
256
        unsigned char WinkelUmschlagNick;     // Wert: 0-250  180°-Punkt
236
        unsigned char WinkelUmschlagRoll;     // Wert: 0-250  180°-Punkt
257
        unsigned char WinkelUmschlagRoll;     // Wert: 0-250  180°-Punkt
237
        unsigned char GyroAccAbgleich;        // 1/k  (Koppel_ACC_Wirkung)
258
        unsigned char GyroAccAbgleich;        // 1/k  (Koppel_ACC_Wirkung)
238
        unsigned char Driftkomp;
259
        unsigned char Driftkomp;
239
        unsigned char DynamicStability;
260
        unsigned char DynamicStability;
240
        unsigned char UserParam5;             // Wert : 0-250
261
        unsigned char UserParam5;             // Wert : 0-250
241
        unsigned char UserParam6;             // Wert : 0-250
262
        unsigned char UserParam6;             // Wert : 0-250
242
        unsigned char UserParam7;             // Wert : 0-250
263
        unsigned char UserParam7;             // Wert : 0-250
243
        unsigned char UserParam8;             // Wert : 0-250
264
        unsigned char UserParam8;             // Wert : 0-250
244
        //---Output ---------------------------------------------
265
        //---Output ---------------------------------------------
245
        unsigned char J16Bitmask;             // for the J16 Output
266
        unsigned char J16Bitmask;             // for the J16 Output
246
        unsigned char J16Timing;              // for the J16 Output
267
        unsigned char J16Timing;              // for the J16 Output
247
        unsigned char J17Bitmask;             // for the J17 Output
268
        unsigned char J17Bitmask;             // for the J17 Output
248
        unsigned char J17Timing;              // for the J17 Output
269
        unsigned char J17Timing;              // for the J17 Output
249
        // seit version V0.75c
270
        // seit version V0.75c
250
        unsigned char WARN_J16_Bitmask;       // for the J16 Output
271
        unsigned char WARN_J16_Bitmask;       // for the J16 Output
251
        unsigned char WARN_J17_Bitmask;       // for the J17 Output
272
        unsigned char WARN_J17_Bitmask;       // for the J17 Output
252
        //---NaviCtrl---------------------------------------------
273
        //---NaviCtrl---------------------------------------------
253
        unsigned char AutoPhotoDistance;      // Auto Photo
274
        unsigned char AutoPhotoDistance;      // Auto Photo
254
        unsigned char NaviGpsModeChannel;     // Parameters for the Naviboard
275
        unsigned char NaviGpsModeChannel;     // Parameters for the Naviboard
255
        unsigned char NaviGpsGain;
276
        unsigned char NaviGpsGain;
256
        unsigned char NaviGpsP;
277
        unsigned char NaviGpsP;
257
        unsigned char NaviGpsI;
278
        unsigned char NaviGpsI;
258
        unsigned char NaviGpsD;
279
        unsigned char NaviGpsD;
259
        unsigned char NaviGpsPLimit;
280
        unsigned char NaviGpsPLimit;
260
        unsigned char NaviGpsILimit;
281
        unsigned char NaviGpsILimit;
261
        unsigned char NaviGpsDLimit;
282
        unsigned char NaviGpsDLimit;
262
        unsigned char NaviGpsA;
283
        unsigned char NaviGpsA;
263
        unsigned char NaviGpsMinSat;
284
        unsigned char NaviGpsMinSat;
264
        unsigned char NaviStickThreshold;
285
        unsigned char NaviStickThreshold;
265
        unsigned char NaviWindCorrection;
286
        unsigned char NaviWindCorrection;
266
        unsigned char NaviAccCompensation;    // New since 0.86 -> was: SpeedCompensation
287
        unsigned char NaviAccCompensation;    // New since 0.86 -> was: SpeedCompensation
267
        unsigned char NaviMaxFlyingRange;     // in 10m
288
        unsigned char NaviMaxFlyingRange;     // in 10m
268
        unsigned char NaviAngleLimitation;
289
        unsigned char NaviAngleLimitation;
269
        unsigned char NaviPH_LoginTime;
290
        unsigned char NaviPH_LoginTime;
270
        unsigned char NaviDescendRange;
291
        unsigned char NaviDescendRange;
271
        //---Ext.Ctrl---------------------------------------------
292
        //---Ext.Ctrl---------------------------------------------
272
        unsigned char ExternalControl;         // for serial Control
293
        unsigned char ExternalControl;         // for serial Control
273
        //---CareFree---------------------------------------------
294
        //---CareFree---------------------------------------------
274
        unsigned char OrientationAngle;        // Where is the front-direction?
295
        unsigned char OrientationAngle;        // Where is the front-direction?
275
        unsigned char CareFreeChannel;     // switch for CareFree
296
        unsigned char CareFreeChannel;     // switch for CareFree
276
    unsigned char MotorSafetySwitch;
297
    unsigned char MotorSafetySwitch;
277
    unsigned char MotorSmooth;
298
    unsigned char MotorSmooth;
278
    unsigned char ComingHomeAltitude;
299
    unsigned char ComingHomeAltitude;
279
    unsigned char FailSafeTime;
300
    unsigned char FailSafeTime;
280
    unsigned char MaxAltitude;
301
    unsigned char MaxAltitude;
281
        unsigned char FailsafeChannel;         // if the value of this channel is > 100, the MK reports "RC-Lost"
302
        unsigned char FailsafeChannel;         // if the value of this channel is > 100, the MK reports "RC-Lost"
282
        unsigned char ServoFilterNick;  
303
        unsigned char ServoFilterNick;  
283
        unsigned char ServoFilterRoll;  
304
        unsigned char ServoFilterRoll;  
284
    unsigned char Servo3OnValue;
305
    unsigned char Servo3OnValue;
285
    unsigned char Servo3OffValue;
306
    unsigned char Servo3OffValue;
286
    unsigned char Servo4OnValue;
307
    unsigned char Servo4OnValue;
287
    unsigned char Servo4OffValue;
308
    unsigned char Servo4OffValue;
288
        unsigned char ServoFS_Pos[5];
309
        unsigned char ServoFS_Pos[5];
289
        unsigned char StartLandChannel;  
310
        unsigned char StartLandChannel;  
290
        unsigned char LandingSpeed;  
311
        unsigned char LandingSpeed;  
291
        unsigned char CompassOffset;        
312
        unsigned char CompassOffset;        
292
        unsigned char AutoLandingVoltage;    // in 0,1V  0 -> disabled
313
        unsigned char AutoLandingVoltage;    // in 0,1V  0 -> disabled
293
        unsigned char ComingHomeVoltage;    // in 0,1V  0 -> disabled
314
        unsigned char ComingHomeVoltage;    // in 0,1V  0 -> disabled
294
        unsigned char AutoPhotoAtitudes;
315
        unsigned char AutoPhotoAtitudes;
295
        unsigned char SingleWpSpeed;
316
        unsigned char SingleWpSpeed;
296
        unsigned char LandingPulse;
317
        unsigned char LandingPulse;
-
 
318
        unsigned char SingleWpControlChannel;
-
 
319
        unsigned char MenuKeyChannel;
297
        //------------------------------------------------
320
        //------------------------------------------------
298
        unsigned char BitConfig;          // (war Loop-Cfg) Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts / wird getrennt behandelt
321
        unsigned char BitConfig;          // (war Loop-Cfg) Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts / wird getrennt behandelt
299
        unsigned char ServoCompInvert;    // //  0x01 = Nick, 0x02 = Roll, 0x04 = relative moving // WICHTIG!!! am Ende lassen
322
        unsigned char ServoCompInvert;    // //  0x01 = Nick, 0x02 = Roll, 0x04 = relative moving // WICHTIG!!! am Ende lassen
300
        unsigned char ExtraConfig;        // bitcodiert
323
        unsigned char ExtraConfig;        // bitcodiert
301
        unsigned char GlobalConfig3;      // bitcodiert
324
        unsigned char GlobalConfig3;      // bitcodiert
302
        char Name[12];
325
        char Name[12];
303
        unsigned char crc;                                // must be the last byte!
326
        unsigned char crc;                                // must be the last byte!
304
} paramset_t; // 134 bytes (V1.06)
327
} paramset_t; // 134 bytes (V1.06)
305
 
328
 
306
 
329
 
307
typedef struct {
330
typedef struct {
308
    u8 SettingsIndex;
331
    u8 SettingsIndex;
309
    paramset_t param;
332
    paramset_t param;
310
} __attribute__((packed)) paramset_serial;
333
} __attribute__((packed)) paramset_serial;
311
 
334
 
312
/*
335
/*
313
 * MikroKopter 3D-Data struct
336
 * MikroKopter 3D-Data struct
314
 * portions taken and adapted from
337
 * portions taken and adapted from
315
 * http://svn.mikrokopter.de/filedetails.php?repname=NaviCtrl&path=%2Ftags%2FV0.28o%2Fuart1.h
338
 * http://svn.mikrokopter.de/filedetails.php?repname=NaviCtrl&path=%2Ftags%2FV0.28o%2Fuart1.h
316
 */
339
 */
317
typedef struct {
340
typedef struct {
318
    s16 AngleNick; // in 0.1 deg
341
    s16 AngleNick; // in 0.1 deg
319
    s16 AngleRoll; // in 0.1 deg
342
    s16 AngleRoll; // in 0.1 deg
320
    s16 Heading; // in 0.1 deg
343
    s16 Heading; // in 0.1 deg
321
    u8 StickNick;
344
    u8 StickNick;
322
    u8 StickRoll;
345
    u8 StickRoll;
323
    u8 StickYaw;
346
    u8 StickYaw;
324
    u8 StickGas;
347
    u8 StickGas;
325
    u8 reserve[4];
348
    u8 reserve[4];
326
} __attribute__((packed)) Data3D_t;
349
} __attribute__((packed)) Data3D_t;
327
 
350
 
328
extern Data3D_t Data3D;
351
extern Data3D_t Data3D;
329
 
352
 
330
#endif
353
#endif
331
 
354