75,7 → 75,7 |
#include "mkprotocol.h" |
#include "params.h" |
#include "fifo.h" |
#include "debug.h" |
#include "debug.h" |
|
#define FALSE 0 |
#define TRUE 1 |
105,7 → 105,7 |
|
#ifdef FOLLOW_ME |
#define FOLLOW_ME_INTERVAL 200 // 5 Hz |
u8 UART1_FollowMe_Timer = 0; |
u32 UART1_FollowMe_Timer = 0; |
Point_t FollowMe; |
#endif |
|
361,10 → 361,10 |
u8 c; |
// if rx buffer is not locked |
if(UART1_rx_buffer.Locked == FALSE) |
{ |
{ |
//collect data from primary rx fifo |
while(fifo_get(&UART1_rx_fifo, &c)) |
{ |
{ |
// break if complete frame is collected |
if(MKProtocol_CollectSerialFrame(&UART1_rx_buffer, c)) break; |
} |
410,10 → 410,10 |
pPoint = (Point_t*)SerialMsg.pData; |
if(pPoint->Position.Status == NEWDATA) |
{ |
//if(!(FC.StatusFlags & FC_STATUS_FLY)) PointList_Clear(); // flush the list |
//if(!(FC.StatusFlags & FC_STATUS_FLY)) PointList_Clear(); // flush the list |
//pPoint->Index = 1; // must be one after empty list |
PointList_SetAt(pPoint); |
if(FC.StatusFlags & FC_STATUS_FLY) PointList_WPActive(TRUE); |
if(FC.StatusFlags & FC_STATUS_FLY) PointList_WPActive(TRUE); |
GPS_pWaypoint = PointList_WPBegin(); // updates POI index |
if(GPS_pWaypoint != NULL) // if new WP exist |
{ // update WP hold time stamp immediately! |
465,12 → 465,12 |
{ |
PointList_Clear(); |
GPS_pWaypoint = PointList_WPBegin(); |
UART1_Request_WritePoint = 0; // return new point count |
UART1_Request_WritePoint = 0; // return new point count |
} |
else |
{ // update WP in list at index |
UART1_Request_WritePoint = PointList_SetAt(pPoint); |
if(FC.StatusFlags & FC_STATUS_FLY) PointList_WPActive(TRUE); |
if(FC.StatusFlags & FC_STATUS_FLY) PointList_WPActive(TRUE); |
if(UART1_Request_WritePoint == pPoint->Index) |
{ |
BeepTime = 500; |
621,8 → 621,8 |
tmp_tx = UART1_tx_buffer.pData[UART1_tx_buffer.Position++]; // read next byte from txd buffer |
UART_SendData(UART1, tmp_tx); // put character to txd fifo |
#ifdef FOLLOW_ME |
if(TransmitAlsoToFC) |
{ |
if(TransmitAlsoToFC) |
{ |
UART_SendData(UART2, tmp_tx); // put character to txd fifo |
} |
#endif |
659,7 → 659,7 |
|
if(UART1_Request_Parameter && (UART1_tx_buffer.Locked == FALSE)) |
{ |
s16 ParamValue; |
s16 ParamValue; |
NCParams_GetValue(UART1_Request_ParameterId, &ParamValue); |
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; |
764,7 → 764,7 |
else if(CheckDelay(UART1_FollowMe_Timer) && (UART1_tx_buffer.Locked == FALSE)) |
{ |
if((GPSData.Status != INVALID) && (GPSData.SatFix == SATFIX_3D) && (GPSData.Flags & FLAG_GPSFIXOK) && (GPSData.NumOfSats >= 4)) |
{ |
{ |
TransmitAlsoToFC = 1; |
// update FollowMe content |
FollowMe.Position.Longitude = GPSData.Position.Longitude; |
797,7 → 797,7 |
MKProtocol_CreateSerialFrame(&UART1_tx_buffer,'0', NC_ADDRESS, 1, (u8 *) &tDebug, sizeof(tDebug)); |
SendDebugOutput = 0; |
} |
#endif |
#endif |
UART1_Transmit(); // output pending bytes in tx buffer |
} |
|