Skip to content

Commit 93a8430

Browse files
Reformat with black.
1 parent 84480ed commit 93a8430

File tree

2 files changed

+26
-22
lines changed

2 files changed

+26
-22
lines changed

adafruit_gps.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ def __init__(self, uart, debug=False):
9090
self.height_geoid = None
9191
self.speed_knots = None
9292
self.track_angle_deg = None
93-
self._sats = None # Temporary holder for information from GSV messages
94-
self.sats = None # Completed information from GSV messages
93+
self._sats = None # Temporary holder for information from GSV messages
94+
self.sats = None # Completed information from GSV messages
9595
self.isactivedata = None
9696
self.true_track = None
9797
self.mag_track = None
@@ -132,19 +132,19 @@ def update(self):
132132
# GP - GPS
133133
# GQ - QZSS
134134
# GN - GNSS / More than one of the above
135-
if talker not in (b'GA', b'GB', b'GI', b'GL', b'GP', b'GQ', b'GN'):
135+
if talker not in (b"GA", b"GB", b"GI", b"GL", b"GP", b"GQ", b"GN"):
136136
# It's not a known GNSS source of data
137137
return True
138138

139-
if sentence_type == b'GLL': # Geographic position - Latitude/Longitude
139+
if sentence_type == b"GLL": # Geographic position - Latitude/Longitude
140140
self._parse_gpgll(args)
141-
elif sentence_type == b'RMC': # Minimum location info
141+
elif sentence_type == b"RMC": # Minimum location info
142142
self._parse_gprmc(args)
143-
elif sentence_type == b'GGA': # 3D location fix
143+
elif sentence_type == b"GGA": # 3D location fix
144144
self._parse_gpgga(args)
145-
elif sentence_type == b'GSV': # Satellites in view
145+
elif sentence_type == b"GSV": # Satellites in view
146146
self._parse_gpgsv(talker, args)
147-
elif sentence_type == b'GSA': # GPS DOP and active satellites
147+
elif sentence_type == b"GSA": # GPS DOP and active satellites
148148
self._parse_gpgsa(talker, args)
149149
return True
150150

@@ -258,7 +258,7 @@ def _parse_sentence(self):
258258

259259
def _parse_talker(self, data_type):
260260
# Split the data_type into talker and sentence_type
261-
if data_type[0] == b'P': # Proprietary codes
261+
if data_type[0] == b"P": # Proprietary codes
262262
return (data_type[:1], data_type[1:])
263263
else:
264264
return (data_type[:2], data_type[2:])
@@ -425,7 +425,7 @@ def _parse_gpgga(self, args):
425425
self.height_geoid = _parse_float(data[10])
426426

427427
def _parse_gpgsa(self, talker, args):
428-
talker = talker.decode('ascii')
428+
talker = talker.decode("ascii")
429429
data = args.split(",")
430430
if data is None or (data[0] == ""):
431431
return # Unexpected number of params
@@ -449,7 +449,7 @@ def _parse_gpgsa(self, talker, args):
449449
def _parse_gpgsv(self, talker, args):
450450
# Parse the arguments (everything after data type) for NMEA GPGGA
451451
# 3D location fix sentence.
452-
talker = talker.decode('ascii')
452+
talker = talker.decode("ascii")
453453
data = args.split(",")
454454
if data is None or (data[0] == ""):
455455
return # Unexpected number of params.

examples/gps_satellitefix.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
# https://cdn-shop.adafruit.com/datasheets/PMTK_A11.pdf
3232

3333
# Turn on everything (not all of it is parsed!)
34-
gps.send_command(b'PMTK314,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0')
34+
gps.send_command(b"PMTK314,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0")
3535

3636
# Set update rate to once a second (1hz) which is what you typically want.
3737
gps.send_command(b"PMTK220,1000")
@@ -42,6 +42,7 @@
4242
# data during parsing. This would be twice a second (2hz, 500ms delay):
4343
# gps.send_command(b'PMTK220,500')
4444

45+
4546
def format_dop(dop):
4647
# https://en.wikipedia.org/wiki/Dilution_of_precision_(navigation)
4748
if dop > 20:
@@ -58,15 +59,16 @@ def format_dop(dop):
5859
msg = "Ideal"
5960
return f"{dop} - {msg}"
6061

62+
6163
talkers = {
62-
'GA': 'Galileo',
63-
'GB': 'BeiDou',
64-
'GI': 'NavIC',
65-
'GL': 'GLONASS',
66-
'GP': 'GPS',
67-
'GQ': 'QZSS',
68-
'GN': 'GNSS'
69-
}
64+
"GA": "Galileo",
65+
"GB": "BeiDou",
66+
"GI": "NavIC",
67+
"GL": "GLONASS",
68+
"GP": "GPS",
69+
"GQ": "QZSS",
70+
"GN": "GNSS",
71+
}
7072

7173
# Main loop runs forever printing the location, etc. every second.
7274
last_print = time.monotonic()
@@ -97,7 +99,9 @@ def format_dop(dop):
9799
if sat is None:
98100
print(f" {talker}-{number} - no info")
99101
else:
100-
print(f" {talker}-{number} Elevation:{sat[1]}* Azimuth:{sat[2]}* SNR:{sat[3]}dB")
102+
print(
103+
f" {talker}-{number} Elevation:{sat[1]}* Azimuth:{sat[2]}* SNR:{sat[3]}dB"
104+
)
101105
except KeyError:
102-
print(f" {talker}-{number} - no info")
106+
print(f" {talker}-{number} - no info")
103107
print()

0 commit comments

Comments
 (0)