Skip to content

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

Merged
tridge merged 1 commit intoArduPilot:masterfrom
WildWilly37:8bit_fix
Sep 29, 2023
Merged

Fix bitshifting issue on 8bit AVR boards when using msgid > 255 with generated C libs#848
tridge merged 1 commit intoArduPilot:masterfrom
WildWilly37:8bit_fix

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