Skip to content

Support float decimal formatting #991

@David-OConnor

Description

@David-OConnor

Desired effect. Code:

println!("\nDoor open. Conf: {:.2}", confidence as f32 / 255.);

Expected: Confidence is printed as 2 decimal places like in Rust std println. Actual:

error: unknown display hint: ".2"

         = help: `defmt` uses a slightly different syntax than regular formatting in Rust. See https://defmt.ferrous-systems.com/macros.html for more details.

I think this (And apeing std::println more broadly) would make this lib easier to use etc. Or at least in the error, show the correct way to do it. Ty!

Love this lib btw; it's a core part of my embedded experience, and I love how defmt::println etc are very similar to the std equivalents.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions