Subversion Repositories NaviCtrl

Rev

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

Rev 773 Rev 789
Line 140... Line 140...
140
        s16 Bearing;                                    // course to target in deg
140
        s16 Bearing;                                    // course to target in deg
141
} __attribute__((packed)) GPS_PosDev_t;
141
} __attribute__((packed)) GPS_PosDev_t;
Line 142... Line 142...
142
 
142
 
Line -... Line 143...
-
 
143
#define NAVIDATA_VERSION 5
-
 
144
 
-
 
145
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
 
146
//+ old protocol
143
#define NAVIDATA_VERSION 5
147
//+ start abbo communication with: 'O' + Interval [10ms] 
144
 
148
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
145
typedef struct   // 84 Bytes
149
typedef struct   // 84 Bytes    (note: this is the old protocol)
146
{
150
{
147
        u8 Version;                                             // version of the data structure = 5 
151
        u8 Version;                                             // version of the data structure = 5 
148
        GPS_Pos_t CurrentPosition;              // see gpspos.h for details
152
        GPS_Pos_t CurrentPosition;              // see gpspos.h for details
Line 161... Line 165...
161
        s16 Heading;                                    // current flight direction in ° as angle to north
165
        s16 Heading;                                    // current flight direction in ° as angle to north
162
        s16     CompassHeading;                         // current compass value in °
166
        s16     CompassHeading;                         // current compass value in °
163
        s8  AngleNick;                                  // current Nick angle in 1°
167
        s8  AngleNick;                                  // current Nick angle in 1°
164
        s8  AngleRoll;                                  // current Rick angle in 1°
168
        s8  AngleRoll;                                  // current Rick angle in 1°
165
        u8  RC_Quality;                                 // RC_Quality
169
        u8  RC_Quality;                                 // RC_Quality
166
        u8  FCStatusFlags;                              // Flags from FC
170
        u8  FCStatusFlags;                              // Flags from FC see main.c FC_STATUS_xxx
167
        u8  NCFlags;                                    // Flags from NC
171
        u8  NCFlags;                                    // Flags from NC see main.h NC_FLAG_xxx
168
        u8  Errorcode;                                  // 0 --> okay
172
        u8  Errorcode;                                  // 0 --> okay
169
        u8  WP_OperatingRadius;                 // current WP operation radius around the Home Position in m
173
        u8  WP_OperatingRadius;                 // current WP operation radius around the Home Position in m
170
        s16 TopSpeed;                                   // velocity in vertical direction in cm/s
174
        s16 TopSpeed;                                   // velocity in vertical direction in cm/s
171
        u8  TargetHoldTime;                             // time in s to stay at the given target, counts down to 0 if target has been reached
175
        u8  TargetHoldTime;                             // time in s to stay at the given target, counts down to 0 if target has been reached
172
        u8  FCStatusFlags2;                             // StatusFlags2 (since version 5 added)
176
        u8  FCStatusFlags2;                             // StatusFlags2 (since version 5 added)
173
        s16 SetpointAltitude;                   // setpoint for altitude
177
        s16 SetpointAltitude;                   // setpoint for altitude
174
        u8  Gas;                                                // for future use
178
        u8  Gas;                                                // current gas (thrust)
175
        u16 Current;                                    // actual current in 0.1A steps
179
        u16 Current;                                    // actual current in 0.1A steps
176
        u16 UsedCapacity;                               // used capacity in mAh
180
        u16 UsedCapacity;                               // used capacity in mAh
177
        u8 reserve1;                                    // to fit into 84 bytes (must be divisible by 3) 
181
        u8 reserve1;                                    // to fit into 84 bytes (must be divisible by 3) 
178
        u8 reserve2;                                    // to fit into 84 bytes (must be divisible by 3)
182
        u8 reserve2;                                    // to fit into 84 bytes (must be divisible by 3)
179
} __attribute__((packed)) NaviData_t;
183
} __attribute__((packed)) NaviData_t;
180
extern NaviData_t NaviData;
184
extern NaviData_t NaviData;
Line -... Line 185...
-
 
185
 
-
 
186
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
 
187
//+ New protocol
-
 
188
//+ start abbo communication with: 'O' + Interval 1byte [10ms] + MaxBytesPerSecond (2Bytes)
-
 
