26
26
GPS parsing module. Can parse simple NMEA data sentences from serial GPS
27
27
modules to read latitude, longitude, and more.
28
28
29
- * Author(s): Tony DiCola
29
+ * Author(s): Tony DiCola, Alexandre Marquet.
30
30
31
31
Implementation Notes
32
32
--------------------
38
38
39
39
**Software and Dependencies:**
40
40
41
- * Adafruit CircuitPython firmware for the ESP8622 and M0-based boards :
42
- https://github.com/adafruit/circuitpython/releases
41
+ * MicroPython :
42
+ https://github.com/micropython/micropython
43
43
44
44
"""
45
- import time
46
-
47
45
__version__ = "0.0.0-auto.0"
48
- __repo__ = "https://github.com/adafruit /Adafruit_CircuitPython_GPS.git"
46
+ __repo__ = "https://github.com/alexmrqt /Adafruit_CircuitPython_GPS.git"
49
47
50
48
# Internal helper parsing functions.
51
49
# These handle input that might be none or null and return none instead of
@@ -169,12 +167,11 @@ def _parse_gpgga(self, args):
169
167
secs = time_utc % 100
170
168
# Set or update time to a friendly python time struct.
171
169
if self .timestamp_utc is not None :
172
- self .timestamp_utc = time . struct_time ( (
173
- self .timestamp_utc . tm_year , self .timestamp_utc . tm_mon ,
174
- self .timestamp_utc . tm_mday , hours , mins , secs , 0 , 0 , - 1 ) )
170
+ self .timestamp_utc = (
171
+ self .timestamp_utc [ 0 ] , self .timestamp_utc [ 1 ] ,
172
+ self .timestamp_utc [ 2 ] , hours , mins , secs , 0 , 0 )
175
173
else :
176
- self .timestamp_utc = time .struct_time ((0 , 0 , 0 , hours , mins ,
177
- secs , 0 , 0 , - 1 ))
174
+ self .timestamp_utc = (0 , 0 , 0 , hours , mins , secs , 0 , 0 )
178
175
# Parse latitude and longitude.
179
176
self .latitude = _parse_degrees (data [1 ])
180
177
if self .latitude is not None and \
@@ -205,12 +202,11 @@ def _parse_gprmc(self, args):
205
202
secs = time_utc % 100
206
203
# Set or update time to a friendly python time struct.
207
204
if self .timestamp_utc is not None :
208
- self .timestamp_utc = time . struct_time ( (
209
- self .timestamp_utc . tm_year , self .timestamp_utc . tm_mon ,
210
- self .timestamp_utc . tm_mday , hours , mins , secs , 0 , 0 , - 1 ) )
205
+ self .timestamp_utc = (
206
+ self .timestamp_utc [ 0 ] , self .timestamp_utc [ 1 ] ,
207
+ self .timestamp_utc [ 2 ] , hours , mins , secs , 0 , 0 )
211
208
else :
212
- self .timestamp_utc = time .struct_time ((0 , 0 , 0 , hours , mins ,
213
- secs , 0 , 0 , - 1 ))
209
+ self .timestamp_utc = (0 , 0 , 0 , hours , mins , secs , 0 , 0 )
214
210
# Parse status (active/fixed or void).
215
211
status = data [1 ]
216
212
self .fix_quality = 0
@@ -237,15 +233,12 @@ def _parse_gprmc(self, args):
237
233
# spec and not this code.
238
234
if self .timestamp_utc is not None :
239
235
# Replace the timestamp with an updated one.
240
- # (struct_time is immutable and can't be changed in place)
241
- self .timestamp_utc = time .struct_time ((year , month , day ,
242
- self .timestamp_utc .tm_hour ,
243
- self .timestamp_utc .tm_min ,
244
- self .timestamp_utc .tm_sec ,
245
- 0 ,
236
+ self .timestamp_utc = (year , month , day ,
237
+ self .timestamp_utc [3 ],
238
+ self .timestamp_utc [4 ],
239
+ self .timestamp_utc [5 ],
246
240
0 ,
247
- - 1 ) )
241
+ 0 )
248
242
else :
249
243
# Time hasn't been set so create it.
250
- self .timestamp_utc = time .struct_time ((year , month , day , 0 , 0 ,
251
- 0 , 0 , 0 , - 1 ))
244
+ self .timestamp_utc = (year , month , day , 0 , 0 , 0 , 0 , 0 )
0 commit comments