seperate time setting from validity check, if we chaneg the time we also invalidate
This commit is contained in:
parent
49a69c7cad
commit
7f45ec04bf
10
GPS.cpp
10
GPS.cpp
|
|
@ -122,12 +122,11 @@ void GPS::process()
|
||||||
getTime(&tv);
|
getTime(&tv);
|
||||||
logger.debug(TAG, "'%s'", _nmea.getSentence());
|
logger.debug(TAG, "'%s'", _nmea.getSentence());
|
||||||
|
|
||||||
if (_nmea.isValid() && _nmea.getNumSatellites() >= 4)
|
const char * id = _nmea.getMessageID();
|
||||||
{
|
|
||||||
//
|
//
|
||||||
// if it was a GGA and its valid then check and maybe update the time
|
// if it was a GGA and its valid then check and maybe update the time
|
||||||
//
|
//
|
||||||
const char * id = _nmea.getMessageID();
|
|
||||||
if (_nmea.getYear() > 2000 && strcmp("RMC", id) == 0)
|
if (_nmea.getYear() > 2000 && strcmp("RMC", id) == 0)
|
||||||
{
|
{
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
|
|
@ -148,6 +147,7 @@ void GPS::process()
|
||||||
if (!_nmea_late)
|
if (!_nmea_late)
|
||||||
{
|
{
|
||||||
_seconds = new_seconds;
|
_seconds = new_seconds;
|
||||||
|
invalidate("seconds adjusted!");
|
||||||
logger.info(TAG, "adjusting seconds from %lu to %lu from:'%s'", old_seconds, new_seconds, _nmea.getSentence());
|
logger.info(TAG, "adjusting seconds from %lu to %lu from:'%s'", old_seconds, new_seconds, _nmea.getSentence());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -158,7 +158,10 @@ void GPS::process()
|
||||||
|
|
||||||
_nmea_late = false;
|
_nmea_late = false;
|
||||||
_nmea_timer.attach_ms(NMEA_TIMER_MS, _timer_handler, &_nmea_timeout);
|
_nmea_timer.attach_ms(NMEA_TIMER_MS, _timer_handler, &_nmea_timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_nmea.isValid() && _nmea.getNumSatellites() >= 4)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// if gps was not valid, it is now
|
// if gps was not valid, it is now
|
||||||
//
|
//
|
||||||
|
|
@ -169,7 +172,6 @@ void GPS::process()
|
||||||
logger.info(TAG, "GPS valid!");
|
logger.info(TAG, "GPS valid!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else /* nmea not valid or sat count < 4 */
|
else /* nmea not valid or sat count < 4 */
|
||||||
{
|
{
|
||||||
if (_gps_valid)
|
if (_gps_valid)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user