14,7 → 14,7 |
#include "analog.h" |
#include "gps.h" |
#include "button.h" |
//#include "logging.h" |
#include "logging.h" |
#include "settings.h" |
|
#define FOLLOWME_INTERVAL 1000 // 1 second update |
26,22 → 26,14 |
int16_t PowerOn = 0; |
int16_t i = 0; |
int16_t delay = 0; |
int16_t FollowMe_active = 0; |
#endif |
|
uint16_t Error = 0; |
SysState_t SysState = STATE_UNDEFINED; |
|
typedef enum |
{ |
STATE_UNDEFINED, |
STATE_IDLE, |
STATE_SEND_FOLLOWME |
} SysState_t; |
|
int main (void) |
{ |
static uint16_t FollowMe_Timer = 0; |
static SysState_t SysState = STATE_UNDEFINED; |
|
// disable interrupts global |
cli(); |
72,7 → 64,7 |
// initialize the settings |
Settings_Init(); |
// initialize logging (needs settings) |
//Logging_Init(); |
Logging_Init(); |
|
#ifdef USE_SDLOGGER |
printf("\r\n\r\nHW: SD-Logger"); |
96,6 → 88,9 |
// get gps data to update the follow me position |
GPS_Update(); |
|
// update logging |
Logging_Update(); |
|
// check for button action and change state resectively |
if(GetButton()) |
{ |
143,7 → 138,6 |
FollowMe_Timer = SetDelay(FOLLOWME_INTERVAL/4); // reset timer on higer frequency |
} |
LEDGRN_TOGGLE; // indication of active follow me |
FollowMe_active = 1; |
} |
break; |
|
150,7 → 144,6 |
case STATE_IDLE: |
// do nothing |
LEDGRN_ON; |
FollowMe_active = 0; |
break; |
|
default: |