Subversion Repositories NaviCtrl

Compare Revisions

Ignore whitespace Rev 851 → Rev 852

/trunk/uart1.c
85,6 → 85,7
#include "triggerlog.h"
#include "settings.h"
#include "MobileMenu.h"
#include "CamCtrl.h"
 
#define LIC_CMD_READ_LICENSE 1
#define LIC_CMD_WRITE_LICENSE 2
109,6 → 110,8
NaviData_Out_t NaviData_Out1Trigger;
NaviData_t NaviData;
NaviData_HoTT_Text_t NaviData_HoTT_Text;
WP_MissionParameter_t WP_MissionParameter;
NaviData_Laser_t NaviData_Laser;
 
u8 UART1_Request_VersionInfo = FALSE;
u8 UART1_Request_ExternalControl= FALSE;
136,6 → 139,8
u8 UART1_Request_MobileLabel = 0xff;
u8 UART1_Request_MobileMenu = 0;
u8 UART1_Request_MobileInfo = 0;
u8 UART1_Request_MissonParameter = 0;
u8 StopAllAbbos = 0;
 
u8 LastTransmittedFCStatusFlags2 = 0;
u8 UART1_ExternalControlConfirmFrame = FALSE;
696,25 → 701,38
UART1_Request_WPLStore = TRUE;
break;
 
case 'j':// Set/Get NC-Parameter
case 'j':
switch(SerialMsg.pData[0])
{
case 0: // get
case 0: // Get NC-Parameter
UART1_Request_ParameterId = SerialMsg.pData[1];
UART1_Request_Parameter = TRUE;
break;
 
case 1: // set
case 1: // Set NC-Parameter
{
s16 value;
value = SerialMsg.pData[2] + (s16)SerialMsg.pData[3] * 0x0100;
NCParams_SetValue(SerialMsg.pData[1], &value);
UART1_Request_ParameterId = SerialMsg.pData[1];
UART1_Request_Parameter = TRUE;
}
break;
case 3: // Get Mission-Parameter
UART1_Request_MissonParameter = SerialMsg.pData[0];
break;
 
case 4: // Set Mission-Parameter
memcpy(&WP_MissionParameter, &SerialMsg.pData[1], sizeof(WP_MissionParameter));
UART1_Request_MissonParameter = SerialMsg.pData[0]; // answer request with 4
break;
case 5: // stop all abbos
StopAllAbbos = 1;
break;
default:
break;
}
UART1_Request_ParameterId = SerialMsg.pData[1];
UART1_Request_Parameter = TRUE;
break;
default:
// unsupported command recieved
1139,7 → 1157,18
 
switch(state++)
{
case 0:
case 0: if(LaserCtrlTimeout > 0) // send only, if LaserCtrl is connected
{
NaviData_Laser.Index = 20;
NaviData_Laser.ActualLongitude = NaviData.CurrentPosition.Longitude;
NaviData_Laser.ActualLatitude = NaviData.CurrentPosition.Latitude;
NaviData_Laser.Altimeter_5cm = NaviData.Altimeter_5cm;
NaviData_Laser.GroundSpeed = NaviData.GroundSpeed / 10;
NaviData_Laser.OSDStatusFlags = (FC.StatusFlags & OSD_FLAG_MASK1) | (FC.StatusFlags2 & OSD_FLAG_MASK2);
NaviData_Laser.Distance = FromLaserCtrl.Distance;
sent += MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'O', NC_ADDRESS, 1 , (u8 *)&NaviData_Laser, sizeof(NaviData_Laser)) + 1;
break;
}
case 6:
case 5:
// belegt 35 ASCII-Zeichen
1358,7 → 1387,7
static u8 motorindex1 = 255, motorindex2 = 0;
if(DebugUART != UART1) return;
 
if(CheckDelay(UART1_AboTimeOut))
if(CheckDelay(UART1_AboTimeOut) || StopAllAbbos)
{
UART1_DebugData_Interval = 0;
UART1_NaviData_Interval = 0;
1370,6 → 1399,7
UART1_AboTimeOut = SetDelay(1000);
UART1_MobileMenu_Timer = 0;
TransmitNavigationData(0,1); // clear the CRC values
StopAllAbbos = 0;
}
//if(UART1_NaviData_MaxBytes > 150) UART1_NaviData_MaxBytes = 150;
//UART1_NaviData_MaxBytes = 150;
1392,6 → 1422,11
MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'J', NC_ADDRESS, 2, &UART1_Request_ParameterId, sizeof(UART1_Request_ParameterId), &ParamValue, sizeof(ParamValue)); // answer the param request
UART1_Request_Parameter = FALSE;
}
else if(UART1_Request_MissonParameter && (UART1_tx_buffer.Locked == FALSE))
{
MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'J', NC_ADDRESS, 2, &UART1_Request_MissonParameter, sizeof(UART1_Request_MissonParameter), &WP_MissionParameter, sizeof(WP_MissionParameter)); // answer the param request
UART1_Request_MissonParameter = 0;
}
else if(UART1_Request_Echo && (UART1_tx_buffer.Locked == FALSE))
{
MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'Z', NC_ADDRESS, 1, &Echo, sizeof(Echo)); // answer the echo request
/trunk/uart1.h
355,6 → 355,41
} __attribute__((packed)) NaviData_HoTT_Text_t;
extern NaviData_HoTT_Text_t NaviData_HoTT_Text;
 
typedef struct // Index:20 (15 Bytes need 27 ASCII-characters) -> 7+(x/3)*4 -> sending only if LaserCtrl is connected
{
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 Distance;
} __attribute__((packed)) NaviData_Laser_t;
extern NaviData_Laser_t NaviData_Laser;
 
typedef struct
{
u8 ComingHomeAltitude;
u8 FailsafeAltitude;
u8 TriggerMask; // Trigger Bitmask
u8 Flags; // 0x01 = Ignore RC lost (Lizenz feature!) - default aus
u8 reserved[32];
} __attribute__((packed)) WP_MissionParameter_t;
extern WP_MissionParameter_t WP_MissionParameter;
 
#define MISSION_IGNORE_RC_LOST 0x01
#define MISSION_TRIGGER_DELAY 0x02
 
 
/*
NaviMaxFlyingRange
NaviDescendRange
FailSafeTime -> ignore RC-Lost
AutoPhotoAtitudes
FailSafeAltitude -> Bei Punkt?
J16Bitmask
*/
 
extern UART_TypeDef *DebugUART;
extern volatile u8 SerialLinkOkay;
extern Buffer_t UART1_tx_buffer;