Page 1 of 1

Float chprintf

Posted: Sat Oct 10, 2015 9:02 am
by Alexte
chprintf(syscon, "%f", 0.12345678);
prints only one character "f"


ChibiOS 3.0.2 Stable

Re: Float chprintf

Posted: Sat Oct 10, 2015 9:37 am
by pgis
According to source code (.\hal\lib\streams\chprintf.c) you should activate %f with:
#define CHPRINTF_USE_FLOAT TRUE

Re: Float chprintf

Posted: Sat Oct 10, 2015 9:41 am
by Giovanni
Correct, floats are optional because code size concerns.

You may also add the macro in the Makefile using -DCHPRINTF_USE_FLOAT=1

Giovanni

Re: Float chprintf

Posted: Sat Oct 10, 2015 5:18 pm
by Alexte
Thanks, it works!