Skip to content

Commit

Permalink
Handle repeated GPSD position packets
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Jessop authored and Mark Jessop committed Jan 7, 2023
1 parent 3b02f75 commit 8aec301
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion chasemapper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@

# Now using Semantic Versioning (https://semver.org/) MAJOR.MINOR.PATCH

__version__ = "1.5.1"
__version__ = "1.5.2"
7 changes: 6 additions & 1 deletion chasemapper/gpsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,8 @@ def gpsd_process_thread(self):
_gpsd_socket.watch(gpsd_protocol="json")
logging.info("GPSD - Connected to GPSD instance at %s" % self.hostname)

_old_state = {}

while self.gpsd_thread_running:
# We should be getting GPS data every second.
# If this isn't the case, we should close the connection and re-connect.
Expand Down Expand Up @@ -403,7 +405,10 @@ def gpsd_process_thread(self):
"valid": True,
}

self.send_to_callback(_gps_state)
if _gps_state != _old_state:
self.send_to_callback(_gps_state)

_old_state = _gps_state

# Close the GPSD connection.
try:
Expand Down

0 comments on commit 8aec301

Please sign in to comment.