Skip to content

Commit

Permalink
Tighten up CustomFields.ino example
Browse files Browse the repository at this point in the history
  • Loading branch information
mikalhart committed Sep 4, 2013
1 parent 00f2154 commit b8b46fe
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions examples/UsingCustomFields/UsingCustomFields.ino
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,8 @@ void loop()
Serial.print(F(" VDOP=")); Serial.print(vdop.value());
Serial.print(F(" SATS=")); Serial.println(gps.satellites.value());
}
smartDelay(1000);

if (millis() > 5000 && gps.charsProcessed() < 10)
Serial.println(F("No GPS data received: check wiring"));
while (ss.available() > 0)
gps.encode(ss.read());
}

// This custom version of delay() ensures that the gps object
// is being "fed".
static void smartDelay(unsigned long ms)
{
unsigned long start = millis();
do
{
while (ss.available())
gps.encode(ss.read());
} while (millis() - start < ms);
}

0 comments on commit b8b46fe

Please sign in to comment.