189
//+ i.e. 'O'+10+1024
-
 
190
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
181
 
191
 
182
typedef struct // 10 (15 Bytes belegen 27 ASCII-Zeichen)
192
typedef struct // Index:10 (15 Bytes need 27 ASCII-characters)
183
{
193
{
184
        u8 Index;                                               // version of the data structure
194
        u8 Index;                               // Index to identify this data set
185
        s32 ActualLongitude;                    // 
195
        s32 ActualLongitude;    // 
186
        s32 ActualLatitude;                             // 
196
        s32 ActualLatitude;             // 
187
        s16 Altimeter_5cm;                              // hight according to air pressure -> devide by 20 to get meters & multiply with 5 to get cm
197
        s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm
188
        u8 GroundSpeed;                                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
198
        u8 GroundSpeed;                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
189
        u8 OSDStatusFlags;
199
        u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
190
        u8 CamCtrlChar;                                 // Status from a connected CamCtrl unit: 'R' = REC  'c' = Ready  '!' = Error  ...etc
200
        u8 CamCtrlChar;                 // Status from a connected CamCtrl unit: 'R' = REC  'c' = Ready  '!' = Error  ...etc
191
u8 reserve1;
201
u8 reserve1;                     
192
} __attribute__((packed)) NaviData_Tiny_t;
202
} __attribute__((packed)) NaviData_Tiny_t;
Line 193... Line 203...
193
extern NaviData_Tiny_t NaviData_Tiny;
203
extern NaviData_Tiny_t NaviData_Tiny;
Line 194... Line 204...
194
 
204
 
195
#define START_PAYLOAD_DATA  13  // 
205
#define START_PAYLOAD_DATA  13  // 
196
 
206
 
197
typedef struct  // 11 (24 Bytes belegen 39 ASCII-Zeichen)
207
typedef struct  // Index:11 (24 Bytes need 39 ASCII-characters)
198
{
208
{
199
        u8 Index;                                               // version of the data structure
209
        u8 Index;                               // Index to identify this data set
200
        s32 ActualLongitude;                    // 
210
        s32 ActualLongitude;    // 
201
        s32 ActualLatitude;                             // 
211
        s32 ActualLatitude;             // 
202
        s16 Altimeter_5cm;                              // hight according to air pressure -> devide by 20 to get meters & multiply with 5 to get cm -> devide by 20 to get meters & multiply with 5 to get cm
212
        s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm 
203
        u8 GroundSpeed;                                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
213
        u8 GroundSpeed;                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
204
        u8 OSDStatusFlags;
214
        u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
205
        u8 OSDStatusFlags2;
215
        u8 OSDStatusFlags2;             // see main.h for definitions OSD_FLAG2_xxx
206
        u8  NCFlags;                                    // Flags from NC
216
        u8  NCFlags;                    // Flags from NC
207
        u8 ReserveFlags;
217
u8 ReserveFlags;
208
        u8  Errorcode;                                  // 0 --> okay
218
        u8  Errorcode;                  // 0 --> okay  see http://wiki.mikrokopter.de/ErrorCodes
209
        u8 SpeakHoTT;
219
        u8 SpeakHoTT;                   // voice output SPEAK_xxx (see spi_slave.h)
210
        u8 VarioCharacter;
220
        u8 VarioCharacter;              // display as ascii character ('+' = 'climb' etc)
211
        u8 GPS_ModeCharacter;
221
        u8 GPS_ModeCharacter;   // display as ascii character ('H' = 'Home' etc)
Line 212... Line 222...
212
        u8 BL_MinOfMaxPWM;
222
        u8 BL_MinOfMaxPWM;              // status byte of the BL-Ctrls
213
} __attribute__((packed)) NaviData_Flags_t;
223
} __attribute__((packed)) NaviData_Flags_t;
214
extern NaviData_Flags_t NaviData_Flags;
224
extern NaviData_Flags_t NaviData_Flags;
215
 
225
 
