I use the following code:
NRF_LOG_RAW_INFO("\t (%f %f %f)\r\n", fgx, fgy, fgz);
(f f f)
What is missing here?
You need to use NRF_LOG_FLOAT_MARKER and NRF_LOG_FLOAT() to print floats, as described in the documentation:
NRF_LOG_INFO("My float number" NRF_LOG_FLOAT_MARKER "\r\n", NRF_LOG_FLOAT(f)))
It looks like this no longer works properly in the latest SDK (nRF5_SDK_13.0.0_04a0bfd.zip).
NRF_LOG_INFO("My float number: " NRF_LOG_FLOAT_MARKER "\r\n", NRF_LOG_FLOAT(15.32f));
now gives the output
APP:INFO:My float number: 15.2d
It looks like the interpretation of %02d has changed, and that it now interprets %0 as an empty string and outputs a literal "2d".
I'm not able to reproduce this behavior in Keil, GCC or IAR. Which compiler are you using? Have you changed anything in the SDK?
Interesting! I've been using Segger Embedded Studio under Linux, configured using the instructions in devzone.nordicsemi.com/.../. I tried it in Keil in Windows as well as in GCC on Linux now, and it works in both cases, so it seems specific to Segger Embedded Studio. I'm not sure if it is a misconfiguration or if there's a bug in the snprintf they supply. Regardless, the SDK is fine, since SES isn't officially supported.
I tested this with SES on Linux as well and experipence the same behavior. It seems to be a bug in SES.