Subversion Repositories Projects

Compare Revisions

Regard whitespace Rev 273 → Rev 274

/FollowMe/main.c
63,13 → 63,20
#include "menu.h"
#include "printf_P.h"
#include "analog.h"
#include "ubx.h"
 
#ifdef USE_FOLLOWME
int16_t UBat = 120;
#endif
 
#define GPS_RX_TIMEOUT 0x0001
 
 
int main (void)
{
static uint16_t GPS_Timer = 0;
static uint16_t Error = 0;
 
// disable interrupts global
cli();
 
83,6 → 90,7
LEDRED_ON;
TIMER0_Init();
USART0_Init();
UBX_Init();
USART1_Init();
ADC_Init();
// enable interrupts global
122,10 → 130,9
 
LCD_Clear();
 
GPS_Timer = SetDelay(1000);
while (1)
{
USART0_ProcessRxData();
USART0_TransmitTxData();
// restart ADConversion if ready
if(ADReady)
{
148,9 → 155,33
DebugOut.Analog[8] = UBat;
#endif
ADReady = 0;
ADC_Enable();
ADC_Enable(); // restart ad conversion sequence
}
 
 
if(GPSData.Status == NEWDATA)
{
Error &= ~GPS_RX_TIMEOUT; // clear possible error
GPS_Timer = SetDelay(1000); // reset timeout
if(CheckGPSOkay >= 5)
{
// trigger transmission of FollowMe message here.
 
CheckGPSOkay = 0;
}
GPSData.Status = PROCESSED;
}
else // invalid or already processed
{
if(CheckDelay(GPS_Timer))
{
Error |= GPS_RX_TIMEOUT;
}
}
 
USART0_ProcessRxData();
USART0_TransmitTxData();
}
return (1);
}