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 Quality 3d returns undocumented values #114

Open
jar349 opened this issue Oct 7, 2024 · 1 comment
Open

Fix Quality 3d returns undocumented values #114

jar349 opened this issue Oct 7, 2024 · 1 comment

Comments

@jar349
Copy link

jar349 commented Oct 7, 2024

The documented values for fix_quality_3d are as follows in the snippet below:

self.fix_quality_3d = 0
"""
The type of fix for a reading
| 1 - no fix
| 2 - 2D fix
| 3 - 3D fix
"""

However, the value I am getting for that attribute is 0. If this is an expected value under certain conditions, would you mind updating the documentation to explain? If it is never expected for the value to be 0, could you please explain what I may be doing wrong on my end to receive that value? All other values I am getting look good/correct.

I suspect that the culprit is this block of code:

if data is None or len(data) not in (17, 18):
return False # Unexpected number of params.
if len(data) == 17:
data = _parse_data(_GSA, data)
else:
data = _parse_data(_GSA_4_11, data)
if data is None:
self.fix_quality_3d = 0
return False # Params didn't parse

If there's code beyond initializing it to 0 that sets it to 0 - as this block does - then 0 probably does have a semantic meaning that can be documented.

@snkYmkrct
Copy link
Contributor

snkYmkrct commented Dec 14, 2024

@jar349
The GPS module only shows the data (NMEA sentences) specified in its initialization commands.
This is documented in the usage example code:

# Initialize the GPS module by changing what data it sends and at what rate.
# These are NMEA extensions for PMTK_314_SET_NMEA_OUTPUT and
# PMTK_220_SET_NMEA_UPDATERATE but you can send anything from here to adjust
# the GPS module behavior:
# https://cdn-shop.adafruit.com/datasheets/PMTK_A11.pdf
# Turn on the basic GGA and RMC info (what you typically want)
gps.send_command(b"PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0")
# Turn on just minimum info (RMC only, location):
# gps.send_command(b'PMTK314,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0')
# Turn off everything:
# gps.send_command(b'PMTK314,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0')
# Turn on everything (not all of it is parsed!)
# gps.send_command(b'PMTK314,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0')
as well as in the referenced command packet document -- see page 12 -- and various learn guides on the Adafruit page, like this one.

Since the fix_quality parameter is part of the GSA NMEA sentence, GSA data needs to be enabled in the initialization command, like so: gps.send_command(b"PMTK314,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0"). Otherwise, the behavior you're observing is correct, self.fix_quality_3d is 0 because there is no valid data to be parsed, and this is the default value.
The "culprit" you're referring to is also correct behavior, since it only occurs when that particular GSA data packet is corrupted, and cannot be parsed.

Usually it's better, and faster, to ask for library usage help on the Adafruit forums, or in the Discord server.

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

No branches or pull requests

2 participants