-
Notifications
You must be signed in to change notification settings - Fork 7
Clean-up PDO and ADO types #57
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
Clean-up PDO and ADO types #57
Conversation
RobertZ2011
commented
Dec 8, 2025
- Fixed source flags are no longer a separate structure
- Introduce missing conversion functions where needed
- Add more tests
f418d72 to
ec6abeb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors PDO and ADO types to simplify the codebase by flattening nested flag structures directly into their parent data structures and adding missing conversion functions. The changes primarily focus on eliminating the separate FixedFlags structure and improving type consistency in bitfield definitions.
- Merged
FixedFlagsstructure directly intoFixedDatafor source PDOs, eliminating an unnecessary layer of abstraction - Updated bitfield definitions to use native
booltypes instead ofu8with manual conversions for boolean flags - Added missing
Fromtrait implementations to convert data structures back to their rawu32representations - Changed visibility of internal Raw bitfield structures from
pubto private - Added comprehensive roundtrip tests for all PDO, RDO, and ADO variants
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/pdo/source.rs | Flattened FixedFlags into FixedData, updated FixedRaw bitfield to include all flag fields directly, made Raw structs private, added roundtrip tests for all PDO variants |
| src/pdo/sink.rs | Changed boolean bitfield types from u8 to bool, removed != 0 comparisons and as u8 casts, made Raw structs private, added roundtrip tests |
| src/pdo/rdo.rs | Added From<Rdo> and From<*Data> for u32 conversion functions, updated BatteryRaw and AvsRaw bitfield boolean types, made Raw structs private, added roundtrip tests for all RDO variants |
| src/ado.rs | Added From<Ado> for u32 conversion function, made Raw structs private, added roundtrip test for ADO |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
* Fixed source flags are no longer a separate structure * Introduce missing conversion functions where needed * Add more tests * Make internal bitfields for conversions private
ec6abeb to
c12933d
Compare