Subversion Repositories NaviCtrl

Compare Revisions

Ignore whitespace Rev 597 → Rev 598

/trunk/ncmag.c
715,7 → 715,7
};
 
TxBytes = sizeof(CfgData);
DebugOut.Analog[16]++;
 
if(I2CBus_Transmission(Compass_I2CPort, MAG_SLAVE_ADDRESS, CfgData, TxBytes, 0, 0))
{
if(I2CBus_WaitForEndOfTransmission(Compass_I2CPort, 100))
/trunk/spi_slave.c
424,7 → 424,11
ToFlightCtrl.Param.Int[2] = NaviData.HomePositionDeviation.Distance; // dm //4&5
ToFlightCtrl.Param.sInt[3] = NaviData.HomePositionDeviation.Bearing; // deg //6&7
if(FC_WP_EventChannel > 254) FC_WP_EventChannel = 254; // Muss in SPI_NCCMD_GPSINFO bleiben! (siehe oben)
if(FC_WP_EventChannel) LogFC_WP_EventChannel = FC_WP_EventChannel; // to make sure that it will be logged
if(FC_WP_EventChannel)
{
LogFC_WP_EventChannel = FC_WP_EventChannel; // to make sure that it will be logged
NaviData_WP.WP_Eventchannel = FC_WP_EventChannel; // to make sure that it will be logged
}
FC_WP_EventChannel_Processed = 1;
// ++++++++++++++++++++++++++++++++++
// Waypoint event +++++++++++++++++++
652,13 → 656,9
HeadFreeStartAngle = GyroCompassCorrected; // in 0.1°
}
}
Parameter.ActiveSetting = FromFlightCtrl.Param.Byte[9];
FC.BAT_Voltage = FromFlightCtrl.Param.Byte[10];
DebugOut.Analog[7] = FC.BAT_Voltage;
DebugOut.Analog[5] = FC.StatusFlags;
NaviData.FCStatusFlags = FC.StatusFlags;
if(FC.StatusFlags2 & FC_STATUS2_WAIT_FOR_TAKEOFF) NaviData.FCStatusFlags &= ~FC_STATUS_FLY;
FC.StatusFlags2 = FromFlightCtrl.Param.Byte[11];
FC.StatusFlags2 = FromFlightCtrl.Param.Byte[9];
NaviData.FCStatusFlags2 = (NaviData.FCStatusFlags2 & (FC_STATUS2_OUT1_ACTIVE | FC_STATUS2_OUT2_ACTIVE)) | (FC.StatusFlags2 & (0xff - (FC_STATUS2_OUT1_ACTIVE | FC_STATUS2_OUT2_ACTIVE)));
 
if((!(LastTransmittedFCStatusFlags2 & FC_STATUS2_OUT1_ACTIVE)) && (FC.StatusFlags2 & FC_STATUS2_OUT1_ACTIVE)) NaviData.FCStatusFlags2 |= FC_STATUS2_OUT1_ACTIVE;
671,8 → 671,11
 
Logging_FCStatusFlags1 |= FC.StatusFlags;
Logging_FCStatusFlags2 |= FC.StatusFlags2;
FC.BAT_Voltage = FromFlightCtrl.Param.Int[5]; // 10 & 11
DebugOut.Analog[7] = FC.BAT_Voltage;
DebugOut.Analog[5] = FC.StatusFlags;
NaviData.UBat = (u8) FC.BAT_Voltage; // Achtung: die (u8) NaviData.UBat kann überlaufen -> das KopterTool müsste dann 25,5V drauf rechnen
break;
 
case SPI_FCCMD_BL_ACCU:
FC.BAT_Current = FromFlightCtrl.Param.Int[0];
DebugOut.Analog[8] = FC.BAT_Current;
692,7 → 695,6
{
NCParams_ClearValue(NCPARAMS_ALTITUDE_RATE);
}
NaviData.UBat = FC.BAT_Voltage;
if(!(SimulationFlags & SIMULATION_ACTIVE)) NaviData.Current = FC.BAT_Current;
NaviData.UsedCapacity = FC.BAT_UsedCapacity;
break;
762,7 → 764,7
else DebugOut.StatusRed &= ~AMPEL_FC;
FC_I2C_ErrorConter = FromFlightCtrl.Param.Byte[8];
FC.RC_Quality = FromFlightCtrl.Param.Byte[9];
NaviData.RC_Quality = FC.RC_Quality;
if(FC.RC_Quality > 160) NaviData.RC_Quality = 200; else NaviData.RC_Quality = FC.RC_Quality;
NC_Wait_for_LED = FromFlightCtrl.Param.Byte[10];
NaviData.Gas = (FC.BAT_Voltage * (u32) FromFlightCtrl.Param.Byte[11]) / (u32) Parameter.LowVoltageWarning;
if(LoggingGasCnt == 0) LoggingGasFilter = 0;
780,7 → 782,7
Parameter.ComingHomeAltitude = FromFlightCtrl.Param.Byte[6];
CHK_POTI_MM(Parameter.AutoPhotoAltitudes,FromFlightCtrl.Param.Byte[7],0,255);
UART_VersionInfo.BL_Firmware = FromFlightCtrl.Param.Byte[8];
// 9
Parameter.ActiveSetting = FromFlightCtrl.Param.Byte[9];
FlugMinutenGesamt = FromFlightCtrl.Param.Int[5]; // 10 & 11
break;
case SPI_FCCMD_NEUTRAL: // slow!
822,9 → 824,8
Parameter.MaximumAltitude = FromFlightCtrl.Param.Byte[3];
ServoParams.CompInvert = FromFlightCtrl.Param.Byte[4];
Parameter.HomeYawMode = ((ServoParams.CompInvert & 0x18) >> 3);
// 5
// 6
// 7
NaviData_Home.LipoCellCount = FromFlightCtrl.Param.Byte[5];
NaviData_Volatile.ShutterCounter = FromFlightCtrl.Param.Int[3]; // 6 & 7
// 8
// 9
// 10
/trunk/uart1.c
80,6 → 80,7
#include "ftphelper.h"
#include "led.h"
#include "fat16.h"
#include "crc16.h"
#include "eeprom.h"
 
#define LIC_CMD_READ_LICENSE 1
86,7 → 87,6
#define LIC_CMD_WRITE_LICENSE 2
#define LIC_CMD_ERASE_LICENSE 3
 
 
#define FALSE 0
#define TRUE 1
 
93,6 → 93,15
#define ABO_TIMEOUT 8000 // disable abo after 8 seconds
u32 UART1_AboTimeOut = 0;
 
NaviData_Volatile_t NaviData_Volatile;
NaviData_WP_t NaviData_WP;
NaviData_Deviation_t NaviData_Deviation;
NaviData_Home_t NaviData_Home;
NaviData_Target_t NaviData_Target;
NaviData_Flags_t NaviData_Flags;
NaviData_Tiny_t NaviData_Tiny;
NaviData_t NaviData;
 
u8 UART1_Request_VersionInfo = FALSE;
u8 UART1_Request_ExternalControl= FALSE;
u8 UART1_Request_Display = FALSE;
203,6 → 212,7
u32 UART1_DebugData_Interval = 0; // in ms
u32 UART1_NaviData_Timer = 0;
u32 UART1_NaviData_Interval = 0; // in ms
u16 UART1_NaviData_MaxBytes = 0; // newer protocol?
u32 UART1_Data3D_Timer = 0;
u32 UART1_Data3D_Interval = 0; // in ms
u32 UART1_MotorData_Timer = 0;
212,6 → 222,14
u32 NMEA_Timer = 0;
u32 NMEA_Interval = 0;// in ms
 
u8 CalculateDebugLableCrc(void)
{
u16 i;
u8 crc = 0;
for(i=0;i<sizeof(ANALOG_LABEL);i++) crc += ANALOG_LABEL[0][i];
return(crc);
}
 
