142,7 → 142,11 |
|
#define NAVIDATA_VERSION 5 |
|
typedef struct // 84 Bytes |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
//+ old protocol |
//+ start abbo communication with: 'O' + Interval [10ms] |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
typedef struct // 84 Bytes (note: this is the old protocol) |
{ |
u8 Version; // version of the data structure = 5 |
GPS_Pos_t CurrentPosition; // see gpspos.h for details |
163,8 → 167,8 |
s8 AngleNick; // current Nick angle in 1° |
s8 AngleRoll; // current Rick angle in 1° |
u8 RC_Quality; // RC_Quality |
u8 FCStatusFlags; // Flags from FC |
u8 NCFlags; // Flags from NC |
u8 FCStatusFlags; // Flags from FC see main.c FC_STATUS_xxx |
u8 NCFlags; // Flags from NC see main.h NC_FLAG_xxx |
u8 Errorcode; // 0 --> okay |
u8 WP_OperatingRadius; // current WP operation radius around the Home Position in m |
s16 TopSpeed; // velocity in vertical direction in cm/s |
171,7 → 175,7 |
u8 TargetHoldTime; // time in s to stay at the given target, counts down to 0 if target has been reached |
u8 FCStatusFlags2; // StatusFlags2 (since version 5 added) |
s16 SetpointAltitude; // setpoint for altitude |
u8 Gas; // for future use |
u8 Gas; // current gas (thrust) |
u16 Current; // actual current in 0.1A steps |
u16 UsedCapacity; // used capacity in mAh |
u8 reserve1; // to fit into 84 bytes (must be divisible by 3) |
179,173 → 183,159 |
} __attribute__((packed)) NaviData_t; |
extern NaviData_t NaviData; |
|
typedef struct // 10 (15 Bytes belegen 27 ASCII-Zeichen) |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
//+ 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; // version of the data structure |
s32 ActualLongitude; // |
s32 ActualLatitude; // |
s16 Altimeter_5cm; // hight according to air pressure -> 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; |
u8 CamCtrlChar; // Status from a connected CamCtrl unit: 'R' = REC 'c' = Ready '!' = Error ...etc |
u8 reserve1; |
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 // 11 (24 Bytes belegen 39 ASCII-Zeichen) |
typedef struct // Index:11 (24 Bytes need 39 ASCII-characters) |
{ |
u8 Index; // version of the data structure |
s32 ActualLongitude; // |
s32 ActualLatitude; // |
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 |
u8 GroundSpeed; // speed over ground in 10cm/s (2D) (255 = 91km/h) |
u8 OSDStatusFlags; |
u8 OSDStatusFlags2; |
u8 NCFlags; // Flags from NC |
u8 ReserveFlags; |
u8 Errorcode; // 0 --> okay |
u8 SpeakHoTT; |
u8 VarioCharacter; |
u8 GPS_ModeCharacter; |
u8 BL_MinOfMaxPWM; |
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 // 12 (27 Bytes belegen 43 ASCII-Zeichen) |
typedef struct // Index:12 (27 Bytes need 43 ASCII-characters) |
{ |
u8 Index; // version of the data structure |
s32 ActualLongitude; // |
s32 ActualLatitude; // |
s16 Altimeter_5cm; // hight according to air pressure -> 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; |
s32 TargetLongitude; // |
s32 TargetLatitude; // |
s16 TargetAltitude; // hight according to air pressure |
u8 RC_Quality; // RC_Quality |
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 // 13 (30 Bytes belegen 47 ASCII-Zeichen) |
{ |
u8 Index; // version of the data structure |
s32 ActualLongitude; // |
s32 ActualLatitude; // |
s16 Altimeter_5cm; // hight according to air pressure -> 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; |
s32 HomeLongitude; // |
s32 HomeLatitude; // |
s16 HomeAltitude; // hight according to air pressure |
u16 WP_OperatingRadius; // current WP operation radius around the Home Position in m |
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 DescendRange; // in [10m] |
u8 ManualFlyingRange; // in [10m] |
u8 reserve1; |
u8 reserve2; |
} __attribute__((packed)) NaviData_Home_t; |
extern NaviData_Home_t NaviData_Home; |
|
typedef struct // 18 (21 Bytes belegen 35 ASCII-Zeichen) |
typedef struct // Index:14 (24 Bytes need 39 ASCII-characters) |
{ |
u8 Index; // version of the data structure |
s32 ActualLongitude; // |
s32 ActualLatitude; // |
s16 Altimeter_5cm; // hight according to air pressure -> 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; |
s32 Longitude; // |
s32 Latitude; // |
} __attribute__((packed)) NaviData_Pos_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 |
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; |
|
extern NaviData_Pos_t NaviData_Failsafe; |
|
typedef struct // 18 (9 Bytes belegen 19 ASCII-Zeichen) |
typedef struct // Index:15 (18 Bytes need 31 ASCII-characters) |
{ |
u8 Index; // version of the data structure |
s32 Longitude; // |
s32 Latitude; // |
} __attribute__((packed)) NaviData_Out_t; |
extern NaviData_Out_t NaviData_Out1Trigger; |
|
typedef struct // 15 (18 Bytes belegen 31 ASCII-Zeichen) |
{ |
u8 Index; // version of the data structure |
s32 ActualLongitude; // |
s32 ActualLatitude; // |
s16 Altimeter_5cm; // hight according to air pressure -> 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; |
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; |
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 // 14 (24 Bytes belegen 39 ASCII-Zeichen) |
typedef struct // Index:16 (27 Bytes need 43 ASCII-characters) |
{ |
u8 Index; // version of the data structure |
s32 ActualLongitude; // |
s32 ActualLatitude; // |
s16 Altimeter_5cm; // hight according to air pressure -> 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; |
u16 FlyingTime; // in seconds |
u16 DistanceToHome; |
u8 HeadingToHome; // in 2° (100 = 200°) |
u16 DistanceToTarget; |
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 // 16 (27 Bytes belegen 43 ASCII-Zeichen) |
{ |
u8 Index; // version of the data structure |
s32 ActualLongitude; // |
s32 ActualLatitude; // |
s16 Altimeter_5cm; // hight according to air pressure -> 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; |
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; // for future use |
u16 ShutterCounter; // counts every time a Out1 was activated |
s16 SetpointAltitude; // setpoint for altitude |
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; |
|
#define OSD_FLAG_MASK1 (0x04 + 0x20 + 0x40 + 0x80) |
#define OSD_FLAG_MASK2 (0x01 + 0x02 + 0x08 + 0x10) |
|
// NC calculates |
//OSDStatusFlags = (FC.StatusFlags & OSD_FLAG_MASK1) | (FC.StatusFlags2 & OSD_FLAG_MASK2); |
//OSDStatusFlags2 = (FC.StatusFlags & ~OSD_FLAG_MASK1) | (FC.StatusFlags2 & ~OSD_FLAG_MASK2); |
typedef struct // Index:17 (21 Bytes need 35 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 Longitude; // Failsafe-Position |
s32 Latitude; // Failsafe-Position |
} __attribute__((packed)) NaviData_FS_Pos_t; |
extern NaviData_FS_Pos_t NaviData_Failsafe; |
|
//calculate Back: |
//FC.StatusFlags = (OSDStatusFlags & OSD_FLAG_MASK1) | (OSDStatusFlags2 & ~OSD_FLAG_MASK1); |
//FC.StatusFlags2 = (OSDStatusFlags & OSD_FLAG_MASK2) | (OSDStatusFlags2 & ~OSD_FLAG_MASK2); |
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; |
|
|
/* |
OSDStatusFlags = (FC.StatusFlags & OSD_FLAG_MASK1) | (FC.StatusFlags2 & OSD_FLAG_MASK2); |
NaviData_Flags.SpeakHoTT = FC.FromFC_SpeakHoTT; |
NaviData_Flags.VarioCharacter = FromFC_VarioCharacter; |
NaviData_Flags.GPS_ModeCharacter = NC_GPS_ModeCharacter; |
NaviData_Flags.BL_MinOfMaxPWM = BL_MinOfMaxPWM; |
NaviData_WP.WP_Wventchannel = LogFC_WP_EventChannel; |
*/ |
|
extern UART_TypeDef *DebugUART; |
extern volatile u8 SerialLinkOkay; |
extern Buffer_t UART1_tx_buffer; |