2010-09-06 17:18:32 -03:00
|
|
|
// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: t -*-
|
|
|
|
|
|
|
|
#include "GPS.h"
|
2010-10-17 01:07:46 -03:00
|
|
|
#include "WProgram.h"
|
2010-09-06 17:18:32 -03:00
|
|
|
|
2010-10-17 01:07:46 -03:00
|
|
|
int
|
2010-10-17 17:13:53 -03:00
|
|
|
GPS::status(void)
|
|
|
|
{
|
2010-10-17 01:07:46 -03:00
|
|
|
if (millis() - _lastTime >= 500){
|
|
|
|
return 0;
|
|
|
|
} else if (fix == 0) {
|
|
|
|
return 1;
|
|
|
|
} else {
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-17 17:13:53 -03:00
|
|
|
void
|
|
|
|
GPS::_setTime(void)
|
|
|
|
{
|
|
|
|
_lastTime = millis();
|
|
|
|
}
|
2010-12-19 09:24:29 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
GPS::update(void)
|
|
|
|
{
|
|
|
|
if (!status())
|
|
|
|
{
|
|
|
|
Serial.println("Reinitializing GPS");
|
|
|
|
init();
|
|
|
|
_setTime();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
read();
|
|
|
|
}
|
|
|
|
}
|