refactor(rc channels): Use packed RC channels #30
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.
Overview
This Pull Request re-factors the way RC channels data is handled.
What's changed
The Old Way
In the
CRSFforArduino::update()
function, this is how I used to unpack RC channels data...This is a very inefficient way of doing it, plus visually speaking, it looks confusing af.
The New Way
In the
CRSFforArduino::update()
function, this is how I roll, now...Notice how it's much more concise?
Programmatically, it is more efficient because all I am doing here is double-buffering the incoming RC channel data.
I have also moved the RC channel data unpacking out of the
CRSFforArduino::update()
function & put it into theCRSFforArduino::getChannel()
function.Here you can see how straightforward this looks. I know what RC channel is going where.
Additional
I have removed the caveat regarding the SERCOM UART data order.
Since using packed RC channels, there is no need for me to the low-level hardware UART driver to set its data order to Most Significant Bit First.
This opens up the door for more hardware compatibility.
In the readme I have also clarified what CRSF for Arduino's minimum requirements are, & what you can do if your devboard meets the minimum requirements & yet, you're still having compatibility issues.