Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Adding packetBuf. Changing sendCommand. Requested class and ID passing. #97

Merged
merged 28 commits into from
Apr 22, 2020

Conversation

PaulZC
Copy link
Collaborator

@PaulZC PaulZC commented Apr 22, 2020

This merge includes some significant changes:

  • the new packet buffer packetBuf has been added
  • waitForACKResponse and waitForNoACKResponse now pass the requested class and ID all the way down to processUBX
  • sendCommand now expects a pointer to a packet buffer, instead of being passed a global packet buffer

Adding 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.

PaulZC added 28 commits April 17, 2020 18:41
@PaulZC PaulZC merged commit 4ea5e2a into master Apr 22, 2020
@PaulZC PaulZC deleted the Experimental_packetBuf branch April 22, 2020 06:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant