mirror of
https://github.com/liquidraver/ZephCore.git
synced 2026-09-02 00:08:18 +00:00
clear first_fix_acquired on gps off, increase timeout to 120 sec
This commit is contained in:
+5
-1
@@ -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
|
||||
|
||||
|
||||
@@ -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 30–120s 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user