I have a project based on SDK 15.3
I've set #define NRF_LOG_DEFERRED 1
The project generates a high volume of log output over RTT
NRF_LOG_FLOAT_MARKER is a macro that splits a floating point number into three pieces:
%s - sign string
%d - integer part
%d - fractional part
I've found that if I use NRF_LOG_FLOAT_MARKER in deferred mode, the sign string is usually corrupted into gibberish
Sometimes the MCU will hang at nrf_fprintf_format.c:string_print():115
Changing the sign from a string to a character in nrf_log.h seems to fix this:
/**
* @brief Macro to be used in a formatted string to a pass float number to the log.
*
* Use this macro in a formatted string instead of the %f specifier together with
* @ref NRF_LOG_FLOAT macro.
* Example: NRF_LOG_INFO("My float number" NRF_LOG_FLOAT_MARKER "\r\n", NRF_LOG_FLOAT(f)))
*/
#define NRF_LOG_FLOAT_MARKER "%c%d.%02d"
/**
* @brief Macro for dissecting a float number into two numbers (integer and residuum).
*/
#define NRF_LOG_FLOAT(val) (uint32_t)(((val) < 0 && (val) > -1.0) ? '-' : '+'), \
(int32_t)(val), \
(int32_t)((((val) > 0) ? (val) - (int32_t)(val) \
: (int32_t)(val) - (val))*100)
Posting here in case someone else has this problem or if there's a better workaround