From 8622090cf8a81c869902a2e5a7a6478d052b6f3a Mon Sep 17 00:00:00 2001 From: Nicu Hodos Date: Thu, 30 Dec 2021 20:30:11 +0100 Subject: [PATCH] round temperature precision to 1 digit --- include/bmp.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/bmp.h b/include/bmp.h index 5c4f5c4..164d187 100644 --- a/include/bmp.h +++ b/include/bmp.h @@ -10,7 +10,9 @@ namespace Bmp { float pressure; float altitude; float readTemp() { - temp = bmp.readTemperature() - 2; + char buf[10]; + sprintf(buf, "%.1f", bmp.readTemperature() - 2); + temp = atof(buf); return temp; } void readAll() {