diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 1851d1e..07b8d6a 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,5 +1,9 @@ # pynmeagps Release Notes +### RELEASE 1.1.2 + +1. Add workaround for Unicore UM9* firmware error, which creates malformed NMEA GLL sentences (-ve latitude). + ### RELEASE 1.1.1 1. Add helper methods `utc2wnotow` and `wnotow2utc` to convert between UTC datetime and GPS week number, time of week (in milliseconds) and leapsecond offset. diff --git a/src/pynmeagps/_version.py b/src/pynmeagps/_version.py index 4359184..2628226 100644 --- a/src/pynmeagps/_version.py +++ b/src/pynmeagps/_version.py @@ -8,4 +8,4 @@ :license: BSD 3-Clause """ -__version__ = "1.1.1" +__version__ = "1.1.2" diff --git a/src/pynmeagps/nmeahelpers.py b/src/pynmeagps/nmeahelpers.py index 0ac7c76..a80c435 100644 --- a/src/pynmeagps/nmeahelpers.py +++ b/src/pynmeagps/nmeahelpers.py @@ -276,7 +276,7 @@ def dmm2ddd(pos: str) -> float | str: dp = pos.find(".") if dp < 4: raise ValueError() - posdeg = float(pos[0 : dp - 2]) + posdeg = abs(float(pos[0 : dp - 2])) posmin = float(pos[dp - 2 :]) return round((posdeg + posmin / 60), 10) except (TypeError, ValueError): diff --git a/tests/pygpsdata-um981.log b/tests/pygpsdata-um981.log new file mode 100644 index 0000000..9bda114 --- /dev/null +++ b/tests/pygpsdata-um981.log @@ -0,0 +1,6 @@ +$GNGGA,130058.00,5327.03598945,N,00214.41467156,W,1,08,7.5,36.3017,M,51.6775,M,,*5B +$GNGLL,5327.03598945,N,-0214.41467156,W,130058.00,A,A*7E +$GNRMC,130058.00,A,5327.03598945,N,00214.41467156,W,0.097,125.7,240226,0.2,W,A,C*4F +$GNGGA,130059.00,5327.03598242,N,00214.41468053,W,1,08,7.5,36.3232,M,51.6775,M,,*58 +$GNGLL,5327.03598242,N,-0214.41468053,W,130059.00,A,A*78 + diff --git a/tests/test_stream.py b/tests/test_stream.py index eed06c4..b84066b 100644 --- a/tests/test_stream.py +++ b/tests/test_stream.py @@ -701,6 +701,24 @@ def testNMEAUnicore(self): # test Unicore extended NMEA GET messages i += 1 self.assertEqual(i, len(EXPECTED_RESULTS)) + def testNMEAUM981(self): # test Unicore GLL firmware error workaround + EXPECTED_RESULTS = ( + "", + "", + "", + "", + "", + ) + i = 0 + with open(os.path.join(DIRNAME, "pygpsdata-um981.log"), "rb") as stream: + nmr = NMEAReader(stream, nmeaonly=False, quitonerror=2) + for raw, parsed in nmr: + if raw is not None: + # print(f'"{parsed}",') + self.assertEqual(str(parsed), EXPECTED_RESULTS[i]) + i += 1 + self.assertEqual(i, len(EXPECTED_RESULTS)) + def testBADHDR_FAIL(self): # invalid header in data with quitonerror = 2 EXPECTED_ERROR = "Unknown protocol header b'$&'." with self.assertRaises(NMEAParseError) as context: