Browse Source

Refactor gps a teeny bit

master
Starbeamrainbowlabs 3 years ago
parent
commit
5b4b36ddad
  1. 15
      iot/main/gps.cpp

15
iot/main/gps.cpp

@ -18,6 +18,7 @@ GPSLocation gps_fetch() { @@ -18,6 +18,7 @@ GPSLocation gps_fetch() {
Serial.print(F("[gps] Working: "));
uint32_t ms_last_update = millis();
uint8_t ticks = 0;
// We WILL discover our location - if it's the last thing we do!
while(true) {
if(millis() > 5000 && gps.charsProcessed() < 10) {
@ -40,7 +41,19 @@ GPSLocation gps_fetch() { @@ -40,7 +41,19 @@ GPSLocation gps_fetch() {
#endif
) {
// NOTE: It can take a rather long time to get a lock. Just wait patiently :-)
if(millis() - ms_last_update > 500) Serial.print(".");
if(millis() - ms_last_update > 500) {
ticks++;
Serial.print(gps.time.isValid() ? '-' : '.');
if(ticks > 80) {
Serial.println();
ticks = 0;
}
// Serial.println(gps.location.lat());
// Serial.println(gps.location.lng());
// Serial.println(gps.date.year());
// Serial.println(gps.time.hour());
// Serial.println(gps.time.minute());
}
ms_last_update = millis();
continue;
}

Loading…
Cancel
Save