Subversion Repositories Projects

Rev

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

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