GPS: short update intervals, lock-time prediction (#4070)

* Refactor GPSPowerState enum
Identifies a case where the GPS hardware is awake, but an update is not yet desired

* Change terminology

* Clear old lock-time prediction on triple press

* Use exponential smoothing to predict lock time

* Rename averageLockTime to predictedLockTime

* Attempt: Send PMREQ with duration 0 on MCU deep-sleep

* Attempt 2: Send PMREQ with duration 0 on MCU deep-sleep

* Revert "Attempt 2: Send PMREQ with duration 0 on MCU deep-sleep"

This reverts commit 8b697cd2a445355dcfab5b33e0ce7a3128cab151.

* Revert "Attempt: Send PMREQ with duration 0 on MCU deep-sleep"

This reverts commit 9d29ec7603a88056b9115796b29b5023165a93bb.
This commit is contained in:
todd-herbert
2024-06-14 08:28:01 -05:00
committed by GitHub
co-authored by GitHub
parent 16b41b51af
commit 39c9f92c6e
2 changed files with 71 additions and 37 deletions
+6 -5
View File
@@ -39,9 +39,10 @@ typedef enum {
} GPS_RESPONSE;
enum GPSPowerState : uint8_t {
GPS_OFF = 0,
GPS_AWAKE = 1,
GPS_STANDBY = 2,
GPS_OFF = 0, // Physically powered off
GPS_ACTIVE = 1, // Awake and want a position
GPS_STANDBY = 2, // Physically powered on, but soft-sleeping
GPS_IDLE = 3, // Awake, but not wanting another position yet
};
// Generate a string representation of DOP
@@ -72,7 +73,7 @@ class GPS : private concurrency::OSThread
uint32_t rx_gpio = 0;
uint32_t tx_gpio = 0;
uint32_t en_gpio = 0;
int32_t averageLockTime = 0;
int32_t predictedLockTime = 0;
uint32_t GPSCycles = 0;
int speedSelect = 0;
@@ -93,7 +94,7 @@ class GPS : private concurrency::OSThread
bool GPSInitFinished = false; // Init thread finished?
bool GPSInitStarted = false; // Init thread finished?
GPSPowerState powerState = GPS_OFF; // GPS_AWAKE if we want a location right now
GPSPowerState powerState = GPS_OFF; // GPS_ACTIVE if we want a location right now
uint8_t numSatellites = 0;