-
Notifications
You must be signed in to change notification settings - Fork 4
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 rust-analyzer error test #20
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Avoid panicing when receiving PDO's with either an unknown kind or an unknown supply in the Augmented PDO's. Signed-off-by: Sjoerd Simons <[email protected]>
Even though the SourceCapabilities message is just a list of 32 bit pdos, some properties are encoded in the first pdo (aka the mandatory vsafe 5v one). Moving to a newtype allows adding some utility functions to get the whole message capabilities directly on it. Signed-off-by: Sjoerd Simons <[email protected]>
Gracefully handle unknown pdo aspects when parsing
Similar to what was done on the other pdo packets add utility functions to get the real watts/power values from the raw values in the packet.
The voltage/current/power values in the various pdos require translations to real numbers; Add utility functions for this and rename the field to raw_ to avoid accidentally using the wrong function. For clarity also suffix the function by the returned unit if it's not the standard unit. Also for consistency use max instead of maximum everywhere Signed-off-by: Sjoerd Simons <[email protected]>
Add utility functions to access various part of source capabilities
Allow pretty printing of the various top-level types Signed-off-by: Sjoerd Simons <[email protected]>
Add parser for Adjustable Voltage Supply requests; Also add an enum covering the various supported request objects, similar to th PDO enum.
Using e.g. si::u8::ElectricPotential with a base unit of decivolts can not be converted to milivolts (which is the obvious conversion) as the u8 milivolts range is only 0 - 255mv.. Same for current. Expand the storage to 16 bits so the full range can be exposes as milivolt/miliamp Signed-off-by: Sjoerd Simons <[email protected]>
There are over 20 different control messages specified in specification version 3.2. Rather then adding them all to the Message enum one-by-one, add a catch-all for control message (as per definition they have no extra information).
To be able to parse Request messages some state needs to be kept as the request objects don't indicate their type only their position as per the last source capabilities. Add a simple trait for maintaining pdo state that current just translates between the object position of the request type and the matching type. This trait is for SourceCapabilities (potentially wrapped in an Option) which allows implementations to maintain state simply by saving the last SourceCapabilities message.
pdo: expand storage types to cover common units
VendorDefined messages need at least 4 bytes of payload to be valid
Add support to parse request data objects
…ssages Parse all control messages
Sorry, messed up with git commands, wanted to change username in my last commit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When adding this project to RustRover IDE or VS Code rust-analyzer runs on project sync. It fails with this message:
I suggest adding harness = false to disable these checks.
You can take a look here, for example:
rust-lang/rust#125714
esp-rs/esp-idf-template@d084765
The commit in my branch fixes the issue.