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-12-24 02:35:09 -04:00
|
|
|
void
|
|
|
|
GPS::update(void)
|
2010-10-17 17:13:53 -03:00
|
|
|
{
|
2011-10-28 15:52:50 -03:00
|
|
|
bool result;
|
|
|
|
|
|
|
|
// call the GPS driver to process incoming data
|
|
|
|
result = read();
|
|
|
|
|
|
|
|
// if we did not get a message, and the idle timer has expired, re-init
|
|
|
|
if (!result) {
|
|
|
|
if ((millis() - _idleTimer) > idleTimeout) {
|
|
|
|
_status = NO_GPS;
|
|
|
|
|
|
|
|
init();
|
|
|
|
// reset the idle timer
|
|
|
|
_idleTimer = millis();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// we got a message, update our status correspondingly
|
|
|
|
_status = fix ? GPS_OK : NO_FIX;
|
|
|
|
|
|
|
|
valid_read = true;
|
|
|
|
new_data = true;
|
|
|
|
|
|
|
|
// reset the idle timer
|
|
|
|
_idleTimer = millis();
|
|
|
|
}
|
2010-10-17 17:13:53 -03:00
|
|
|
}
|
2010-12-19 09:24:29 -04:00
|
|
|
|
2011-06-16 13:33:08 -03:00
|
|
|
void
|
2011-05-04 16:12:27 -03:00
|
|
|
GPS::setHIL(long _time, float _latitude, float _longitude, float _altitude,
|
|
|
|
float _ground_speed, float _ground_course, float _speed_3d, uint8_t _num_sats)
|
2011-02-19 14:33:42 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-12-24 02:35:09 -04:00
|
|
|
// XXX this is probably the wrong way to do it, too
|
2010-12-19 09:24:29 -04:00
|
|
|
void
|
2010-12-24 02:35:09 -04:00
|
|
|
GPS::_error(const char *msg)
|
2010-12-19 09:24:29 -04:00
|
|
|
{
|
2011-10-28 15:52:50 -03:00
|
|
|
Serial.println(msg);
|
2010-12-19 09:24:29 -04:00
|
|
|
}
|