Skip to content

Conversation

@lopsided98
Copy link

COBSPrint::abort() has two bugs: the leftover buffer is not reset, causing old data to be printed after the abort, and the counter is reset to 0 instead of 1, causing the next packet to fail.

For my application, I need the ability to reset the internal packet state without trying to terminate the current packet, so I added the PacketPrint::reset() method.

These changes build off each other, so I put them in the same PR.

abort() did not reset the leftover buffer, causing the aborted packet to
be retried. It also didn't reset the counter correctly.
This method allows a new packet to be started even if we are in the
middle of writing the previous packet. No attempt is made to make sure
the transition between packets is valid.
}

virtual void abort() override {
_counter = 0;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch. Sorry for not spotting this PR two years ago...

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

Successfully merging this pull request may close these issues.

2 participants