clear first_fix_acquired on gps off, increase timeout to 120 sec

This commit is contained in:
liquidraver
2026-04-21 14:41:56 +02:00
parent a3244e2dc2
commit de4bcd9a52
2 changed files with 12 additions and 2 deletions
+5 -1
View File
@@ -445,11 +445,15 @@ config ZEPHCORE_GPS_POLL_INTERVAL_SEC
config ZEPHCORE_GPS_FIX_TIMEOUT_SEC
int "GPS fix acquisition timeout in seconds"
default 30
default 120
range 10 300
help
Maximum time to wait for GPS fix before giving up.
GPS will be powered off after this timeout.
Default 120s — 30s was too aggressive for Air530Z / MAX-7Q warm
starts in marginal sky conditions; the acquire loop would time out
before the 3-consecutive-good-fix gate could promote. Only applies
to wake cycles after the first successful fix since enable.
endmenu
+7 -1
View File
@@ -85,7 +85,7 @@ enum gps_state {
static enum gps_state gps_current_state = GPS_STATE_OFF;
static uint8_t consecutive_good_fixes = 0;
static bool first_fix_acquired = false; /* True after first successful fix since enable */
static bool first_fix_acquired = false; /* True after first 3-good-fix cycle since enable. Cleared on gps_enable(false) and at boot. */
static bool gps_time_synced = false; /* True after GPS syncs RTC. Starts false at boot (RTC reset),
* set true after 3 good fixes, cleared when GPS disabled. */
static int64_t last_fix_uptime_ms = 0; /* k_uptime when last validated fix was acquired */
@@ -1297,6 +1297,12 @@ void gps_enable(bool enable)
gps_current_state = GPS_STATE_OFF;
consecutive_good_fixes = 0;
/* Clear first-fix flag so the next enable gets the "no timeout"
* grace period again — in marginal signal, a 30120s timeout may
* never be enough, and the user explicitly toggled GPS expecting
* it to try hard for a fix. */
first_fix_acquired = false;
/* Clear time sync flag - time will drift, allow phone sync again */
gps_time_synced = false;
}