Subversion Repositories Projects

Rev

Rev 2000 | Rev 2043 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2000 Rev 2039
Line 1... Line 1...
1
/****************************************************************************
1
/****************************************************************************
2
 *   Copyright (C) 2009-2013 by Claas Anders "CaScAdE" Rathje               *
2
 *   Copyright (C) 2009-2014 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   *
Line 79... Line 79...
79
#define PROCESSED       0x02
79
#define PROCESSED       0x02
80
80
81
/*
81
/*
82
 * NaviCtrl OSD Structs
82
 * NaviCtrl OSD Structs
83
 * portions taken and adapted from
83
 * portions taken and adapted from
84
 * http://svn.mikrokopter.de/filedetails.php?repname=NaviCtrl&path=/tags/V0.24b/uart1.h
84
 * http://svn.mikrokopter.de/filedetails.php?repname=NaviCtrl&path=/tags/V2.04a/uart1.h
85
 */
85
 */
86
typedef struct {
86
typedef struct {
87
    u16 Distance; // distance to target in dm
87
    u16 Distance; // distance to target in dm
88
    s16 Bearing; // course to target in deg
88
    s16 Bearing; // course to target in deg
89
} __attribute__((packed)) GPS_PosDev_t;
89
} __attribute__((packed)) GPS_PosDev_t;
-
 
90
#define NAVIDATA_VERSION 5
90
91
91
typedef struct {
92
typedef struct {
92
    u8 Version; // version of the data structure
93
    u8 Version; // version of the data structure
93
    GPS_Pos_t CurrentPosition; // see ubx.h for details
94
    GPS_Pos_t CurrentPosition; // see gpspos.h for details
94
    GPS_Pos_t TargetPosition;
95
    GPS_Pos_t TargetPosition;
95
    GPS_PosDev_t TargetPositionDeviation;
96
    GPS_PosDev_t TargetPositionDeviation;
96
    GPS_Pos_t HomePosition;
97
    GPS_Pos_t HomePosition;
97
    GPS_PosDev_t HomePositionDeviation;
98
    GPS_PosDev_t HomePositionDeviation;
98
    u8 WaypointIndex; // index of current waypoints running from 0 to WaypointNumber-1
99
    u8 WaypointIndex; // index of current waypoints running from 0 to WaypointNumber-1
Line 101... Line 102...
101
    s16 Altimeter; // hight according to air pressure
102
    s16 Altimeter; // hight according to air pressure
102
    s16 Variometer; // climb(+) and sink(-) rate
103
    s16 Variometer; // climb(+) and sink(-) rate
103
    u16 FlyingTime; // in seconds
104
    u16 FlyingTime; // in seconds
104
    u8 UBat; // Battery Voltage in 0.1 Volts
105
    u8 UBat; // Battery Voltage in 0.1 Volts
105
    u16 GroundSpeed; // speed over ground in cm/s (2D)
106
    u16 GroundSpeed; // speed over ground in cm/s (2D)
106
    s16 Heading; // current flight direction in ° as angle to north
107
    s16 Heading; // current flight direction in ° as angle to north
107
    s16 CompassHeading; // current compass value in °
108
    s16 CompassHeading; // current compass value in °
108
    s8 AngleNick; // current Nick angle in 1°
109
    s8 AngleNick; // current Nick angle in 1°
109
    s8 AngleRoll; // current Rick angle in 1°
110
    s8 AngleRoll; // current Rick angle in 1°
110
    u8 RC_Quality; // RC_Quality
111
    u8 RC_Quality; // RC_Quality
111
    u8 FCFlags; // Flags from FC
112
    u8 FCStatusFlags; // Flags from FC
112
    u8 NCFlags; // Flags from NC
113
    u8 NCFlags; // Flags from NC
113
    u8 Errorcode; // 0 --> okay
114
    u8 Errorcode; // 0 --> okay
114
    u8 OperatingRadius; // current operation radius around the Home Position in m
115
    u8 OperatingRadius; // current operation radius around the Home Position in m
115
    s16 TopSpeed; // velocity in vertical direction in cm/s
116
    s16 TopSpeed; // velocity in vertical direction in cm/s
116
    u8 TargetHoldTime; // time in s to stay at the given target, counts down to 0 if target has been reached
117
    u8 TargetHoldTime; // time in s to stay at the given target, counts down to 0 if target has been reached
Line 119... Line 120...
119
    u8 Gas; // for future use
120
    u8 Gas; // for future use
120
    u16 Current; // actual current in 0.1A steps
121
    u16 Current; // actual current in 0.1A steps
121
    u16 UsedCapacity; // used capacity in mAh
122
    u16 UsedCapacity; // used capacity in mAh
122
} __attribute__((packed)) NaviData_t;
123
} __attribute__((packed)) NaviData_t;
123
124
124
#define NC_FLAG_FREE                    0x01
125
#define NC_FLAG_FREE                    0x01
125
#define NC_FLAG_PH                              0x02
126
#define NC_FLAG_PH                              0x02
126
#define NC_FLAG_CH                              0x04
127
#define NC_FLAG_CH                              0x04
127
#define NC_FLAG_RANGE_LIMIT             0x08
128
#define NC_FLAG_RANGE_LIMIT             0x08
128
#define NC_FLAG_NOSERIALLINK    0x10
129
#define NC_FLAG_NOSERIALLINK    0x10
129
#define NC_FLAG_TARGET_REACHED  0x20
130
#define NC_FLAG_TARGET_REACHED  0x20
130
#define NC_FLAG_MANUAL_CONTROL  0x40
131
#define NC_FLAG_MANUAL_CONTROL  0x40
131
#define NC_FLAG_GPS_OK                  0x80
132
#define NC_FLAG_GPS_OK                  0x80
132
133
133
/*
134
/*
134
 * MikroKopter Flags
135
 * MikroKopter Flags
135
 * portions taken and adapted from
136
 * portions taken and adapted from
Line 164... Line 165...
164
#define DEFEKT_MIXER_ERR    0x10
165
#define DEFEKT_MIXER_ERR    0x10
165
166
166
/*
167
/*
167
 * MikroKopter config struct
168
 * MikroKopter config struct
168
 * portions taken and adapted from
169
 * portions taken and adapted from
169
 * http://svn.mikrokopter.de/filedetails.php?repname=FlightCtrl&path=/tags/V0.90j/eeprom.h
170
 * http://svn.mikrokopter.de/filedetails.php?repname=FlightCtrl&path=/tags/V2.04a/eeprom.h
170
 */
171
 */
-
 
172
-
 
173
#define EEPARAM_REVISION         98 // is count up, if paramater stucture has changed (compatibility)
-
 
174
171
typedef struct {
175
typedef struct {
172
    unsigned char Revision;
176
    unsigned char Revision;
173
    unsigned char Kanalbelegung[12]; // GAS[0], GIER[1],NICK[2], ROLL[3], POTI1, POTI2, POTI3
177
    unsigned char Kanalbelegung[12]; // GAS[0], GIER[1],NICK[2], ROLL[3], POTI1, POTI2, POTI3
174
    unsigned char GlobalConfig; // 0x01=Höhenregler aktiv,0x02=Kompass aktiv, 0x04=GPS aktiv, 0x08=Heading Hold aktiv
178
    unsigned char GlobalConfig; // 0x01=Höhenregler aktiv,0x02=Kompass aktiv, 0x04=GPS aktiv, 0x08=Heading Hold aktiv
175
    unsigned char Hoehe_MinGas; // Wert : 0-100
179
    unsigned char Hoehe_MinGas; // Wert : 0-100
176
    unsigned char Luftdruck_D; // Wert : 0-250
180
    unsigned char Luftdruck_D; // Wert : 0-250
177
    unsigned char MaxHoehe; // Wert : 0-32
181
    unsigned char HoeheChannel; // Wert : 0-32
178
    unsigned char Hoehe_P; // Wert : 0-32
182
    unsigned char Hoehe_P; // Wert : 0-32
179
    unsigned char Hoehe_Verstaerkung; // Wert : 0-50
183
    unsigned char Hoehe_Verstaerkung; // Wert : 0-50
180
    unsigned char Hoehe_ACC_Wirkung; // Wert : 0-250
184
    unsigned char Hoehe_ACC_Wirkung; // Wert : 0-250
181
    unsigned char Hoehe_HoverBand; // Wert : 0-250
185
    unsigned char Hoehe_HoverBand; // Wert : 0-250
182
    unsigned char Hoehe_GPS_Z; // Wert : 0-250
186
    unsigned char Hoehe_GPS_Z; // Wert : 0-250
Line 242... Line 246...
242
    // seit version V0.75c
246
    // seit version V0.75c
243
    unsigned char WARN_J16_Bitmask; // for the J16 Output
247
    unsigned char WARN_J16_Bitmask; // for the J16 Output
244
    unsigned char WARN_J17_Bitmask; // for the J17 Output
248
    unsigned char WARN_J17_Bitmask; // for the J17 Output
245
    //---NaviCtrl---------------------------------------------
249
    //---NaviCtrl---------------------------------------------
246
    unsigned char NaviOut1Parameter; // for the J16 Output
250
    unsigned char NaviOut1Parameter; // for the J16 Output
247
    unsigned char NaviGpsModeControl; // Parameters for the Naviboard
251
    unsigned char NaviGpsModeChannel; // Parameters for the Naviboard
248
    unsigned char NaviGpsGain;
252
    unsigned char NaviGpsGain;
249
    unsigned char NaviGpsP;
253
    unsigned char NaviGpsP;
250
    unsigned char NaviGpsI;
254
    unsigned char NaviGpsI;
251
    unsigned char NaviGpsD;
255
    unsigned char NaviGpsD;
252
    unsigned char NaviGpsPLimit;
256
    unsigned char NaviGpsPLimit;
253
    unsigned char NaviGpsILimit;
257
    unsigned char NaviGpsILimit;
254
    unsigned char NaviGpsDLimit;
258
    unsigned char NaviGpsDLimit;
255
    unsigned char NaviGpsACC;
259
    unsigned char NaviGpsA;
256
    unsigned char NaviGpsMinSat;
260
    unsigned char NaviGpsMinSat;
257
    unsigned char NaviStickThreshold;
261
    unsigned char NaviStickThreshold;
258
    unsigned char NaviWindCorrection;
262
    unsigned char NaviWindCorrection;
259
    unsigned char NaviAccCompensation; // New since 0.86 -> was: SpeedCompensation
263
    unsigned char NaviAccCompensation; // New since 0.86 -> was: SpeedCompensation
260
    unsigned char NaviOperatingRadius;
264
    unsigned char NaviOperatingRadius;
Line 262... Line 266...
262
    unsigned char NaviPH_LoginTime;
266
    unsigned char NaviPH_LoginTime;
263
    //---Ext.Ctrl---------------------------------------------
267
    //---Ext.Ctrl---------------------------------------------
264
    unsigned char ExternalControl; // for serial Control
268
    unsigned char ExternalControl; // for serial Control
265
    //---CareFree---------------------------------------------
269
    //---CareFree---------------------------------------------
266
    unsigned char OrientationAngle; // Where is the front-direction?
270
    unsigned char OrientationAngle; // Where is the front-direction?
267
    unsigned char CareFreeModeControl; // switch for CareFree
271
    unsigned char CareFreeChannel; // switch for CareFree
268
    unsigned char MotorSafetySwitch;
272
    unsigned char MotorSafetySwitch;
269
    unsigned char MotorSmooth;
273
    unsigned char MotorSmooth;
270
    unsigned char ComingHomeAltitude;
274
    unsigned char ComingHomeAltitude;
271
    unsigned char FailSafeTime;
275
    unsigned char FailSafeTime;
272
    unsigned char MaxAltitude;
276
    unsigned char MaxAltitude;
273
    unsigned char FailsafeChannel; // if the value of this channel is > 100, the MK reports "RC-Lost"
277
    unsigned char FailsafeChannel; // if the value of this channel is > 100, the MK reports "RC-Lost"
274
    unsigned char ServoFilterNick;
278
    unsigned char ServoFilterNick;
275
    unsigned char ServoFilterRoll;
279
    unsigned char ServoFilterRoll;
276
        unsigned char StartLandChannel;
280
    unsigned char StartLandChannel;
277
        unsigned char LandingSpeed;
281
    unsigned char LandingSpeed;
-
 
282
    unsigned char CompassOffset;
-
 
283
    unsigned char AutoLandingVoltage; // in 0,1V  0 -> disabled
-
 
284
    unsigned char ComingHomeVoltage; // in 0,1V  0 -> disabled
278
    //------------------------------------------------
285
    //------------------------------------------------
279
    unsigned char BitConfig; // (war Loop-Cfg) Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts / wird getrennt behandelt
286
    unsigned char BitConfig; // (war Loop-Cfg) Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts / wird getrennt behandelt
280
    unsigned char ServoCompInvert; // //  0x01 = Nick, 0x02 = Roll, 0x04 = relative moving // WICHTIG!!! am Ende lassen
287
    unsigned char ServoCompInvert; // //  0x01 = Nick, 0x02 = Roll, 0x04 = relative moving // WICHTIG!!! am Ende lassen
281
    unsigned char ExtraConfig; // bitcodiert
288
    unsigned char ExtraConfig; // bitcodiert
282
    unsigned char GlobalConfig3; // bitcodiert
289
    unsigned char GlobalConfig3; // bitcodiert
283
    char Name[12];
290
    char Name[12];
284
    unsigned char crc; // must be the last byte!
291
    unsigned char crc; // must be the last byte!
285
} paramset_t;
292
} paramset_t; // 127 bytes 
286
293
287
typedef struct {
294
typedef struct {
288
    u8 SettingsIndex;
295
    u8 SettingsIndex;
289
    paramset_t param;
296
    paramset_t param;
290
} __attribute__((packed)) paramset_serial;
297
} __attribute__((packed)) paramset_serial;