Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wait until date fixes #33

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 16 additions & 20 deletions TinyGPS.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ TinyGPS::TinyGPS(bool enable_raw)
, _term_number(0)
, _term_offset(0)
, _gps_data_good(false)
, _date_good(false)
#ifndef _GPS_NO_STATS
, _encoded_characters(0)
, _good_sentences(0)
Expand Down Expand Up @@ -186,50 +187,45 @@ bool TinyGPS::term_complete()
byte checksum = 16 * from_hex(_term[0]) + from_hex(_term[1]);
if (checksum == _parity)
{
// Handle MTK3339 RTC clock (even with no GPS fix)
switch(_sentence_type)
{
case _GPS_SENTENCE_GPRMC:
_time = _new_time;
_date = _new_date;
_date_good = true;
_last_time_fix = _new_time_fix;
break;
case _GPS_SENTENCE_GPGGA:
_time = _new_time;
if (_date_good)
_last_time_fix = _new_time_fix;
break;
}
if (_gps_data_good)
{
#ifndef _GPS_NO_STATS
++_good_sentences;
#endif
_last_time_fix = _new_time_fix;
_last_position_fix = _new_position_fix;

switch(_sentence_type)
{
case _GPS_SENTENCE_GPRMC:
_time = _new_time;
_date = _new_date;
_latitude = _new_latitude;
_longitude = _new_longitude;
_speed = _new_speed;
_course = _new_course;
break;
case _GPS_SENTENCE_GPGGA:
_altitude = _new_altitude;
_time = _new_time;
_latitude = _new_latitude;
_longitude = _new_longitude;
_numsats = _new_numsats;
_hdop = _new_hdop;
break;
}

return true;
} else {
// Handle MTK3339 RTC clock (even with no GPS fix)
if (_new_time) {
_last_time_fix = _new_time_fix;
switch(_sentence_type)
{
case _GPS_SENTENCE_GPRMC:
_time = _new_time;
_date = _new_date;
break;
case _GPS_SENTENCE_GPGGA:
_time = _new_time;
break;
}
}
}
}

Expand Down
1 change: 1 addition & 0 deletions TinyGPS.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class TinyGPS
byte _term_number;
byte _term_offset;
bool _gps_data_good;
bool _date_good;
bool _raw_enabled;

#ifndef _GPS_NO_STATS
Expand Down