You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It was arguably a weak naming choice, but isValid() == true means only "at least one properly formatted sentence containing this field has been received" and not "this field was populated with data that has been verified to be correct". I'm guessing that your GPS has sent a sentence which contains a blank date/time field--which is perfectly Valid, if not immediately useful.
Early on we decided that, in the interest of staying Tiny, the library would act strictly as a parser, and not a validator. Your sort of workaround is exactly what is needed. For example, one of the devices we sometimes deploy sends "January 1, 2080" as the date until it gets a fix. We have to check for this condition outside TinyGPS++.
I'm currently working on a watch that uses GPS to tell the time.
But the error is also in the example DeviceExample.ino
`Serial.print(F(" Date/Time: "));
if (gps.date.isValid())
{
Serial.print(gps.date.month());
Serial.print(F("/"));
Serial.print(gps.date.day());
Serial.print(F("/"));
Serial.print(gps.date.year());
}else
{
Serial.print(F("INVALID"));
}
if (gps.date.isValid()) {
// do something
} else
{
Serial.print(F("INVALID"));
}
`
if (gps.date.isValid()) is always TRUE, even if GPS fails.
gps.date.month() and gps.date.day() are 0.
Valid values are month 1 to 12 - day 1 to 31.
if (gps.time.isValid()) is always TRUE, even if GPS fails.
Work around: check if the month or day is 0 Zerro
The text was updated successfully, but these errors were encountered: