From 06c4fa9afff2a49c1893d838eae931d3454e7c61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20Sch=C3=A4fer?= Date: Tue, 13 Oct 2026 11:45:14 -0700 Subject: [PATCH] pigeond: overwrite cached AssistNow time with host UTC (#39071) * pigeond: fix stale AssistNow time assistance * pigeond: save GNSS state after stopping receiver * pigeond: preserve fractional UTC assistance * Revert "pigeond: save GNSS state after stopping receiver" This reverts commit 5bf5ea84d8a995f7561a58bdf6d071cc78759703. * pigeond: send current time after AssistNow assistance * pigeond: simplify AssistNow initialization filter * pigeond: send host time only with AssistNow * pigeond: check host time validity inside send_time * Update pigeond.py --------- Co-authored-by: haraschax <6804392+haraschax@users.noreply.github.com> (cherry picked from commit 4c535577640a1dc8d91b017584de2c9b010f491b) --- openpilot/system/ubloxd/pigeond.py | 53 ++++++++++++++++-------------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/openpilot/system/ubloxd/pigeond.py b/openpilot/system/ubloxd/pigeond.py index 08ed568d43..816f3acb86 100755 --- a/openpilot/system/ubloxd/pigeond.py +++ b/openpilot/system/ubloxd/pigeond.py @@ -67,7 +67,9 @@ def get_assistnow_messages() -> list[bytes]: while len(dat) > 0: assert dat[:2] == b"\xB5\x62" msg_len = 6 + (dat[5] << 8 | dat[4]) + 2 - msgs.append(dat[:msg_len]) + # Skip MGA-INI messages; time from proxyserver is a stale cache + if dat[2:4] != b"\x13\x40": + msgs.append(dat[:msg_len]) dat = dat[msg_len:] return msgs @@ -146,6 +148,31 @@ class TTYPigeon: return True return False +def send_time(pigeon: TTYPigeon) -> None: + if not system_time_valid(): + return + + cloudlog.warning("Sending current time to ublox") + + # UBX-MGA-INI-TIME_UTC + t_now = datetime.now(UTC).replace(tzinfo=None) + msg = add_ubx_checksum(b"\xB5\x62\x13\x40\x18\x00" + struct.pack(" None: # store almanac in flash pigeon.send(b"\xB5\x62\x09\x14\x04\x00\x00\x00\x00\x00\x21\xEC") @@ -217,29 +244,6 @@ def init_pigeon(pigeon: TTYPigeon) -> bool: else: cloudlog.error(f"failed to restore almanac backup, status: {restore_status}") - # sending time to ublox - if system_time_valid(): - t_now = datetime.now(UTC).replace(tzinfo=None) - cloudlog.warning("Sending current time to ublox") - - # UBX-MGA-INI-TIME_UTC - msg = add_ubx_checksum(b"\xB5\x62\x13\x40\x18\x00" + struct.pack("