This is an automated email from the ASF dual-hosted git repository.
jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
The following commit(s) were added to refs/heads/master by this push:
new 4552586aa sys/config: Fix floating point support
4552586aa is described below
commit 4552586aa6accfcda189a17d6f857bd0e479b6b2
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Tue May 7 13:30:54 2024 +0200
sys/config: Fix floating point support
When CONFIG_FLOAT_SUPPORT was added ony conf_value_from_str()
was changed, not also conf_str_from_value() has conditional
compilation code.
Signed-off-by: Jerzy Kasenberg <[email protected]>
---
sys/config/src/config.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sys/config/src/config.c b/sys/config/src/config.c
index d10a77abc..7266e51b0 100644
--- a/sys/config/src/config.c
+++ b/sys/config/src/config.c
@@ -270,7 +270,9 @@ conf_str_from_value(enum conf_type type, void *vp, char
*buf, int buf_len)
{
int64_t val;
uint64_t uval;
+#if MYNEWT_VAL(CONFIG_FLOAT_SUPPORT)
float fval;
+#endif
if (type == CONF_STRING) {
return vp;
@@ -309,10 +311,12 @@ conf_str_from_value(enum conf_type type, void *vp, char
*buf, int buf_len)
}
snprintf(buf, buf_len, "%" PRIu64, uval);
return buf;
+#if MYNEWT_VAL(CONFIG_FLOAT_SUPPORT)
case CONF_FLOAT:
fval = *(float *)vp;
snprintf(buf, buf_len, "%f", fval);
return buf;
+#endif
default:
return NULL;
}