⇤ ← Revision 1 vom 17.12.2015 10:48
Größe: 4482
Kommentar:
|
Größe: 8032
Kommentar:
|
Gelöschter Text ist auf diese Art markiert. | Hinzugefügter Text ist auf diese Art markiert. |
Zeile 7: | Zeile 7: |
#define OSD_FLAG_MASK1 (0x04 + 0x20 + 0x40 + 0x80) #define OSD_FLAG_MASK2 (0x01 + 0x02 + 0x08 + 0x10) |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //+ New protocol //+ start abbo communication with: 'O' + Interval 1byte [10ms] + MaxBytesPerSecond (2Bytes) //+ i.e. 'O'+10+1024 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ typedef struct // Index:10 (15 Bytes need 27 ASCII-characters) { u8 Index; // Index to identify this data set s32 ActualLongitude; // s32 ActualLatitude; // s16 Altimeter_5cm; // hight -> devide by 20 to get meters & multiply with 5 to get cm u8 GroundSpeed; // speed over ground in 10cm/s (2D) (255 = 91km/h) u8 OSDStatusFlags; // see main.h for definitions OSD_FLAG_xxx u8 CamCtrlChar; // Status from a connected CamCtrl unit: 'R' = REC 'c' = Ready '!' = Error ...etc u8 reserve1; } __attribute__((packed)) NaviData_Tiny_t; extern NaviData_Tiny_t NaviData_Tiny; #define START_PAYLOAD_DATA 13 // typedef struct // Index:11 (24 Bytes need 39 ASCII-characters) { u8 Index; // Index to identify this data set s32 ActualLongitude; // s32 ActualLatitude; // s16 Altimeter_5cm; // hight -> devide by 20 to get meters & multiply with 5 to get cm u8 GroundSpeed; // speed over ground in 10cm/s (2D) (255 = 91km/h) u8 OSDStatusFlags; // see main.h for definitions OSD_FLAG_xxx u8 OSDStatusFlags2; // see main.h for definitions OSD_FLAG2_xxx u8 NCFlags; // Flags from NC u8 ReserveFlags; u8 Errorcode; // 0 --> okay see http://wiki.mikrokopter.de/ErrorCodes u8 SpeakHoTT; // voice output SPEAK_xxx (see spi_slave.h) u8 VarioCharacter; // display as ascii character ('+' = 'climb' etc) u8 GPS_ModeCharacter; // display as ascii character ('H' = 'Home' etc) u8 BL_MinOfMaxPWM; // status byte of the BL-Ctrls } __attribute__((packed)) NaviData_Flags_t; extern NaviData_Flags_t NaviData_Flags; typedef struct // Index:12 (27 Bytes need 43 ASCII-characters) { u8 Index; // Index to identify this data set s32 ActualLongitude; // s32 ActualLatitude; // s16 Altimeter_5cm; // hight -> devide by 20 to get meters & multiply with 5 to get cm u8 GroundSpeed; // speed over ground in 10cm/s (2D) (255 = 91km/h) u8 OSDStatusFlags; // see main.h for definitions OSD_FLAG_xxx s32 TargetLongitude; // s32 TargetLatitude; // s16 TargetAltitude; // hight according to air pressure u8 RC_Quality; // RC_Quality } __attribute__((packed)) NaviData_Target_t; extern NaviData_Target_t NaviData_Target; typedef struct // Index:13 (30 Bytes need 47 ASCII-characters) { u8 Index; // Index to identify this data set s32 ActualLongitude; // s32 ActualLatitude; // s16 Altimeter_5cm; // hight -> devide by 20 to get meters & multiply with 5 to get cm u8 GroundSpeed; // speed over ground in 10cm/s (2D) (255 = 91km/h) u8 OSDStatusFlags; // see main.h for definitions OSD_FLAG_xxx s32 HomeLongitude; // s32 HomeLatitude; // s16 HomeAltitude; // hight according to air pressure u16 WP_OperatingRadius; // current WP operation radius around the Home Position in m u8 LipoCellCount; u8 DescendRange; // in [10m] u8 ManualFlyingRange; // in [10m] u8 reserve1; u8 reserve2; } __attribute__((packed)) NaviData_Home_t; extern NaviData_Home_t NaviData_Home; typedef struct // Index:14 (24 Bytes need 39 ASCII-characters) { u8 Index; // Index to identify this data set s32 ActualLongitude; // s32 ActualLatitude; // s16 Altimeter_5cm; // hight -> devide by 20 to get meters & multiply with 5 to get cm u8 GroundSpeed; // speed over ground in 10cm/s (2D) (255 = 91km/h) u8 OSDStatusFlags; // see main.h for definitions OSD_FLAG_xxx u16 FlyingTime; // in seconds u16 DistanceToHome; // [10cm] (100 = 10m) u8 HeadingToHome; // in 2° (100 = 200°) u16 DistanceToTarget; // [10cm] (100 = 10m) u8 HeadingToTarget; // in 2° (100 = 200°) s8 AngleNick; // current Nick angle in 1° s8 AngleRoll; // current Rick angle in 1° u8 SatsInUse; // number of satellites used for position solution } __attribute__((packed)) NaviData_Deviation_t; extern NaviData_Deviation_t NaviData_Deviation; typedef struct // Index:15 (18 Bytes need 31 ASCII-characters) { u8 Index; // Index to identify this data set s32 ActualLongitude; // s32 ActualLatitude; // s16 Altimeter_5cm; // hight -> devide by 20 to get meters & multiply with 5 to get cm u8 GroundSpeed; // speed over ground in 10cm/s (2D) (255 = 91km/h) u8 OSDStatusFlags; // see main.h for definitions OSD_FLAG_xxx u8 WaypointIndex; // index of current waypoints running from 0 to WaypointNumber-1 u8 WaypointNumber; // number of stored waypoints u8 TargetHoldTime; // time in s to stay at the given target, counts down to 0 if target has been reached u8 WP_Eventchannel; // the current value of the event channel u8 reserve; } __attribute__((packed)) NaviData_WP_t; extern NaviData_WP_t NaviData_WP; typedef struct // Index:16 (27 Bytes need 43 ASCII-characters) { u8 Index; // Index to identify this data set s32 ActualLongitude; // s32 ActualLatitude; // s16 Altimeter_5cm; // hight -> devide by 20 to get meters & multiply with 5 to get cm u8 GroundSpeed; // speed over ground in 10cm/s (2D) (255 = 91km/h) u8 OSDStatusFlags; // see main.h for definitions OSD_FLAG_xxx u16 UBat; // Battery Voltage in 0.1 Volts u16 Current; // actual current in 0.1A steps u16 UsedCapacity; // used capacity in mAh s8 Variometer; // climb(+) and sink(-) rate u8 Heading; // Current moving direction in 2° (100 = 200°) u8 CompassHeading; // current compass value in 2° u8 Gas; // current gas (thrust) u16 ShutterCounter; // counts every time a Out1 was activated s16 SetpointAltitude; // setpoint for altitude } __attribute__((packed)) NaviData_Volatile_t; extern NaviData_Volatile_t NaviData_Volatile; |
Zeile 11: | Zeile 138: |
typedef struct | typedef struct // Index:17 (21 Bytes need 35 ASCII-characters) |
Zeile 13: | Zeile 140: |
signed long Longitude; // distance to target in cm signed long Latitude; // course to target in deg } GPS_Position_tiny_t; |
u8 Index; // Index to identify this data set s32 ActualLongitude; // s32 ActualLatitude; // s16 Altimeter_5cm; // hight -> devide by 20 to get meters & multiply with 5 to get cm u8 GroundSpeed; // speed over ground in 10cm/s (2D) (255 = 91km/h) u8 OSDStatusFlags; // see main.h for definitions OSD_FLAG_xxx s32 Longitude; // Failsafe-Position s32 Latitude; // Failsafe-Position } __attribute__((packed)) NaviData_FS_Pos_t; extern NaviData_FS_Pos_t NaviData_Failsafe; typedef struct // Index:18 (9 Bytes need 19 ASCII-characters) { u8 Index; // Index to identify this data set s32 Longitude; // Trigger Position s32 Latitude; // Trigger Position } __attribute__((packed)) NaviData_Out_t; extern NaviData_Out_t NaviData_Out1Trigger; }}} '''OSD flags definitions''' {{{ #!cplusplus |
Zeile 18: | Zeile 167: |
// this struct is included in every dataset at the beginning | // xxx.OSDStatusFlags (multiple data sets) -> this is the definition in the OSD data structure #define OSD_FLAG_CAREFREE 0x01 #define OSD_FLAG_ALTITUDE_CONTROL 0x02 #define OSD_FLAG_CALIBRATE 0x04 #define OSD_FLAG_OUT1_ACTIVE 0x08 #define OSD_FLAG_OUT2_ACTIVE 0x10 #define OSD_FLAG_LOWBAT 0x20 #define OSD_FLAG_VARIO_TRIM_UP 0x40 #define OSD_FLAG_VARIO_TRIM_DOWN 0x80 |
Zeile 20: | Zeile 177: |
typedef struct // Index 10 { unsigned char Index; // version of the data structure (<10 == old data struct) GPS_Position_tiny_t CurrentPosition; short int Altimeter; // hight according to air pressure unsigned char GroundSpeed; // speed over ground in 10cm/s (2D) (255 = 91km/h) unsigned char OSDStatusFlags; } OSD_Base_Data_t; |
// NaviData_Flags.OSDStatusFlags2 (Index:11) -> this is the definition in the OSD data structure #define OSD2_FLAG_MOTOR_RUN 0x01 #define OSD2_FLAG_FLY 0x02 #define OSD2_FLAG_RC_FAILSAVE_ACTIVE 0x04 #define OSD2_FLAG_START 0x08 #define OSD2_FLAG_EMERGENCY_LANDING 0x10 #define OSD2_FLAG_WAIT_FOR_TAKEOFF 0x20 // Motor Running, but still on the ground #define OSD2_FLAG_AUTO_STARTING 0x40 #define OSD2_FLAG_AUTO_LANDING 0x80 }}} |
Zeile 30: | Zeile 189: |
typedef struct // Index 11 { OSD_Base_Data_t BaseData; // common data in every dataset unsigned char OSDStatusFlags2; unsigned char NCFlags; // Flags from NC unsigned char ReserveFlags; unsigned char Errorcode; // 0 --> okay unsigned char SpeakHoTT; unsigned char VarioCharacter; unsigned char GPS_ModeCharacter; unsigned char BL_MinOfMaxPWM; } OSD_NaviData_Flags_t; |
|
Zeile 43: | Zeile 190: |
typedef struct // Index 12 { OSD_Base_Data_t BaseData; // common data in every dataset GPS_Position_tiny_t TargetPosition; // short int TargetAltitude; // unsigned char RC_Quality; // RC_Quality } OSD_NaviData_Target_t; typedef struct // Index 13 { OSD_Base_Data_t BaseData; GPS_Position_tiny_t HomePosition; // short int HomeAltitude; // short unsigned int WP_OperatingRadius; // current WP operation radius around the Home Position in m unsigned char LipoCellCount; unsigned char DescendRange; // in 10m unsigned char FlyingRange; // in 10m } OSD_NaviData_Home_t; typedef struct // Index 14 { OSD_Base_Data_t BaseData; short unsigned int FlyingTime; // in seconds short unsigned int DistanceToHome; unsigned char BearingToHome; // in 2° (100 = 200°) short unsigned int DistanceToTarget; unsigned char BearingToTarget; // in 2° (100 = 200°) char AngleNick; // current Nick angle in 1° char AngleRoll; // current Rick angle in 1° unsigned char SatsInUse; // number of satellites used for position solution } OSD_NaviData_Deviation_t; typedef struct // Index 15 { OSD_Base_Data_t BaseData; unsigned char WaypointIndex; // index of current waypoints running from 0 to WaypointNumber-1 unsigned char WaypointNumber; // number of stored waypoints unsigned char TargetHoldTime; // time in s to stay at the given target, counts down to 0 if target has been reached unsigned char WP_Eventchannel; } OSD_NaviData_Waypoint_t; typedef struct // Index 16 { OSD_Base_Data_t BaseData; short unsigned int UBat; // Battery Voltage in 0.1 Volts short unsigned int Current; // actual current in 0.1A steps // now 16 bit ! short unsigned int UsedCapacity; // used capacity in mAh char Variometer; // climb(+) and sink(-) rate unsigned char Heading; // Current moving direction in 2° (100 = 200°) unsigned char CompassHeading; // current compass value in 2° unsigned char Gas; // for future use short unsigned int ShutterCounter; // counts every time a Out1 was activated short int SetPointAltitude; // setpoint for altitude } OSD_NaviData_Volatile_t; typedef struct // Index 17 { OSD_Base_Data_t BaseData; GPS_Position_tiny_t FailsafePosition; // } OSD_NaviData_Failsafe_t; typedef struct // Index 18 { unsigned char Index; // version of the data structure GPS_Position_tiny_t ShutterPosition; // } OSD_NaviData_ShutterPosition_t; }}} |
from uart1.h in NaviCtrl code (please take a look at SVN for latest version of header files)
1 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 //+ New protocol
3 //+ start abbo communication with: 'O' + Interval 1byte [10ms] + MaxBytesPerSecond (2Bytes)
4 //+ i.e. 'O'+10+1024
5 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6
7 typedef struct // Index:10 (15 Bytes need 27 ASCII-characters)
8 {
9 u8 Index; // Index to identify this data set
10 s32 ActualLongitude; //
11 s32 ActualLatitude; //
12 s16 Altimeter_5cm; // hight -> devide by 20 to get meters & multiply with 5 to get cm
13 u8 GroundSpeed; // speed over ground in 10cm/s (2D) (255 = 91km/h)
14 u8 OSDStatusFlags; // see main.h for definitions OSD_FLAG_xxx
15 u8 CamCtrlChar; // Status from a connected CamCtrl unit: 'R' = REC 'c' = Ready '!' = Error ...etc
16 u8 reserve1;
17 } __attribute__((packed)) NaviData_Tiny_t;
18 extern NaviData_Tiny_t NaviData_Tiny;
19
20 #define START_PAYLOAD_DATA 13 //
21
22 typedef struct // Index:11 (24 Bytes need 39 ASCII-characters)
23 {
24 u8 Index; // Index to identify this data set
25 s32 ActualLongitude; //
26 s32 ActualLatitude; //
27 s16 Altimeter_5cm; // hight -> devide by 20 to get meters & multiply with 5 to get cm
28 u8 GroundSpeed; // speed over ground in 10cm/s (2D) (255 = 91km/h)
29 u8 OSDStatusFlags; // see main.h for definitions OSD_FLAG_xxx
30 u8 OSDStatusFlags2; // see main.h for definitions OSD_FLAG2_xxx
31 u8 NCFlags; // Flags from NC
32 u8 ReserveFlags;
33 u8 Errorcode; // 0 --> okay see http://wiki.mikrokopter.de/ErrorCodes
34 u8 SpeakHoTT; // voice output SPEAK_xxx (see spi_slave.h)
35 u8 VarioCharacter; // display as ascii character ('+' = 'climb' etc)
36 u8 GPS_ModeCharacter; // display as ascii character ('H' = 'Home' etc)
37 u8 BL_MinOfMaxPWM; // status byte of the BL-Ctrls
38 } __attribute__((packed)) NaviData_Flags_t;
39 extern NaviData_Flags_t NaviData_Flags;
40
41 typedef struct // Index:12 (27 Bytes need 43 ASCII-characters)
42 {
43 u8 Index; // Index to identify this data set
44 s32 ActualLongitude; //
45 s32 ActualLatitude; //
46 s16 Altimeter_5cm; // hight -> devide by 20 to get meters & multiply with 5 to get cm
47 u8 GroundSpeed; // speed over ground in 10cm/s (2D) (255 = 91km/h)
48 u8 OSDStatusFlags; // see main.h for definitions OSD_FLAG_xxx
49 s32 TargetLongitude; //
50 s32 TargetLatitude; //
51 s16 TargetAltitude; // hight according to air pressure
52 u8 RC_Quality; // RC_Quality
53 } __attribute__((packed)) NaviData_Target_t;
54 extern NaviData_Target_t NaviData_Target;
55
56 typedef struct // Index:13 (30 Bytes need 47 ASCII-characters)
57 {
58 u8 Index; // Index to identify this data set
59 s32 ActualLongitude; //
60 s32 ActualLatitude; //
61 s16 Altimeter_5cm; // hight -> devide by 20 to get meters & multiply with 5 to get cm
62 u8 GroundSpeed; // speed over ground in 10cm/s (2D) (255 = 91km/h)
63 u8 OSDStatusFlags; // see main.h for definitions OSD_FLAG_xxx
64 s32 HomeLongitude; //
65 s32 HomeLatitude; //
66 s16 HomeAltitude; // hight according to air pressure
67 u16 WP_OperatingRadius; // current WP operation radius around the Home Position in m
68 u8 LipoCellCount;
69 u8 DescendRange; // in [10m]
70 u8 ManualFlyingRange; // in [10m]
71 u8 reserve1;
72 u8 reserve2;
73 } __attribute__((packed)) NaviData_Home_t;
74 extern NaviData_Home_t NaviData_Home;
75
76 typedef struct // Index:14 (24 Bytes need 39 ASCII-characters)
77 {
78 u8 Index; // Index to identify this data set
79 s32 ActualLongitude; //
80 s32 ActualLatitude; //
81 s16 Altimeter_5cm; // hight -> devide by 20 to get meters & multiply with 5 to get cm
82 u8 GroundSpeed; // speed over ground in 10cm/s (2D) (255 = 91km/h)
83 u8 OSDStatusFlags; // see main.h for definitions OSD_FLAG_xxx
84 u16 FlyingTime; // in seconds
85 u16 DistanceToHome; // [10cm] (100 = 10m)
86 u8 HeadingToHome; // in 2° (100 = 200°)
87 u16 DistanceToTarget; // [10cm] (100 = 10m)
88 u8 HeadingToTarget; // in 2° (100 = 200°)
89 s8 AngleNick; // current Nick angle in 1°
90 s8 AngleRoll; // current Rick angle in 1°
91 u8 SatsInUse; // number of satellites used for position solution
92 } __attribute__((packed)) NaviData_Deviation_t;
93 extern NaviData_Deviation_t NaviData_Deviation;
94
95 typedef struct // Index:15 (18 Bytes need 31 ASCII-characters)
96 {
97 u8 Index; // Index to identify this data set
98 s32 ActualLongitude; //
99 s32 ActualLatitude; //
100 s16 Altimeter_5cm; // hight -> devide by 20 to get meters & multiply with 5 to get cm
101 u8 GroundSpeed; // speed over ground in 10cm/s (2D) (255 = 91km/h)
102 u8 OSDStatusFlags; // see main.h for definitions OSD_FLAG_xxx
103 u8 WaypointIndex; // index of current waypoints running from 0 to WaypointNumber-1
104 u8 WaypointNumber; // number of stored waypoints
105 u8 TargetHoldTime; // time in s to stay at the given target, counts down to 0 if target has been reached
106 u8 WP_Eventchannel; // the current value of the event channel
107 u8 reserve;
108 } __attribute__((packed)) NaviData_WP_t;
109 extern NaviData_WP_t NaviData_WP;
110
111 typedef struct // Index:16 (27 Bytes need 43 ASCII-characters)
112 {
113 u8 Index; // Index to identify this data set
114 s32 ActualLongitude; //
115 s32 ActualLatitude; //
116 s16 Altimeter_5cm; // hight -> devide by 20 to get meters & multiply with 5 to get cm
117 u8 GroundSpeed; // speed over ground in 10cm/s (2D) (255 = 91km/h)
118 u8 OSDStatusFlags; // see main.h for definitions OSD_FLAG_xxx
119 u16 UBat; // Battery Voltage in 0.1 Volts
120 u16 Current; // actual current in 0.1A steps
121 u16 UsedCapacity; // used capacity in mAh
122 s8 Variometer; // climb(+) and sink(-) rate
123 u8 Heading; // Current moving direction in 2° (100 = 200°)
124 u8 CompassHeading; // current compass value in 2°
125 u8 Gas; // current gas (thrust)
126 u16 ShutterCounter; // counts every time a Out1 was activated
127 s16 SetpointAltitude; // setpoint for altitude
128 } __attribute__((packed)) NaviData_Volatile_t;
129 extern NaviData_Volatile_t NaviData_Volatile;
130
131
132 typedef struct // Index:17 (21 Bytes need 35 ASCII-characters)
133 {
134 u8 Index; // Index to identify this data set
135 s32 ActualLongitude; //
136 s32 ActualLatitude; //
137 s16 Altimeter_5cm; // hight -> devide by 20 to get meters & multiply with 5 to get cm
138 u8 GroundSpeed; // speed over ground in 10cm/s (2D) (255 = 91km/h)
139 u8 OSDStatusFlags; // see main.h for definitions OSD_FLAG_xxx
140 s32 Longitude; // Failsafe-Position
141 s32 Latitude; // Failsafe-Position
142 } __attribute__((packed)) NaviData_FS_Pos_t;
143 extern NaviData_FS_Pos_t NaviData_Failsafe;
144
145 typedef struct // Index:18 (9 Bytes need 19 ASCII-characters)
146 {
147 u8 Index; // Index to identify this data set
148 s32 Longitude; // Trigger Position
149 s32 Latitude; // Trigger Position
150 } __attribute__((packed)) NaviData_Out_t;
151 extern NaviData_Out_t NaviData_Out1Trigger;
OSD flags definitions
1 // xxx.OSDStatusFlags (multiple data sets) -> this is the definition in the OSD data structure
2 #define OSD_FLAG_CAREFREE 0x01
3 #define OSD_FLAG_ALTITUDE_CONTROL 0x02
4 #define OSD_FLAG_CALIBRATE 0x04
5 #define OSD_FLAG_OUT1_ACTIVE 0x08
6 #define OSD_FLAG_OUT2_ACTIVE 0x10
7 #define OSD_FLAG_LOWBAT 0x20
8 #define OSD_FLAG_VARIO_TRIM_UP 0x40
9 #define OSD_FLAG_VARIO_TRIM_DOWN 0x80
10
11 // NaviData_Flags.OSDStatusFlags2 (Index:11) -> this is the definition in the OSD data structure
12 #define OSD2_FLAG_MOTOR_RUN 0x01
13 #define OSD2_FLAG_FLY 0x02
14 #define OSD2_FLAG_RC_FAILSAVE_ACTIVE 0x04
15 #define OSD2_FLAG_START 0x08
16 #define OSD2_FLAG_EMERGENCY_LANDING 0x10
17 #define OSD2_FLAG_WAIT_FOR_TAKEOFF 0x20 // Motor Running, but still on the ground
18 #define OSD2_FLAG_AUTO_STARTING 0x40
19 #define OSD2_FLAG_AUTO_LANDING 0x80
20