/********************************************************/
/* Initialization the UART1 */
/********************************************************/
292,9 → 310,8
UART_VersionInfo.HWMajor = Version_HW & 0x7F;
UART_VersionInfo.BL_Firmware = 255;
UART_VersionInfo.Flags = 0;
UART_VersionInfo.Reserved1 = 0;
UART_VersionInfo.LabelTextCRC = CalculateDebugLableCrc();
NaviData.Version = NAVIDATA_VERSION;
 
UART1_PutString("\r\n UART1 init...ok");
}
 
624,6 → 641,7
{
UART1_DisplayLine = 2;
UART1_Display_Interval = 0;
UART1_Request_Display = TRUE;
}
else
{
631,8 → 649,8
UART1_Display_Interval = (u32) SerialMsg.pData[1] * 10;
UART1_DisplayLine = 4;
UART1_AboTimeOut = SetDelay(ABO_TIMEOUT);
if(UART1_Display_Interval) UART1_Request_Display = TRUE;
}
UART1_Request_Display = TRUE;
break;
 
case 'l':// reqest for display columns
642,6 → 660,8
 
case 'o': // request for navigation information
UART1_NaviData_Interval = (u32) SerialMsg.pData[0] * 10;
if(SerialMsg.DataLen > 2) UART1_NaviData_MaxBytes = SerialMsg.pData[1] * 256 + SerialMsg.pData[2];
else UART1_NaviData_MaxBytes = 0;
if(UART1_NaviData_Interval > 0) UART1_Request_NaviData = TRUE;
UART1_AboTimeOut = SetDelay(ABO_TIMEOUT);
break;
947,6 → 967,167
}
 
 
u16 TransmitNavigationData(u16 MaxBytesPerSecond) // returns the minumum pause time in ms
{
static u8 state = 0, count_flags = 2, count_target = 3, count_home = 4, count_wp = 5 , count_tiny = 6;
static u16 CRC_Home = 0, CRC_Target = 0, CRC_Flags = 0, CRC_Wp = 0;
u16 pause, sent = 0, crc_home = 0xff, crc_target = 0xff, crc_flags = 0xff, crc_wp = 0xff;
 
while(!sent)
{
switch(state++)
{
case 0:
case 4:
// belegt 35 ASCII-Zeichen
NaviData_Flags.Index = 11;
NaviData_Flags.ActualLongitude = NaviData.CurrentPosition.Longitude;
NaviData_Flags.ActualLatitude = NaviData.CurrentPosition.Latitude;
NaviData_Flags.Altimeter = NaviData.Altimeter;
NaviData_Flags.GroundSpeed = NaviData.GroundSpeed / 10;
NaviData_Flags.OSDStatusFlags = (FC.StatusFlags & OSD_FLAG_MASK1) | (FC.StatusFlags2 & OSD_FLAG_MASK2);
NaviData_Flags.OSDStatusFlags2 = (FC.StatusFlags & ~OSD_FLAG_MASK1) | (FC.StatusFlags2 & ~OSD_FLAG_MASK2);
NaviData_Flags.NCFlags = NaviData.NCFlags;
NaviData_Flags.Errorcode = ErrorCode;
NaviData_Flags.ReserveFlags = 0;
NaviData_Flags.SpeakHoTT = FC.FromFC_SpeakHoTT;
NaviData_Flags.VarioCharacter = FromFC_VarioCharacter;
NaviData_Flags.GPS_ModeCharacter = NC_GPS_ModeCharacter;
NaviData_Flags.BL_MinOfMaxPWM = BL_MinOfMaxPWM;
crc_flags = CRC16((unsigned char*)(&NaviData_Flags.OSDStatusFlags2), sizeof(NaviData_Flags) - START_PAYLOAD_DATA); // update crc for the license structure
if((crc_flags != CRC_Flags) || (--count_flags == 0))
{
sent += MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'O', NC_ADDRESS, 1 , (u8 *)&NaviData_Flags, sizeof(NaviData_Flags)) + 1;
CRC_Flags = crc_flags;
count_flags = 11*2;
}
break;
case 1:
case 5:
// belegt 43 ASCII-Zeichen
NaviData_Target.Index = 12;
NaviData_Target.ActualLongitude = NaviData.CurrentPosition.Longitude;
NaviData_Target.ActualLatitude = NaviData.CurrentPosition.Latitude;
NaviData_Target.Altimeter = NaviData.Altimeter;
NaviData_Target.GroundSpeed = NaviData.GroundSpeed / 10;
NaviData_Target.OSDStatusFlags = (FC.StatusFlags & OSD_FLAG_MASK1) | (FC.StatusFlags2 & OSD_FLAG_MASK2);
NaviData_Target.TargetLongitude = NaviData.TargetPosition.Longitude;
NaviData_Target.TargetLatitude = NaviData.TargetPosition.Latitude;
NaviData_Target.TargetAltitude = NaviData.TargetPosition.Altitude;
NaviData_Target.RC_Quality = NaviData.RC_Quality;
crc_target = CRC16((unsigned char*)(&NaviData_Target.TargetLongitude), sizeof(NaviData_Target) - START_PAYLOAD_DATA); // update crc for the license structure
if((crc_target != CRC_Target) || (--count_target == 0))
{
sent += MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'O', NC_ADDRESS, 1 , (u8 *)&NaviData_Target, sizeof(NaviData_Target)) + 1;
CRC_Target = crc_target;
count_target = 10*2;
}
break;
case 2:
case 6:
// belegt 31 ASCII-Zeichen
NaviData_WP.Index = 15;
NaviData_WP.ActualLongitude = NaviData.CurrentPosition.Longitude;
NaviData_WP.ActualLatitude = NaviData.CurrentPosition.Latitude;
NaviData_WP.Altimeter = NaviData.Altimeter;
NaviData_WP.GroundSpeed = NaviData.GroundSpeed / 10;
NaviData_WP.OSDStatusFlags = (FC.StatusFlags & OSD_FLAG_MASK1) | (FC.StatusFlags2 & OSD_FLAG_MASK2);
NaviData_WP.WaypointIndex = NaviData.WaypointIndex;
NaviData_WP.WaypointNumber = NaviData.WaypointNumber;
NaviData_WP.TargetHoldTime = NaviData.TargetHoldTime;
// NaviData_WP.WP_Eventchannel = FC_WP_EventChannel; -> happends already in SPI.c
crc_wp = CRC16((unsigned char*)(&NaviData_WP.WaypointIndex), sizeof(NaviData_WP) - START_PAYLOAD_DATA); // update crc for the license structure
if((crc_wp != CRC_Wp) || (--count_wp == 0))
{
sent += MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'O', NC_ADDRESS, 1 , (u8 *)&NaviData_WP, sizeof(NaviData_WP)) + 1;
CRC_Wp = crc_wp;
count_wp = 12*2;
}
break;
case 3:
// belegt 43 ASCII-Zeichen
NaviData_Home.Index = 13;
NaviData_Home.ActualLongitude = NaviData.CurrentPosition.Longitude;
NaviData_Home.ActualLatitude = NaviData.CurrentPosition.Latitude;
NaviData_Home.Altimeter = NaviData.Altimeter;
NaviData_Home.GroundSpeed = NaviData.GroundSpeed / 10;
NaviData_Home.OSDStatusFlags = (FC.StatusFlags & OSD_FLAG_MASK1) | (FC.StatusFlags2 & OSD_FLAG_MASK2);
NaviData_Home.HomeLongitude = NaviData.HomePosition.Longitude;
NaviData_Home.HomeLatitude = NaviData.HomePosition.Latitude;
NaviData_Home.HomeAltitude = NaviData.HomePosition.Altitude;
crc_home = CRC16((unsigned char*)(&NaviData_Home.HomeLongitude), sizeof(NaviData_Home_t) - START_PAYLOAD_DATA); // update crc for the license structure
if((crc_home != CRC_Home) || (--count_home == 0))
{
sent += MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'O', NC_ADDRESS, 1 , (u8 *)&NaviData_Home, sizeof(NaviData_Home)) + 1;
CRC_Home = crc_home;
count_home = 25;
}
break;
case 7:
// belegt 39 ASCII-Zeichen
NaviData_Deviation.Index = 14;
NaviData_Deviation.ActualLongitude = NaviData.CurrentPosition.Longitude;
NaviData_Deviation.ActualLatitude = NaviData.CurrentPosition.Latitude;
NaviData_Deviation.Altimeter = NaviData.Altimeter;
NaviData_Deviation.GroundSpeed = NaviData.GroundSpeed / 10;
NaviData_Deviation.OSDStatusFlags = (FC.StatusFlags & OSD_FLAG_MASK1) | (FC.StatusFlags2 & OSD_FLAG_MASK2);
NaviData_Deviation.FlyingTime = NaviData.FlyingTime;
NaviData_Deviation.DistanceToHome = NaviData.HomePositionDeviation.Distance;
NaviData_Deviation.HeadingToHome = NaviData.HomePositionDeviation.Bearing/2;
NaviData_Deviation.DistanceToTarget = NaviData.TargetPositionDeviation.Distance;
NaviData_Deviation.HeadingToTarget = NaviData.TargetPositionDeviation.Bearing/2;
NaviData_Deviation.AngleNick = NaviData.AngleNick;
NaviData_Deviation.AngleRoll = NaviData.AngleRoll;
NaviData_Deviation.SatsInUse = NaviData.SatsInUse;
sent += MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'O', NC_ADDRESS, 1 , (u8 *)&NaviData_Deviation, sizeof(NaviData_Deviation)) + 1;
break;
case 8:
// belegt 43 ASCII-Zeichen
NaviData_Volatile.Index = 16;
NaviData_Volatile.ActualLongitude = NaviData.CurrentPosition.Longitude;
NaviData_Volatile.ActualLatitude = NaviData.CurrentPosition.Latitude;
NaviData_Volatile.Altimeter = NaviData.Altimeter;
NaviData_Volatile.GroundSpeed = NaviData.GroundSpeed / 10;
NaviData_Volatile.OSDStatusFlags = (FC.StatusFlags & OSD_FLAG_MASK1) | (FC.StatusFlags2 & OSD_FLAG_MASK2);
NaviData_Volatile.UBat = FC.BAT_Voltage;
NaviData_Volatile.Current = NaviData.Current;
NaviData_Volatile.UsedCapacity = NaviData.UsedCapacity;
NaviData_Volatile.Variometer = NaviData.Variometer;
NaviData_Volatile.Heading = NaviData.Heading / 2;
NaviData_Volatile.CompassHeading = NaviData.CompassHeading / 2;
NaviData_Volatile.Gas = NaviData.Gas;
NaviData_Volatile.Gas = NaviData.SetpointAltitude;
sent += MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'O', NC_ADDRESS, 1 , (u8 *)&NaviData_Volatile, sizeof(NaviData_Volatile)) + 1;
break;
 
