Skip to content

Conversation

@RobertZ2011
Copy link
Contributor

  • Fixed source flags are no longer a separate structure
  • Introduce missing conversion functions where needed
  • Add more tests

@RobertZ2011 RobertZ2011 force-pushed the pdo-clean-up branch 2 times, most recently from f418d72 to ec6abeb Compare December 9, 2025 21:52
@RobertZ2011 RobertZ2011 self-assigned this Dec 9, 2025
@RobertZ2011 RobertZ2011 marked this pull request as ready for review December 9, 2025 21:55
@RobertZ2011 RobertZ2011 requested a review from a team as a code owner December 9, 2025 21:55
Copy link
Contributor

Copilot AI left a 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 FixedFlags structure directly into FixedData for source PDOs, eliminating an unnecessary layer of abstraction
  • Updated bitfield definitions to use native bool types instead of u8 with manual conversions for boolean flags
  • Added missing From trait implementations to convert data structures back to their raw u32 representations
  • Changed visibility of internal Raw bitfield structures from pub to 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
@RobertZ2011 RobertZ2011 merged commit 736a52d into OpenDevicePartnership:main Dec 15, 2025
10 checks passed
@github-project-automation github-project-automation bot moved this from In review to Done in Embedded Controller Dec 15, 2025
@RobertZ2011 RobertZ2011 deleted the pdo-clean-up branch December 15, 2025 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants