-
Notifications
You must be signed in to change notification settings - Fork 60
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
Added decoding of 'PGTOP' to get the status of the antenna extension … #94
base: main
Are you sure you want to change the base?
Conversation
…(if any). The antenna status is made accessible via the new 'self.antenna' property. A tuple (current status, last status). Possible values are: 1: Antenna shorted. 2: Internal antenna. 3: Active (extending) antenna. So self.antenna[0] gives the current status and self.antenna[1] gives the last status. User is responsible to acknowledge change in the antenna status by making self.antenna[1] same as item 0.
…(if any). The antenna status is made accessible via the new 'self.antenna' property. A tuple (current status, last status). Possible values are: 1: Antenna shorted. 2: Internal antenna. 3: Active (extending) antenna. So self.antenna[0] gives the current status and self.antenna[1] gives the last status. User is responsible to acknowledge change in the antenna status by making self.antenna[1] same as item 0.
# Conflicts: # adafruit_gps.py
# Conflicts: # adafruit_gps.py
# Conflicts: # adafruit_gps.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! I noted a couple of things in separate comments.
adafruit_gps.py
Outdated
if talker not in (b"GA", b"GB", b"GI", b"GL", b"GP", b"GQ", b"GN"): | ||
# It's not a known GNSS source of data | ||
# Assume it's a valid packet anyway | ||
return True | ||
# False: PGTOP. Status of antenna extension. | ||
return True if data_type[:5] != b"PGTOP" else self._parse_pgtop(args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion for clarity:
return True if data_type[:5] != b"PGTOP" else self._parse_pgtop(args) | |
return True if data_type.endswith(b"PGTOP") else self._parse_pgtop(args) |
Use of the 'antenna' attribute requires the user to send the appropriate NMEA command. The following code is an example. It should probably be added somewhere in the documentation. Check if antenna extension is present. To do this, send the following command:
GPS chips will emits PGTOP sentence (antenna status) at each 'FIX'. You could use the antenna attribute of your GPS instance to interpret the status as following. If no antenna status was detected, the attribute antenna return False else attribute antenna return a tuple with two items (actual status, last status). Status is an integer with the following meaning. 1: Problem with the antenna (shorted). You can do two simple things with the attribute. 1. Simply linked the attribute to an indicator light (LED). In this case, only antenna[0] will interest you. 2. Detect any change in antenna status in real time. In this case, you must compare antenna[0] to antenna[1] and then acknowledge the state change by setting the antenna[1] attribute equal to antenna[0]. The acknowledgment is necessary to allow the detection of a future status change. |
With regards to documenting the mentioned commands. Could we make I would also be in favor of a new script in the examples/ directory to show usage of the new behavior. |
Yes. Since the last commit I have defined an 'antenna' property and added an antenna_acknowledge_receipt(delay=5) method. I have inserted the docstrings with the text that seems appropriate to me. But before publishing a new commit, I have to test the whole thing. Here is the docstring for the new method antenna_acknowledge_receipt to basically explain the acknowledgment logic that is implemented.
The delay in question is in seconds (0, 1, 2, 3, 4 or 5). 0 means no latching is done. |
By the way, the reason why I need to track the status of the active antenna has to do with a little connection issue on the Ultimate GPS Logging Shield board. The micro ufl connector is on the front edge of the card. Mounting in a box forces me to run the cable through the back with the SD reader obstructing it. In the end, the connector clips a bit at the corner which makes the connection unsafe. |
Added a property to make it easier to enable the antenna advisor on the PA6H chip. Write useful docstrings.
Antenna acknowledgment mecanismImplementation Variables:
The acknowledgment mechanism is implemented as soon as the status of the antenna changes. This status change corresponds to the instantaneous value (__antenna_instant_status). The program then behaves as follows. If the acknowledgment delay is 0 seconds (__antenna_ack_delay) If the acknowledgment delay is 1, 2, 3, 4 or 5 seconds. The __antenna_ack state variable tracks the state of the antenna.
|
I would like to write a script as an example for the implementation of the monitoring of the status of the active antenna. How should I submit it? By adding a .py file to the directory in question? |
Sorry that I did not notice this and reply sooner. Yes examples can be submitted with a PR by adding a new .py file into |
OK. I'm working on it. |
Added decoding of 'PGTOP' to get the status of the antenna extension (if any).
The antenna status is made accessible via the new 'self.antenna' property.
A tuple (current status, last status). Possible values are:
1: Antenna shorted.
2: Internal antenna.
3: Active (extending) antenna.
So self.antenna[0] gives the current status and self.antenna[1] gives the
last status. User is responsible to acknowledge change in the antenna
status by making self.antenna[1] same as item 0.