case 9:
// belegt 27 ASCII-Zeichen
NaviData_Tiny.Index = 10;
NaviData_Tiny.ActualLongitude = NaviData.CurrentPosition.Longitude;
NaviData_Tiny.ActualLatitude = NaviData.CurrentPosition.Latitude;
NaviData_Tiny.Altimeter = NaviData.Altimeter;
NaviData_Tiny.GroundSpeed = NaviData.GroundSpeed / 10;
NaviData_Tiny.OSDStatusFlags = (FC.StatusFlags & OSD_FLAG_MASK1) | (FC.StatusFlags2 & OSD_FLAG_MASK2);
if(--count_tiny == 0)
{
sent += MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'O', NC_ADDRESS, 1 , (u8 *)&NaviData_Tiny, sizeof(NaviData_Tiny)) + 1;
count_tiny = 60;
}
break;
default: state = 0;
break;
}
}
pause = (sent * 1000) / MaxBytesPerSecond;
 
UART1_NaviData_Timer = SetDelay(UART1_NaviData_Interval);
UART1_Request_NaviData = FALSE;
LastTransmittedFCStatusFlags2 = NaviData.FCStatusFlags2;
return(pause);
// Clear at timeout:
// NaviData_WP.WP_Eventchannel
}
 
/**************************************************************/
/* Send the answers to incomming commands at the debug uart */
/**************************************************************/
959,11 → 1140,22
{
UART1_DebugData_Interval = 0;
UART1_NaviData_Interval = 0;
UART1_NaviData_MaxBytes = 0;
UART1_Data3D_Interval = 0;
UART1_Display_Interval = 0;
UART1_MotorData_Interval = 0;
UART1_NaviData_Timer = SetDelay(500);
UART1_AboTimeOut = SetDelay(100);
}
 
