In periodic mode a window closed after GPS_FIX_SETTLE_MS (10 s) from the
first fix even if the clock sync was still pending. The sync needs about
4 s of continuous valid fixes (time_valid > 2, reset on any pass without
a fix), so after a hot start, when the receiver reports a fix within
seconds but not yet steadily, the window could close unsynced. On a
board without an RTC the clock then stays at its default until the next
window, a whole period later.
Close the window only once the sync has been tried (done, not needed, or
refused by GPS_GUARD); the settle time and the satellite count apply
after that. The acquisition timeout still bounds the window.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RakLocationProvider wraps a MicroNMEALocationProvider but did not override
setFirstFixTimeout(), getFirstFixTimeout() or formatDiagnostics(), so on
RAK4631 boards with a serial GPS:
- `gps firstfix` always answered "0 (no limit)" (the LocationProvider
default), while the limit in force was the build default (1 h);
- `gps firstfix <n>` saved the value but never applied it, at once or at boot;
- `gps diag` gave the short base form, without the UART/NMEA counters or fm:.
Forward all three to the NMEA provider. The RAK12500 (I2C) path has no
first-fix limit, so it keeps reporting 0 and the short diagnostics.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The I2C probe left WB_IO2 as an input when no RAK12500 answered. WB_IO2
switches the 3V3_S slot rail, which also powers a serial GPS. On base
boards that pull this line low, the serial GPS lost power right after
detection and never got a fix (#3830). Before df5a768c the pin stayed
HIGH, so keep it driven HIGH again. WB_IO4 and WB_IO5 still go back to
inputs.
Per review: a 2D fix is valid, only less precise, and in some places a
receiver never gets a 3D fix. So the guard no longer rejects it; instead
the fix mode decides when the GPS may sleep:
- the fix mode is read from GSA for every NMEA receiver, not only with
GPS_GUARD (`fm:` in `gps diag`), and stored with the last fix;
- in periodic mode, and for `gps once`, the GPS sleeps only after a 3D
fix (or a fix from a receiver that does not report the mode); after a
2D fix it stays on up to the acquisition timeout;
- a 2D fix does not replace a 3D fix younger than 5 min
(GPS_3D_FIX_PREFERRED_MS).
A cold start can take up to ~30 min with a weak sky view, so the default
limit before the first fix since boot goes from 15 min to 1 h.
The limit is now a GPS preference, set with `gps firstfix <duration>`
(0 = no limit, at most 1 day) and saved with the other GPS settings, so
repeaters and companions can use different values without a rebuild.
GPS_FIRST_FIX_TIMEOUT_MS stays as the build default.
Before the first fix since boot, a periodic acquisition had no timeout. If no
fix is accepted (no sky view, no antenna, or a guard rejecting spoofed fixes),
the receiver then stayed on until a fix was accepted.
Give that window its own limit, GPS_FIRST_FIX_TIMEOUT_MS (15 min by default,
enough for a full almanac; 0 keeps the old behaviour). It counts as a miss and
the next acquisition starts after the configured period.
Use pin index 0, which maps to NRFX_SPIM_PIN_NOT_USED, to avoid the nRF52 SPI constructor indexing g_ADigitalPinMap[255]. Remove the absent MISO shutdown reset so the sentinel cannot reset physical P0.00. Follows the variant-side fixes in #3188 and #3189.
Validated heltec_rc52_repeater and heltec_rc52_companion_radio_ble builds. ELF disassembly confirms the MISO lookup uses map[0]=0xFF instead of the +1020-byte read and shutdown has no P0.00 reset. No hardware testing performed.
The guard checked satellites and HDOP but not the fix type. When the
receiver sends GSA, a fix it reports as 2D or no-fix is now rejected
(`rej 2d`). Receivers without GSA are unchanged (fix mode unknown).
GPS_GUARD_REQUIRE_3D=0 turns the check off. `gps diag` shows the fix
mode as `fm`.
Add a 16-byte zeroed tail behind the 100-byte NMEA buffer. MicroNMEA's
fixed-width field skips can read a few bytes past the end of a malformed
sentence; with the tail those reads land on NUL bytes.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
#3813 removed the telemetry channel for the GPS time alert. Remove the
docs sentence that still described it and the now unused
GpsGuard::getAlertOffset().