Fix bitshifting issue on 8bit AVR boards when using msgid > 255 with generated C libs #848
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 is fixing an issue within the C libs generated with mavgenerate.py for an ATMega4809 MCU.
Using the ATMega4809 MCU compiled with AVR-GCC 5.4.0, during the decoding of the second byte of the msgid if it is non-zero, the high byte of the msgid would be set to 0xFF. This would in turn never get corrected in the receiving of the high byte of the msgid since it was ORd with the current msgid high byte (which should be 0, but is now 0xFF).
Adding this explicit typecast to the input byte of the second msgid byte seems to have fixed this issue and it works as expected on the ATMega4809 as well as a custom 64bit QGroundControl and 2 custom STM32 based boards.
I would also like to point out that without this fix, there were no issues in the decoding of the msgid on the custom 64bit QGC or on the 2 custom STM32 boards. This issue only showed up on a custom AVR based board.