/*
#define CHK_MIN_INTERVAL(a,b) {if(a && a < b) a = b;}
UART1_NaviData_Interval = 500;
CHK_MIN_INTERVAL(UART1_DebugData_Interval,500);
CHK_MIN_INTERVAL(UART1_NaviData_Interval,1000);
CHK_MIN_INTERVAL(UART1_Data3D_Interval,255);
CHK_MIN_INTERVAL(UART1_Display_Interval,1500);
CHK_MIN_INTERVAL(UART1_MotorData_Interval,750);
*/
UART1_Transmit(); // output pending bytes in tx buffer
if((UART1_tx_buffer.Locked == TRUE)) return;
 
1025,11 → 1217,28
}
else if(( ((UART1_NaviData_Interval > 0) && CheckDelay(UART1_NaviData_Timer) ) || UART1_Request_NaviData) && (UART1_tx_buffer.Locked == FALSE))
{
u16 time = 0;
if(UART1_NaviData_MaxBytes == 0) // Transmit the big NC Data frame
{
NaviData.Errorcode = ErrorCode;
MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'O', NC_ADDRESS, 1 , (u8 *)&NaviData, sizeof(NaviData));
LastTransmittedFCStatusFlags2 = NaviData.FCStatusFlags2;
UART1_NaviData_Timer = SetDelay(UART1_NaviData_Interval);
UART1_Request_NaviData = FALSE;
LastTransmittedFCStatusFlags2 = NaviData.FCStatusFlags2;
}
else
if(CheckDelay(UART1_NaviData_Timer))
{
// Wert = 50 -> Sekunden laufen in 2 s-Abstand (im Wegpunkteflug mit aktivem Countdown in 3-4s)
// Wert = 100 -> Sekunden laufen in 1-2 s-Abstand (im Wegpunkteflug mit aktivem Countdown in 2s)
// Wert = 150 -> Sekunden laufen flüssig (im Wegpunkteflug mit aktivem Countdown und gleichzeitig Target verschieben manchmal in 2s)
// Wert = 200 -> Sekunden laufen flüssig
// Wert >= 250 -> optimal
//UART1_NaviData_MaxBytes = 250;
time = TransmitNavigationData(UART1_NaviData_MaxBytes);
if(UART1_NaviData_Interval > time) time = UART1_NaviData_Interval;
UART1_NaviData_Timer = SetDelay(time);
}
UART1_Request_NaviData = FALSE;
}
else if( (( (UART1_DebugData_Interval > 0) && CheckDelay(UART1_DebugData_Timer)) || UART1_Request_DebugData) && (UART1_tx_buffer.Locked == FALSE))
{
1138,7 → 1347,7
version_tmp.ProtoMajor = UART_VersionInfo.ProtoMajor;
version_tmp.BL_Firmware = UART_VersionInfo.BL_Firmware;
version_tmp.Flags = 0;
version_tmp.Reserved1 = 0;
version_tmp.LabelTextCRC = 0;//UART_VersionInfo.DebugTextCRC;
MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'V', NC_ADDRESS,1, (u8 *)&version_tmp, sizeof(version_tmp));
UART1_Request_VersionInfo = FALSE;
}
/trunk/uart1.h
20,7 → 20,7
u8 SWMajor;
u8 SWMinor;
u8 ProtoMajor;
u8 Reserved1;
u8 LabelTextCRC;
u8 SWPatch;
u8 HardwareError[2];
u8 HWMajor;
98,7 → 98,7
 
#define NAVIDATA_VERSION 5
 
typedef struct
typedef struct // 85 Bytes
{
u8 Version; // version of the data structure
GPS_Pos_t CurrentPosition; // see gpspos.h for details
131,18 → 131,151
u16 Current; // actual current in 0.1A steps
u16 UsedCapacity; // used capacity in mAh
} __attribute__((packed)) NaviData_t;
 
extern NaviData_t NaviData;
// .NCFlags
#define NC_FLAG_FREE 0x01
#define NC_FLAG_PH 0x02
#define NC_FLAG_CH 0x04
#define NC_FLAG_RANGE_LIMIT 0x08
#define NC_FLAG_NOSERIALLINK 0x10
#define NC_FLAG_TARGET_REACHED 0x20
#define NC_FLAG_MANUAL_CONTROL 0x40
#define NC_FLAG_GPS_OK 0x80
 
typedef struct // 10 (15 Bytes belegen 27 ASCII-Zeichen)
{
u8 Index; // version of the data structure
s32 ActualLongitude; //
s32 ActualLatitude; //
s16 Altimeter; // hight according to air pressure
u8 GroundSpeed; // speed over ground in 10cm/s (2D) (255 = 91km/h)
u8 OSDStatusFlags;
u8 reserve1;
u8 reserve2;
} __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)
{
u8 Index; // version of the data structure
s32 ActualLongitude; //
s32 ActualLatitude; //
s16 Altimeter; // hight according to air pressure
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;
} __attribute__((packed)) NaviData_Flags_t;
extern NaviData_Flags_t NaviData_Flags;
 
