Skip to content
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

Example: uFmt_f32/uFmt_f64 #303

Open
chevdor opened this issue Aug 31, 2022 · 4 comments
Open

Example: uFmt_f32/uFmt_f64 #303

chevdor opened this issue Aug 31, 2022 · 4 comments
Labels
examples Related to example programs.

Comments

@chevdor
Copy link

chevdor commented Aug 31, 2022

I was surprised hitting bigger problems than expected when trying to format a string and writting to a serial port.
This issue is partly related to #302.

In a nutshell, it would be great to see a working example such as:

let value = 3.1415926_f32;
let value_write = uFmt_f32::Two(value); // 3.14
ufmt::uwriteln!(&mut serial, "value: {}", value_write);

The issue I hit was the trait uDisplayis not implemented foruFmt_f32despite the fact thatuFmt_f32` does implement it.

@Rahix
Copy link
Owner

Rahix commented Aug 31, 2022

Can you check your dependency tree on whether avr-hal and ufmt_float both depend on the same version of ufmt? Easiest way to do this is using cargo tree.

@chevdor
Copy link
Author

chevdor commented Aug 31, 2022

Ah indeed:

c tree -i ufmt
error: There are multiple `ufmt` packages in your project, and the specification `ufmt` is ambiguous.
Please re-run this command with `-p <spec>` where `<spec>` is one of the following:
  ufmt@0.1.2
  ufmt@0.2.0

@chevdor
Copy link
Author

chevdor commented Aug 31, 2022

NOTE: heapless::string (and alloc::... even less) is, unlike what I initiall thought, not required for such an example to work.

@chevdor
Copy link
Author

chevdor commented Sep 7, 2022

FYI: ufmt_loat was published on crates.io but there was no public repo. I contacted the author who nicely published the repo. I also lined up a PR so ufmt_float no longer depends on an ancient ufmt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
examples Related to example programs.
Projects
None yet
Development

No branches or pull requests

2 participants