216
typedef struct  // 12  (27 Bytes belegen 43 ASCII-Zeichen)
226
typedef struct  // Index:12  (27 Bytes need 43 ASCII-characters)
217
{
227
{
218
        u8 Index;                                               // version of the data structure
228
        u8 Index;                               // Index to identify this data set
219
        s32 ActualLongitude;                    // 
229
        s32 ActualLongitude;    // 
220
        s32 ActualLatitude;                             // 
230
        s32 ActualLatitude;             // 
221
        s16 Altimeter_5cm;                              // hight according to air pressure -> devide by 20 to get meters & multiply with 5 to get cm
231
        s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm
222
        u8 GroundSpeed;                                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
232
        u8 GroundSpeed;                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
223
        u8 OSDStatusFlags;
233
        u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
224
        s32 TargetLongitude;                    // 
234
        s32 TargetLongitude;    // 
225
        s32 TargetLatitude;                             // 
235
        s32 TargetLatitude;             // 
Line 226... Line 236...
226
        s16 TargetAltitude;                     // hight according to air pressure
236
        s16 TargetAltitude;     // hight according to air pressure
227
        u8  RC_Quality;                                 // RC_Quality
237
        u8  RC_Quality;                 // RC_Quality
228
} __attribute__((packed)) NaviData_Target_t;
238
} __attribute__((packed)) NaviData_Target_t;
229
extern NaviData_Target_t NaviData_Target;
239
extern NaviData_Target_t NaviData_Target;
230
 
240
 
231
typedef struct  // 13  (30 Bytes belegen 47 ASCII-Zeichen)
241
typedef struct  // Index:13  (30 Bytes need 47 ASCII-characters)
232
{
242
{                                          
233
        u8 Index;                                               // version of the data structure
243
        u8 Index;                               // Index to identify this data set
234
        s32 ActualLongitude;                    // 
244
        s32 ActualLongitude;    // 
235
        s32 ActualLatitude;                             // 
245
        s32 ActualLatitude;             // 
236
        s16 Altimeter_5cm;                              // hight according to air pressure -> devide by 20 to get meters & multiply with 5 to get cm
246
        s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm
237
        u8 GroundSpeed;                                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
247
        u8 GroundSpeed;                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
238
        u8 OSDStatusFlags;
248
        u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
239
        s32 HomeLongitude;                              // 
249
        s32 HomeLongitude;              // 
240
        s32 HomeLatitude;                               // 
250
        s32 HomeLatitude;               // 
241
        s16 HomeAltitude;                               // hight according to air pressure
251
        s16 HomeAltitude;               // hight according to air pressure
242
        u16 WP_OperatingRadius;                 // current WP operation radius around the Home Position in m
252
        u16 WP_OperatingRadius; // current WP operation radius around the Home Position in m
243
        u8 LipoCellCount;
253
        u8 LipoCellCount;
244
        u8 DescendRange;                                // in [10m]
254
        u8 DescendRange;                // in [10m]
Line 245... Line 255...
245
        u8 ManualFlyingRange;                   // in [10m]
255
        u8 ManualFlyingRange;   // in [10m]
246
u8 reserve1;
256
u8 reserve1;
247
u8 reserve2;
257
u8 reserve2;
248
} __attribute__((packed)) NaviData_Home_t;
258
} __attribute__((packed)) NaviData_Home_t;
249
extern NaviData_Home_t NaviData_Home;
259
extern NaviData_Home_t NaviData_Home;
250
 
260
 
251
typedef struct  // 18  (21 Bytes belegen 35 ASCII-Zeichen)
261
typedef struct   // Index:14    (24 Bytes need 39 ASCII-characters)
252
{
262
{
253
        u8 Index;                                               // version of the data structure
263
        u8 Index;                               // Index to identify this data set
254
        s32 ActualLongitude;                    // 
264
        s32 ActualLongitude;    // 
255
        s32 ActualLatitude;                             // 
265
        s32 ActualLatitude;             // 
256
        s16 Altimeter_5cm;                              // hight according to air pressure -> devide by 20 to get meters & multiply with 5 to get cm
-
 
257
        u8 GroundSpeed;                                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
266
        s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm
258
        u8 OSDStatusFlags;
-
 
259
        s32 Longitude;                                  // 
267
        u8 GroundSpeed;                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
260
        s32 Latitude;                                   // 
-
 
261
} __attribute__((packed)) NaviData_Pos_t;
268
        u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
262
 
269
        u16 FlyingTime;                 // in seconds
263
extern NaviData_Pos_t NaviData_Failsafe;
270
        u16 DistanceToHome;             // [10cm] (100 = 10m)
264
 
271
        u8  HeadingToHome;              // in 2° (100 = 200°)
265
typedef struct  // 18  (9 Bytes belegen 19 ASCII-Zeichen)
272
        u16 DistanceToTarget;   // [10cm] (100 = 10m)   
Line 266... Line 273...
266
{
273
        u8  HeadingToTarget;    // in 2° (100 = 200°)
267
        u8 Index;                                               // version of the data structure
274
        s8  AngleNick;                  // current Nick angle in 1°
268
        s32 Longitude;                                  // 
275
        s8  AngleRoll;                  // current Rick angle in 1°
269
        s32 Latitude;                                   // 
276
        u8  SatsInUse;                  // number of satellites used for position solution
270
} __attribute__((packed)) NaviData_Out_t;
277
} __attribute__((packed)) NaviData_Deviation_t;
271
extern NaviData_Out_t NaviData_Out1Trigger;
278
extern NaviData_Deviation_t NaviData_Deviation;
272
 
