From 8dbfd0f19bf70edfe792d2ed695dd973e43cfb53 Mon Sep 17 00:00:00 2001 From: a-f-G-U-C <65810997+a-f-G-U-C@users.noreply.github.com> Date: Mon, 30 Aug 2021 13:45:42 +0000 Subject: [PATCH 1/2] disable gps powercycle for small gps_update_interval --- src/gps/UBloxGPS.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/gps/UBloxGPS.cpp b/src/gps/UBloxGPS.cpp index 91c895a1..da8f1e3a 100644 --- a/src/gps/UBloxGPS.cpp +++ b/src/gps/UBloxGPS.cpp @@ -5,6 +5,11 @@ #include "sleep.h" #include +/ if gps_update_interval below this value, do not powercycle the GPS +#define UBLOX_POWEROFF_THRESHOLD 90 + +extern RadioConfig radioConfig; + UBloxGPS::UBloxGPS() {} bool UBloxGPS::tryConnect() @@ -201,15 +206,20 @@ bool UBloxGPS::whileIdle() /// Note: ublox doesn't need a wake method, because as soon as we send chars to the GPS it will wake up void UBloxGPS::sleep() { - // Tell GPS to power down until we send it characters on serial port (we leave vcc connected) - ublox.powerOff(); - // setGPSPower(false); + if (radioConfig.preferences.gps_update_interval > UBLOX_POWEROFF_THRESHOLD) { + // Tell GPS to power down until we send it characters on serial port (we leave vcc connected) + ublox.powerOff(); + // setGPSPower(false); + } } void UBloxGPS::wake() { - fixType = 0; // assume we hace no fix yet + if (radioConfig.preferences.gps_update_interval > UBLOX_POWEROFF_THRESHOLD) { + fixType = 0; // assume we have no fix yet + } + // this is idempotent setGPSPower(true); // Note: no delay needed because now we leave gps power on always and instead use ublox.powerOff() From 71951a4e6aae99c78076e14025941da6651a6dc4 Mon Sep 17 00:00:00 2001 From: a-f-G-U-C <65810997+a-f-G-U-C@users.noreply.github.com> Date: Mon, 30 Aug 2021 13:55:50 +0000 Subject: [PATCH 2/2] fix a typo --- src/gps/UBloxGPS.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gps/UBloxGPS.cpp b/src/gps/UBloxGPS.cpp index da8f1e3a..aae4ecc3 100644 --- a/src/gps/UBloxGPS.cpp +++ b/src/gps/UBloxGPS.cpp @@ -5,7 +5,7 @@ #include "sleep.h" #include -/ if gps_update_interval below this value, do not powercycle the GPS +// if gps_update_interval below this value, do not powercycle the GPS #define UBLOX_POWEROFF_THRESHOLD 90 extern RadioConfig radioConfig;