MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / _nmea_to_decimal

Function _nmea_to_decimal

gps_manager.py:43–59  ·  view source on GitHub ↗

Convert NMEA lat/lon (ddmm.mmmm) to decimal degrees.

(raw, direction)

Source from the content-addressed store, hash-verified

41)
42
43
44UBX_SYNC = b'\xb5\x62'
45
46# Start of a plausible NMEA sentence: '$' + talker/sentence letters + ','
47# (e.g. $GPGGA, $GNRMC, $PUBX). Deliberately loose about the exact talker,
48# strict that binary noise decoding to a stray '$' does not qualify.
49_NMEA_SHAPE = re.compile(r'^\$[A-Z]{4,5}\d*,')
50
51
52def _ubx_frame(msg_class, msg_id, payload=b''):
53 """Build a UBX frame with its 8-bit Fletcher checksum."""
54 body = bytes((msg_class, msg_id)) + struct.pack('<H', len(payload)) + payload
55 ck_a = ck_b = 0
56 for byte in body:
57 ck_a = (ck_a + byte) & 0xFF
58 ck_b = (ck_b + ck_a) & 0xFF
59 return UBX_SYNC + body + bytes((ck_a, ck_b))
60
61
62def ubx_enable_nmea_frames(save=True):

Callers 1

_parse_nmeaMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected