From 7af51f46a399ab6695d74374d3b5b6339f451250 Mon Sep 17 00:00:00 2001 From: Sean Smith Date: Mon, 6 Jul 2026 19:05:03 -0600 Subject: [PATCH] Existing sensors complete --- code.py | 7 ++++--- lib/car_os/gps.py | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/code.py b/code.py index 2ae4425..92e61a4 100644 --- a/code.py +++ b/code.py @@ -28,6 +28,7 @@ def main(): network.initialize() network_timer = Timer(1) network_reset_timer = Timer(600) + prind(board.__dict__) pps = PPS(board.GP22) imu = IMU(board.GP21, board.GP20, 0x0C, (44, 66, -109), (-1, 3, -1), (-7, -16, -39)) @@ -42,6 +43,9 @@ def main(): network_reset_timer.update(delta) gps.update(pps.utc) imu.update(pps.utc) + + if network_timer.check_timer(): + network.update(pps.utc, network_reset_timer) if not gps.has_fix: print(time.time()) @@ -52,9 +56,6 @@ def main(): if gps.time_updated: pps.update_from_gps(gps) - if network_timer.check_timer(): - network.update(pps.utc, network_reset_timer) - #if heartbeat_timer.check_timer(): # message = bytearray(b'\xd4\x53\x6e\x4e\x00\x00\x00') # message[4] = pps.utc[0] diff --git a/lib/car_os/gps.py b/lib/car_os/gps.py index 8244477..d33d8af 100644 --- a/lib/car_os/gps.py +++ b/lib/car_os/gps.py @@ -22,6 +22,7 @@ class GPS: self._gps_time = (0, 0, 0) self._previous_gps_time = (0, 0, 0) self.time_updated = False + self._time_ready = False self.gps_updated = False self.sats_updated = False self._gps_update_time = [0, 0, 0, 0] @@ -36,6 +37,7 @@ class GPS: self._gps_time = (self._gps.timestamp_utc.tm_hour, self._gps.timestamp_utc.tm_min, self._gps.timestamp_utc.tm_sec) if self._gps_time != self._previous_gps_time: self.time_updated = True + self._time_ready = True self._previous_gps_time = self._gps_time[:] if self._gps.latitude != self._previous_latitude: self.gps_updated = True @@ -132,4 +134,6 @@ class GPS: return False if self._gps.vdop is None: return False + if not self._time_ready: + return False return True \ No newline at end of file