Float chprintf

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
Alexte
Posts: 27
Joined: Sun Jul 01, 2012 1:24 pm

Float chprintf

Post by Alexte »

chprintf(syscon, "%f", 0.12345678);
prints only one character "f"


ChibiOS 3.0.2 Stable
pgis
Posts: 1
Joined: Sat Oct 10, 2015 9:31 am

Re: Float chprintf

Post by pgis »

According to source code (.\hal\lib\streams\chprintf.c) you should activate %f with:
#define CHPRINTF_USE_FLOAT TRUE
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Float chprintf

Post 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
Alexte
Posts: 27
Joined: Sun Jul 01, 2012 1:24 pm

Re: Float chprintf

Post by Alexte »

Thanks, it works!
Post Reply