Lost half day on figuring out how to debug/ print floats :/

Please make this flag on by default…

For anyone who is loosing time figuring out how to print out floats:


LDFLAGS = -u _printf_float
1 Like

There’s a mention of this in this post: SSD1306 OLED compatibility? - #12 by shensley

But printing floats without adding bloat to the firmware makes use of the FMT_* macros:

float f = 3.14;
hardware.PrintLine("Floating point value " FLT_FMT(3), FLT_VAR(f));
//                 |----- output  format string -----| |-- args --|

The solution you expose is mentioned and what I also explained about is here but it’s actually mis-typed. Should be:

LDFLAGS += -u _printf_float

And not:

LDFLAGS = -u _printf_float