Skip to content

Move xbus big-endian byte helper functions to common.h (#57) - #61

Open
gennaro-rescigno wants to merge 6 commits into
UBCSailbot:mainfrom
gennaro-rescigno:patch-big-endian
Open

Move xbus big-endian byte helper functions to common.h (#57)#61
gennaro-rescigno wants to merge 6 commits into
UBCSailbot:mainfrom
gennaro-rescigno:patch-big-endian

Conversation

@gennaro-rescigno

Copy link
Copy Markdown

Hi! This pull request addresses issue #57.

I have moved the xbus big-endian byte helper functions (read_u16_big_endian, write_u16_big_endian, and read_f32_big_endian) from xbus_protocol.h to the shared common.h file inside the plrs namespace. I also updated the references in xbus_protocol.h to use the plrs:: prefix.

This is my very first open-source contribution, any feedback is highly appreciated!

@georgesleen

Copy link
Copy Markdown
Collaborator

Hi @gennaro-rescigno,

Thank you for submitting the pull request! I notice that the comments you've included are not in English. As the members on our student design team communicate in English, If you could please update those comments I can have another look at the request.

@gennaro-rescigno

Copy link
Copy Markdown
Author

Hi @georgesleen, thank you for the feedback! I have updated the comment to English as requested and pushed the changes. Let me know if everything looks good now!

@georgesleen

Copy link
Copy Markdown
Collaborator

Please translate all the comments so that I may review it. Thank you.

@gennaro-rescigno

Copy link
Copy Markdown
Author

Hi @georgesleen, I have reviewed both files, removed all the remaining Italian comments/notes, and made sure everything is strictly in English. Thanks again for your patience!

Comment thread lib/mti_imu/xbus_protocol.h Outdated
uint32_t(b[2]) << 8 | uint32_t(b[3]));
return std::bit_cast<float>(u);
}
// NOTE: The three big-endian functions that were here have been removed

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: This comment is not necessary and I would prefer it removed.

Comment thread lib/mti_imu/xbus_protocol.h Outdated
for (std::size_t i = 0; i < N; i++) {
const auto id = write_u16_big_endian(static_cast<uint16_t>(items[i].id));
const auto rate = write_u16_big_endian(items[i].rate_hz);
// Qualified with plrs:: prefix

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment feels unnecessary to me.

Comment thread lib/mti_imu/xbus_protocol.h Outdated
}
auto take = [&](std::size_t idx) {
return read_f32_big_endian(
// Qualified with plrs:: prefix

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again this comment is not needed.

}

} // namespace xbus
} // namespace xbus No newline at end of file

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please leave newlines at the end of files.

@georgesleen georgesleen added enhancement New feature or request good first issue Good for newcomers labels Jun 20, 2026
@georgesleen

Copy link
Copy Markdown
Collaborator

Closes #57

@georgesleen

georgesleen commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

Additionally @gennaro-rescigno please complete the necessary formatting steps as required by this repository please. I have updated CONTRIBUTING.md to better explain the steps required to do this.

When you push to your fork you are able to see the status of CI, please make sure that it passes for you.

@gennaro-rescigno

Copy link
Copy Markdown
Author

Hi @georgesleen, I have applied the official repository formatting rules to xbus_protocol.h using clang-format via VS Code and pushed the updated code. Everything is clean and ready for your final review and workflow approval!

Comment thread lib/common/common.h
return std::bit_cast<float>(u);
}

} // namespace plrs No newline at end of file

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please leave newlines at the end of files

@georgesleen

Copy link
Copy Markdown
Collaborator

@gennaro-rescigno please make sure that unit tests are passing for you locally so that I can merge your changes in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request good first issue Good for newcomers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants