Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix minute parsing #102

Merged
merged 7 commits into from
Mar 21, 2024
Merged

fix minute parsing #102

merged 7 commits into from
Mar 21, 2024

Conversation

jkittner
Copy link
Contributor

@jkittner jkittner commented May 30, 2023

This fixes the issue that came up in #99. resolves #95

I tried to simplify this a little to get the best possible precision. We cannot be more accurate than what's in the actual NMEA message.
The previous approach was to parse the sentence (which contains degrees and minutes) to decimal degrees and then convert them back. During this conversion they forgot to divide by 60, which caused the incorrect minutes (as seen in #99).
Since we already get the degrees and minutes, we can directly parse them and provide them without any loss of precision.

I added tests, that verify, that for all sentence types, the degrees and minutes match exactly the values provided in the original raw NMEA message.

They do not almost match, when it comes to the number of digits, but that's maybe due to different versions?

@jkittner jkittner mentioned this pull request May 30, 2023
Copy link
Member

@tekktrik tekktrik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, would definitely be good to test out on the hardware too, but a few questions in the meantime below.

tests/adafruit_gps_test.py Outdated Show resolved Hide resolved
examples/gps_simpletest.py Outdated Show resolved Hide resolved
@dhalbert
Copy link
Contributor

Hi @jkittner Do you have time to finish this off? Thanks.

@jkittner
Copy link
Contributor Author

@dhalbert sorry - I was quite busy with my thesis, conferences and other stuff. I had a look a while back and figured it's not an easy fix with the way parsing is done currently.

I think we should consider using and existing or implementing a proper NMEA parser first and then just accessing the results and checking if they are available depending on the current message type. The way it is implemented now, the parsing is done incrementally in bits and pieces here and there because the different msg types were probably added incrementally

I'll have another look and check if there maybe is an easier, temporary fix for that...

@jkittner
Copy link
Contributor Author

@tekktrik @dhalbert - I came up with a temporary fix for this. Things should now work as expected.

@jkittner
Copy link
Contributor Author

jkittner commented Jan 5, 2024

@tekktrik @dhalbert do you maybe have time to have a final look at this?

@tannewt tannewt requested a review from tekktrik January 17, 2024 19:18
Copy link
Member

@tekktrik tekktrik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay! Feedback added but this looks great! Just a few changes and questions!

.pre-commit-config.yaml Outdated Show resolved Hide resolved
adafruit_gps.py Show resolved Hide resolved
adafruit_gps.py Outdated Show resolved Hide resolved
adafruit_gps.py Outdated Show resolved Hide resolved
tox.ini Outdated Show resolved Hide resolved
tests/adafruit_gps_test.py Outdated Show resolved Hide resolved
partition is not available on all boards
@jkittner
Copy link
Contributor Author

The pylint version is so old it doesn't work with my python version (3.12) anymore so I had to use -- no-verify and of course I violated the black style - should have used SKIP=pylint instaed...

@tekktrik tekktrik self-requested a review January 19, 2024 16:52
@tekktrik
Copy link
Member

The pylint version is so old it doesn't work with my python version (3.12) anymore so I had to use -- no-verify and of course I violated the black style - should have used SKIP=pylint instaed...

We're working on a fix for this! Sorry for the delay, this looks great! Thanks for your work and patience!

@tekktrik tekktrik merged commit ab6b33a into adafruit:main Mar 21, 2024
1 check passed
@jkittner jkittner deleted the minutes_fix branch March 22, 2024 00:29
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Mar 22, 2024
Updating https://github.com/adafruit/Adafruit_CircuitPython_AGS02MA to 1.0.8 from 1.0.7:
  > Merge pull request adafruit/Adafruit_CircuitPython_AGS02MA#4 from FoamyGuy/fix_readme

Updating https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SSD1306 to 2.0.0 from 1.8.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_DisplayIO_SSD1306#39 from makermelissa/master

Updating https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI to 7.1.0 from 7.0.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_ESP32SPI#196 from anecdata/exit
  > Merge pull request adafruit/Adafruit_CircuitPython_ESP32SPI#192 from mMerlin/new-sample
  > Merge pull request adafruit/Adafruit_CircuitPython_ESP32SPI#193 from justmobilize/fix-readme-requirements

Updating https://github.com/adafruit/Adafruit_CircuitPython_FT5336 to 1.0.2 from 1.0.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_FT5336#3 from adafruit/buttons_example

Updating https://github.com/adafruit/Adafruit_CircuitPython_GPS to 3.10.13 from 3.10.12:
  > Merge pull request adafruit/Adafruit_CircuitPython_GPS#102 from jkittner/minutes_fix

Updating https://github.com/adafruit/Adafruit_CircuitPython_HT16K33 to 4.6.9 from 4.6.7:
  > Merge pull request adafruit/Adafruit_CircuitPython_HT16K33#118 from adafruit/matrix_fill_color_swap
  > Merge pull request adafruit/Adafruit_CircuitPython_HT16K33#117 from DJDevon3/main

Updating https://github.com/adafruit/Adafruit_CircuitPython_LTR329_LTR303 to 3.0.6 from 3.0.5:
  > Merge pull request adafruit/Adafruit_CircuitPython_LTR329_LTR303#8 from FoamyGuy/fix_readme

Updating https://github.com/adafruit/Adafruit_CircuitPython_MAX31856 to 0.12.0 from 0.11.8:
  > Merge pull request adafruit/Adafruit_CircuitPython_MAX31856#28 from diegosolano/main

Updating https://github.com/adafruit/Adafruit_CircuitPython_MMC56x3 to 1.0.8 from 1.0.7:
  > Merge pull request adafruit/Adafruit_CircuitPython_MMC56x3#4 from FoamyGuy/fix_readme

Updating https://github.com/adafruit/Adafruit_CircuitPython_PCA9685 to 3.4.15 from 3.4.14:
  > Merge pull request adafruit/Adafruit_CircuitPython_PCA9685#55 from DJDevon3/WorkingBranch

Updating https://github.com/adafruit/Adafruit_CircuitPython_SI5351 to 1.4.4 from 1.4.3:
  > Merge pull request adafruit/Adafruit_CircuitPython_SI5351#31 from kamocat/main

Updating https://github.com/adafruit/Adafruit_CircuitPython_SSD1306 to 2.12.17 from 2.12.16:
  > Merge pull request adafruit/Adafruit_CircuitPython_SSD1306#85 from waynedyck/fix-pillow-10-errors

Updating https://github.com/adafruit/Adafruit_CircuitPython_TCA8418 to 1.0.11 from 1.0.10:
  > Merge pull request adafruit/Adafruit_CircuitPython_TCA8418#13 from FoamyGuy/fix_readme

Updating https://github.com/adafruit/Adafruit_CircuitPython_TSC2007 to 1.1.0 from 1.0.9:
  > Merge pull request adafruit/Adafruit_CircuitPython_TSC2007#6 from makermelissa/main

Updating https://github.com/adafruit/Adafruit_CircuitPython_TT21100 to 1.0.2 from 1.0.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_TT21100#5 from FoamyGuy/fix_readme

Updating https://github.com/adafruit/Adafruit_CircuitPython_VL53L4CD to 1.2.2 from 1.2.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_VL53L4CD#15 from FoamyGuy/fix_readme

Updating https://github.com/adafruit/Adafruit_CircuitPython_Wiznet5k to 5.0.9 from 5.0.7:
  > Merge pull request adafruit/Adafruit_CircuitPython_Wiznet5k#148 from pinkavaj/pi-fix-if
  > Merge pull request adafruit/Adafruit_CircuitPython_Wiznet5k#143 from us3r64/fix/socket-recv-timeout

Updating https://github.com/adafruit/Adafruit_CircuitPython_BitbangIO to 1.3.15 from 1.3.14:
  > Merge pull request adafruit/Adafruit_CircuitPython_BitbangIO#32 from kbsriram/i2c-clock-stretching
  > Merge pull request adafruit/Adafruit_CircuitPython_BitbangIO#31 from kbsriram/fix-phase

Updating https://github.com/adafruit/Adafruit_CircuitPython_HID to 6.1.1 from 6.1.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_HID#125 from dhalbert/fix-class-docs

Updating https://github.com/adafruit/Adafruit_CircuitPython_NTP to 3.0.13 from 3.0.12:
  > Merge pull request adafruit/Adafruit_CircuitPython_NTP#31 from anecdata/cm_multi_radio

Updating https://github.com/adafruit/Adafruit_CircuitPython_PyCamera to 1.3.0 from 1.2.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_PyCamera#33 from FoamyGuy/overlay_scale

Updating https://github.com/adafruit/Adafruit_CircuitPython_Requests to 3.2.2 from 3.0.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_Requests#170 from DJDevon3/DJDevon3-TwitchAPI
  > Merge pull request adafruit/Adafruit_CircuitPython_Requests#169 from DJDevon3/DJDevon3-SteamAPI
  > Merge pull request adafruit/Adafruit_CircuitPython_Requests#166 from DJDevon3/GithubAPI
  > Merge pull request adafruit/Adafruit_CircuitPython_Requests#165 from DJDevon3/DJDevon3-PremiereLeagueAPI
  > Merge pull request adafruit/Adafruit_CircuitPython_Requests#160 from DJDevon3/main
  > Merge pull request adafruit/Adafruit_CircuitPython_Requests#164 from DJDevon3/DJDevon3-FitbitAPI
  > Merge pull request adafruit/Adafruit_CircuitPython_Requests#163 from DJDevon3/DJDevon3-DiscordAPI
  > Merge pull request adafruit/Adafruit_CircuitPython_Requests#162 from DJDevon3/DJDevon3-DiscordActive
  > Merge pull request adafruit/Adafruit_CircuitPython_Requests#161 from DJDevon3/MastodonBranch
  > Merge pull request adafruit/Adafruit_CircuitPython_Requests#159 from justmobilize/remove-response-close-read-all
  > Merge pull request adafruit/Adafruit_CircuitPython_Requests#156 from bablokb/main

Updating https://github.com/adafruit/Adafruit_CircuitPython_RGBLED to 1.2.0 from 1.1.19:
  > Merge pull request adafruit/Adafruit_CircuitPython_RGBLED#25 from BiffoBear/Error_check_colors

Updating https://github.com/adafruit/Adafruit_CircuitPython_RSA to 1.2.20 from 1.2.19:
  > Merge pull request adafruit/Adafruit_CircuitPython_RSA#40 from FoamyGuy/add_hashlib_req

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Updated download stats for the libraries
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ValueError: Format specifier missing precision
3 participants