From 0c4c6cf199362463c08fa5943eab38021bb753cb Mon Sep 17 00:00:00 2001 From: Themba Dube Date: Mon, 1 Jun 2020 12:08:08 -0400 Subject: [PATCH] lv_printf: expose floating-point configuration option --- lv_conf_template.h | 2 ++ src/lv_conf_internal.h | 4 ++++ src/lv_misc/lv_printf.c | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lv_conf_template.h b/lv_conf_template.h index 7b985d5dc..415a33d8f 100644 --- a/lv_conf_template.h +++ b/lv_conf_template.h @@ -478,6 +478,8 @@ typedef void * lv_font_user_data_t; # define LV_SPRINTF_INCLUDE # define lv_snprintf snprintf # define lv_vsnprintf vsnprintf +#else /*!LV_SPRINTF_CUSTOM*/ +# define LV_SPRINTF_DISABLE_FLOAT 1 #endif /*LV_SPRINTF_CUSTOM*/ /*=================== diff --git a/src/lv_conf_internal.h b/src/lv_conf_internal.h index a009dedf8..42cf547ba 100644 --- a/src/lv_conf_internal.h +++ b/src/lv_conf_internal.h @@ -721,6 +721,10 @@ #ifndef lv_vsnprintf # define lv_vsnprintf vsnprintf #endif +#else /*!LV_SPRINTF_CUSTOM*/ +#ifndef LV_SPRINTF_DISABLE_FLOAT +# define LV_SPRINTF_DISABLE_FLOAT 1 +#endif #endif /*LV_SPRINTF_CUSTOM*/ /*=================== diff --git a/src/lv_misc/lv_printf.c b/src/lv_misc/lv_printf.c index 76bb76a76..5ff85fe23 100644 --- a/src/lv_misc/lv_printf.c +++ b/src/lv_misc/lv_printf.c @@ -38,7 +38,7 @@ #include -#define PRINTF_DISABLE_SUPPORT_FLOAT 1 +#define PRINTF_DISABLE_SUPPORT_FLOAT LV_SPRINTF_DISABLE_FLOAT // 'ntoa' conversion buffer size, this must be big enough to hold one converted // numeric number including padded zeros (dynamically created on stack)