Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bitshifting issue on 8bit AVR boards when using msgid > 255 with generated C libs #848

Merged
merged 1 commit into from
Sep 29, 2023

Conversation

WildWilly37
Copy link
Contributor

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.

@tridge tridge merged commit ab5a4c2 into ArduPilot:master Sep 29, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants