Make the GPS serial UI smarter at giving progress updates

If onylt he serial monitor handled \r properly.....
This commit is contained in:
Starbeamrainbowlabs 2019-06-13 15:15:23 +01:00
parent 4d394b1978
commit 188c74e2d6

View file

@ -13,6 +13,7 @@ void gps_begin() {
TinyGPSLocation gps_location() { TinyGPSLocation gps_location() {
Serial.print("[gps] Getting location: "); Serial.print("[gps] Getting location: ");
uint32_t ms_last_update = millis();
// We WILL discover our location - if it's the last thing we do! // We WILL discover our location - if it's the last thing we do!
while(true) { while(true) {
if(millis() > 5000 && gps.charsProcessed() < 10) { if(millis() > 5000 && gps.charsProcessed() < 10) {
@ -32,8 +33,9 @@ TinyGPSLocation gps_location() {
// If we haven't acquired a lock yet, go around again // If we haven't acquired a lock yet, go around again
// Also go around again if the location is the same hasn't yet been updated (GPS devices are strange) // Also go around again if the location is the same hasn't yet been updated (GPS devices are strange)
if(!gps.location.isValid()) { if(!gps.location.isValid()) {
Serial.print("."); // NOTE: It can really take a rather long time to get a lock. Just wait patiently :-)
delay(100); if(millis() - ms_last_update > 500) Serial.print(".");
ms_last_update = millis();
continue; continue;
} }