From bdcd5c3981f3977f0e2de338e7489d0dd553ff70 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Thu, 8 Oct 2020 06:22:25 +0800 Subject: [PATCH] allow reporting # sats before we ahve a fix --- docs/software/gps-todo.txt | 1 - platformio.ini | 2 +- src/gps/UBloxGPS.cpp | 12 ++++++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/software/gps-todo.txt b/docs/software/gps-todo.txt index ab750d9ed..f22e53f9f 100644 --- a/docs/software/gps-todo.txt +++ b/docs/software/gps-todo.txt @@ -6,7 +6,6 @@ bin/run.sh --set region 8 time only mode ./bin/run.sh --set gps_operation 3 -allow longer locking attempts allow locking while cpu sleeps test with crummy antenna ublox parsing failure diff --git a/platformio.ini b/platformio.ini index 504165bce..cf255f380 100644 --- a/platformio.ini +++ b/platformio.ini @@ -63,7 +63,7 @@ lib_deps = 1202 ; CRC32, explicitly needed because dependency is missing in the ble ota update lib https://github.com/meshtastic/arduino-fsm.git https://github.com/meshtastic/SparkFun_Ublox_Arduino_Library.git#31015a55e630a2df77d9d714669c621a5bf355ad - https://github.com/meshtastic/RadioLib.git#1083c2e76f9906c5f80dfec726facebf8413eef0 + https://github.com/meshtastic/RadioLib.git#8657380241bce681c33aab46598bbf13b11f876c https://github.com/meshtastic/TinyGPSPlus.git https://github.com/meshtastic/AXP202X_Library.git#8404abb6d4b486748636bc6ad72d2a47baaf5460 Wire ; explicitly needed here because the AXP202 library forgets to add it diff --git a/src/gps/UBloxGPS.cpp b/src/gps/UBloxGPS.cpp index ba30935f9..f59b3bf03 100644 --- a/src/gps/UBloxGPS.cpp +++ b/src/gps/UBloxGPS.cpp @@ -32,7 +32,7 @@ bool UBloxGPS::setupGPS() _serial_gps->begin(GPS_BAUDRATE); #endif #ifndef NO_ESP32 - _serial_gps->setRxBufferSize(1024); // the default is 256 + _serial_gps->setRxBufferSize(2048); // the default is 256 #endif } @@ -126,7 +126,7 @@ void UBloxGPS::whileActive() // Update fixtype if (ublox.moduleQueried.fixType) { fixType = ublox.getFixType(0); - DEBUG_MSG("GPS fix type %d\n", fixType); + DEBUG_MSG("GPS fix type %d, numSats %d\n", fixType, numSatellites); } } @@ -168,6 +168,12 @@ bool UBloxGPS::lookForLocation() { bool foundLocation = false; + if (ublox.moduleQueried.SIV) + numSatellites = ublox.getSIV(0); + + if (ublox.moduleQueried.pDOP) + dop = ublox.getPDOP(0); // PDOP (an accuracy metric) is reported in 10^2 units so we have to scale down when we use it + // we only notify if position has changed due to a new fix if ((fixType >= 3 && fixType <= 4)) { if (ublox.moduleQueried.latitude) // rd fixes only @@ -175,12 +181,10 @@ bool UBloxGPS::lookForLocation() latitude = ublox.getLatitude(0); longitude = ublox.getLongitude(0); altitude = ublox.getAltitudeMSL(0) / 1000; // in mm convert to meters - dop = ublox.getPDOP(0); // PDOP (an accuracy metric) is reported in 10^2 units so we have to scale down when we use it // Note: heading is only currently implmented in the ublox for the 8m chipset - therefore // don't read it here - it will generate an ignored getPVT command on the 6ms // heading = ublox.getHeading(0); - numSatellites = ublox.getSIV(0); // bogus lat lon is reported as 0 or 0 (can be bogus just for one) // Also: apparently when the GPS is initially reporting lock it can output a bogus latitude > 90 deg!