Updated software serial pull rate

This commit is contained in:
Ryan Alder 2020-03-03 13:39:42 -08:00
parent 5e48c293bf
commit 6cd65f0a8f
1 changed files with 5 additions and 5 deletions

View File

@ -44,12 +44,15 @@ void loop() {
Serial.println(); Serial.println();
} }
if (ss.available() > 0)
gps.encode(ss.read());
unsigned long currentMillis = millis(); unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) { if (currentMillis - previousMillis >= interval) {
previousMillis = currentMillis; previousMillis = currentMillis;
// Gather GPS data // Gather GPS data
if (gps.encode(ss.read()) && gps.location.isValid()) { if (gps.location.isValid()) {
Serial.println("Valid GPS"); Serial.println("Valid GPS");
lat = gps.location.lat(); lat = gps.location.lat();
lng = gps.location.lng(); lng = gps.location.lng();
@ -70,13 +73,10 @@ void loop() {
if (!status) { if (!status) {
Serial.println("Failed to encode"); Serial.println("Failed to encode");
} else {
Serial.print("Status: ");
Serial.println(status);
} }
Serial.print("Sending packet Lat / Long: "); Serial.print("Sending packet Lat / Long: ");
Serial.print(lat); Serial.println(lat);
Serial.println(lng); Serial.println(lng);
// send packet // send packet