This repository was archived by the owner on Jan 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 85
Adding packetBuf. Changing sendCommand. Requested class and ID passing. #97
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This merge includes some significant changes:
packetBuf
has been addedwaitForACKResponse
andwaitForNoACKResponse
now pass the requested class and ID all the way down toprocessUBX
sendCommand
now expects a pointer to a packet buffer, instead of being passed a global packet bufferAdding packetBuf makes the UBX message parsing much more robust. Previously, if the serial or I2C buffers contained the requested packet(s) and an autoPVT packet, then the PVT would overwrite the requested data packet. In this merge, incoming data is stored first in packetBuf until at least the first two payload bytes have been received. The data is then checked for a match against: either a match for the requested class and ID; or an ACK/NACK which matches the requested class and ID. If a match is seen, then the data is diverted into either packetCfg or packetAck as normal and is preserved. Data from an un-requested autoPVT packet is dumped and no longer overwrites the data in packetCfg. Passing the requested class and ID all the way from sendCommand down to processUBX facilitates this.
Previously sendCommand was passed a copy of the global packet buffer packetCfg. It was only able to return data in packetCfg because it was global. Of course this worked fine, but it meant sendCommand was hardwired at a fundamental level to packetCfg. This merge changes that and sendCommand now expects a pointer to a buffer, rather than a copy of the buffer. This opens up new possibilities for defining a custom packet in a .ino and passing a pointer to that to sendCommand. This is exciting as it makes it much easier to define custom commands to e.g.: request a power management task with RXM-PMREQ; or getProtocolVersion using a larger-than-normal buffer.