Commit d1897775 authored by James Browning's avatar James Browning
Browse files

ntploggps: Resolve issue #730 by ensuring relevant fields valid.

gpsd appears to be sending SKY sentences without satellites[].
gpsd also appears to be (sometimes) 'uSat' which has the number.
So, grab 'device', 'tdop' and (the sum of used satellites[] or 'uSat').
Check that non of them are invalid, then package them for use.

Also, address potential issue where on multi-device systems,
another device can steal the thunder of the reporting device.
That however, can never occur.
parent cfa361c4
Pipeline #482658641 passed with stages
in 5 minutes and 34 seconds
......@@ -159,14 +159,28 @@ class GpsPoller(threading.Thread):
self.running = False
if hasattr(self.gpsd, "data"):
if"class") == "SKY":
self.satellites_used = 0
self.tdop ="tdop", 0)
for sat in"satellites", []):
if sat["used"]:
self.satellites_used += 1
elif"class") == "TPV":
self.device ="device")
if"class", None) == "SKY":
satellite_list =
"satellites", None
if satellite_list is not None:
count_used_satellites = sum(
map(lambda x: x.used, satellite_list)
time_dilution ="tdop", None)
device_path ="device", None)
if count_used_satellites is None:
count_used_satellites =
"uSat", None
if None not in [
self.satellites_used = count_used_satellites
self.tdop = time_dilution
self.device = device_path
def time(self):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment