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
1 changed files with 4 additions and 2 deletions

View File

@ -13,6 +13,7 @@ void gps_begin() {
TinyGPSLocation gps_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!
while(true) {
if(millis() > 5000 && gps.charsProcessed() < 10) {
@ -32,8 +33,9 @@ TinyGPSLocation gps_location() {
// 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)
if(!gps.location.isValid()) {
Serial.print(".");
delay(100);
// NOTE: It can really take a rather long time to get a lock. Just wait patiently :-)
if(millis() - ms_last_update > 500) Serial.print(".");
ms_last_update = millis();
continue;
}