Subversion Repositories Projects

Rev

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

Rev 675 Rev 676
1
/****************************************************************************
1
/****************************************************************************
2
 *   Copyright (C) 2009 by Claas Anders "CaScAdE" Rathje                    *
2
 *   Copyright (C) 2009 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
/* ##########################################################################
21
/* ##########################################################################
22
 * gain some fake arm compat :)
22
 * gain some fake arm compat :)
23
 * ##########################################################################*/
23
 * ##########################################################################*/
24
#define u8 uint8_t
24
#define u8 uint8_t
25
#define s8 int8_t
25
#define s8 int8_t
26
#define u16 uint16_t
26
#define u16 uint16_t
27
#define s16 int16_t
27
#define s16 int16_t
28
#define u32 uint32_t
28
#define u32 uint32_t
29
#define s32 int32_t
29
#define s32 int32_t
30
 
30
 
31
/*
31
/*
32
 * FC Debug Struct
32
 * FC Debug Struct
33
 * portions taken and adapted from
33
 * portions taken and adapted from
34
 * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.72p%2Fuart.h
34
 * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.72p%2Fuart.h
35
 */
35
 */
36
typedef struct {
36
typedef struct {
37
    uint8_t Digital[2];
37
    uint8_t Digital[2];
38
    uint16_t Analog[32]; // Debugvalues
38
    uint16_t Analog[32]; // Debugvalues
39
} __attribute__((packed)) DebugOut_t;
39
} __attribute__((packed)) DebugOut_t;
40
 
40
 
41
/*
41
/*
42
 * NaviCtrl OSD Structs
42
 * NaviCtrl OSD Structs
43
 * portions taken and adapted from
43
 * portions taken and adapted from
44
 * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=NaviCtrl&path=%2Ftags%2FV0.17e%2Fuart1.h
44
 * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=NaviCtrl&path=%2Ftags%2FV0.17e%2Fuart1.h
45
 */
45
 */
46
typedef struct {
46
typedef struct {
47
    s32 Longitude; // in 1E-7 deg
47
    s32 Longitude; // in 1E-7 deg
48
    s32 Latitude; // in 1E-7 deg
48
    s32 Latitude; // in 1E-7 deg
49
    s32 Altitude; // in mm
49
    s32 Altitude; // in mm
50
    u8 Status; // validity of data
50
    u8 Status; // validity of data
51
} __attribute__((packed)) GPS_Pos_t;
51
} __attribute__((packed)) GPS_Pos_t;
52
#define INVALID         0x00
52
#define INVALID         0x00
53
#define NEWDATA         0x01
53
#define NEWDATA         0x01
54
#define PROCESSED       0x02
54
#define PROCESSED       0x02
55
 
55
 
56
 
-
 
57
typedef struct {
-
 
58
{
56
 
59
        u16 Distance;                                   // distance to target in cm
57
typedef struct {
60
        s16 Bearing;                                    // course to target in deg
58
        u16 Distance;                                   // distance to target in cm
61
} __attribute__((packed)) GPS_PosDev_t;
59
        s16 Bearing;                                    // course to target in deg
62
 
60
} __attribute__((packed)) GPS_PosDev_t;
63
typedef struct {
61
 
64
        u8 Version;                                     // version of the data structure
62
typedef struct {
65
        GPS_Pos_t CurrentPosition;                      // see ubx.h for details
63
        u8 Version;                                     // version of the data structure
66
        GPS_Pos_t TargetPosition;
64
        GPS_Pos_t CurrentPosition;                      // see ubx.h for details
67
        GPS_PosDev_t TargetPositionDeviation;
65
        GPS_Pos_t TargetPosition;
68
        GPS_Pos_t HomePosition;
66
        GPS_PosDev_t TargetPositionDeviation;
69
        GPS_PosDev_t HomePositionDeviation;
67
        GPS_Pos_t HomePosition;
70
        u8  WaypointIndex;                              // index of current waypoints running from 0 to WaypointNumber-1
68
        GPS_PosDev_t HomePositionDeviation;
71
        u8  WaypointNumber;                             // number of stored waypoints
69
        u8  WaypointIndex;                              // index of current waypoints running from 0 to WaypointNumber-1
72
        u8  SatsInUse;                                  // number of satellites used for position solution
70
        u8  WaypointNumber;                             // number of stored waypoints
73
        s16 Altimeter;                                  // hight according to air pressure
71
        u8  SatsInUse;                                  // number of satellites used for position solution
74
        s16 Variometer;                                 // climb(+) and sink(-) rate
72
        s16 Altimeter;                                  // hight according to air pressure
75
        u16 FlyingTime;                                 // in seconds
73
        s16 Variometer;                                 // climb(+) and sink(-) rate
76
        u8  UBat;                                       // Battery Voltage in 0.1 Volts
74
        u16 FlyingTime;                                 // in seconds
77
        u16 GroundSpeed;                                // speed over ground in cm/s (2D)
75
        u8  UBat;                                       // Battery Voltage in 0.1 Volts
78
        s16 Heading;                                    // current flight direction in ° as angle to north
76
        u16 GroundSpeed;                                // speed over ground in cm/s (2D)
79
        s16 CompassHeading;                             // current compass value in °
77
        s16 Heading;                                    // current flight direction in ° as angle to north
80
        s8  AngleNick;                                  // current Nick angle in 1°
78
        s16 CompassHeading;                             // current compass value in °
81
        s8  AngleRoll;                                  // current Rick angle in 1°
79
        s8  AngleNick;                                  // current Nick angle in 1°
82
        u8  RC_Quality;                                 // RC_Quality
80
        s8  AngleRoll;                                  // current Rick angle in 1°
83
        u8  MKFlags;                                    // Flags from FC
81
        u8  RC_Quality;                                 // RC_Quality
84
        u8  NCFlags;                                    // Flags from NC
82
        u8  MKFlags;                                    // Flags from FC
85
        u8  Errorcode;                                  // 0 --> okay
83
        u8  NCFlags;                                    // Flags from NC
86
        u8  OperatingRadius;                            // current operation radius around the Home Position in m
84
        u8  Errorcode;                                  // 0 --> okay
87
        s16 TopSpeed;                                   // velocity in vertical direction in cm/s
85
        u8  OperatingRadius;                            // current operation radius around the Home Position in m
88
        u8  TargetHoldTime;                             // time in s to stay at the given target, counts down to 0 if target has been reached
86
        s16 TopSpeed;                                   // velocity in vertical direction in cm/s
89
        u8  RC_RSSI;                                    // Receiver signal strength (since version 2 added)
87
        u8  TargetHoldTime;                             // time in s to stay at the given target, counts down to 0 if target has been reached
90
        s16 SetpointAltitude;                           // setpoint for altitude
88
        u8  RC_RSSI;                                    // Receiver signal strength (since version 2 added)
91
        u8  Gas;                                        // for future use
89
        s16 SetpointAltitude;                           // setpoint for altitude
92
} __attribute__((packed)) NaviData_t;
90
        u8  Gas;                                        // for future use
93
 
91
} __attribute__((packed)) NaviData_t;
94
/*
92
 
95
 * MikroKopter Flags
93
/*
96
 * taken from
94
 * MikroKopter Flags
97
 * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.73d%2Ffc.h
95
 * taken from
98
 */
96
 * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.73d%2Ffc.h
99
#define FLAG_MOTOR_RUN  1
97
 */
100
#define FLAG_FLY        2
98
#define FLAG_MOTOR_RUN  1
101
#define FLAG_CALIBRATE  4
99
#define FLAG_FLY        2
102
#define FLAG_START      8
100
#define FLAG_CALIBRATE  4
103
 
101
#define FLAG_START      8
104
/*
102
 
105
 * NaviCtrl Flags
103
/*
106
 * taken from
104
 * NaviCtrl Flags
107
 * http://mikrocontroller.cco-ev.de/mikrowebsvn/filedetails.php?repname=NaviCtrl&path=%2Ftags%2FV0.17e%2Fuart1.h
105
 * taken from
108
 */
106
 * http://mikrocontroller.cco-ev.de/mikrowebsvn/filedetails.php?repname=NaviCtrl&path=%2Ftags%2FV0.17e%2Fuart1.h
109
#define NC_FLAG_FREE                    0x01
107
 */
110
#define NC_FLAG_PH                              0x02
108
#define NC_FLAG_FREE                    0x01
111
#define NC_FLAG_CH                              0x04
109
#define NC_FLAG_PH                              0x02
112
#define NC_FLAG_RANGE_LIMIT             0x08
110
#define NC_FLAG_CH                              0x04
113
#define NC_FLAG_NOSERIALLINK    0x10
111
#define NC_FLAG_RANGE_LIMIT             0x08
114
#define NC_FLAG_TARGET_REACHED  0x20
112
#define NC_FLAG_NOSERIALLINK    0x10
115
#define NC_FLAG_MANUAL_CONTROL  0x40
113
#define NC_FLAG_TARGET_REACHED  0x20
116
#define NC_FLAG_8                               0x80
114
#define NC_FLAG_MANUAL_CONTROL  0x40
117
 
115
#define NC_FLAG_8                               0x80
118
 
116
 
119
 
117
 
-
 
118