Existing sensors complete
This commit is contained in:
@@ -28,6 +28,7 @@ def main():
|
|||||||
network.initialize()
|
network.initialize()
|
||||||
network_timer = Timer(1)
|
network_timer = Timer(1)
|
||||||
network_reset_timer = Timer(600)
|
network_reset_timer = Timer(600)
|
||||||
|
prind(board.__dict__)
|
||||||
|
|
||||||
pps = PPS(board.GP22)
|
pps = PPS(board.GP22)
|
||||||
imu = IMU(board.GP21, board.GP20, 0x0C, (44, 66, -109), (-1, 3, -1), (-7, -16, -39))
|
imu = IMU(board.GP21, board.GP20, 0x0C, (44, 66, -109), (-1, 3, -1), (-7, -16, -39))
|
||||||
@@ -43,6 +44,9 @@ def main():
|
|||||||
gps.update(pps.utc)
|
gps.update(pps.utc)
|
||||||
imu.update(pps.utc)
|
imu.update(pps.utc)
|
||||||
|
|
||||||
|
if network_timer.check_timer():
|
||||||
|
network.update(pps.utc, network_reset_timer)
|
||||||
|
|
||||||
if not gps.has_fix:
|
if not gps.has_fix:
|
||||||
print(time.time())
|
print(time.time())
|
||||||
print("waiting for gps fix")
|
print("waiting for gps fix")
|
||||||
@@ -52,9 +56,6 @@ def main():
|
|||||||
if gps.time_updated:
|
if gps.time_updated:
|
||||||
pps.update_from_gps(gps)
|
pps.update_from_gps(gps)
|
||||||
|
|
||||||
if network_timer.check_timer():
|
|
||||||
network.update(pps.utc, network_reset_timer)
|
|
||||||
|
|
||||||
#if heartbeat_timer.check_timer():
|
#if heartbeat_timer.check_timer():
|
||||||
# message = bytearray(b'\xd4\x53\x6e\x4e\x00\x00\x00')
|
# message = bytearray(b'\xd4\x53\x6e\x4e\x00\x00\x00')
|
||||||
# message[4] = pps.utc[0]
|
# message[4] = pps.utc[0]
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ class GPS:
|
|||||||
self._gps_time = (0, 0, 0)
|
self._gps_time = (0, 0, 0)
|
||||||
self._previous_gps_time = (0, 0, 0)
|
self._previous_gps_time = (0, 0, 0)
|
||||||
self.time_updated = False
|
self.time_updated = False
|
||||||
|
self._time_ready = False
|
||||||
self.gps_updated = False
|
self.gps_updated = False
|
||||||
self.sats_updated = False
|
self.sats_updated = False
|
||||||
self._gps_update_time = [0, 0, 0, 0]
|
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)
|
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:
|
if self._gps_time != self._previous_gps_time:
|
||||||
self.time_updated = True
|
self.time_updated = True
|
||||||
|
self._time_ready = True
|
||||||
self._previous_gps_time = self._gps_time[:]
|
self._previous_gps_time = self._gps_time[:]
|
||||||
if self._gps.latitude != self._previous_latitude:
|
if self._gps.latitude != self._previous_latitude:
|
||||||
self.gps_updated = True
|
self.gps_updated = True
|
||||||
@@ -132,4 +134,6 @@ class GPS:
|
|||||||
return False
|
return False
|
||||||
if self._gps.vdop is None:
|
if self._gps.vdop is None:
|
||||||
return False
|
return False
|
||||||
|
if not self._time_ready:
|
||||||
|
return False
|
||||||
return True
|
return True
|
||||||
Reference in New Issue
Block a user