From ea651c2f8fa421ad64809eb9d66b6a466471d643 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sun, 7 Jan 2024 09:35:19 -0600 Subject: [PATCH] Remove gps_attempt_time and use broadcast interval instead (#3064) --- src/gps/GPS.cpp | 5 +++-- src/gps/GPS.h | 2 +- src/mesh/NodeDB.cpp | 3 --- src/mesh/NodeDB.h | 4 ---- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index 60eeeb3bb..fee9393b0 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -596,11 +596,12 @@ void GPS::setAwake(bool on) */ uint32_t GPS::getWakeTime() const { - uint32_t t = config.position.gps_attempt_time; + uint32_t t = config.position.position_broadcast_secs; if (t == UINT32_MAX) return t; // already maxint - return t * 1000; + + return getConfiguredOrDefaultMs(t, default_broadcast_interval_secs); } /** Get how long we should sleep between aqusition attempts in msecs diff --git a/src/gps/GPS.h b/src/gps/GPS.h index 4cbdae06b..d05bad950 100644 --- a/src/gps/GPS.h +++ b/src/gps/GPS.h @@ -70,7 +70,7 @@ class GPS : private concurrency::OSThread /** * hasValidLocation - indicates that the position variables contain a complete - * GPS location, valid and fresh (< gps_update_interval + gps_attempt_time) + * GPS location, valid and fresh (< gps_update_interval + position_broadcast_secs) */ bool hasValidLocation = false; // default to false, until we complete our first read diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 6f1ba5583..4de79de0b 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -223,7 +223,6 @@ void NodeDB::installDefaultConfig() void NodeDB::initConfigIntervals() { config.position.gps_update_interval = default_gps_update_interval; - config.position.gps_attempt_time = default_gps_attempt_time; config.position.position_broadcast_secs = default_broadcast_interval_secs; config.power.ls_secs = default_ls_secs; @@ -301,8 +300,6 @@ void NodeDB::installRoleDefaults(meshtastic_Config_DeviceConfig_Role role) initModuleConfigIntervals(); } else if (role == meshtastic_Config_DeviceConfig_Role_REPEATER) { config.display.screen_on_secs = 1; - } else if (role == meshtastic_Config_DeviceConfig_Role_TRACKER) { - config.position.gps_update_interval = 30; } else if (role == meshtastic_Config_DeviceConfig_Role_SENSOR) { moduleConfig.telemetry.environment_measurement_enabled = true; moduleConfig.telemetry.environment_update_interval = 300; diff --git a/src/mesh/NodeDB.h b/src/mesh/NodeDB.h index 5e4dc4885..47d143cd9 100644 --- a/src/mesh/NodeDB.h +++ b/src/mesh/NodeDB.h @@ -179,9 +179,6 @@ extern NodeDB nodeDB; prefs.gps_update_interval = oneday prefs.is_power_saving = True - - # allow up to five minutes for each new GPS lock attempt - prefs.gps_attempt_time = 300 */ // Our delay functions check for this for times that should never expire @@ -192,7 +189,6 @@ extern NodeDB nodeDB; #define ONE_DAY 24 * 60 * 60 -#define default_gps_attempt_time IF_ROUTER(5 * 60, 15 * 60) #define default_gps_update_interval IF_ROUTER(ONE_DAY, 2 * 60) #define default_broadcast_interval_secs IF_ROUTER(ONE_DAY / 2, 15 * 60) #define default_wait_bluetooth_secs IF_ROUTER(1, 60)