From 7ba6f7cdb3b524c5ceec4fd412cfb0f97a0f11fb Mon Sep 17 00:00:00 2001 From: Diego Herranz Date: Mon, 13 Dec 2021 19:31:24 +0100 Subject: [PATCH] examples/hdc1008_demo: fix formatting after decimal point Modulo operation used to calculate digits after decimal point, but if that result is <10, a leading zero wasn't added, giving a wrong value. Same as https://github.com/apache/incubator-nuttx/commit/34c7bec0dc644ba3bab9f0ffa91de9dafd44b37d but on the example app. --- examples/hdc1008_demo/hdc1008_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/hdc1008_demo/hdc1008_main.c b/examples/hdc1008_demo/hdc1008_main.c index f34daf32e..cf5c558c4 100644 --- a/examples/hdc1008_demo/hdc1008_main.c +++ b/examples/hdc1008_demo/hdc1008_main.c @@ -99,7 +99,7 @@ int main(int argc, FAR char *argv[]) printf("Temperature and humidity (ioctl)\n" "================================\n"); - printf("t=%d.%d, h=%d.%d\n\n", + printf("t=%d.%02d, h=%d.%d\n\n", data.temperature / 100, data.temperature % 100, data.humidity / 10, data.humidity % 10);