-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
derive(Format): Support more than 256 variants #302
Conversation
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.
The encoder part looks good but I think we also need to do changes in the decoder.
Could you add the EnumLarge
as a test to firmware/log.rs
and test out a small enum and a large (>256) enum?
firmware/qemu/src/bin/log.rs
Outdated
} | ||
|
||
defmt::info!("Format EnumLarge Variant: {:?}", EnumLarge::A007); | ||
defmt::info!("Format EnumLarge Variant: {:?}", EnumLarge::A269); |
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.
this fails locally with
0.000101 INFO Format EnumLarge Variant: A007
failed to decode defmt data: [0, 99, 1]
Error: malformed data
I think the decoder expects that the discriminant is encoded as a single byte but with these changes it should consider how many the variants the enum has (and use 1,2,3,4,etc. bytes as the discriminant size)
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.
Whoops interesting. It's failing locally for me as well. I just pushed it to have a failing case to move along and eventually make it pass.
But that this does not fail in CI is interesting.
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.
I think CI is not running because the PR has merge conflicts. The last CI run (I'm referring to the GitHub Action runs on this repo; if you are referring to the ones on you fork, I've not seen those) is from your very first version, which didn't have the qemu test.
ff704da
to
2bacbd9
Compare
Nice! Thanks for the PR. bors r+ |
Build failed: |
Thanks! (and sorry for the repeated rebase work) bors r+ |
No problem, these were minor anyways. :) |
Build succeeded: |
Closes #63