typedef struct // 12 (27 Bytes belegen 43 ASCII-Zeichen)
{
u8 Index; // version of the data structure
s32 ActualLongitude; //
s32 ActualLatitude; //
s16 Altimeter; // hight according to air pressure
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 reserve;
} __attribute__((packed)) NaviData_Target_t;
extern NaviData_Target_t NaviData_Target;
 
typedef struct // 13 (27 Bytes belegen 43 ASCII-Zeichen)
{
u8 Index; // version of the data structure
s32 ActualLongitude; //
s32 ActualLatitude; //
s16 Altimeter; // hight according to air pressure
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
u8 LipoCellCount;
u8 reserve;
} __attribute__((packed)) NaviData_Home_t;
extern NaviData_Home_t NaviData_Home;
 
typedef struct // 15 (18 Bytes belegen 31 ASCII-Zeichen)
{
u8 Index; // version of the data structure
s32 ActualLongitude; //
s32 ActualLatitude; //
s16 Altimeter; // hight according to air pressure
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 reserve;
} __attribute__((packed)) NaviData_WP_t;
extern NaviData_WP_t NaviData_WP;
 
typedef struct // 14 (24 Bytes belegen 39 ASCII-Zeichen)
{
u8 Index; // version of the data structure
s32 ActualLongitude; //
s32 ActualLatitude; //
s16 Altimeter; // hight according to air pressure
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; // hight according to air pressure
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
} __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);
 
//calculate Back:
//FC.StatusFlags = (OSDStatusFlags & OSD_FLAG_MASK1) | (OSDStatusFlags2 & ~OSD_FLAG_MASK1);
//FC.StatusFlags2 = (OSDStatusFlags & OSD_FLAG_MASK2) | (OSDStatusFlags2 & ~OSD_FLAG_MASK2);
 
 
/*
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;
160,6 → 293,7
extern u8 LastTransmittedFCStatusFlags2;
extern u8 UART1_Request_ReadPoint;
extern WPL_Store_t WPL_Store;
extern u8 CalculateDebugLableCrc(void);
 
typedef struct
{