This repository was archived by the owner on Jan 28, 2021. It is now read-only.
Added powerSaveMode (and some minor corrections) #56
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi Nathan (@nseidle),
Here's a re-submission of the powerSaveMode PR. This supersedes PR #53.
I've based this on a clean fork of the library, so hopefully it should be easy to merge. That said, I did muck up the first commit (850cce0), had to revert it (ead94de), but here it is in all its glory (6364ea4)!
This adds the powerSaveMode function which, as discussed, now includes protocol version checking. It checks that the protocol is less than 27 before it tries to apply the change.
While I was working on this, I corrected a few small gremlins in the getProtocolVersion code:
There is some kind of strange race condition that exists when parsing UBX packets. If we send (poll/get) a packet and the GNSS module returns both a packet and an ACK, the ACK can upset subsequent sends using the same class and ID. The weird thing is that it doesn't happen all the time. enableDebugging changes its behavior. And it is different on I2C compared to Serial.
The solution seems to be that if we know we are going to do another sendCommand quickly, using the same class and ID, then it would be wise to wait and eat the ACK using another waitForResponse (with a short maxWait) in between. Hence me adding lines like this in two places:
I've tested this on the ZOE, NEO, MAX and ZED using both Serial and I2C. As discussed, this will fail on the ZED but at least now does it gracefully.
Enjoy!
Paul