279
 
273
typedef struct // 15 (18 Bytes belegen 31 ASCII-Zeichen)
280
typedef struct // Index:15 (18 Bytes need 31 ASCII-characters)
274
{
281
{
275
        u8 Index;                                               // version of the data structure
282
        u8 Index;                               // Index to identify this data set
276
        s32 ActualLongitude;                    // 
283
        s32 ActualLongitude;    // 
277
        s32 ActualLatitude;                             // 
284
        s32 ActualLatitude;             // 
278
        s16 Altimeter_5cm;                              // hight according to air pressure -> devide by 20 to get meters & multiply with 5 to get cm
285
        s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm
279
        u8  GroundSpeed;                                // speed over ground in 10cm/s (2D) (255 = 91km/h)
286
        u8  GroundSpeed;                // speed over ground in 10cm/s (2D) (255 = 91km/h)
280
        u8 OSDStatusFlags;
287
        u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
Line 281... Line 288...
281
        u8  WaypointIndex;                              // index of current waypoints running from 0 to WaypointNumber-1
288
        u8  WaypointIndex;              // index of current waypoints running from 0 to WaypointNumber-1
282
        u8  WaypointNumber;                             // number of stored waypoints
289
        u8  WaypointNumber;             // number of stored waypoints
283
        u8  TargetHoldTime;                             // time in s to stay at the given target, counts down to 0 if target has been reached
290
        u8  TargetHoldTime;             // time in s to stay at the given target, counts down to 0 if target has been reached
284
        u8 WP_Eventchannel;
291
        u8 WP_Eventchannel;             // the current value of the event channel
285
u8 reserve;
292
u8 reserve;
286
} __attribute__((packed)) NaviData_WP_t;
293
} __attribute__((packed)) NaviData_WP_t;
287
extern NaviData_WP_t NaviData_WP;
294
extern NaviData_WP_t NaviData_WP;
288
 
-
 
289
typedef struct   // 14  (24 Bytes belegen 39 ASCII-Zeichen)
-
 
290
{
-
 
291
        u8 Index;                                               // version of the data structure
-
 
292
        s32 ActualLongitude;                    // 
-
 
293
        s32 ActualLatitude;                             // 
-
 
294
        s16 Altimeter_5cm;                              // hight according to air pressure -> devide by 20 to get meters & multiply with 5 to get cm
-
 
295
        u8 GroundSpeed;                                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
-
 
296
        u8 OSDStatusFlags;
295
 
297
        u16 FlyingTime;                                 // in seconds
-
 
298
        u16 DistanceToHome;                            
-
 
299
        u8  HeadingToHome;                              // in 2° (100 = 200°)
-
 
300
        u16 DistanceToTarget;                          
-
 
301
        u8  HeadingToTarget;                    // in 2° (100 = 200°)
-
 
302
        s8  AngleNick;                                  // current Nick angle in 1°
-
 
303
        s8  AngleRoll;                                  // current Rick angle in 1°
-
 
304
        u8  SatsInUse;                                  // number of satellites used for position solution
-
 
305
} __attribute__((packed)) NaviData_Deviation_t;
-
 
306
extern NaviData_Deviation_t NaviData_Deviation;
-
 
307
 
-
 
308
typedef struct // 16  (27 Bytes belegen 43 ASCII-Zeichen)
296
typedef struct // Index:16  (27 Bytes need 43 ASCII-characters)
309
{
297
{
310
        u8 Index;                                               // version of the data structure
298
        u8 Index;                               // Index to identify this data set
311
        s32 ActualLongitude;                    // 
299
        s32 ActualLongitude;    // 
312
        s32 ActualLatitude;                             // 
300
        s32 ActualLatitude;             // 
313
        s16 Altimeter_5cm;                              // hight according to air pressure -> devide by 20 to get meters & multiply with 5 to get cm
301
        s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm
314
        u8 GroundSpeed;                                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
302
        u8 GroundSpeed;                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
315
        u8 OSDStatusFlags;
303
        u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
316
        u16 UBat;                                               // Battery Voltage in 0.1 Volts
304
        u16 UBat;                               // Battery Voltage in 0.1 Volts
317
        u16 Current;                                    // actual current in 0.1A steps
305
        u16 Current;                    // actual current in 0.1A steps
318
        u16 UsedCapacity;                               // used capacity in mAh
306
        u16 UsedCapacity;               // used capacity in mAh
Line 319... Line -...
319
        s8  Variometer;                                 // climb(+) and sink(-) rate
-
 
320
        u8  Heading;                                    // Current moving direction in 2° (100 = 200°)
-
 
Line 321... Line -...
321
        u8      CompassHeading;                         // current compass value in 2°
-
 
322
        u8  Gas;                                                // for future use
307
        s8  Variometer;                 // climb(+) and sink(-) rate
323
        u16 ShutterCounter;                             // counts every time a Out1 was activated
-
 
324
        s16 SetpointAltitude;                   // setpoint for altitude
308
        u8  Heading;                    // Current moving direction in 2° (100 = 200°)
-
 
309
        u8      CompassHeading;         // current compass value in 2°
-
 
310
        u8  Gas;                                // current gas (thrust)
325
} __attribute__((packed)) NaviData_Volatile_t;
311
        u16 ShutterCounter;             // counts every time a Out1 was activated
326
extern NaviData_Volatile_t NaviData_Volatile;
312
        s16 SetpointAltitude;   // setpoint for altitude
-
 
313
} __attribute__((packed)) NaviData_Volatile_t;
327
 
314
extern NaviData_Volatile_t NaviData_Volatile;
-
 
315
 
-
 
316
 
-
 
317
typedef struct  // Index:17  (21 Bytes need 35 ASCII-characters)
-
 
318
{
328
#define OSD_FLAG_MASK1 (0x04 + 0x20 + 0x40 + 0x80)
319
        u8 Index;                               // Index to identify this data set
-
 
320
        s32 ActualLongitude;    // 
329
#define OSD_FLAG_MASK2 (0x01 + 0x02 + 0x08 + 0x10)
321
        s32 ActualLatitude;             // 
330
 
-
 
331
// NC calculates
-
 
332
//OSDStatusFlags = (FC.StatusFlags & OSD_FLAG_MASK1) | (FC.StatusFlags2 & OSD_FLAG_MASK2);
322
        s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm
333
//OSDStatusFlags2 = (FC.StatusFlags & ~OSD_FLAG_MASK1) | (FC.StatusFlags2 & ~OSD_FLAG_MASK2);
323
        u8 GroundSpeed;                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
334
 
324
        u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
335
//calculate Back:
325
        s32 Longitude;                  // Failsafe-Position
336
//FC.StatusFlags = (OSDStatusFlags & OSD_FLAG_MASK1) | (OSDStatusFlags2 & ~OSD_FLAG_MASK1);
326
        s32 Latitude;                   // Failsafe-Position
337
//FC.StatusFlags2 = (OSDStatusFlags & OSD_FLAG_MASK2) | (OSDStatusFlags2 & ~OSD_FLAG_MASK2);
327
} __attribute__((packed)) NaviData_FS_Pos_t;
Line 338... Line 328...
338
 
328
extern NaviData_FS_Pos_t NaviData_Failsafe;
339
 
329
 
340
/*
330
typedef struct // Index:18  (9 Bytes need 19 ASCII-characters)
341
OSDStatusFlags = (FC.StatusFlags & OSD_FLAG_MASK1) | (FC.StatusFlags2 & OSD_FLAG_MASK2);
331
{