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(pubsub): compute McuMessage wrapper size without throwing error #144

Merged
merged 1 commit into from
Jan 14, 2025

Conversation

fouge
Copy link
Collaborator

@fouge fouge commented Jan 9, 2025

because we want to minimize memory used to store messages to send, we compute the number of bytes taken to wrap the payload to send into an McuMessage.
The number of bytes is guessed thanks to the McuMessage max size and all
the payloads max sizes which are all known at compile time.
In case the biggest payload among the 4 available changes, the computation needs to change: we now use the max of all 4 so that we don't have to throw an error in case the biggest payload changes.

@sri9311 sri9311 self-requested a review January 13, 2025 23:40
@fouge fouge force-pushed the fouge/compute-mcu-message-wrapper-size branch from a676518 to e265652 Compare January 14, 2025 14:16
because we want to minimize memory used to store messages to send, we
compute the number of bytes taken to wrap the payload to send into an
McuMessage.
The number of bytes is guessed thanks to the McuMessage max size and all
 the payloads max sizes which are all known at compile time.
In case the biggest payload among the 4 available changes, the
computation needs to change: we now use the max of all 4 so that we
don't have to throw an error in case the biggest payload changes.

Signed-off-by: Cyril Fougeray <[email protected]>
@fouge fouge force-pushed the fouge/compute-mcu-message-wrapper-size branch from e265652 to 59677e3 Compare January 14, 2025 14:19
@fouge
Copy link
Collaborator Author

fouge commented Jan 14, 2025

@sri9311 I moved the computation / declaration of MCU_MESSAGE_ENCODED_WRAPPER_SIZE so that it's share across our public and private repos

@fouge fouge merged commit 61b0003 into main Jan 14, 2025
11 checks passed
@fouge fouge deleted the fouge/compute-mcu-message-wrapper-size branch January 14, 2025 14:22
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